summaryrefslogtreecommitdiff
path: root/src/core/hardware_properties.h
diff options
context:
space:
mode:
authorGravatar bunnei2023-01-31 10:51:10 -0800
committerGravatar GitHub2023-01-31 10:51:10 -0800
commitde28cd0c2df507ffc84497e6069233d1a7cac208 (patch)
tree98d32eac04d7e84eda7ef4010e85ac3dd766dd78 /src/core/hardware_properties.h
parentMerge pull request #9508 from ameerj/hle-ipc-buffer-span (diff)
parentkernel: add KCapabilities (diff)
downloadyuzu-de28cd0c2df507ffc84497e6069233d1a7cac208.tar.gz
yuzu-de28cd0c2df507ffc84497e6069233d1a7cac208.tar.xz
yuzu-de28cd0c2df507ffc84497e6069233d1a7cac208.zip
Merge pull request #9697 from liamwhite/kcap
kernel: add KCapabilities
Diffstat (limited to 'src/core/hardware_properties.h')
-rw-r--r--src/core/hardware_properties.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/core/hardware_properties.h b/src/core/hardware_properties.h
index 13cbdb734..45567b840 100644
--- a/src/core/hardware_properties.h
+++ b/src/core/hardware_properties.h
@@ -25,6 +25,26 @@ constexpr std::array<s32, Common::BitSize<u64>()> VirtualToPhysicalCoreMap{
25 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 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,
26}; 26};
27 27
28static constexpr inline size_t NumVirtualCores = Common::BitSize<u64>();
29
30static constexpr inline u64 VirtualCoreMask = [] {
31 u64 mask = 0;
32 for (size_t i = 0; i < NumVirtualCores; ++i) {
33 mask |= (UINT64_C(1) << i);
34 }
35 return mask;
36}();
37
38static constexpr inline u64 ConvertVirtualCoreMaskToPhysical(u64 v_core_mask) {
39 u64 p_core_mask = 0;
40 while (v_core_mask != 0) {
41 const u64 next = std::countr_zero(v_core_mask);
42 v_core_mask &= ~(static_cast<u64>(1) << next);
43 p_core_mask |= (static_cast<u64>(1) << VirtualToPhysicalCoreMap[next]);
44 }
45 return p_core_mask;
46}
47
28// Cortex-A57 supports 4 memory watchpoints 48// Cortex-A57 supports 4 memory watchpoints
29constexpr u64 NUM_WATCHPOINTS = 4; 49constexpr u64 NUM_WATCHPOINTS = 4;
30 50