diff options
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 22 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc_wrap.h | 22 |
2 files changed, 40 insertions, 4 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 3a2c9d18d..9836809f2 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -645,6 +645,10 @@ static void OutputDebugString(Core::System& system, VAddr address, u64 len) { | |||
| 645 | LOG_DEBUG(Debug_Emulated, "{}", str); | 645 | LOG_DEBUG(Debug_Emulated, "{}", str); |
| 646 | } | 646 | } |
| 647 | 647 | ||
| 648 | static void OutputDebugString32(Core::System& system, u32 address, u32 len) { | ||
| 649 | OutputDebugString(system, address, len); | ||
| 650 | } | ||
| 651 | |||
| 648 | /// Gets system/memory information for the current process | 652 | /// Gets system/memory information for the current process |
| 649 | static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle handle, | 653 | static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle handle, |
| 650 | u64 info_sub_id) { | 654 | u64 info_sub_id) { |
| @@ -1404,7 +1408,7 @@ static ResultCode UnmapProcessMemory(Core::System& system, VAddr dst_address, Ha | |||
| 1404 | } | 1408 | } |
| 1405 | 1409 | ||
| 1406 | static ResultCode CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) { | 1410 | static ResultCode CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) { |
| 1407 | LOG_TRACE(Kernel_SVC, "called, handle_out=0x{:X}, address=0x{:X}, size=0x{:X}", | 1411 | LOG_TRACE(Kernel_SVC, "called, handle_out={}, address=0x{:X}, size=0x{:X}", |
| 1408 | static_cast<void*>(out), address, size); | 1412 | static_cast<void*>(out), address, size); |
| 1409 | // Get kernel instance. | 1413 | // Get kernel instance. |
| 1410 | auto& kernel = system.Kernel(); | 1414 | auto& kernel = system.Kernel(); |
| @@ -1438,6 +1442,10 @@ static ResultCode CreateCodeMemory(Core::System& system, Handle* out, VAddr addr | |||
| 1438 | return ResultSuccess; | 1442 | return ResultSuccess; |
| 1439 | } | 1443 | } |
| 1440 | 1444 | ||
| 1445 | static ResultCode CreateCodeMemory32(Core::System& system, Handle* out, u32 address, u32 size) { | ||
| 1446 | return CreateCodeMemory(system, out, address, size); | ||
| 1447 | } | ||
| 1448 | |||
| 1441 | static ResultCode ControlCodeMemory(Core::System& system, Handle code_memory_handle, u32 operation, | 1449 | static ResultCode ControlCodeMemory(Core::System& system, Handle code_memory_handle, u32 operation, |
| 1442 | VAddr address, size_t size, Svc::MemoryPermission perm) { | 1450 | VAddr address, size_t size, Svc::MemoryPermission perm) { |
| 1443 | 1451 | ||
| @@ -1517,6 +1525,12 @@ static ResultCode ControlCodeMemory(Core::System& system, Handle code_memory_han | |||
| 1517 | return ResultSuccess; | 1525 | return ResultSuccess; |
| 1518 | } | 1526 | } |
| 1519 | 1527 | ||
| 1528 | static ResultCode ControlCodeMemory32(Core::System& system, Handle code_memory_handle, | ||
| 1529 | u32 operation, u64 address, u64 size, | ||
| 1530 | Svc::MemoryPermission perm) { | ||
| 1531 | return ControlCodeMemory(system, code_memory_handle, operation, address, size, perm); | ||
| 1532 | } | ||
| 1533 | |||
| 1520 | static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_address, | 1534 | static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_address, |
| 1521 | VAddr page_info_address, Handle process_handle, | 1535 | VAddr page_info_address, Handle process_handle, |
| 1522 | VAddr address) { | 1536 | VAddr address) { |
| @@ -2598,7 +2612,7 @@ static const FunctionDef SVC_Table_32[] = { | |||
| 2598 | {0x24, SvcWrap32<GetProcessId32>, "GetProcessId32"}, | 2612 | {0x24, SvcWrap32<GetProcessId32>, "GetProcessId32"}, |
| 2599 | {0x25, SvcWrap32<GetThreadId32>, "GetThreadId32"}, | 2613 | {0x25, SvcWrap32<GetThreadId32>, "GetThreadId32"}, |
| 2600 | {0x26, SvcWrap32<Break32>, "Break32"}, | 2614 | {0x26, SvcWrap32<Break32>, "Break32"}, |
| 2601 | {0x27, nullptr, "OutputDebugString32"}, | 2615 | {0x27, SvcWrap32<OutputDebugString32>, "OutputDebugString32"}, |
| 2602 | {0x28, nullptr, "ReturnFromException32"}, | 2616 | {0x28, nullptr, "ReturnFromException32"}, |
| 2603 | {0x29, SvcWrap32<GetInfo32>, "GetInfo32"}, | 2617 | {0x29, SvcWrap32<GetInfo32>, "GetInfo32"}, |
| 2604 | {0x2a, nullptr, "FlushEntireDataCache32"}, | 2618 | {0x2a, nullptr, "FlushEntireDataCache32"}, |
| @@ -2634,8 +2648,8 @@ static const FunctionDef SVC_Table_32[] = { | |||
| 2634 | {0x48, nullptr, "MapPhysicalMemoryUnsafe32"}, | 2648 | {0x48, nullptr, "MapPhysicalMemoryUnsafe32"}, |
| 2635 | {0x49, nullptr, "UnmapPhysicalMemoryUnsafe32"}, | 2649 | {0x49, nullptr, "UnmapPhysicalMemoryUnsafe32"}, |
| 2636 | {0x4a, nullptr, "SetUnsafeLimit32"}, | 2650 | {0x4a, nullptr, "SetUnsafeLimit32"}, |
| 2637 | {0x4b, nullptr, "CreateCodeMemory32"}, | 2651 | {0x4b, SvcWrap32<CreateCodeMemory32>, "CreateCodeMemory32"}, |
| 2638 | {0x4c, nullptr, "ControlCodeMemory32"}, | 2652 | {0x4c, SvcWrap32<ControlCodeMemory32>, "ControlCodeMemory32"}, |
| 2639 | {0x4d, nullptr, "SleepSystem32"}, | 2653 | {0x4d, nullptr, "SleepSystem32"}, |
| 2640 | {0x4e, nullptr, "ReadWriteRegister32"}, | 2654 | {0x4e, nullptr, "ReadWriteRegister32"}, |
| 2641 | {0x4f, nullptr, "SetProcessActivity32"}, | 2655 | {0x4f, nullptr, "SetProcessActivity32"}, |
diff --git a/src/core/hle/kernel/svc_wrap.h b/src/core/hle/kernel/svc_wrap.h index a60adfcab..d309f166c 100644 --- a/src/core/hle/kernel/svc_wrap.h +++ b/src/core/hle/kernel/svc_wrap.h | |||
| @@ -669,4 +669,26 @@ void SvcWrap32(Core::System& system) { | |||
| 669 | FuncReturn(system, retval); | 669 | FuncReturn(system, retval); |
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | // Used by CreateCodeMemory32 | ||
| 673 | template <ResultCode func(Core::System&, Handle*, u32, u32)> | ||
| 674 | void SvcWrap32(Core::System& system) { | ||
| 675 | Handle handle = 0; | ||
| 676 | |||
| 677 | const u32 retval = func(system, &handle, Param32(system, 1), Param32(system, 2)).raw; | ||
| 678 | |||
| 679 | system.CurrentArmInterface().SetReg(1, handle); | ||
| 680 | FuncReturn(system, retval); | ||
| 681 | } | ||
| 682 | |||
| 683 | // Used by ControlCodeMemory32 | ||
| 684 | template <ResultCode func(Core::System&, Handle, u32, u64, u64, Svc::MemoryPermission)> | ||
| 685 | void SvcWrap32(Core::System& system) { | ||
| 686 | const u32 retval = | ||
| 687 | func(system, Param32(system, 0), Param32(system, 1), Param(system, 2), Param(system, 4), | ||
| 688 | static_cast<Svc::MemoryPermission>(Param32(system, 6))) | ||
| 689 | .raw; | ||
| 690 | |||
| 691 | FuncReturn(system, retval); | ||
| 692 | } | ||
| 693 | |||
| 672 | } // namespace Kernel | 694 | } // namespace Kernel |