2024-03-06 06:26:38 +01:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
2022-04-23 10:59:50 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-02-12 00:56:24 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-01-20 06:07:07 +01:00
|
|
|
#include <array>
|
2020-02-14 03:08:49 +01:00
|
|
|
#include <tuple>
|
|
|
|
|
2021-01-20 06:07:07 +01:00
|
|
|
#include "common/bit_util.h"
|
2020-02-12 00:56:24 +01:00
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
namespace Hardware {
|
|
|
|
|
2023-03-04 02:43:51 +01:00
|
|
|
constexpr u64 BASE_CLOCK_RATE = 1'020'000'000; // Default CPU Frequency = 1020 MHz
|
|
|
|
constexpr u64 CNTFREQ = 19'200'000; // CNTPCT_EL0 Frequency = 19.2 MHz
|
|
|
|
constexpr u32 NUM_CPU_CORES = 4; // Number of CPU Cores
|
2020-02-13 22:01:44 +01:00
|
|
|
|
2021-01-20 06:07:07 +01:00
|
|
|
// Virtual to Physical core map.
|
|
|
|
constexpr std::array<s32, Common::BitSize<u64>()> VirtualToPhysicalCoreMap{
|
|
|
|
0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
|
2020-02-13 22:01:44 +01:00
|
|
|
};
|
|
|
|
|
2023-01-29 01:38:00 +01:00
|
|
|
static constexpr inline size_t NumVirtualCores = Common::BitSize<u64>();
|
|
|
|
|
|
|
|
static constexpr inline u64 VirtualCoreMask = [] {
|
|
|
|
u64 mask = 0;
|
|
|
|
for (size_t i = 0; i < NumVirtualCores; ++i) {
|
|
|
|
mask |= (UINT64_C(1) << i);
|
|
|
|
}
|
|
|
|
return mask;
|
|
|
|
}();
|
|
|
|
|
|
|
|
static constexpr inline u64 ConvertVirtualCoreMaskToPhysical(u64 v_core_mask) {
|
|
|
|
u64 p_core_mask = 0;
|
|
|
|
while (v_core_mask != 0) {
|
|
|
|
const u64 next = std::countr_zero(v_core_mask);
|
|
|
|
v_core_mask &= ~(static_cast<u64>(1) << next);
|
|
|
|
p_core_mask |= (static_cast<u64>(1) << VirtualToPhysicalCoreMap[next]);
|
|
|
|
}
|
|
|
|
return p_core_mask;
|
|
|
|
}
|
|
|
|
|
2022-06-06 18:56:01 +02:00
|
|
|
// Cortex-A57 supports 4 memory watchpoints
|
|
|
|
constexpr u64 NUM_WATCHPOINTS = 4;
|
|
|
|
|
2021-01-20 06:07:07 +01:00
|
|
|
} // namespace Hardware
|
|
|
|
|
2020-02-12 00:56:24 +01:00
|
|
|
} // namespace Core
|