summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2017-12-28 15:29:52 -0500
committerGravatar bunnei2017-12-28 15:29:52 -0500
commit7618b5237d4b4f525e3db96bc70e488210da373d (patch)
treee446b8c40cff77e411c288612ba5c1a074bc9f7a /src
parentservice: Clean up apm/lm/applet_oe/controller/sm ctor/dtor. (diff)
downloadyuzu-7618b5237d4b4f525e3db96bc70e488210da373d.tar.gz
yuzu-7618b5237d4b4f525e3db96bc70e488210da373d.tar.xz
yuzu-7618b5237d4b4f525e3db96bc70e488210da373d.zip
svc: Implement SetHeapSize.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/function_wrappers.h12
-rw-r--r--src/core/hle/svc.cpp10
2 files changed, 19 insertions, 3 deletions
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index abc2b96a8..528208178 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -42,9 +42,17 @@ void Wrap() {
42 FuncReturn(func(PARAM(0), PARAM(1)).raw); 42 FuncReturn(func(PARAM(0), PARAM(1)).raw);
43} 43}
44 44
45template <ResultCode func(u64, u64, u64)> 45template <ResultCode func(u64, u64, s64)>
46void Wrap() { 46void Wrap() {
47 FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw); 47 FuncReturn(func(PARAM(1), PARAM(2), (s64)PARAM(3)).raw);
48}
49
50template <ResultCode func(u64*, u64)>
51void Wrap() {
52 u64 param_1 = 0;
53 u32 retval = func(&param_1, PARAM(1)).raw;
54 Core::CPU().SetReg(1, param_1);
55 FuncReturn(retval);
48} 56}
49 57
50template <ResultCode func(u64*, u64, u64, u64)> 58template <ResultCode func(u64*, u64, u64, u64)>
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 4b5c1dff3..ae0ceb252 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -24,6 +24,14 @@ using Kernel::SharedPtr;
24 24
25namespace SVC { 25namespace SVC {
26 26
27/// Set the process heap to a given Size. It can both extend and shrink the heap.
28static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) {
29 LOG_TRACE(Kernel_SVC, "called, heap_size=%ull", heap_size);
30 auto& process = *Kernel::g_current_process;
31 CASCADE_RESULT(*heap_addr, process.HeapAllocate(Memory::HEAP_VADDR, heap_size, Kernel::VMAPermission::ReadWrite));
32 return RESULT_SUCCESS;
33}
34
27/// Connect to an OS service given the port name, returns the handle to the port to out 35/// Connect to an OS service given the port name, returns the handle to the port to out
28static ResultCode ConnectToPort(Kernel::Handle* out_handle, VAddr port_name_address) { 36static ResultCode ConnectToPort(Kernel::Handle* out_handle, VAddr port_name_address) {
29 if (!Memory::IsValidVirtualAddress(port_name_address)) 37 if (!Memory::IsValidVirtualAddress(port_name_address))
@@ -205,7 +213,7 @@ struct FunctionDef {
205 213
206static const FunctionDef SVC_Table[] = { 214static const FunctionDef SVC_Table[] = {
207 {0x00, nullptr, "Unknown"}, 215 {0x00, nullptr, "Unknown"},
208 {0x01, nullptr, "svcSetHeapSize"}, 216 {0x01, HLE::Wrap<SetHeapSize>, "svcSetHeapSize"},
209 {0x02, nullptr, "svcSetMemoryPermission"}, 217 {0x02, nullptr, "svcSetMemoryPermission"},
210 {0x03, nullptr, "svcSetMemoryAttribute"}, 218 {0x03, nullptr, "svcSetMemoryAttribute"},
211 {0x04, nullptr, "svcMapMemory"}, 219 {0x04, nullptr, "svcMapMemory"},