diff options
| author | 2022-06-25 22:44:19 -0500 | |
|---|---|---|
| committer | 2022-06-26 20:21:37 -0500 | |
| commit | a7d9be13840acd65d0d684666390758ede72c826 (patch) | |
| tree | 37485f63b09576444173d6a765abe0bb95dd45db /src/core/hle/kernel/svc.cpp | |
| parent | Merge pull request #8475 from liamwhite/x18 (diff) | |
| download | yuzu-a7d9be13840acd65d0d684666390758ede72c826.tar.gz yuzu-a7d9be13840acd65d0d684666390758ede72c826.tar.xz yuzu-a7d9be13840acd65d0d684666390758ede72c826.zip | |
core: Replace all instances of ResultCode with Result
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 292 |
1 files changed, 143 insertions, 149 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 2b34fc19d..de8a0864c 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -58,8 +58,8 @@ constexpr bool IsValidAddressRange(VAddr address, u64 size) { | |||
| 58 | // Helper function that performs the common sanity checks for svcMapMemory | 58 | // Helper function that performs the common sanity checks for svcMapMemory |
| 59 | // and svcUnmapMemory. This is doable, as both functions perform their sanitizing | 59 | // and svcUnmapMemory. This is doable, as both functions perform their sanitizing |
| 60 | // in the same order. | 60 | // in the same order. |
| 61 | ResultCode MapUnmapMemorySanityChecks(const KPageTable& manager, VAddr dst_addr, VAddr src_addr, | 61 | Result MapUnmapMemorySanityChecks(const KPageTable& manager, VAddr dst_addr, VAddr src_addr, |
| 62 | u64 size) { | 62 | u64 size) { |
| 63 | if (!Common::Is4KBAligned(dst_addr)) { | 63 | if (!Common::Is4KBAligned(dst_addr)) { |
| 64 | LOG_ERROR(Kernel_SVC, "Destination address is not aligned to 4KB, 0x{:016X}", dst_addr); | 64 | LOG_ERROR(Kernel_SVC, "Destination address is not aligned to 4KB, 0x{:016X}", dst_addr); |
| 65 | return ResultInvalidAddress; | 65 | return ResultInvalidAddress; |
| @@ -135,7 +135,7 @@ enum class ResourceLimitValueType { | |||
| 135 | } // Anonymous namespace | 135 | } // Anonymous namespace |
| 136 | 136 | ||
| 137 | /// Set the process heap to a given Size. It can both extend and shrink the heap. | 137 | /// Set the process heap to a given Size. It can both extend and shrink the heap. |
| 138 | static ResultCode SetHeapSize(Core::System& system, VAddr* out_address, u64 size) { | 138 | static Result SetHeapSize(Core::System& system, VAddr* out_address, u64 size) { |
| 139 | LOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", size); | 139 | LOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", size); |
| 140 | 140 | ||
| 141 | // Validate size. | 141 | // Validate size. |
| @@ -148,9 +148,9 @@ static ResultCode SetHeapSize(Core::System& system, VAddr* out_address, u64 size | |||
| 148 | return ResultSuccess; | 148 | return ResultSuccess; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | static ResultCode SetHeapSize32(Core::System& system, u32* heap_addr, u32 heap_size) { | 151 | static Result SetHeapSize32(Core::System& system, u32* heap_addr, u32 heap_size) { |
| 152 | VAddr temp_heap_addr{}; | 152 | VAddr temp_heap_addr{}; |
| 153 | const ResultCode result{SetHeapSize(system, &temp_heap_addr, heap_size)}; | 153 | const Result result{SetHeapSize(system, &temp_heap_addr, heap_size)}; |
| 154 | *heap_addr = static_cast<u32>(temp_heap_addr); | 154 | *heap_addr = static_cast<u32>(temp_heap_addr); |
| 155 | return result; | 155 | return result; |
| 156 | } | 156 | } |
| @@ -166,8 +166,8 @@ constexpr bool IsValidSetMemoryPermission(MemoryPermission perm) { | |||
| 166 | } | 166 | } |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | static ResultCode SetMemoryPermission(Core::System& system, VAddr address, u64 size, | 169 | static Result SetMemoryPermission(Core::System& system, VAddr address, u64 size, |
| 170 | MemoryPermission perm) { | 170 | MemoryPermission perm) { |
| 171 | LOG_DEBUG(Kernel_SVC, "called, address=0x{:016X}, size=0x{:X}, perm=0x{:08X", address, size, | 171 | LOG_DEBUG(Kernel_SVC, "called, address=0x{:016X}, size=0x{:X}, perm=0x{:08X", address, size, |
| 172 | perm); | 172 | perm); |
| 173 | 173 | ||
| @@ -188,8 +188,8 @@ static ResultCode SetMemoryPermission(Core::System& system, VAddr address, u64 s | |||
| 188 | return page_table.SetMemoryPermission(address, size, perm); | 188 | return page_table.SetMemoryPermission(address, size, perm); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | static ResultCode SetMemoryAttribute(Core::System& system, VAddr address, u64 size, u32 mask, | 191 | static Result SetMemoryAttribute(Core::System& system, VAddr address, u64 size, u32 mask, |
| 192 | u32 attr) { | 192 | u32 attr) { |
| 193 | LOG_DEBUG(Kernel_SVC, | 193 | LOG_DEBUG(Kernel_SVC, |
| 194 | "called, address=0x{:016X}, size=0x{:X}, mask=0x{:08X}, attribute=0x{:08X}", address, | 194 | "called, address=0x{:016X}, size=0x{:X}, mask=0x{:08X}, attribute=0x{:08X}", address, |
| 195 | size, mask, attr); | 195 | size, mask, attr); |
| @@ -213,19 +213,19 @@ static ResultCode SetMemoryAttribute(Core::System& system, VAddr address, u64 si | |||
| 213 | return page_table.SetMemoryAttribute(address, size, mask, attr); | 213 | return page_table.SetMemoryAttribute(address, size, mask, attr); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | static ResultCode SetMemoryAttribute32(Core::System& system, u32 address, u32 size, u32 mask, | 216 | static Result SetMemoryAttribute32(Core::System& system, u32 address, u32 size, u32 mask, |
| 217 | u32 attr) { | 217 | u32 attr) { |
| 218 | return SetMemoryAttribute(system, address, size, mask, attr); | 218 | return SetMemoryAttribute(system, address, size, mask, attr); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | /// Maps a memory range into a different range. | 221 | /// Maps a memory range into a different range. |
| 222 | static ResultCode MapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 size) { | 222 | static Result MapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 size) { |
| 223 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, | 223 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, |
| 224 | src_addr, size); | 224 | src_addr, size); |
| 225 | 225 | ||
| 226 | auto& page_table{system.Kernel().CurrentProcess()->PageTable()}; | 226 | auto& page_table{system.Kernel().CurrentProcess()->PageTable()}; |
| 227 | 227 | ||
| 228 | if (const ResultCode result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)}; | 228 | if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)}; |
| 229 | result.IsError()) { | 229 | result.IsError()) { |
| 230 | return result; | 230 | return result; |
| 231 | } | 231 | } |
| @@ -233,18 +233,18 @@ static ResultCode MapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr | |||
| 233 | return page_table.MapMemory(dst_addr, src_addr, size); | 233 | return page_table.MapMemory(dst_addr, src_addr, size); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | static ResultCode MapMemory32(Core::System& system, u32 dst_addr, u32 src_addr, u32 size) { | 236 | static Result MapMemory32(Core::System& system, u32 dst_addr, u32 src_addr, u32 size) { |
| 237 | return MapMemory(system, dst_addr, src_addr, size); | 237 | return MapMemory(system, dst_addr, src_addr, size); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | /// Unmaps a region that was previously mapped with svcMapMemory | 240 | /// Unmaps a region that was previously mapped with svcMapMemory |
| 241 | static ResultCode UnmapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 size) { | 241 | static Result UnmapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 size) { |
| 242 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, | 242 | LOG_TRACE(Kernel_SVC, "called, dst_addr=0x{:X}, src_addr=0x{:X}, size=0x{:X}", dst_addr, |
| 243 | src_addr, size); | 243 | src_addr, size); |
| 244 | 244 | ||
| 245 | auto& page_table{system.Kernel().CurrentProcess()->PageTable()}; | 245 | auto& page_table{system.Kernel().CurrentProcess()->PageTable()}; |
| 246 | 246 | ||
| 247 | if (const ResultCode result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)}; | 247 | if (const Result result{MapUnmapMemorySanityChecks(page_table, dst_addr, src_addr, size)}; |
| 248 | result.IsError()) { | 248 | result.IsError()) { |
| 249 | return result; | 249 | return result; |
| 250 | } | 250 | } |
| @@ -252,12 +252,12 @@ static ResultCode UnmapMemory(Core::System& system, VAddr dst_addr, VAddr src_ad | |||
| 252 | return page_table.UnmapMemory(dst_addr, src_addr, size); | 252 | return page_table.UnmapMemory(dst_addr, src_addr, size); |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | static ResultCode UnmapMemory32(Core::System& system, u32 dst_addr, u32 src_addr, u32 size) { | 255 | static Result UnmapMemory32(Core::System& system, u32 dst_addr, u32 src_addr, u32 size) { |
| 256 | return UnmapMemory(system, dst_addr, src_addr, size); | 256 | return UnmapMemory(system, dst_addr, src_addr, size); |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | /// Connect to an OS service given the port name, returns the handle to the port to out | 259 | /// Connect to an OS service given the port name, returns the handle to the port to out |
| 260 | static ResultCode ConnectToNamedPort(Core::System& system, Handle* out, VAddr port_name_address) { | 260 | static Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr port_name_address) { |
| 261 | auto& memory = system.Memory(); | 261 | auto& memory = system.Memory(); |
| 262 | if (!memory.IsValidVirtualAddress(port_name_address)) { | 262 | if (!memory.IsValidVirtualAddress(port_name_address)) { |
| 263 | LOG_ERROR(Kernel_SVC, | 263 | LOG_ERROR(Kernel_SVC, |
| @@ -307,14 +307,14 @@ static ResultCode ConnectToNamedPort(Core::System& system, Handle* out, VAddr po | |||
| 307 | return ResultSuccess; | 307 | return ResultSuccess; |
| 308 | } | 308 | } |
| 309 | 309 | ||
| 310 | static ResultCode ConnectToNamedPort32(Core::System& system, Handle* out_handle, | 310 | static Result ConnectToNamedPort32(Core::System& system, Handle* out_handle, |
| 311 | u32 port_name_address) { | 311 | u32 port_name_address) { |
| 312 | 312 | ||
| 313 | return ConnectToNamedPort(system, out_handle, port_name_address); | 313 | return ConnectToNamedPort(system, out_handle, port_name_address); |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | /// Makes a blocking IPC call to an OS service. | 316 | /// Makes a blocking IPC call to an OS service. |
| 317 | static ResultCode SendSyncRequest(Core::System& system, Handle handle) { | 317 | static Result SendSyncRequest(Core::System& system, Handle handle) { |
| 318 | auto& kernel = system.Kernel(); | 318 | auto& kernel = system.Kernel(); |
| 319 | 319 | ||
| 320 | // Create the wait queue. | 320 | // Create the wait queue. |
| @@ -339,12 +339,12 @@ static ResultCode SendSyncRequest(Core::System& system, Handle handle) { | |||
| 339 | return GetCurrentThread(kernel).GetWaitResult(); | 339 | return GetCurrentThread(kernel).GetWaitResult(); |
| 340 | } | 340 | } |
| 341 | 341 | ||
| 342 | static ResultCode SendSyncRequest32(Core::System& system, Handle handle) { | 342 | static Result SendSyncRequest32(Core::System& system, Handle handle) { |
| 343 | return SendSyncRequest(system, handle); | 343 | return SendSyncRequest(system, handle); |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | /// Get the ID for the specified thread. | 346 | /// Get the ID for the specified thread. |
| 347 | static ResultCode GetThreadId(Core::System& system, u64* out_thread_id, Handle thread_handle) { | 347 | static Result GetThreadId(Core::System& system, u64* out_thread_id, Handle thread_handle) { |
| 348 | // Get the thread from its handle. | 348 | // Get the thread from its handle. |
| 349 | KScopedAutoObject thread = | 349 | KScopedAutoObject thread = |
| 350 | system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle); | 350 | system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(thread_handle); |
| @@ -355,10 +355,10 @@ static ResultCode GetThreadId(Core::System& system, u64* out_thread_id, Handle t | |||
| 355 | return ResultSuccess; | 355 | return ResultSuccess; |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | static ResultCode GetThreadId32(Core::System& system, u32* out_thread_id_low, | 358 | static Result GetThreadId32(Core::System& system, u32* out_thread_id_low, u32* out_thread_id_high, |
| 359 | u32* out_thread_id_high, Handle thread_handle) { | 359 | Handle thread_handle) { |
| 360 | u64 out_thread_id{}; | 360 | u64 out_thread_id{}; |
| 361 | const ResultCode result{GetThreadId(system, &out_thread_id, thread_handle)}; | 361 | const Result result{GetThreadId(system, &out_thread_id, thread_handle)}; |
| 362 | 362 | ||
| 363 | *out_thread_id_low = static_cast<u32>(out_thread_id >> 32); | 363 | *out_thread_id_low = static_cast<u32>(out_thread_id >> 32); |
| 364 | *out_thread_id_high = static_cast<u32>(out_thread_id & std::numeric_limits<u32>::max()); | 364 | *out_thread_id_high = static_cast<u32>(out_thread_id & std::numeric_limits<u32>::max()); |
| @@ -367,7 +367,7 @@ static ResultCode GetThreadId32(Core::System& system, u32* out_thread_id_low, | |||
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | /// Gets the ID of the specified process or a specified thread's owning process. | 369 | /// Gets the ID of the specified process or a specified thread's owning process. |
| 370 | static ResultCode GetProcessId(Core::System& system, u64* out_process_id, Handle handle) { | 370 | static Result GetProcessId(Core::System& system, u64* out_process_id, Handle handle) { |
| 371 | LOG_DEBUG(Kernel_SVC, "called handle=0x{:08X}", handle); | 371 | LOG_DEBUG(Kernel_SVC, "called handle=0x{:08X}", handle); |
| 372 | 372 | ||
| 373 | // Get the object from the handle table. | 373 | // Get the object from the handle table. |
| @@ -398,8 +398,8 @@ static ResultCode GetProcessId(Core::System& system, u64* out_process_id, Handle | |||
| 398 | return ResultSuccess; | 398 | return ResultSuccess; |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | static ResultCode GetProcessId32(Core::System& system, u32* out_process_id_low, | 401 | static Result GetProcessId32(Core::System& system, u32* out_process_id_low, |
| 402 | u32* out_process_id_high, Handle handle) { | 402 | u32* out_process_id_high, Handle handle) { |
| 403 | u64 out_process_id{}; | 403 | u64 out_process_id{}; |
| 404 | const auto result = GetProcessId(system, &out_process_id, handle); | 404 | const auto result = GetProcessId(system, &out_process_id, handle); |
| 405 | *out_process_id_low = static_cast<u32>(out_process_id); | 405 | *out_process_id_low = static_cast<u32>(out_process_id); |
| @@ -408,8 +408,8 @@ static ResultCode GetProcessId32(Core::System& system, u32* out_process_id_low, | |||
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds | 410 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds |
| 411 | static ResultCode WaitSynchronization(Core::System& system, s32* index, VAddr handles_address, | 411 | static Result WaitSynchronization(Core::System& system, s32* index, VAddr handles_address, |
| 412 | s32 num_handles, s64 nano_seconds) { | 412 | s32 num_handles, s64 nano_seconds) { |
| 413 | LOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, num_handles={}, nano_seconds={}", | 413 | LOG_TRACE(Kernel_SVC, "called handles_address=0x{:X}, num_handles={}, nano_seconds={}", |
| 414 | handles_address, num_handles, nano_seconds); | 414 | handles_address, num_handles, nano_seconds); |
| 415 | 415 | ||
| @@ -444,14 +444,14 @@ static ResultCode WaitSynchronization(Core::System& system, s32* index, VAddr ha | |||
| 444 | nano_seconds); | 444 | nano_seconds); |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | static ResultCode WaitSynchronization32(Core::System& system, u32 timeout_low, u32 handles_address, | 447 | static Result WaitSynchronization32(Core::System& system, u32 timeout_low, u32 handles_address, |
| 448 | s32 num_handles, u32 timeout_high, s32* index) { | 448 | s32 num_handles, u32 timeout_high, s32* index) { |
| 449 | const s64 nano_seconds{(static_cast<s64>(timeout_high) << 32) | static_cast<s64>(timeout_low)}; | 449 | const s64 nano_seconds{(static_cast<s64>(timeout_high) << 32) | static_cast<s64>(timeout_low)}; |
| 450 | return WaitSynchronization(system, index, handles_address, num_handles, nano_seconds); | 450 | return WaitSynchronization(system, index, handles_address, num_handles, nano_seconds); |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | /// Resumes a thread waiting on WaitSynchronization | 453 | /// Resumes a thread waiting on WaitSynchronization |
| 454 | static ResultCode CancelSynchronization(Core::System& system, Handle handle) { | 454 | static Result CancelSynchronization(Core::System& system, Handle handle) { |
| 455 | LOG_TRACE(Kernel_SVC, "called handle=0x{:X}", handle); | 455 | LOG_TRACE(Kernel_SVC, "called handle=0x{:X}", handle); |
| 456 | 456 | ||
| 457 | // Get the thread from its handle. | 457 | // Get the thread from its handle. |
| @@ -464,13 +464,12 @@ static ResultCode CancelSynchronization(Core::System& system, Handle handle) { | |||
| 464 | return ResultSuccess; | 464 | return ResultSuccess; |
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | static ResultCode CancelSynchronization32(Core::System& system, Handle handle) { | 467 | static Result CancelSynchronization32(Core::System& system, Handle handle) { |
| 468 | return CancelSynchronization(system, handle); | 468 | return CancelSynchronization(system, handle); |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | /// Attempts to locks a mutex | 471 | /// Attempts to locks a mutex |
| 472 | static ResultCode ArbitrateLock(Core::System& system, Handle thread_handle, VAddr address, | 472 | static Result ArbitrateLock(Core::System& system, Handle thread_handle, VAddr address, u32 tag) { |
| 473 | u32 tag) { | ||
| 474 | LOG_TRACE(Kernel_SVC, "called thread_handle=0x{:08X}, address=0x{:X}, tag=0x{:08X}", | 473 | LOG_TRACE(Kernel_SVC, "called thread_handle=0x{:08X}, address=0x{:X}, tag=0x{:08X}", |
| 475 | thread_handle, address, tag); | 474 | thread_handle, address, tag); |
| 476 | 475 | ||
| @@ -488,13 +487,12 @@ static ResultCode ArbitrateLock(Core::System& system, Handle thread_handle, VAdd | |||
| 488 | return system.Kernel().CurrentProcess()->WaitForAddress(thread_handle, address, tag); | 487 | return system.Kernel().CurrentProcess()->WaitForAddress(thread_handle, address, tag); |
| 489 | } | 488 | } |
| 490 | 489 | ||
| 491 | static ResultCode ArbitrateLock32(Core::System& system, Handle thread_handle, u32 address, | 490 | static Result ArbitrateLock32(Core::System& system, Handle thread_handle, u32 address, u32 tag) { |
| 492 | u32 tag) { | ||
| 493 | return ArbitrateLock(system, thread_handle, address, tag); | 491 | return ArbitrateLock(system, thread_handle, address, tag); |
| 494 | } | 492 | } |
| 495 | 493 | ||
| 496 | /// Unlock a mutex | 494 | /// Unlock a mutex |
| 497 | static ResultCode ArbitrateUnlock(Core::System& system, VAddr address) { | 495 | static Result ArbitrateUnlock(Core::System& system, VAddr address) { |
| 498 | LOG_TRACE(Kernel_SVC, "called address=0x{:X}", address); | 496 | LOG_TRACE(Kernel_SVC, "called address=0x{:X}", address); |
| 499 | 497 | ||
| 500 | // Validate the input address. | 498 | // Validate the input address. |
| @@ -512,7 +510,7 @@ static ResultCode ArbitrateUnlock(Core::System& system, VAddr address) { | |||
| 512 | return system.Kernel().CurrentProcess()->SignalToAddress(address); | 510 | return system.Kernel().CurrentProcess()->SignalToAddress(address); |
| 513 | } | 511 | } |
| 514 | 512 | ||
| 515 | static ResultCode ArbitrateUnlock32(Core::System& system, u32 address) { | 513 | static Result ArbitrateUnlock32(Core::System& system, u32 address) { |
| 516 | return ArbitrateUnlock(system, address); | 514 | return ArbitrateUnlock(system, address); |
| 517 | } | 515 | } |
| 518 | 516 | ||
| @@ -655,8 +653,8 @@ static void OutputDebugString32(Core::System& system, u32 address, u32 len) { | |||
| 655 | } | 653 | } |
| 656 | 654 | ||
| 657 | /// Gets system/memory information for the current process | 655 | /// Gets system/memory information for the current process |
| 658 | static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle handle, | 656 | static Result GetInfo(Core::System& system, u64* result, u64 info_id, Handle handle, |
| 659 | u64 info_sub_id) { | 657 | u64 info_sub_id) { |
| 660 | LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, | 658 | LOG_TRACE(Kernel_SVC, "called info_id=0x{:X}, info_sub_id=0x{:X}, handle=0x{:08X}", info_id, |
| 661 | info_sub_id, handle); | 659 | info_sub_id, handle); |
| 662 | 660 | ||
| @@ -919,12 +917,12 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle | |||
| 919 | } | 917 | } |
| 920 | } | 918 | } |
| 921 | 919 | ||
| 922 | static ResultCode GetInfo32(Core::System& system, u32* result_low, u32* result_high, u32 sub_id_low, | 920 | static Result GetInfo32(Core::System& system, u32* result_low, u32* result_high, u32 sub_id_low, |
| 923 | u32 info_id, u32 handle, u32 sub_id_high) { | 921 | u32 info_id, u32 handle, u32 sub_id_high) { |
| 924 | const u64 sub_id{u64{sub_id_low} | (u64{sub_id_high} << 32)}; | 922 | const u64 sub_id{u64{sub_id_low} | (u64{sub_id_high} << 32)}; |
| 925 | u64 res_value{}; | 923 | u64 res_value{}; |
| 926 | 924 | ||
| 927 | const ResultCode result{GetInfo(system, &res_value, info_id, handle, sub_id)}; | 925 | const Result result{GetInfo(system, &res_value, info_id, handle, sub_id)}; |
| 928 | *result_high = static_cast<u32>(res_value >> 32); | 926 | *result_high = static_cast<u32>(res_value >> 32); |
| 929 | *result_low = static_cast<u32>(res_value & std::numeric_limits<u32>::max()); | 927 | *result_low = static_cast<u32>(res_value & std::numeric_limits<u32>::max()); |
| 930 | 928 | ||
| @@ -932,7 +930,7 @@ static ResultCode GetInfo32(Core::System& system, u32* result_low, u32* result_h | |||
| 932 | } | 930 | } |
| 933 | 931 | ||
| 934 | /// Maps memory at a desired address | 932 | /// Maps memory at a desired address |
| 935 | static ResultCode MapPhysicalMemory(Core::System& system, VAddr addr, u64 size) { | 933 | static Result MapPhysicalMemory(Core::System& system, VAddr addr, u64 size) { |
| 936 | LOG_DEBUG(Kernel_SVC, "called, addr=0x{:016X}, size=0x{:X}", addr, size); | 934 | LOG_DEBUG(Kernel_SVC, "called, addr=0x{:016X}, size=0x{:X}", addr, size); |
| 937 | 935 | ||
| 938 | if (!Common::Is4KBAligned(addr)) { | 936 | if (!Common::Is4KBAligned(addr)) { |
| @@ -980,12 +978,12 @@ static ResultCode MapPhysicalMemory(Core::System& system, VAddr addr, u64 size) | |||
| 980 | return page_table.MapPhysicalMemory(addr, size); | 978 | return page_table.MapPhysicalMemory(addr, size); |
| 981 | } | 979 | } |
| 982 | 980 | ||
| 983 | static ResultCode MapPhysicalMemory32(Core::System& system, u32 addr, u32 size) { | 981 | static Result MapPhysicalMemory32(Core::System& system, u32 addr, u32 size) { |
| 984 | return MapPhysicalMemory(system, addr, size); | 982 | return MapPhysicalMemory(system, addr, size); |
| 985 | } | 983 | } |
| 986 | 984 | ||
| 987 | /// Unmaps memory previously mapped via MapPhysicalMemory | 985 | /// Unmaps memory previously mapped via MapPhysicalMemory |
| 988 | static ResultCode UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size) { | 986 | static Result UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size) { |
| 989 | LOG_DEBUG(Kernel_SVC, "called, addr=0x{:016X}, size=0x{:X}", addr, size); | 987 | LOG_DEBUG(Kernel_SVC, "called, addr=0x{:016X}, size=0x{:X}", addr, size); |
| 990 | 988 | ||
| 991 | if (!Common::Is4KBAligned(addr)) { | 989 | if (!Common::Is4KBAligned(addr)) { |
| @@ -1033,13 +1031,13 @@ static ResultCode UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size | |||
| 1033 | return page_table.UnmapPhysicalMemory(addr, size); | 1031 | return page_table.UnmapPhysicalMemory(addr, size); |
| 1034 | } | 1032 | } |
| 1035 | 1033 | ||
| 1036 | static ResultCode UnmapPhysicalMemory32(Core::System& system, u32 addr, u32 size) { | 1034 | static Result UnmapPhysicalMemory32(Core::System& system, u32 addr, u32 size) { |
| 1037 | return UnmapPhysicalMemory(system, addr, size); | 1035 | return UnmapPhysicalMemory(system, addr, size); |
| 1038 | } | 1036 | } |
| 1039 | 1037 | ||
| 1040 | /// Sets the thread activity | 1038 | /// Sets the thread activity |
| 1041 | static ResultCode SetThreadActivity(Core::System& system, Handle thread_handle, | 1039 | static Result SetThreadActivity(Core::System& system, Handle thread_handle, |
| 1042 | ThreadActivity thread_activity) { | 1040 | ThreadActivity thread_activity) { |
| 1043 | LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, activity=0x{:08X}", thread_handle, | 1041 | LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, activity=0x{:08X}", thread_handle, |
| 1044 | thread_activity); | 1042 | thread_activity); |
| 1045 | 1043 | ||
| @@ -1064,13 +1062,13 @@ static ResultCode SetThreadActivity(Core::System& system, Handle thread_handle, | |||
| 1064 | return ResultSuccess; | 1062 | return ResultSuccess; |
| 1065 | } | 1063 | } |
| 1066 | 1064 | ||
| 1067 | static ResultCode SetThreadActivity32(Core::System& system, Handle thread_handle, | 1065 | static Result SetThreadActivity32(Core::System& system, Handle thread_handle, |
| 1068 | Svc::ThreadActivity thread_activity) { | 1066 | Svc::ThreadActivity thread_activity) { |
| 1069 | return SetThreadActivity(system, thread_handle, thread_activity); | 1067 | return SetThreadActivity(system, thread_handle, thread_activity); |
| 1070 | } | 1068 | } |
| 1071 | 1069 | ||
| 1072 | /// Gets the thread context | 1070 | /// Gets the thread context |
| 1073 | static ResultCode GetThreadContext(Core::System& system, VAddr out_context, Handle thread_handle) { | 1071 | static Result GetThreadContext(Core::System& system, VAddr out_context, Handle thread_handle) { |
| 1074 | LOG_DEBUG(Kernel_SVC, "called, out_context=0x{:08X}, thread_handle=0x{:X}", out_context, | 1072 | LOG_DEBUG(Kernel_SVC, "called, out_context=0x{:08X}, thread_handle=0x{:X}", out_context, |
| 1075 | thread_handle); | 1073 | thread_handle); |
| 1076 | 1074 | ||
| @@ -1127,12 +1125,12 @@ static ResultCode GetThreadContext(Core::System& system, VAddr out_context, Hand | |||
| 1127 | return ResultSuccess; | 1125 | return ResultSuccess; |
| 1128 | } | 1126 | } |
| 1129 | 1127 | ||
| 1130 | static ResultCode GetThreadContext32(Core::System& system, u32 out_context, Handle thread_handle) { | 1128 | static Result GetThreadContext32(Core::System& system, u32 out_context, Handle thread_handle) { |
| 1131 | return GetThreadContext(system, out_context, thread_handle); | 1129 | return GetThreadContext(system, out_context, thread_handle); |
| 1132 | } | 1130 | } |
| 1133 | 1131 | ||
| 1134 | /// Gets the priority for the specified thread | 1132 | /// Gets the priority for the specified thread |
| 1135 | static ResultCode GetThreadPriority(Core::System& system, u32* out_priority, Handle handle) { | 1133 | static Result GetThreadPriority(Core::System& system, u32* out_priority, Handle handle) { |
| 1136 | LOG_TRACE(Kernel_SVC, "called"); | 1134 | LOG_TRACE(Kernel_SVC, "called"); |
| 1137 | 1135 | ||
| 1138 | // Get the thread from its handle. | 1136 | // Get the thread from its handle. |
| @@ -1145,12 +1143,12 @@ static ResultCode GetThreadPriority(Core::System& system, u32* out_priority, Han | |||
| 1145 | return ResultSuccess; | 1143 | return ResultSuccess; |
| 1146 | } | 1144 | } |
| 1147 | 1145 | ||
| 1148 | static ResultCode GetThreadPriority32(Core::System& system, u32* out_priority, Handle handle) { | 1146 | static Result GetThreadPriority32(Core::System& system, u32* out_priority, Handle handle) { |
| 1149 | return GetThreadPriority(system, out_priority, handle); | 1147 | return GetThreadPriority(system, out_priority, handle); |
| 1150 | } | 1148 | } |
| 1151 | 1149 | ||
| 1152 | /// Sets the priority for the specified thread | 1150 | /// Sets the priority for the specified thread |
| 1153 | static ResultCode SetThreadPriority(Core::System& system, Handle thread_handle, u32 priority) { | 1151 | static Result SetThreadPriority(Core::System& system, Handle thread_handle, u32 priority) { |
| 1154 | // Get the current process. | 1152 | // Get the current process. |
| 1155 | KProcess& process = *system.Kernel().CurrentProcess(); | 1153 | KProcess& process = *system.Kernel().CurrentProcess(); |
| 1156 | 1154 | ||
| @@ -1168,7 +1166,7 @@ static ResultCode SetThreadPriority(Core::System& system, Handle thread_handle, | |||
| 1168 | return ResultSuccess; | 1166 | return ResultSuccess; |
| 1169 | } | 1167 | } |
| 1170 | 1168 | ||
| 1171 | static ResultCode SetThreadPriority32(Core::System& system, Handle thread_handle, u32 priority) { | 1169 | static Result SetThreadPriority32(Core::System& system, Handle thread_handle, u32 priority) { |
| 1172 | return SetThreadPriority(system, thread_handle, priority); | 1170 | return SetThreadPriority(system, thread_handle, priority); |
| 1173 | } | 1171 | } |
| 1174 | 1172 | ||
| @@ -1228,8 +1226,8 @@ constexpr bool IsValidUnmapFromOwnerCodeMemoryPermission(Svc::MemoryPermission p | |||
| 1228 | 1226 | ||
| 1229 | } // Anonymous namespace | 1227 | } // Anonymous namespace |
| 1230 | 1228 | ||
| 1231 | static ResultCode MapSharedMemory(Core::System& system, Handle shmem_handle, VAddr address, | 1229 | static Result MapSharedMemory(Core::System& system, Handle shmem_handle, VAddr address, u64 size, |
| 1232 | u64 size, Svc::MemoryPermission map_perm) { | 1230 | Svc::MemoryPermission map_perm) { |
| 1233 | LOG_TRACE(Kernel_SVC, | 1231 | LOG_TRACE(Kernel_SVC, |
| 1234 | "called, shared_memory_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}", | 1232 | "called, shared_memory_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}", |
| 1235 | shmem_handle, address, size, map_perm); | 1233 | shmem_handle, address, size, map_perm); |
| @@ -1269,13 +1267,13 @@ static ResultCode MapSharedMemory(Core::System& system, Handle shmem_handle, VAd | |||
| 1269 | return ResultSuccess; | 1267 | return ResultSuccess; |
| 1270 | } | 1268 | } |
| 1271 | 1269 | ||
| 1272 | static ResultCode MapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address, | 1270 | static Result MapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address, u32 size, |
| 1273 | u32 size, Svc::MemoryPermission map_perm) { | 1271 | Svc::MemoryPermission map_perm) { |
| 1274 | return MapSharedMemory(system, shmem_handle, address, size, map_perm); | 1272 | return MapSharedMemory(system, shmem_handle, address, size, map_perm); |
| 1275 | } | 1273 | } |
| 1276 | 1274 | ||
| 1277 | static ResultCode UnmapSharedMemory(Core::System& system, Handle shmem_handle, VAddr address, | 1275 | static Result UnmapSharedMemory(Core::System& system, Handle shmem_handle, VAddr address, |
| 1278 | u64 size) { | 1276 | u64 size) { |
| 1279 | // Validate the address/size. | 1277 | // Validate the address/size. |
| 1280 | R_UNLESS(Common::IsAligned(address, PageSize), ResultInvalidAddress); | 1278 | R_UNLESS(Common::IsAligned(address, PageSize), ResultInvalidAddress); |
| 1281 | R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize); | 1279 | R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize); |
| @@ -1302,13 +1300,13 @@ static ResultCode UnmapSharedMemory(Core::System& system, Handle shmem_handle, V | |||
| 1302 | return ResultSuccess; | 1300 | return ResultSuccess; |
| 1303 | } | 1301 | } |
| 1304 | 1302 | ||
| 1305 | static ResultCode UnmapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address, | 1303 | static Result UnmapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address, |
| 1306 | u32 size) { | 1304 | u32 size) { |
| 1307 | return UnmapSharedMemory(system, shmem_handle, address, size); | 1305 | return UnmapSharedMemory(system, shmem_handle, address, size); |
| 1308 | } | 1306 | } |
| 1309 | 1307 | ||
| 1310 | static ResultCode SetProcessMemoryPermission(Core::System& system, Handle process_handle, | 1308 | static Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, VAddr address, |
| 1311 | VAddr address, u64 size, Svc::MemoryPermission perm) { | 1309 | u64 size, Svc::MemoryPermission perm) { |
| 1312 | LOG_TRACE(Kernel_SVC, | 1310 | LOG_TRACE(Kernel_SVC, |
| 1313 | "called, process_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}", | 1311 | "called, process_handle=0x{:X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}", |
| 1314 | process_handle, address, size, perm); | 1312 | process_handle, address, size, perm); |
| @@ -1337,8 +1335,8 @@ static ResultCode SetProcessMemoryPermission(Core::System& system, Handle proces | |||
| 1337 | return page_table.SetProcessMemoryPermission(address, size, perm); | 1335 | return page_table.SetProcessMemoryPermission(address, size, perm); |
| 1338 | } | 1336 | } |
| 1339 | 1337 | ||
| 1340 | static ResultCode MapProcessMemory(Core::System& system, VAddr dst_address, Handle process_handle, | 1338 | static Result MapProcessMemory(Core::System& system, VAddr dst_address, Handle process_handle, |
| 1341 | VAddr src_address, u64 size) { | 1339 | VAddr src_address, u64 size) { |
| 1342 | LOG_TRACE(Kernel_SVC, | 1340 | LOG_TRACE(Kernel_SVC, |
| 1343 | "called, dst_address=0x{:X}, process_handle=0x{:X}, src_address=0x{:X}, size=0x{:X}", | 1341 | "called, dst_address=0x{:X}, process_handle=0x{:X}, src_address=0x{:X}, size=0x{:X}", |
| 1344 | dst_address, process_handle, src_address, size); | 1342 | dst_address, process_handle, src_address, size); |
| @@ -1380,8 +1378,8 @@ static ResultCode MapProcessMemory(Core::System& system, VAddr dst_address, Hand | |||
| 1380 | return ResultSuccess; | 1378 | return ResultSuccess; |
| 1381 | } | 1379 | } |
| 1382 | 1380 | ||
| 1383 | static ResultCode UnmapProcessMemory(Core::System& system, VAddr dst_address, Handle process_handle, | 1381 | static Result UnmapProcessMemory(Core::System& system, VAddr dst_address, Handle process_handle, |
| 1384 | VAddr src_address, u64 size) { | 1382 | VAddr src_address, u64 size) { |
| 1385 | LOG_TRACE(Kernel_SVC, | 1383 | LOG_TRACE(Kernel_SVC, |
| 1386 | "called, dst_address=0x{:X}, process_handle=0x{:X}, src_address=0x{:X}, size=0x{:X}", | 1384 | "called, dst_address=0x{:X}, process_handle=0x{:X}, src_address=0x{:X}, size=0x{:X}", |
| 1387 | dst_address, process_handle, src_address, size); | 1385 | dst_address, process_handle, src_address, size); |
| @@ -1415,7 +1413,7 @@ static ResultCode UnmapProcessMemory(Core::System& system, VAddr dst_address, Ha | |||
| 1415 | return ResultSuccess; | 1413 | return ResultSuccess; |
| 1416 | } | 1414 | } |
| 1417 | 1415 | ||
| 1418 | static ResultCode CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) { | 1416 | static Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) { |
| 1419 | LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, size=0x{:X}", address, size); | 1417 | LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, size=0x{:X}", address, size); |
| 1420 | 1418 | ||
| 1421 | // Get kernel instance. | 1419 | // Get kernel instance. |
| @@ -1450,12 +1448,12 @@ static ResultCode CreateCodeMemory(Core::System& system, Handle* out, VAddr addr | |||
| 1450 | return ResultSuccess; | 1448 | return ResultSuccess; |
| 1451 | } | 1449 | } |
| 1452 | 1450 | ||
| 1453 | static ResultCode CreateCodeMemory32(Core::System& system, Handle* out, u32 address, u32 size) { | 1451 | static Result CreateCodeMemory32(Core::System& system, Handle* out, u32 address, u32 size) { |
| 1454 | return CreateCodeMemory(system, out, address, size); | 1452 | return CreateCodeMemory(system, out, address, size); |
| 1455 | } | 1453 | } |
| 1456 | 1454 | ||
| 1457 | static ResultCode ControlCodeMemory(Core::System& system, Handle code_memory_handle, u32 operation, | 1455 | static Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, u32 operation, |
| 1458 | VAddr address, size_t size, Svc::MemoryPermission perm) { | 1456 | VAddr address, size_t size, Svc::MemoryPermission perm) { |
| 1459 | 1457 | ||
| 1460 | LOG_TRACE(Kernel_SVC, | 1458 | LOG_TRACE(Kernel_SVC, |
| 1461 | "called, code_memory_handle=0x{:X}, operation=0x{:X}, address=0x{:X}, size=0x{:X}, " | 1459 | "called, code_memory_handle=0x{:X}, operation=0x{:X}, address=0x{:X}, size=0x{:X}, " |
| @@ -1533,15 +1531,13 @@ static ResultCode ControlCodeMemory(Core::System& system, Handle code_memory_han | |||
| 1533 | return ResultSuccess; | 1531 | return ResultSuccess; |
| 1534 | } | 1532 | } |
| 1535 | 1533 | ||
| 1536 | static ResultCode ControlCodeMemory32(Core::System& system, Handle code_memory_handle, | 1534 | static Result ControlCodeMemory32(Core::System& system, Handle code_memory_handle, u32 operation, |
| 1537 | u32 operation, u64 address, u64 size, | 1535 | u64 address, u64 size, Svc::MemoryPermission perm) { |
| 1538 | Svc::MemoryPermission perm) { | ||
| 1539 | return ControlCodeMemory(system, code_memory_handle, operation, address, size, perm); | 1536 | return ControlCodeMemory(system, code_memory_handle, operation, address, size, perm); |
| 1540 | } | 1537 | } |
| 1541 | 1538 | ||
| 1542 | static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_address, | 1539 | static Result QueryProcessMemory(Core::System& system, VAddr memory_info_address, |
| 1543 | VAddr page_info_address, Handle process_handle, | 1540 | VAddr page_info_address, Handle process_handle, VAddr address) { |
| 1544 | VAddr address) { | ||
| 1545 | LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address); | 1541 | LOG_TRACE(Kernel_SVC, "called process=0x{:08X} address={:X}", process_handle, address); |
| 1546 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); | 1542 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); |
| 1547 | KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle); | 1543 | KScopedAutoObject process = handle_table.GetObject<KProcess>(process_handle); |
| @@ -1569,8 +1565,8 @@ static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_add | |||
| 1569 | return ResultSuccess; | 1565 | return ResultSuccess; |
| 1570 | } | 1566 | } |
| 1571 | 1567 | ||
| 1572 | static ResultCode QueryMemory(Core::System& system, VAddr memory_info_address, | 1568 | static Result QueryMemory(Core::System& system, VAddr memory_info_address, VAddr page_info_address, |
| 1573 | VAddr page_info_address, VAddr query_address) { | 1569 | VAddr query_address) { |
| 1574 | LOG_TRACE(Kernel_SVC, | 1570 | LOG_TRACE(Kernel_SVC, |
| 1575 | "called, memory_info_address=0x{:016X}, page_info_address=0x{:016X}, " | 1571 | "called, memory_info_address=0x{:016X}, page_info_address=0x{:016X}, " |
| 1576 | "query_address=0x{:016X}", | 1572 | "query_address=0x{:016X}", |
| @@ -1580,13 +1576,13 @@ static ResultCode QueryMemory(Core::System& system, VAddr memory_info_address, | |||
| 1580 | query_address); | 1576 | query_address); |
| 1581 | } | 1577 | } |
| 1582 | 1578 | ||
| 1583 | static ResultCode QueryMemory32(Core::System& system, u32 memory_info_address, | 1579 | static Result QueryMemory32(Core::System& system, u32 memory_info_address, u32 page_info_address, |
| 1584 | u32 page_info_address, u32 query_address) { | 1580 | u32 query_address) { |
| 1585 | return QueryMemory(system, memory_info_address, page_info_address, query_address); | 1581 | return QueryMemory(system, memory_info_address, page_info_address, query_address); |
| 1586 | } | 1582 | } |
| 1587 | 1583 | ||
| 1588 | static ResultCode MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst_address, | 1584 | static Result MapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst_address, |
| 1589 | u64 src_address, u64 size) { | 1585 | u64 src_address, u64 size) { |
| 1590 | LOG_DEBUG(Kernel_SVC, | 1586 | LOG_DEBUG(Kernel_SVC, |
| 1591 | "called. process_handle=0x{:08X}, dst_address=0x{:016X}, " | 1587 | "called. process_handle=0x{:08X}, dst_address=0x{:016X}, " |
| 1592 | "src_address=0x{:016X}, size=0x{:016X}", | 1588 | "src_address=0x{:016X}, size=0x{:016X}", |
| @@ -1653,8 +1649,8 @@ static ResultCode MapProcessCodeMemory(Core::System& system, Handle process_hand | |||
| 1653 | return page_table.MapCodeMemory(dst_address, src_address, size); | 1649 | return page_table.MapCodeMemory(dst_address, src_address, size); |
| 1654 | } | 1650 | } |
| 1655 | 1651 | ||
| 1656 | static ResultCode UnmapProcessCodeMemory(Core::System& system, Handle process_handle, | 1652 | static Result UnmapProcessCodeMemory(Core::System& system, Handle process_handle, u64 dst_address, |
| 1657 | u64 dst_address, u64 src_address, u64 size) { | 1653 | u64 src_address, u64 size) { |
| 1658 | LOG_DEBUG(Kernel_SVC, | 1654 | LOG_DEBUG(Kernel_SVC, |
| 1659 | "called. process_handle=0x{:08X}, dst_address=0x{:016X}, src_address=0x{:016X}, " | 1655 | "called. process_handle=0x{:08X}, dst_address=0x{:016X}, src_address=0x{:016X}, " |
| 1660 | "size=0x{:016X}", | 1656 | "size=0x{:016X}", |
| @@ -1746,8 +1742,8 @@ constexpr bool IsValidVirtualCoreId(int32_t core_id) { | |||
| 1746 | } // Anonymous namespace | 1742 | } // Anonymous namespace |
| 1747 | 1743 | ||
| 1748 | /// Creates a new thread | 1744 | /// Creates a new thread |
| 1749 | static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point, u64 arg, | 1745 | static Result CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point, u64 arg, |
| 1750 | VAddr stack_bottom, u32 priority, s32 core_id) { | 1746 | VAddr stack_bottom, u32 priority, s32 core_id) { |
| 1751 | LOG_DEBUG(Kernel_SVC, | 1747 | LOG_DEBUG(Kernel_SVC, |
| 1752 | "called entry_point=0x{:08X}, arg=0x{:08X}, stack_bottom=0x{:08X}, " | 1748 | "called entry_point=0x{:08X}, arg=0x{:08X}, stack_bottom=0x{:08X}, " |
| 1753 | "priority=0x{:08X}, core_id=0x{:08X}", | 1749 | "priority=0x{:08X}, core_id=0x{:08X}", |
| @@ -1818,13 +1814,13 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e | |||
| 1818 | return ResultSuccess; | 1814 | return ResultSuccess; |
| 1819 | } | 1815 | } |
| 1820 | 1816 | ||
| 1821 | static ResultCode CreateThread32(Core::System& system, Handle* out_handle, u32 priority, | 1817 | static Result CreateThread32(Core::System& system, Handle* out_handle, u32 priority, |
| 1822 | u32 entry_point, u32 arg, u32 stack_top, s32 processor_id) { | 1818 | u32 entry_point, u32 arg, u32 stack_top, s32 processor_id) { |
| 1823 | return CreateThread(system, out_handle, entry_point, arg, stack_top, priority, processor_id); | 1819 | return CreateThread(system, out_handle, entry_point, arg, stack_top, priority, processor_id); |
| 1824 | } | 1820 | } |
| 1825 | 1821 | ||
| 1826 | /// Starts the thread for the provided handle | 1822 | /// Starts the thread for the provided handle |
| 1827 | static ResultCode StartThread(Core::System& system, Handle thread_handle) { | 1823 | static Result StartThread(Core::System& system, Handle thread_handle) { |
| 1828 | LOG_DEBUG(Kernel_SVC, "called thread=0x{:08X}", thread_handle); | 1824 | LOG_DEBUG(Kernel_SVC, "called thread=0x{:08X}", thread_handle); |
| 1829 | 1825 | ||
| 1830 | // Get the thread from its handle. | 1826 | // Get the thread from its handle. |
| @@ -1842,7 +1838,7 @@ static ResultCode StartThread(Core::System& system, Handle thread_handle) { | |||
| 1842 | return ResultSuccess; | 1838 | return ResultSuccess; |
| 1843 | } | 1839 | } |
| 1844 | 1840 | ||
| 1845 | static ResultCode StartThread32(Core::System& system, Handle thread_handle) { | 1841 | static Result StartThread32(Core::System& system, Handle thread_handle) { |
| 1846 | return StartThread(system, thread_handle); | 1842 | return StartThread(system, thread_handle); |
| 1847 | } | 1843 | } |
| 1848 | 1844 | ||
| @@ -1893,8 +1889,8 @@ static void SleepThread32(Core::System& system, u32 nanoseconds_low, u32 nanosec | |||
| 1893 | } | 1889 | } |
| 1894 | 1890 | ||
| 1895 | /// Wait process wide key atomic | 1891 | /// Wait process wide key atomic |
| 1896 | static ResultCode WaitProcessWideKeyAtomic(Core::System& system, VAddr address, VAddr cv_key, | 1892 | static Result WaitProcessWideKeyAtomic(Core::System& system, VAddr address, VAddr cv_key, u32 tag, |
| 1897 | u32 tag, s64 timeout_ns) { | 1893 | s64 timeout_ns) { |
| 1898 | LOG_TRACE(Kernel_SVC, "called address={:X}, cv_key={:X}, tag=0x{:08X}, timeout_ns={}", address, | 1894 | LOG_TRACE(Kernel_SVC, "called address={:X}, cv_key={:X}, tag=0x{:08X}, timeout_ns={}", address, |
| 1899 | cv_key, tag, timeout_ns); | 1895 | cv_key, tag, timeout_ns); |
| 1900 | 1896 | ||
| @@ -1929,8 +1925,8 @@ static ResultCode WaitProcessWideKeyAtomic(Core::System& system, VAddr address, | |||
| 1929 | address, Common::AlignDown(cv_key, sizeof(u32)), tag, timeout); | 1925 | address, Common::AlignDown(cv_key, sizeof(u32)), tag, timeout); |
| 1930 | } | 1926 | } |
| 1931 | 1927 | ||
| 1932 | static ResultCode WaitProcessWideKeyAtomic32(Core::System& system, u32 address, u32 cv_key, u32 tag, | 1928 | static Result WaitProcessWideKeyAtomic32(Core::System& system, u32 address, u32 cv_key, u32 tag, |
| 1933 | u32 timeout_ns_low, u32 timeout_ns_high) { | 1929 | u32 timeout_ns_low, u32 timeout_ns_high) { |
| 1934 | const auto timeout_ns = static_cast<s64>(timeout_ns_low | (u64{timeout_ns_high} << 32)); | 1930 | const auto timeout_ns = static_cast<s64>(timeout_ns_low | (u64{timeout_ns_high} << 32)); |
| 1935 | return WaitProcessWideKeyAtomic(system, address, cv_key, tag, timeout_ns); | 1931 | return WaitProcessWideKeyAtomic(system, address, cv_key, tag, timeout_ns); |
| 1936 | } | 1932 | } |
| @@ -1975,8 +1971,8 @@ constexpr bool IsValidArbitrationType(Svc::ArbitrationType type) { | |||
| 1975 | } // namespace | 1971 | } // namespace |
| 1976 | 1972 | ||
| 1977 | // Wait for an address (via Address Arbiter) | 1973 | // Wait for an address (via Address Arbiter) |
| 1978 | static ResultCode WaitForAddress(Core::System& system, VAddr address, Svc::ArbitrationType arb_type, | 1974 | static Result WaitForAddress(Core::System& system, VAddr address, Svc::ArbitrationType arb_type, |
| 1979 | s32 value, s64 timeout_ns) { | 1975 | s32 value, s64 timeout_ns) { |
| 1980 | LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, arb_type=0x{:X}, value=0x{:X}, timeout_ns={}", | 1976 | LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, arb_type=0x{:X}, value=0x{:X}, timeout_ns={}", |
| 1981 | address, arb_type, value, timeout_ns); | 1977 | address, arb_type, value, timeout_ns); |
| 1982 | 1978 | ||
| @@ -2013,15 +2009,15 @@ static ResultCode WaitForAddress(Core::System& system, VAddr address, Svc::Arbit | |||
| 2013 | return system.Kernel().CurrentProcess()->WaitAddressArbiter(address, arb_type, value, timeout); | 2009 | return system.Kernel().CurrentProcess()->WaitAddressArbiter(address, arb_type, value, timeout); |
| 2014 | } | 2010 | } |
| 2015 | 2011 | ||
| 2016 | static ResultCode WaitForAddress32(Core::System& system, u32 address, Svc::ArbitrationType arb_type, | 2012 | static Result WaitForAddress32(Core::System& system, u32 address, Svc::ArbitrationType arb_type, |
| 2017 | s32 value, u32 timeout_ns_low, u32 timeout_ns_high) { | 2013 | s32 value, u32 timeout_ns_low, u32 timeout_ns_high) { |
| 2018 | const auto timeout = static_cast<s64>(timeout_ns_low | (u64{timeout_ns_high} << 32)); | 2014 | const auto timeout = static_cast<s64>(timeout_ns_low | (u64{timeout_ns_high} << 32)); |
| 2019 | return WaitForAddress(system, address, arb_type, value, timeout); | 2015 | return WaitForAddress(system, address, arb_type, value, timeout); |
| 2020 | } | 2016 | } |
| 2021 | 2017 | ||
| 2022 | // Signals to an address (via Address Arbiter) | 2018 | // Signals to an address (via Address Arbiter) |
| 2023 | static ResultCode SignalToAddress(Core::System& system, VAddr address, Svc::SignalType signal_type, | 2019 | static Result SignalToAddress(Core::System& system, VAddr address, Svc::SignalType signal_type, |
| 2024 | s32 value, s32 count) { | 2020 | s32 value, s32 count) { |
| 2025 | LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, signal_type=0x{:X}, value=0x{:X}, count=0x{:X}", | 2021 | LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, signal_type=0x{:X}, value=0x{:X}, count=0x{:X}", |
| 2026 | address, signal_type, value, count); | 2022 | address, signal_type, value, count); |
| 2027 | 2023 | ||
| @@ -2062,8 +2058,8 @@ static void SynchronizePreemptionState(Core::System& system) { | |||
| 2062 | } | 2058 | } |
| 2063 | } | 2059 | } |
| 2064 | 2060 | ||
| 2065 | static ResultCode SignalToAddress32(Core::System& system, u32 address, Svc::SignalType signal_type, | 2061 | static Result SignalToAddress32(Core::System& system, u32 address, Svc::SignalType signal_type, |
| 2066 | s32 value, s32 count) { | 2062 | s32 value, s32 count) { |
| 2067 | return SignalToAddress(system, address, signal_type, value, count); | 2063 | return SignalToAddress(system, address, signal_type, value, count); |
| 2068 | } | 2064 | } |
| 2069 | 2065 | ||
| @@ -2101,7 +2097,7 @@ static void GetSystemTick32(Core::System& system, u32* time_low, u32* time_high) | |||
| 2101 | } | 2097 | } |
| 2102 | 2098 | ||
| 2103 | /// Close a handle | 2099 | /// Close a handle |
| 2104 | static ResultCode CloseHandle(Core::System& system, Handle handle) { | 2100 | static Result CloseHandle(Core::System& system, Handle handle) { |
| 2105 | LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle); | 2101 | LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle); |
| 2106 | 2102 | ||
| 2107 | // Remove the handle. | 2103 | // Remove the handle. |
| @@ -2111,12 +2107,12 @@ static ResultCode CloseHandle(Core::System& system, Handle handle) { | |||
| 2111 | return ResultSuccess; | 2107 | return ResultSuccess; |
| 2112 | } | 2108 | } |
| 2113 | 2109 | ||
| 2114 | static ResultCode CloseHandle32(Core::System& system, Handle handle) { | 2110 | static Result CloseHandle32(Core::System& system, Handle handle) { |
| 2115 | return CloseHandle(system, handle); | 2111 | return CloseHandle(system, handle); |
| 2116 | } | 2112 | } |
| 2117 | 2113 | ||
| 2118 | /// Clears the signaled state of an event or process. | 2114 | /// Clears the signaled state of an event or process. |
| 2119 | static ResultCode ResetSignal(Core::System& system, Handle handle) { | 2115 | static Result ResetSignal(Core::System& system, Handle handle) { |
| 2120 | LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle); | 2116 | LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle); |
| 2121 | 2117 | ||
| 2122 | // Get the current handle table. | 2118 | // Get the current handle table. |
| @@ -2143,7 +2139,7 @@ static ResultCode ResetSignal(Core::System& system, Handle handle) { | |||
| 2143 | return ResultInvalidHandle; | 2139 | return ResultInvalidHandle; |
| 2144 | } | 2140 | } |
| 2145 | 2141 | ||
| 2146 | static ResultCode ResetSignal32(Core::System& system, Handle handle) { | 2142 | static Result ResetSignal32(Core::System& system, Handle handle) { |
| 2147 | return ResetSignal(system, handle); | 2143 | return ResetSignal(system, handle); |
| 2148 | } | 2144 | } |
| 2149 | 2145 | ||
| @@ -2163,8 +2159,8 @@ constexpr bool IsValidTransferMemoryPermission(MemoryPermission perm) { | |||
| 2163 | } // Anonymous namespace | 2159 | } // Anonymous namespace |
| 2164 | 2160 | ||
| 2165 | /// Creates a TransferMemory object | 2161 | /// Creates a TransferMemory object |
| 2166 | static ResultCode CreateTransferMemory(Core::System& system, Handle* out, VAddr address, u64 size, | 2162 | static Result CreateTransferMemory(Core::System& system, Handle* out, VAddr address, u64 size, |
| 2167 | MemoryPermission map_perm) { | 2163 | MemoryPermission map_perm) { |
| 2168 | auto& kernel = system.Kernel(); | 2164 | auto& kernel = system.Kernel(); |
| 2169 | 2165 | ||
| 2170 | // Validate the size. | 2166 | // Validate the size. |
| @@ -2210,13 +2206,13 @@ static ResultCode CreateTransferMemory(Core::System& system, Handle* out, VAddr | |||
| 2210 | return ResultSuccess; | 2206 | return ResultSuccess; |
| 2211 | } | 2207 | } |
| 2212 | 2208 | ||
| 2213 | static ResultCode CreateTransferMemory32(Core::System& system, Handle* out, u32 address, u32 size, | 2209 | static Result CreateTransferMemory32(Core::System& system, Handle* out, u32 address, u32 size, |
| 2214 | MemoryPermission map_perm) { | 2210 | MemoryPermission map_perm) { |
| 2215 | return CreateTransferMemory(system, out, address, size, map_perm); | 2211 | return CreateTransferMemory(system, out, address, size, map_perm); |
| 2216 | } | 2212 | } |
| 2217 | 2213 | ||
| 2218 | static ResultCode GetThreadCoreMask(Core::System& system, Handle thread_handle, s32* out_core_id, | 2214 | static Result GetThreadCoreMask(Core::System& system, Handle thread_handle, s32* out_core_id, |
| 2219 | u64* out_affinity_mask) { | 2215 | u64* out_affinity_mask) { |
| 2220 | LOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle); | 2216 | LOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle); |
| 2221 | 2217 | ||
| 2222 | // Get the thread from its handle. | 2218 | // Get the thread from its handle. |
| @@ -2230,8 +2226,8 @@ static ResultCode GetThreadCoreMask(Core::System& system, Handle thread_handle, | |||
| 2230 | return ResultSuccess; | 2226 | return ResultSuccess; |
| 2231 | } | 2227 | } |
| 2232 | 2228 | ||
| 2233 | static ResultCode GetThreadCoreMask32(Core::System& system, Handle thread_handle, s32* out_core_id, | 2229 | static Result GetThreadCoreMask32(Core::System& system, Handle thread_handle, s32* out_core_id, |
| 2234 | u32* out_affinity_mask_low, u32* out_affinity_mask_high) { | 2230 | u32* out_affinity_mask_low, u32* out_affinity_mask_high) { |
| 2235 | u64 out_affinity_mask{}; | 2231 | u64 out_affinity_mask{}; |
| 2236 | const auto result = GetThreadCoreMask(system, thread_handle, out_core_id, &out_affinity_mask); | 2232 | const auto result = GetThreadCoreMask(system, thread_handle, out_core_id, &out_affinity_mask); |
| 2237 | *out_affinity_mask_high = static_cast<u32>(out_affinity_mask >> 32); | 2233 | *out_affinity_mask_high = static_cast<u32>(out_affinity_mask >> 32); |
| @@ -2239,8 +2235,8 @@ static ResultCode GetThreadCoreMask32(Core::System& system, Handle thread_handle | |||
| 2239 | return result; | 2235 | return result; |
| 2240 | } | 2236 | } |
| 2241 | 2237 | ||
| 2242 | static ResultCode SetThreadCoreMask(Core::System& system, Handle thread_handle, s32 core_id, | 2238 | static Result SetThreadCoreMask(Core::System& system, Handle thread_handle, s32 core_id, |
| 2243 | u64 affinity_mask) { | 2239 | u64 affinity_mask) { |
| 2244 | // Determine the core id/affinity mask. | 2240 | // Determine the core id/affinity mask. |
| 2245 | if (core_id == IdealCoreUseProcessValue) { | 2241 | if (core_id == IdealCoreUseProcessValue) { |
| 2246 | core_id = system.Kernel().CurrentProcess()->GetIdealCoreId(); | 2242 | core_id = system.Kernel().CurrentProcess()->GetIdealCoreId(); |
| @@ -2271,13 +2267,13 @@ static ResultCode SetThreadCoreMask(Core::System& system, Handle thread_handle, | |||
| 2271 | return ResultSuccess; | 2267 | return ResultSuccess; |
| 2272 | } | 2268 | } |
| 2273 | 2269 | ||
| 2274 | static ResultCode SetThreadCoreMask32(Core::System& system, Handle thread_handle, s32 core_id, | 2270 | static Result SetThreadCoreMask32(Core::System& system, Handle thread_handle, s32 core_id, |
| 2275 | u32 affinity_mask_low, u32 affinity_mask_high) { | 2271 | u32 affinity_mask_low, u32 affinity_mask_high) { |
| 2276 | const auto affinity_mask = u64{affinity_mask_low} | (u64{affinity_mask_high} << 32); | 2272 | const auto affinity_mask = u64{affinity_mask_low} | (u64{affinity_mask_high} << 32); |
| 2277 | return SetThreadCoreMask(system, thread_handle, core_id, affinity_mask); | 2273 | return SetThreadCoreMask(system, thread_handle, core_id, affinity_mask); |
| 2278 | } | 2274 | } |
| 2279 | 2275 | ||
| 2280 | static ResultCode SignalEvent(Core::System& system, Handle event_handle) { | 2276 | static Result SignalEvent(Core::System& system, Handle event_handle) { |
| 2281 | LOG_DEBUG(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle); | 2277 | LOG_DEBUG(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle); |
| 2282 | 2278 | ||
| 2283 | // Get the current handle table. | 2279 | // Get the current handle table. |
| @@ -2290,11 +2286,11 @@ static ResultCode SignalEvent(Core::System& system, Handle event_handle) { | |||
| 2290 | return writable_event->Signal(); | 2286 | return writable_event->Signal(); |
| 2291 | } | 2287 | } |
| 2292 | 2288 | ||
| 2293 | static ResultCode SignalEvent32(Core::System& system, Handle event_handle) { | 2289 | static Result SignalEvent32(Core::System& system, Handle event_handle) { |
| 2294 | return SignalEvent(system, event_handle); | 2290 | return SignalEvent(system, event_handle); |
| 2295 | } | 2291 | } |
| 2296 | 2292 | ||
| 2297 | static ResultCode ClearEvent(Core::System& system, Handle event_handle) { | 2293 | static Result ClearEvent(Core::System& system, Handle event_handle) { |
| 2298 | LOG_TRACE(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle); | 2294 | LOG_TRACE(Kernel_SVC, "called, event_handle=0x{:08X}", event_handle); |
| 2299 | 2295 | ||
| 2300 | // Get the current handle table. | 2296 | // Get the current handle table. |
| @@ -2321,11 +2317,11 @@ static ResultCode ClearEvent(Core::System& system, Handle event_handle) { | |||
| 2321 | return ResultInvalidHandle; | 2317 | return ResultInvalidHandle; |
| 2322 | } | 2318 | } |
| 2323 | 2319 | ||
| 2324 | static ResultCode ClearEvent32(Core::System& system, Handle event_handle) { | 2320 | static Result ClearEvent32(Core::System& system, Handle event_handle) { |
| 2325 | return ClearEvent(system, event_handle); | 2321 | return ClearEvent(system, event_handle); |
| 2326 | } | 2322 | } |
| 2327 | 2323 | ||
| 2328 | static ResultCode CreateEvent(Core::System& system, Handle* out_write, Handle* out_read) { | 2324 | static Result CreateEvent(Core::System& system, Handle* out_write, Handle* out_read) { |
| 2329 | LOG_DEBUG(Kernel_SVC, "called"); | 2325 | LOG_DEBUG(Kernel_SVC, "called"); |
| 2330 | 2326 | ||
| 2331 | // Get the kernel reference and handle table. | 2327 | // Get the kernel reference and handle table. |
| @@ -2370,11 +2366,11 @@ static ResultCode CreateEvent(Core::System& system, Handle* out_write, Handle* o | |||
| 2370 | return ResultSuccess; | 2366 | return ResultSuccess; |
| 2371 | } | 2367 | } |
| 2372 | 2368 | ||
| 2373 | static ResultCode CreateEvent32(Core::System& system, Handle* out_write, Handle* out_read) { | 2369 | static Result CreateEvent32(Core::System& system, Handle* out_write, Handle* out_read) { |
| 2374 | return CreateEvent(system, out_write, out_read); | 2370 | return CreateEvent(system, out_write, out_read); |
| 2375 | } | 2371 | } |
| 2376 | 2372 | ||
| 2377 | static ResultCode GetProcessInfo(Core::System& system, u64* out, Handle process_handle, u32 type) { | 2373 | static Result GetProcessInfo(Core::System& system, u64* out, Handle process_handle, u32 type) { |
| 2378 | LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, type=0x{:X}", process_handle, type); | 2374 | LOG_DEBUG(Kernel_SVC, "called, handle=0x{:08X}, type=0x{:X}", process_handle, type); |
| 2379 | 2375 | ||
| 2380 | // This function currently only allows retrieving a process' status. | 2376 | // This function currently only allows retrieving a process' status. |
| @@ -2400,7 +2396,7 @@ static ResultCode GetProcessInfo(Core::System& system, u64* out, Handle process_ | |||
| 2400 | return ResultSuccess; | 2396 | return ResultSuccess; |
| 2401 | } | 2397 | } |
| 2402 | 2398 | ||
| 2403 | static ResultCode CreateResourceLimit(Core::System& system, Handle* out_handle) { | 2399 | static Result CreateResourceLimit(Core::System& system, Handle* out_handle) { |
| 2404 | LOG_DEBUG(Kernel_SVC, "called"); | 2400 | LOG_DEBUG(Kernel_SVC, "called"); |
| 2405 | 2401 | ||
| 2406 | // Create a new resource limit. | 2402 | // Create a new resource limit. |
| @@ -2423,9 +2419,8 @@ static ResultCode CreateResourceLimit(Core::System& system, Handle* out_handle) | |||
| 2423 | return ResultSuccess; | 2419 | return ResultSuccess; |
| 2424 | } | 2420 | } |
| 2425 | 2421 | ||
| 2426 | static ResultCode GetResourceLimitLimitValue(Core::System& system, u64* out_limit_value, | 2422 | static Result GetResourceLimitLimitValue(Core::System& system, u64* out_limit_value, |
| 2427 | Handle resource_limit_handle, | 2423 | Handle resource_limit_handle, LimitableResource which) { |
| 2428 | LimitableResource which) { | ||
| 2429 | LOG_DEBUG(Kernel_SVC, "called, resource_limit_handle={:08X}, which={}", resource_limit_handle, | 2424 | LOG_DEBUG(Kernel_SVC, "called, resource_limit_handle={:08X}, which={}", resource_limit_handle, |
| 2430 | which); | 2425 | which); |
| 2431 | 2426 | ||
| @@ -2444,9 +2439,8 @@ static ResultCode GetResourceLimitLimitValue(Core::System& system, u64* out_limi | |||
| 2444 | return ResultSuccess; | 2439 | return ResultSuccess; |
| 2445 | } | 2440 | } |
| 2446 | 2441 | ||
| 2447 | static ResultCode GetResourceLimitCurrentValue(Core::System& system, u64* out_current_value, | 2442 | static Result GetResourceLimitCurrentValue(Core::System& system, u64* out_current_value, |
| 2448 | Handle resource_limit_handle, | 2443 | Handle resource_limit_handle, LimitableResource which) { |
| 2449 | LimitableResource which) { | ||
| 2450 | LOG_DEBUG(Kernel_SVC, "called, resource_limit_handle={:08X}, which={}", resource_limit_handle, | 2444 | LOG_DEBUG(Kernel_SVC, "called, resource_limit_handle={:08X}, which={}", resource_limit_handle, |
| 2451 | which); | 2445 | which); |
| 2452 | 2446 | ||
| @@ -2465,8 +2459,8 @@ static ResultCode GetResourceLimitCurrentValue(Core::System& system, u64* out_cu | |||
| 2465 | return ResultSuccess; | 2459 | return ResultSuccess; |
| 2466 | } | 2460 | } |
| 2467 | 2461 | ||
| 2468 | static ResultCode SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_handle, | 2462 | static Result SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_handle, |
| 2469 | LimitableResource which, u64 limit_value) { | 2463 | LimitableResource which, u64 limit_value) { |
| 2470 | LOG_DEBUG(Kernel_SVC, "called, resource_limit_handle={:08X}, which={}, limit_value={}", | 2464 | LOG_DEBUG(Kernel_SVC, "called, resource_limit_handle={:08X}, which={}, limit_value={}", |
| 2471 | resource_limit_handle, which, limit_value); | 2465 | resource_limit_handle, which, limit_value); |
| 2472 | 2466 | ||
| @@ -2485,8 +2479,8 @@ static ResultCode SetResourceLimitLimitValue(Core::System& system, Handle resour | |||
| 2485 | return ResultSuccess; | 2479 | return ResultSuccess; |
| 2486 | } | 2480 | } |
| 2487 | 2481 | ||
| 2488 | static ResultCode GetProcessList(Core::System& system, u32* out_num_processes, | 2482 | static Result GetProcessList(Core::System& system, u32* out_num_processes, VAddr out_process_ids, |
| 2489 | VAddr out_process_ids, u32 out_process_ids_size) { | 2483 | u32 out_process_ids_size) { |
| 2490 | LOG_DEBUG(Kernel_SVC, "called. out_process_ids=0x{:016X}, out_process_ids_size={}", | 2484 | LOG_DEBUG(Kernel_SVC, "called. out_process_ids=0x{:016X}, out_process_ids_size={}", |
| 2491 | out_process_ids, out_process_ids_size); | 2485 | out_process_ids, out_process_ids_size); |
| 2492 | 2486 | ||
| @@ -2522,8 +2516,8 @@ static ResultCode GetProcessList(Core::System& system, u32* out_num_processes, | |||
| 2522 | return ResultSuccess; | 2516 | return ResultSuccess; |
| 2523 | } | 2517 | } |
| 2524 | 2518 | ||
| 2525 | static ResultCode GetThreadList(Core::System& system, u32* out_num_threads, VAddr out_thread_ids, | 2519 | static Result GetThreadList(Core::System& system, u32* out_num_threads, VAddr out_thread_ids, |
| 2526 | u32 out_thread_ids_size, Handle debug_handle) { | 2520 | u32 out_thread_ids_size, Handle debug_handle) { |
| 2527 | // TODO: Handle this case when debug events are supported. | 2521 | // TODO: Handle this case when debug events are supported. |
| 2528 | UNIMPLEMENTED_IF(debug_handle != InvalidHandle); | 2522 | UNIMPLEMENTED_IF(debug_handle != InvalidHandle); |
| 2529 | 2523 | ||
| @@ -2562,9 +2556,9 @@ static ResultCode GetThreadList(Core::System& system, u32* out_num_threads, VAdd | |||
| 2562 | return ResultSuccess; | 2556 | return ResultSuccess; |
| 2563 | } | 2557 | } |
| 2564 | 2558 | ||
| 2565 | static ResultCode FlushProcessDataCache32([[maybe_unused]] Core::System& system, | 2559 | static Result FlushProcessDataCache32([[maybe_unused]] Core::System& system, |
| 2566 | [[maybe_unused]] Handle handle, | 2560 | [[maybe_unused]] Handle handle, [[maybe_unused]] u32 address, |
| 2567 | [[maybe_unused]] u32 address, [[maybe_unused]] u32 size) { | 2561 | [[maybe_unused]] u32 size) { |
| 2568 | // Note(Blinkhawk): For emulation purposes of the data cache this is mostly a no-op, | 2562 | // Note(Blinkhawk): For emulation purposes of the data cache this is mostly a no-op, |
| 2569 | // as all emulation is done in the same cache level in host architecture, thus data cache | 2563 | // as all emulation is done in the same cache level in host architecture, thus data cache |
| 2570 | // does not need flushing. | 2564 | // does not need flushing. |