|
|
|
@ -4,8 +4,10 @@
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
|
#include <tuple>
|
|
|
|
|
|
|
|
|
|
#include "common/bit_util.h"
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
@ -18,34 +20,12 @@ constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch cpu frequency is 1020MHz u
|
|
|
|
|
constexpr u64 CNTFREQ = 19200000; // Switch's hardware clock speed
|
|
|
|
|
constexpr u32 NUM_CPU_CORES = 4; // Number of CPU Cores
|
|
|
|
|
|
|
|
|
|
} // namespace Hardware
|
|
|
|
|
|
|
|
|
|
constexpr u32 INVALID_HOST_THREAD_ID = 0xFFFFFFFF;
|
|
|
|
|
|
|
|
|
|
struct EmuThreadHandle {
|
|
|
|
|
u32 host_handle;
|
|
|
|
|
u32 guest_handle;
|
|
|
|
|
|
|
|
|
|
u64 GetRaw() const {
|
|
|
|
|
return (static_cast<u64>(host_handle) << 32) | guest_handle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool operator==(const EmuThreadHandle& rhs) const {
|
|
|
|
|
return std::tie(host_handle, guest_handle) == std::tie(rhs.host_handle, rhs.guest_handle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool operator!=(const EmuThreadHandle& rhs) const {
|
|
|
|
|
return !operator==(rhs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static constexpr EmuThreadHandle InvalidHandle() {
|
|
|
|
|
constexpr u32 invalid_handle = 0xFFFFFFFF;
|
|
|
|
|
return {invalid_handle, invalid_handle};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsInvalid() const {
|
|
|
|
|
return (*this) == InvalidHandle();
|
|
|
|
|
}
|
|
|
|
|
// 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,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Hardware
|
|
|
|
|
|
|
|
|
|
} // namespace Core
|
|
|
|
|