summaryrefslogtreecommitdiff
path: root/src/core/hle/syscall.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-04-18 17:52:49 -0400
committerGravatar bunnei2014-04-18 17:52:49 -0400
commit958bca606e80110e05d7c142dda3097fddc96503 (patch)
tree576917751444b4dfdb476d040b4e075bde431b7b /src/core/hle/syscall.cpp
parentInit window size from VideoCore. Start changing the default window behavior... (diff)
parentrenamed hw_lcd module to just lcd (diff)
downloadyuzu-958bca606e80110e05d7c142dda3097fddc96503.tar.gz
yuzu-958bca606e80110e05d7c142dda3097fddc96503.tar.xz
yuzu-958bca606e80110e05d7c142dda3097fddc96503.zip
Merge branch 'hle-interface'
Diffstat (limited to 'src/core/hle/syscall.cpp')
-rw-r--r--src/core/hle/syscall.cpp197
1 files changed, 197 insertions, 0 deletions
diff --git a/src/core/hle/syscall.cpp b/src/core/hle/syscall.cpp
new file mode 100644
index 000000000..e5533a741
--- /dev/null
+++ b/src/core/hle/syscall.cpp
@@ -0,0 +1,197 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include <map>
6
7#include "core/mem_map.h"
8
9#include "core/hle/function_wrappers.h"
10#include "core/hle/syscall.h"
11#include "core/hle/service/service.h"
12
13////////////////////////////////////////////////////////////////////////////////////////////////////
14// Namespace Syscall
15
16namespace Syscall {
17
18/// Map application or GSP heap memory
19Result ControlMemory(void* outaddr, u32 addr0, u32 addr1, u32 size, u32 operation, u32 permissions) {
20 u32 virtual_address = 0x00000000;
21
22 switch (operation) {
23
24 // Map GSP heap memory?
25 case 0x00010003:
26 virtual_address = Memory::MapBlock_HeapGSP(size, operation, permissions);
27 break;
28
29 // Unknown ControlMemory operation
30 default:
31 ERROR_LOG(OSHLE, "Unknown ControlMemory operation %08X", operation);
32 }
33
34 Core::g_app_core->SetReg(1, Memory::MapBlock_HeapGSP(size, operation, permissions));
35 return 0;
36}
37
38/// Connect to an OS service given the port name, returns the handle to the port to out
39Result ConnectToPort(void* out, const char* port_name) {
40 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
41 Core::g_app_core->SetReg(1, service->GetUID());
42 return 0;
43}
44
45/// Synchronize to an OS service
46Result SendSyncRequest(Handle session) {
47 Service::Interface* service = Service::g_manager->FetchFromUID(session);
48 service->Sync();
49 return 0;
50}
51
52/// Close a handle
53Result CloseHandle(Handle handle) {
54 // ImplementMe
55 return 0;
56}
57
58/// Wait for a handle to synchronize, timeout after the specified nanoseconds
59Result WaitSynchronization1(Handle handle, s64 nanoseconds) {
60 // ImplementMe
61 return 0;
62}
63
64const HLE::FunctionDef Syscall_Table[] = {
65 {0x00, NULL, "Unknown"},
66 {0x01, WrapI_VUUUUU<ControlMemory>, "ControlMemory"},
67 {0x02, NULL, "QueryMemory"},
68 {0x03, NULL, "ExitProcess"},
69 {0x04, NULL, "GetProcessAffinityMask"},
70 {0x05, NULL, "SetProcessAffinityMask"},
71 {0x06, NULL, "GetProcessIdealProcessor"},
72 {0x07, NULL, "SetProcessIdealProcessor"},
73 {0x08, NULL, "CreateThread"},
74 {0x09, NULL, "ExitThread"},
75 {0x0A, NULL, "SleepThread"},
76 {0x0B, NULL, "GetThreadPriority"},
77 {0x0C, NULL, "SetThreadPriority"},
78 {0x0D, NULL, "GetThreadAffinityMask"},
79 {0x0E, NULL, "SetThreadAffinityMask"},
80 {0x0F, NULL, "GetThreadIdealProcessor"},
81 {0x10, NULL, "SetThreadIdealProcessor"},
82 {0x11, NULL, "GetCurrentProcessorNumber"},
83 {0x12, NULL, "Run"},
84 {0x13, NULL, "CreateMutex"},
85 {0x14, NULL, "ReleaseMutex"},
86 {0x15, NULL, "CreateSemaphore"},
87 {0x16, NULL, "ReleaseSemaphore"},
88 {0x17, NULL, "CreateEvent"},
89 {0x18, NULL, "SignalEvent"},
90 {0x19, NULL, "ClearEvent"},
91 {0x1A, NULL, "CreateTimer"},
92 {0x1B, NULL, "SetTimer"},
93 {0x1C, NULL, "CancelTimer"},
94 {0x1D, NULL, "ClearTimer"},
95 {0x1E, NULL, "CreateMemoryBlock"},
96 {0x1F, NULL, "MapMemoryBlock"},
97 {0x20, NULL, "UnmapMemoryBlock"},
98 {0x21, NULL, "CreateAddressArbiter"},
99 {0x22, NULL, "ArbitrateAddress"},
100 {0x23, WrapI_U<CloseHandle>, "CloseHandle"},
101 {0x24, WrapI_US64<WaitSynchronization1>, "WaitSynchronization1"},
102 {0x25, NULL, "WaitSynchronizationN"},
103 {0x26, NULL, "SignalAndWait"},
104 {0x27, NULL, "DuplicateHandle"},
105 {0x28, NULL, "GetSystemTick"},
106 {0x29, NULL, "GetHandleInfo"},
107 {0x2A, NULL, "GetSystemInfo"},
108 {0x2B, NULL, "GetProcessInfo"},
109 {0x2C, NULL, "GetThreadInfo"},
110 {0x2D, WrapI_VC<ConnectToPort>, "ConnectToPort"},
111 {0x2E, NULL, "SendSyncRequest1"},
112 {0x2F, NULL, "SendSyncRequest2"},
113 {0x30, NULL, "SendSyncRequest3"},
114 {0x31, NULL, "SendSyncRequest4"},
115 {0x32, WrapI_U<SendSyncRequest>, "SendSyncRequest"},
116 {0x33, NULL, "OpenProcess"},
117 {0x34, NULL, "OpenThread"},
118 {0x35, NULL, "GetProcessId"},
119 {0x36, NULL, "GetProcessIdOfThread"},
120 {0x37, NULL, "GetThreadId"},
121 {0x38, NULL, "GetResourceLimit"},
122 {0x39, NULL, "GetResourceLimitLimitValues"},
123 {0x3A, NULL, "GetResourceLimitCurrentValues"},
124 {0x3B, NULL, "GetThreadContext"},
125 {0x3C, NULL, "Break"},
126 {0x3D, NULL, "OutputDebugString"},
127 {0x3E, NULL, "ControlPerformanceCounter"},
128 {0x3F, NULL, "Unknown"},
129 {0x40, NULL, "Unknown"},
130 {0x41, NULL, "Unknown"},
131 {0x42, NULL, "Unknown"},
132 {0x43, NULL, "Unknown"},
133 {0x44, NULL, "Unknown"},
134 {0x45, NULL, "Unknown"},
135 {0x46, NULL, "Unknown"},
136 {0x47, NULL, "CreatePort"},
137 {0x48, NULL, "CreateSessionToPort"},
138 {0x49, NULL, "CreateSession"},
139 {0x4A, NULL, "AcceptSession"},
140 {0x4B, NULL, "ReplyAndReceive1"},
141 {0x4C, NULL, "ReplyAndReceive2"},
142 {0x4D, NULL, "ReplyAndReceive3"},
143 {0x4E, NULL, "ReplyAndReceive4"},
144 {0x4F, NULL, "ReplyAndReceive"},
145 {0x50, NULL, "BindInterrupt"},
146 {0x51, NULL, "UnbindInterrupt"},
147 {0x52, NULL, "InvalidateProcessDataCache"},
148 {0x53, NULL, "StoreProcessDataCache"},
149 {0x54, NULL, "FlushProcessDataCache"},
150 {0x55, NULL, "StartInterProcessDma"},
151 {0x56, NULL, "StopDma"},
152 {0x57, NULL, "GetDmaState"},
153 {0x58, NULL, "RestartDma"},
154 {0x59, NULL, "Unknown"},
155 {0x5A, NULL, "Unknown"},
156 {0x5B, NULL, "Unknown"},
157 {0x5C, NULL, "Unknown"},
158 {0x5D, NULL, "Unknown"},
159 {0x5E, NULL, "Unknown"},
160 {0x5F, NULL, "Unknown"},
161 {0x60, NULL, "DebugActiveProcess"},
162 {0x61, NULL, "BreakDebugProcess"},
163 {0x62, NULL, "TerminateDebugProcess"},
164 {0x63, NULL, "GetProcessDebugEvent"},
165 {0x64, NULL, "ContinueDebugEvent"},
166 {0x65, NULL, "GetProcessList"},
167 {0x66, NULL, "GetThreadList"},
168 {0x67, NULL, "GetDebugThreadContext"},
169 {0x68, NULL, "SetDebugThreadContext"},
170 {0x69, NULL, "QueryDebugProcessMemory"},
171 {0x6A, NULL, "ReadProcessMemory"},
172 {0x6B, NULL, "WriteProcessMemory"},
173 {0x6C, NULL, "SetHardwareBreakPoint"},
174 {0x6D, NULL, "GetDebugThreadParam"},
175 {0x6E, NULL, "Unknown"},
176 {0x6F, NULL, "Unknown"},
177 {0x70, NULL, "ControlProcessMemory"},
178 {0x71, NULL, "MapProcessMemory"},
179 {0x72, NULL, "UnmapProcessMemory"},
180 {0x73, NULL, "Unknown"},
181 {0x74, NULL, "Unknown"},
182 {0x75, NULL, "Unknown"},
183 {0x76, NULL, "TerminateProcess"},
184 {0x77, NULL, "Unknown"},
185 {0x78, NULL, "CreateResourceLimit"},
186 {0x79, NULL, "Unknown"},
187 {0x7A, NULL, "Unknown"},
188 {0x7B, NULL, "Unknown"},
189 {0x7C, NULL, "KernelSetState"},
190 {0x7D, NULL, "QueryProcessMemory"},
191};
192
193void Register() {
194 HLE::RegisterModule("SyscallTable", ARRAY_SIZE(Syscall_Table), Syscall_Table);
195}
196
197} // namespace