summaryrefslogtreecommitdiff
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 5ba42973a..11b77e2c5 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -34,8 +34,8 @@ enum MapMemoryPermission {
34}; 34};
35 35
36/// Map application or GSP heap memory 36/// Map application or GSP heap memory
37Result ControlMemory(void* _outaddr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) { 37Result ControlMemory(void* _out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) {
38 u32 virtual_address = 0x00000000; 38 u32* out_addr = (u32*)_out_addr;
39 39
40 DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X", 40 DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X",
41 operation, addr0, addr1, size, permissions); 41 operation, addr0, addr1, size, permissions);
@@ -44,21 +44,18 @@ Result ControlMemory(void* _outaddr, u32 operation, u32 addr0, u32 addr1, u32 si
44 44
45 // Map normal heap memory 45 // Map normal heap memory
46 case MEMORY_OPERATION_HEAP: 46 case MEMORY_OPERATION_HEAP:
47 virtual_address = Memory::MapBlock_Heap(size, operation, permissions); 47 *out_addr = Memory::MapBlock_Heap(size, operation, permissions);
48 break; 48 break;
49 49
50 // Map GSP heap memory 50 // Map GSP heap memory
51 case MEMORY_OPERATION_GSP_HEAP: 51 case MEMORY_OPERATION_GSP_HEAP:
52 virtual_address = Memory::MapBlock_HeapGSP(size, operation, permissions); 52 *out_addr = Memory::MapBlock_HeapGSP(size, operation, permissions);
53 break; 53 break;
54 54
55 // Unknown ControlMemory operation 55 // Unknown ControlMemory operation
56 default: 56 default:
57 ERROR_LOG(SVC, "unknown operation=0x%08X", operation); 57 ERROR_LOG(SVC, "unknown operation=0x%08X", operation);
58 } 58 }
59
60 Core::g_app_core->SetReg(1, virtual_address);
61
62 return 0; 59 return 0;
63} 60}
64 61
@@ -80,10 +77,14 @@ Result MapMemoryBlock(Handle memblock, u32 addr, u32 mypermissions, u32 otherper
80 77
81/// Connect to an OS service given the port name, returns the handle to the port to out 78/// Connect to an OS service given the port name, returns the handle to the port to out
82Result ConnectToPort(void* _out, const char* port_name) { 79Result ConnectToPort(void* _out, const char* port_name) {
80 Handle* out = (Handle*)_out;
83 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); 81 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
82
84 DEBUG_LOG(SVC, "called port_name=%s", port_name); 83 DEBUG_LOG(SVC, "called port_name=%s", port_name);
85 _assert_msg_(KERNEL, service, "called, but service is not implemented!"); 84 _assert_msg_(KERNEL, service, "called, but service is not implemented!");
86 Core::g_app_core->SetReg(1, service->GetHandle()); 85
86 *out = service->GetHandle();
87
87 return 0; 88 return 0;
88} 89}
89 90
@@ -209,12 +210,13 @@ void OutputDebugString(const char* string) {
209} 210}
210 211
211/// Get resource limit 212/// Get resource limit
212Result GetResourceLimit(void* resource_limit, Handle process) { 213Result GetResourceLimit(void* _resource_limit, Handle process) {
213 // With regards to proceess values: 214 // With regards to proceess values:
214 // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for 215 // 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for
215 // the current KThread. 216 // the current KThread.
217 Handle* resource_limit = (Handle*)_resource_limit;
218 *resource_limit = 0xDEADBEEF;
216 ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process); 219 ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process);
217 Core::g_app_core->SetReg(1, 0xDEADBEEF);
218 return 0; 220 return 0;
219} 221}
220 222
@@ -253,10 +255,10 @@ Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 p
253 255
254/// Create a mutex 256/// Create a mutex
255Result CreateMutex(void* _mutex, u32 initial_locked) { 257Result CreateMutex(void* _mutex, u32 initial_locked) {
256 Handle mutex = Kernel::CreateMutex((initial_locked != 0)); 258 Handle* mutex = (Handle*)_mutex;
257 Core::g_app_core->SetReg(1, mutex); 259 *mutex = Kernel::CreateMutex((initial_locked != 0));
258 DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X", 260 DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X",
259 initial_locked ? "true" : "false", mutex); 261 initial_locked ? "true" : "false", *mutex);
260 return 0; 262 return 0;
261} 263}
262 264
@@ -282,10 +284,10 @@ Result QueryMemory(void *_info, void *_out, u32 addr) {
282 284
283/// Create an event 285/// Create an event
284Result CreateEvent(void* _event, u32 reset_type) { 286Result CreateEvent(void* _event, u32 reset_type) {
285 Handle evt = Kernel::CreateEvent((ResetType)reset_type); 287 Handle* evt = (Handle*)_event;
286 Core::g_app_core->SetReg(1, evt); 288 *evt = Kernel::CreateEvent((ResetType)reset_type);
287 DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X", 289 DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X",
288 reset_type, evt); 290 reset_type, *evt);
289 return 0; 291 return 0;
290} 292}
291 293