diff options
| author | 2021-01-19 21:07:07 -0800 | |
|---|---|---|
| committer | 2021-01-28 21:42:26 -0800 | |
| commit | 1f99f5473c7a03c791ea20256c7fc2f1caba8adc (patch) | |
| tree | 3dea03c0082e6685aeda2769fd7b186f0afbf46c /src/core/hardware_properties.h | |
| parent | hle: kernel: TimeManager: Simplify to not rely on previous EmuThreadHandle im... (diff) | |
| download | yuzu-1f99f5473c7a03c791ea20256c7fc2f1caba8adc.tar.gz yuzu-1f99f5473c7a03c791ea20256c7fc2f1caba8adc.tar.xz yuzu-1f99f5473c7a03c791ea20256c7fc2f1caba8adc.zip | |
kernel: k_light_lock: Simplify EmuThreadHandle implementation.
Diffstat (limited to 'src/core/hardware_properties.h')
| -rw-r--r-- | src/core/hardware_properties.h | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/src/core/hardware_properties.h b/src/core/hardware_properties.h index 456b41e1b..176a72c67 100644 --- a/src/core/hardware_properties.h +++ b/src/core/hardware_properties.h | |||
| @@ -4,8 +4,10 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 7 | #include <tuple> | 8 | #include <tuple> |
| 8 | 9 | ||
| 10 | #include "common/bit_util.h" | ||
| 9 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 10 | 12 | ||
| 11 | namespace Core { | 13 | namespace Core { |
| @@ -18,34 +20,12 @@ constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch cpu frequency is 1020MHz u | |||
| 18 | constexpr u64 CNTFREQ = 19200000; // Switch's hardware clock speed | 20 | constexpr u64 CNTFREQ = 19200000; // Switch's hardware clock speed |
| 19 | constexpr u32 NUM_CPU_CORES = 4; // Number of CPU Cores | 21 | constexpr u32 NUM_CPU_CORES = 4; // Number of CPU Cores |
| 20 | 22 | ||
| 21 | } // namespace Hardware | 23 | // Virtual to Physical core map. |
| 22 | 24 | constexpr std::array<s32, Common::BitSize<u64>()> VirtualToPhysicalCoreMap{ | |
| 23 | constexpr u32 INVALID_HOST_THREAD_ID = 0xFFFFFFFF; | 25 | 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, |
| 24 | 26 | 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, | |
| 25 | struct EmuThreadHandle { | ||
| 26 | u32 host_handle; | ||
| 27 | u32 guest_handle; | ||
| 28 | |||
| 29 | u64 GetRaw() const { | ||
| 30 | return (static_cast<u64>(host_handle) << 32) | guest_handle; | ||
| 31 | } | ||
| 32 | |||
| 33 | bool operator==(const EmuThreadHandle& rhs) const { | ||
| 34 | return std::tie(host_handle, guest_handle) == std::tie(rhs.host_handle, rhs.guest_handle); | ||
| 35 | } | ||
| 36 | |||
| 37 | bool operator!=(const EmuThreadHandle& rhs) const { | ||
| 38 | return !operator==(rhs); | ||
| 39 | } | ||
| 40 | |||
| 41 | static constexpr EmuThreadHandle InvalidHandle() { | ||
| 42 | constexpr u32 invalid_handle = 0xFFFFFFFF; | ||
| 43 | return {invalid_handle, invalid_handle}; | ||
| 44 | } | ||
| 45 | |||
| 46 | bool IsInvalid() const { | ||
| 47 | return (*this) == InvalidHandle(); | ||
| 48 | } | ||
| 49 | }; | 27 | }; |
| 50 | 28 | ||
| 29 | } // namespace Hardware | ||
| 30 | |||
| 51 | } // namespace Core | 31 | } // namespace Core |