diff options
Diffstat (limited to 'src/core/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/process_capability.cpp | 31 | ||||
| -rw-r--r-- | src/core/hle/kernel/process_capability.h | 10 |
2 files changed, 40 insertions, 1 deletions
diff --git a/src/core/hle/kernel/process_capability.cpp b/src/core/hle/kernel/process_capability.cpp index 8d787547b..9f513b25b 100644 --- a/src/core/hle/kernel/process_capability.cpp +++ b/src/core/hle/kernel/process_capability.cpp | |||
| @@ -205,7 +205,36 @@ void ProcessCapabilities::Clear() { | |||
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | ResultCode ProcessCapabilities::HandlePriorityCoreNumFlags(u32 flags) { | 207 | ResultCode ProcessCapabilities::HandlePriorityCoreNumFlags(u32 flags) { |
| 208 | // TODO: Implement | 208 | if (priority_mask != 0 || core_mask != 0) { |
| 209 | return ERR_INVALID_CAPABILITY_DESCRIPTOR; | ||
| 210 | } | ||
| 211 | |||
| 212 | const u32 core_num_min = (flags >> 16) & 0xFF; | ||
| 213 | const u32 core_num_max = (flags >> 24) & 0xFF; | ||
| 214 | if (core_num_min > core_num_max) { | ||
| 215 | return ERR_INVALID_COMBINATION; | ||
| 216 | } | ||
| 217 | |||
| 218 | const u32 priority_min = (flags >> 10) & 0x3F; | ||
| 219 | const u32 priority_max = (flags >> 4) & 0x3F; | ||
| 220 | if (priority_min > priority_max) { | ||
| 221 | return ERR_INVALID_COMBINATION; | ||
| 222 | } | ||
| 223 | |||
| 224 | // The switch only has 4 usable cores. | ||
| 225 | if (core_num_max >= 4) { | ||
| 226 | return ERR_INVALID_PROCESSOR_ID; | ||
| 227 | } | ||
| 228 | |||
| 229 | const auto make_mask = [](u64 min, u64 max) { | ||
| 230 | const u64 range = max - min + 1; | ||
| 231 | const u64 mask = (1ULL << range) - 1; | ||
| 232 | |||
| 233 | return mask << min; | ||
| 234 | }; | ||
| 235 | |||
| 236 | core_mask = make_mask(core_num_min, core_num_max); | ||
| 237 | priority_mask = make_mask(priority_min, priority_max); | ||
| 209 | return RESULT_SUCCESS; | 238 | return RESULT_SUCCESS; |
| 210 | } | 239 | } |
| 211 | 240 | ||
diff --git a/src/core/hle/kernel/process_capability.h b/src/core/hle/kernel/process_capability.h index 5cff10476..4b27ee8b9 100644 --- a/src/core/hle/kernel/process_capability.h +++ b/src/core/hle/kernel/process_capability.h | |||
| @@ -122,6 +122,16 @@ public: | |||
| 122 | /// | 122 | /// |
| 123 | void InitializeForMetadatalessProcess(); | 123 | void InitializeForMetadatalessProcess(); |
| 124 | 124 | ||
| 125 | /// Gets the allowable core mask | ||
| 126 | u64 GetCoreMask() const { | ||
| 127 | return core_mask; | ||
| 128 | } | ||
| 129 | |||
| 130 | /// Gets the allowable priority mask | ||
| 131 | u64 GetPriorityMask() const { | ||
| 132 | return priority_mask; | ||
| 133 | } | ||
| 134 | |||
| 125 | private: | 135 | private: |
| 126 | /// Attempts to parse a given sequence of capability descriptors. | 136 | /// Attempts to parse a given sequence of capability descriptors. |
| 127 | /// | 137 | /// |