summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei2014-04-10 19:58:28 -0400
committerGravatar bunnei2014-04-10 19:58:28 -0400
commitf68de21ad1cd267029b60ee3767d219c46f5fba0 (patch)
tree47d44cfed0c2bd071c75b03a157e7b8a61d85b0d /src/core
parentmissed this file with commit 95e5436f (diff)
downloadyuzu-f68de21ad1cd267029b60ee3767d219c46f5fba0.tar.gz
yuzu-f68de21ad1cd267029b60ee3767d219c46f5fba0.tar.xz
yuzu-f68de21ad1cd267029b60ee3767d219c46f5fba0.zip
added initial modules for setting up SysCall HLE
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.cpp18
-rw-r--r--src/core/core.vcxproj4
-rw-r--r--src/core/core.vcxproj.filters15
-rw-r--r--src/core/hle/function_wrappers.h726
-rw-r--r--src/core/hle/hle.h35
-rw-r--r--src/core/hle/hle_syscall.cpp22
-rw-r--r--src/core/hle/hle_syscall.h42
7 files changed, 862 insertions, 0 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 28f6b6c58..acb0a6e82 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -24,6 +24,24 @@ void RunLoop() {
24 24
25/// Step the CPU one instruction 25/// Step the CPU one instruction
26void SingleStep() { 26void SingleStep() {
27
28 char current_instr[512];
29
30 if (g_app_core->GetPC() == 0x080D1534) {
31 g_disasm->disasm(g_app_core->GetPC(), Memory::Read32(g_app_core->GetPC()), current_instr);
32
33
34 NOTICE_LOG(ARM11, "0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X",
35 g_app_core->GetReg(0),
36 g_app_core->GetReg(1),
37 g_app_core->GetReg(2),
38 g_app_core->GetReg(3), Memory::Read32(g_app_core->GetReg(0)), Memory::Read32(g_app_core->GetReg(1)));
39
40
41 NOTICE_LOG(ARM11, "0x%08X\t%s", g_app_core->GetPC(), current_instr);
42 }
43
44
27 g_app_core->Step(); 45 g_app_core->Step();
28 HW::Update(); 46 HW::Update();
29} 47}
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index 1800b5512..55ce508a6 100644
--- a/src/core/core.vcxproj
+++ b/src/core/core.vcxproj
@@ -152,6 +152,7 @@
152 <ClCompile Include="elf\elf_reader.cpp" /> 152 <ClCompile Include="elf\elf_reader.cpp" />
153 <ClCompile Include="file_sys\directory_file_system.cpp" /> 153 <ClCompile Include="file_sys\directory_file_system.cpp" />
154 <ClCompile Include="file_sys\meta_file_system.cpp" /> 154 <ClCompile Include="file_sys\meta_file_system.cpp" />
155 <ClCompile Include="hle\hle_syscall.cpp" />
155 <ClCompile Include="hw\hw.cpp" /> 156 <ClCompile Include="hw\hw.cpp" />
156 <ClCompile Include="hw\hw_lcd.cpp" /> 157 <ClCompile Include="hw\hw_lcd.cpp" />
157 <ClCompile Include="loader.cpp" /> 158 <ClCompile Include="loader.cpp" />
@@ -182,6 +183,9 @@
182 <ClInclude Include="file_sys\directory_file_system.h" /> 183 <ClInclude Include="file_sys\directory_file_system.h" />
183 <ClInclude Include="file_sys\file_sys.h" /> 184 <ClInclude Include="file_sys\file_sys.h" />
184 <ClInclude Include="file_sys\meta_file_system.h" /> 185 <ClInclude Include="file_sys\meta_file_system.h" />
186 <ClInclude Include="hle\function_wrappers.h" />
187 <ClInclude Include="hle\hle.h" />
188 <ClInclude Include="hle\hle_syscall.h" />
185 <ClInclude Include="hw\hw.h" /> 189 <ClInclude Include="hw\hw.h" />
186 <ClInclude Include="hw\hw_lcd.h" /> 190 <ClInclude Include="hw\hw_lcd.h" />
187 <ClInclude Include="loader.h" /> 191 <ClInclude Include="loader.h" />
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters
index 2efac8127..7bac04a2d 100644
--- a/src/core/core.vcxproj.filters
+++ b/src/core/core.vcxproj.filters
@@ -22,6 +22,9 @@
22 <Filter Include="elf"> 22 <Filter Include="elf">
23 <UniqueIdentifier>{7ae34319-6d72-4d12-bc62-9b438ba9241f}</UniqueIdentifier> 23 <UniqueIdentifier>{7ae34319-6d72-4d12-bc62-9b438ba9241f}</UniqueIdentifier>
24 </Filter> 24 </Filter>
25 <Filter Include="hle">
26 <UniqueIdentifier>{8b62769e-3e2a-4a57-a7bc-b3b2933c2bc7}</UniqueIdentifier>
27 </Filter>
25 </ItemGroup> 28 </ItemGroup>
26 <ItemGroup> 29 <ItemGroup>
27 <ClCompile Include="arm\disassembler\arm_disasm.cpp"> 30 <ClCompile Include="arm\disassembler\arm_disasm.cpp">
@@ -75,6 +78,9 @@
75 <ClCompile Include="mem_map_funcs.cpp" /> 78 <ClCompile Include="mem_map_funcs.cpp" />
76 <ClCompile Include="system.cpp" /> 79 <ClCompile Include="system.cpp" />
77 <ClCompile Include="core_timing.cpp" /> 80 <ClCompile Include="core_timing.cpp" />
81 <ClCompile Include="hle\hle_syscall.cpp">
82 <Filter>hle</Filter>
83 </ClCompile>
78 </ItemGroup> 84 </ItemGroup>
79 <ItemGroup> 85 <ItemGroup>
80 <ClInclude Include="arm\disassembler\arm_disasm.h"> 86 <ClInclude Include="arm\disassembler\arm_disasm.h">
@@ -148,6 +154,15 @@
148 <ClInclude Include="loader.h" /> 154 <ClInclude Include="loader.h" />
149 <ClInclude Include="mem_map.h" /> 155 <ClInclude Include="mem_map.h" />
150 <ClInclude Include="system.h" /> 156 <ClInclude Include="system.h" />
157 <ClInclude Include="hle\hle.h">
158 <Filter>hle</Filter>
159 </ClInclude>
160 <ClInclude Include="hle\function_wrappers.h">
161 <Filter>hle</Filter>
162 </ClInclude>
163 <ClInclude Include="hle\hle_syscall.h">
164 <Filter>hle</Filter>
165 </ClInclude>
151 </ItemGroup> 166 </ItemGroup>
152 <ItemGroup> 167 <ItemGroup>
153 <Text Include="CMakeLists.txt" /> 168 <Text Include="CMakeLists.txt" />
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
new file mode 100644
index 000000000..22588d95d
--- /dev/null
+++ b/src/core/hle/function_wrappers.h
@@ -0,0 +1,726 @@
1// Copyright (c) 2012- PPSSPP Project.
2
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, version 2.0 or later versions.
6
7// This program is distributed in the hope that it will be useful,
8// but WITHOUT ANY WARRANTY; without even the implied warranty of
9// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10// GNU General Public License 2.0 for more details.
11
12// A copy of the GPL 2.0 should have been included with the program.
13// If not, see http://www.gnu.org/licenses/
14
15// Official git repository and contact information can be found at
16// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18#pragma once
19
20#include "common/common_types.h"
21#include "core/mem_map.h"
22#include "core/hle/hle.h"
23
24// For easy parameter parsing and return value processing.
25
26//32bit wrappers
27template<void func()> void WrapV_V() {
28 func();
29}
30
31template<u32 func()> void WrapU_V() {
32 RETURN(func());
33}
34
35template<int func(void *, const char *)> void WrapI_VC() {
36 u32 retval = func(Memory::GetPointer(PARAM(0)), Memory::GetCharPointer(PARAM(1)));
37 RETURN(retval);
38}
39
40template<u32 func(int, void *, int)> void WrapU_IVI() {
41 u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), PARAM(2));
42 RETURN(retval);
43}
44
45template<int func(const char *, int, int, u32)> void WrapI_CIIU() {
46 u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
47 RETURN(retval);
48}
49
50template<int func(int, const char *, u32, void *, void *, u32, int)> void WrapI_ICUVVUI() {
51 u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)),Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) );
52 RETURN(retval);
53}
54
55// Hm, do so many params get passed in registers?
56template<int func(const char *, int, const char *, int, int, int, int, int)> void WrapI_CICIIIII() {
57 u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), Memory::GetCharPointer(PARAM(2)),
58 PARAM(3), PARAM(4), PARAM(5), PARAM(6), PARAM(7));
59 RETURN(retval);
60}
61
62// Hm, do so many params get passed in registers?
63template<int func(const char *, int, int, int, int, int, int)> void WrapI_CIIIIII() {
64 u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
65 PARAM(3), PARAM(4), PARAM(5), PARAM(6));
66 RETURN(retval);
67}
68
69// Hm, do so many params get passed in registers?
70template<int func(int, int, int, int, int, int, u32)> void WrapI_IIIIIIU() {
71 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
72 RETURN(retval);
73}
74
75// Hm, do so many params get passed in registers?
76template<int func(int, int, int, int, int, int, int, int, u32)> void WrapI_IIIIIIIIU() {
77 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6), PARAM(7), PARAM(8));
78 RETURN(retval);
79}
80
81template<u32 func(int, void *)> void WrapU_IV() {
82 u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)));
83 RETURN(retval);
84}
85
86template<float func()> void WrapF_V() {
87 RETURNF(func());
88}
89
90// TODO: Not sure about the floating point parameter passing
91template<float func(int, float, u32)> void WrapF_IFU() {
92 RETURNF(func(PARAM(0), PARAMF(0), PARAM(1)));
93}
94
95template<u32 func(u32)> void WrapU_U() {
96 u32 retval = func(PARAM(0));
97 RETURN(retval);
98}
99
100template<u32 func(u32, int)> void WrapU_UI() {
101 u32 retval = func(PARAM(0), PARAM(1));
102 RETURN(retval);
103}
104
105template<int func(u32)> void WrapI_U() {
106 int retval = func(PARAM(0));
107 RETURN(retval);
108}
109
110template<int func(u32, int)> void WrapI_UI() {
111 int retval = func(PARAM(0), PARAM(1));
112 RETURN(retval);
113}
114
115template<int func(u32, int, int, u32)> void WrapI_UIIU() {
116 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
117 RETURN(retval);
118}
119
120template<u32 func(int, u32, int)> void WrapU_IUI() {
121 u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
122 RETURN(retval);
123}
124
125template<int func(u32, u32)> void WrapI_UU() {
126 int retval = func(PARAM(0), PARAM(1));
127 RETURN(retval);
128}
129
130template<int func(u32, float, float)> void WrapI_UFF() {
131 // Not sure about the float arguments.
132 int retval = func(PARAM(0), PARAMF(0), PARAMF(1));
133 RETURN(retval);
134}
135
136template<int func(u32, u32, u32)> void WrapI_UUU() {
137 int retval = func(PARAM(0), PARAM(1), PARAM(2));
138 RETURN(retval);
139}
140
141template<int func(u32, u32, u32, int)> void WrapI_UUUI() {
142 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
143 RETURN(retval);
144}
145
146template<int func(u32, u32, u32, int, int, int,int )> void WrapI_UUUIIII() {
147 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
148 RETURN(retval);
149}
150
151template<int func(u32, u32, u32, u32)> void WrapI_UUUU() {
152 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
153 RETURN(retval);
154}
155
156template<int func(u32, u32, u32, u32, u32)> void WrapI_UUUUU() {
157 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
158 RETURN(retval);
159}
160
161template<int func()> void WrapI_V() {
162 int retval = func();
163 RETURN(retval);
164}
165
166template<u32 func(int)> void WrapU_I() {
167 u32 retval = func(PARAM(0));
168 RETURN(retval);
169}
170
171template<u32 func(int, int, u32)> void WrapU_IIU() {
172 u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
173 RETURN(retval);
174}
175
176template<int func(int)> void WrapI_I() {
177 int retval = func(PARAM(0));
178 RETURN(retval);
179}
180
181template<void func(u32)> void WrapV_U() {
182 func(PARAM(0));
183}
184
185template<void func(int)> void WrapV_I() {
186 func(PARAM(0));
187}
188
189template<void func(u32, u32)> void WrapV_UU() {
190 func(PARAM(0), PARAM(1));
191}
192
193template<void func(int, int)> void WrapV_II() {
194 func(PARAM(0), PARAM(1));
195}
196
197template<void func(u32, const char *)> void WrapV_UC() {
198 func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
199}
200
201template<int func(u32, const char *)> void WrapI_UC() {
202 int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
203 RETURN(retval);
204}
205
206template<int func(u32, const char *, int)> void WrapI_UCI() {
207 int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2));
208 RETURN(retval);
209}
210
211template<u32 func(u32, int , int , int, int, int)> void WrapU_UIIIII() {
212 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
213 RETURN(retval);
214}
215
216template<u32 func(u32, int , int , int, u32)> void WrapU_UIIIU() {
217 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
218 RETURN(retval);
219}
220
221template<u32 func(u32, int , int , int, int, int, int)> void WrapU_UIIIIII() {
222 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
223 RETURN(retval);
224}
225
226template<u32 func(u32, u32)> void WrapU_UU() {
227 u32 retval = func(PARAM(0), PARAM(1));
228 RETURN(retval);
229}
230
231template<u32 func(u32, u32, int)> void WrapU_UUI() {
232 u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
233 RETURN(retval);
234}
235
236template<u32 func(u32, u32, int, int)> void WrapU_UUII() {
237 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
238 RETURN(retval);
239}
240
241template<u32 func(const char *, u32, u32, u32)> void WrapU_CUUU() {
242 u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
243 RETURN(retval);
244}
245
246template<void func(u32, int, u32, int, int)> void WrapV_UIUII() {
247 func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
248}
249
250template<u32 func(u32, int, u32, int, int)> void WrapU_UIUII() {
251 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
252 RETURN(retval);
253}
254
255template<int func(u32, int, u32, int, int)> void WrapI_UIUII() {
256 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
257 RETURN(retval);
258}
259
260template<u32 func(u32, int, u32, int)> void WrapU_UIUI() {
261 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
262 RETURN(retval);
263}
264
265template<int func(u32, int, u32, int)> void WrapI_UIUI() {
266 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
267 RETURN(retval);
268}
269
270template<u32 func(u32, int, u32)> void WrapU_UIU() {
271 u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
272 RETURN(retval);
273}
274
275template<u32 func(u32, int, u32, u32)> void WrapU_UIUU() {
276 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
277 RETURN(retval);
278}
279
280template<u32 func(u32, int, int)> void WrapU_UII() {
281 u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
282 RETURN(retval);
283}
284
285template<u32 func(u32, int, int, u32)> void WrapU_UIIU() {
286 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
287 RETURN(retval);
288}
289
290template<int func(u32, int, int, u32, u32)> void WrapI_UIIUU() {
291 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
292 RETURN(retval);
293}
294
295template<int func(u32, u32, int, int)> void WrapI_UUII() {
296 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
297 RETURN(retval);
298}
299
300template<int func(u32, u32, int, int, int)> void WrapI_UUIII() {
301 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
302 RETURN(retval);
303}
304
305template<void func(u32, int, int, int)> void WrapV_UIII() {
306 func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
307}
308
309template<void func(u32, int, int, int, int, int)> void WrapV_UIIIII() {
310 func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
311}
312
313template<void func(u32, int, int)> void WrapV_UII() {
314 func(PARAM(0), PARAM(1), PARAM(2));
315}
316
317template<u32 func(int, u32)> void WrapU_IU() {
318 int retval = func(PARAM(0), PARAM(1));
319 RETURN(retval);
320}
321
322template<int func(int, u32)> void WrapI_IU() {
323 int retval = func(PARAM(0), PARAM(1));
324 RETURN(retval);
325}
326
327template<int func(u32, u32, int)> void WrapI_UUI() {
328 int retval = func(PARAM(0), PARAM(1), PARAM(2));
329 RETURN(retval);
330}
331
332template<int func(u32, u32, int, u32)> void WrapI_UUIU() {
333 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
334 RETURN(retval);
335}
336
337template<int func(int, int)> void WrapI_II() {
338 int retval = func(PARAM(0), PARAM(1));
339 RETURN(retval);
340}
341
342template<int func(int, int, int)> void WrapI_III() {
343 int retval = func(PARAM(0), PARAM(1), PARAM(2));
344 RETURN(retval);
345}
346
347template<int func(int, u32, int)> void WrapI_IUI() {
348 int retval = func(PARAM(0), PARAM(1), PARAM(2));
349 RETURN(retval);
350}
351
352template<int func(int, int, int, int)> void WrapI_IIII() {
353 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
354 RETURN(retval);
355}
356
357template<int func(u32, int, int, int)> void WrapI_UIII() {
358 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
359 RETURN(retval);
360}
361
362template<int func(int, int, int, u32, int)> void WrapI_IIIUI() {
363 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
364 RETURN(retval);
365}
366
367template<int func(int, u32, u32, int, int)> void WrapI_IUUII() {
368 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
369 RETURN(retval);
370}
371
372template<int func(int, const char *, int, u32, u32)> void WrapI_ICIUU() {
373 int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4));
374 RETURN(retval);
375}
376
377template<int func(int, int, u32)> void WrapI_IIU() {
378 int retval = func(PARAM(0), PARAM(1), PARAM(2));
379 RETURN(retval);
380}
381
382template<void func(int, u32)> void WrapV_IU() {
383 func(PARAM(0), PARAM(1));
384}
385
386template<void func(u32, int)> void WrapV_UI() {
387 func(PARAM(0), PARAM(1));
388}
389
390template<u32 func(const char *)> void WrapU_C() {
391 u32 retval = func(Memory::GetCharPointer(PARAM(0)));
392 RETURN(retval);
393}
394
395template<u32 func(const char *, const char *, const char *, u32)> void WrapU_CCCU() {
396 u32 retval = func(Memory::GetCharPointer(PARAM(0)),
397 Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)),
398 PARAM(3));
399 RETURN(retval);
400}
401
402template<int func(const char *)> void WrapI_C() {
403 int retval = func(Memory::GetCharPointer(PARAM(0)));
404 RETURN(retval);
405}
406
407template<int func(const char *, u32)> void WrapI_CU() {
408 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
409 RETURN(retval);
410}
411
412template<int func(const char *, u32, int)> void WrapI_CUI() {
413 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
414 RETURN(retval);
415}
416
417template<int func(int, const char *, int, u32)> void WrapI_ICIU() {
418 int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3));
419 RETURN(retval);
420}
421
422template<int func(const char *, int, u32)> void WrapI_CIU() {
423 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
424 RETURN(retval);
425}
426
427template<int func(const char *, u32, u32)> void WrapI_CUU() {
428 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
429 RETURN(retval);
430}
431
432template<int func(const char *, u32, u32, u32)> void WrapI_CUUU() {
433 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
434 PARAM(3));
435 RETURN(retval);
436}
437
438template<int func(const char *, const char*, int, int)> void WrapI_CCII() {
439 int retval = func(Memory::GetCharPointer(PARAM(0)), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3));
440 RETURN(retval);
441}
442
443template<int func(const char *, u32, u32, int, u32, u32)> void WrapI_CUUIUU() {
444 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
445 PARAM(3), PARAM(4), PARAM(5));
446 RETURN(retval);
447}
448
449template<int func(const char *, int, int, u32, int, int)> void WrapI_CIIUII() {
450 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
451 PARAM(3), PARAM(4), PARAM(5));
452 RETURN(retval);
453}
454
455template<int func(const char *, int, u32, u32, u32)> void WrapI_CIUUU() {
456 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
457 PARAM(3), PARAM(4));
458 RETURN(retval);
459}
460
461template<int func(const char *, u32, u32, u32, u32, u32)> void WrapI_CUUUUU() {
462 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
463 PARAM(3), PARAM(4), PARAM(5));
464 RETURN(retval);
465}
466
467template<u32 func(const char *, u32)> void WrapU_CU() {
468 u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
469 RETURN((u32) retval);
470}
471
472template<u32 func(u32, const char *)> void WrapU_UC() {
473 u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
474 RETURN(retval);
475}
476
477template<u32 func(const char *, u32, u32)> void WrapU_CUU() {
478 u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
479 RETURN((u32) retval);
480}
481
482template<u32 func(int, int, int)> void WrapU_III() {
483 u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
484 RETURN(retval);
485}
486
487template<u32 func(int, int)> void WrapU_II() {
488 u32 retval = func(PARAM(0), PARAM(1));
489 RETURN(retval);
490}
491
492template<u32 func(int, int, int, int)> void WrapU_IIII() {
493 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
494 RETURN(retval);
495}
496
497template<u32 func(int, u32, u32)> void WrapU_IUU() {
498 u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
499 RETURN(retval);
500}
501
502template<u32 func(int, u32, u32, u32)> void WrapU_IUUU() {
503 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
504 RETURN(retval);
505}
506
507template<u32 func(int, u32, u32, u32, u32)> void WrapU_IUUUU() {
508 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
509 RETURN(retval);
510}
511
512template<u32 func(u32, u32, u32)> void WrapU_UUU() {
513 u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
514 RETURN(retval);
515}
516
517template<void func(int, u32, u32)> void WrapV_IUU() {
518 func(PARAM(0), PARAM(1), PARAM(2));
519}
520
521template<void func(int, int, u32)> void WrapV_IIU() {
522 func(PARAM(0), PARAM(1), PARAM(2));
523}
524
525template<void func(u32, int, u32)> void WrapV_UIU() {
526 func(PARAM(0), PARAM(1), PARAM(2));
527}
528
529template<int func(u32, int, u32)> void WrapI_UIU() {
530 int retval = func(PARAM(0), PARAM(1), PARAM(2));
531 RETURN(retval);
532}
533
534template<void func(int, u32, u32, u32, u32)> void WrapV_IUUUU() {
535 func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
536}
537
538template<void func(u32, u32, u32)> void WrapV_UUU() {
539 func(PARAM(0), PARAM(1), PARAM(2));
540}
541
542template<void func(u32, u32, u32, u32)> void WrapV_UUUU() {
543 func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
544}
545
546template<void func(const char *, u32, int, u32)> void WrapV_CUIU() {
547 func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
548}
549
550template<int func(const char *, u32, int, u32)> void WrapI_CUIU() {
551 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
552 RETURN(retval);
553}
554
555template<void func(u32, const char *, u32, int, u32)> void WrapV_UCUIU() {
556 func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3),
557 PARAM(4));
558}
559
560template<int func(u32, const char *, u32, int, u32)> void WrapI_UCUIU() {
561 int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2),
562 PARAM(3), PARAM(4));
563 RETURN(retval);
564}
565
566template<void func(const char *, u32, int, int, u32)> void WrapV_CUIIU() {
567 func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3),
568 PARAM(4));
569}
570
571template<int func(const char *, u32, int, int, u32)> void WrapI_CUIIU() {
572 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
573 PARAM(3), PARAM(4));
574 RETURN(retval);
575}
576
577template<u32 func(u32, u32, u32, u32)> void WrapU_UUUU() {
578 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
579 RETURN(retval);
580}
581
582template<u32 func(u32, const char *, u32, u32)> void WrapU_UCUU() {
583 u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3));
584 RETURN(retval);
585}
586
587template<u32 func(u32, u32, u32, int)> void WrapU_UUUI() {
588 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
589 RETURN(retval);
590}
591
592template<u32 func(u32, u32, u32, int, u32)> void WrapU_UUUIU() {
593 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
594 RETURN(retval);
595}
596
597template<u32 func(u32, u32, u32, int, u32, int)> void WrapU_UUUIUI() {
598 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
599 RETURN(retval);
600}
601
602template<u32 func(u32, u32, int, u32)> void WrapU_UUIU() {
603 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
604 RETURN(retval);
605}
606
607template<u32 func(u32, int, int, int)> void WrapU_UIII() {
608 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
609 RETURN(retval);
610}
611
612template<int func(int, u32, u32, u32, u32)> void WrapI_IUUUU() {
613 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
614 RETURN(retval);
615}
616
617template<int func(int, u32, u32, u32, u32, u32)> void WrapI_IUUUUU() {
618 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
619 RETURN(retval);
620}
621
622template<int func(int, u32, int, int)> void WrapI_IUII() {
623 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
624 RETURN(retval);
625}
626template<u32 func(u32, u32, u32, u32, u32)> void WrapU_UUUUU() {
627 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
628 RETURN(retval);
629}
630
631template<void func(u32, u32, u32, u32, u32)> void WrapV_UUUUU() {
632 func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
633}
634
635template<u32 func(const char *, const char *)> void WrapU_CC() {
636 int retval = func(Memory::GetCharPointer(PARAM(0)),
637 Memory::GetCharPointer(PARAM(1)));
638 RETURN(retval);
639}
640
641template<void func(const char *, int)> void WrapV_CI() {
642 func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
643}
644
645template<u32 func(const char *, int)> void WrapU_CI() {
646 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
647 RETURN(retval);
648}
649
650template<u32 func(const char *, int, int)> void WrapU_CII() {
651 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
652 RETURN(retval);
653}
654
655template<int func(const char *, int, u32, int, u32)> void WrapU_CIUIU() {
656 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
657 PARAM(3), PARAM(4));
658 RETURN(retval);
659}
660
661template<u32 func(const char *, int, u32, int, u32, int)> void WrapU_CIUIUI() {
662 u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
663 PARAM(3), PARAM(4), PARAM(5));
664 RETURN(retval);
665}
666
667template<u32 func(u32, u32, u32, u32, u32, u32)> void WrapU_UUUUUU() {
668 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4),
669 PARAM(5));
670 RETURN(retval);
671}
672
673template<int func(int, u32, u32, u32)> void WrapI_IUUU() {
674 int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
675 RETURN(retval);
676}
677
678template<int func(int, u32, u32)> void WrapI_IUU() {
679 int retval = func(PARAM(0), PARAM(1), PARAM(2));
680 RETURN(retval);
681}
682
683template<u32 func(u32, u32, u32, u32, u32, u32, u32)> void WrapU_UUUUUUU() {
684 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
685 RETURN(retval);
686}
687
688template<int func(u32, int, u32, u32)> void WrapI_UIUU() {
689 u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
690 RETURN(retval);
691}
692
693template<int func(int, const char *)> void WrapI_IC() {
694 int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
695 RETURN(retval);
696}
697
698template <int func(int, const char *, const char *, u32, int)> void WrapI_ICCUI() {
699 int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), PARAM(3), PARAM(4));
700 RETURN(retval);
701}
702
703template <int func(int, const char *, const char *, int)> void WrapI_ICCI() {
704 int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), PARAM(3));
705 RETURN(retval);
706}
707
708template <int func(const char *, int, int)> void WrapI_CII() {
709 int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
710 RETURN(retval);
711}
712
713template <int func(int, const char *, int)> void WrapI_ICI() {
714 int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2));
715 RETURN(retval);
716}
717
718template<int func(int, void *, void *, void *, void *, u32, int)> void WrapI_IVVVVUI(){
719 u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), Memory::GetPointer(PARAM(2)), Memory::GetPointer(PARAM(3)), Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) );
720 RETURN(retval);
721}
722
723template<int func(int, const char *, u32, void *, int, int, int)> void WrapI_ICUVIII(){
724 u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)), PARAM(4), PARAM(5), PARAM(6));
725 RETURN(retval);
726}
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
new file mode 100644
index 000000000..6780b52c4
--- /dev/null
+++ b/src/core/hle/hle.h
@@ -0,0 +1,35 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8#include "core/core.h"
9
10////////////////////////////////////////////////////////////////////////////////////////////////////
11
12typedef void (*HLEFunc)();
13typedef void (*SysCallFunc)();
14
15struct HLEFunction {
16 u32 id;
17 HLEFunc func;
18 const char* name;
19 u32 flags;
20};
21
22struct HLEModule {
23 const char* name;
24 int num_funcs;
25 const HLEFunction* func_table;
26};
27
28struct SysCall {
29 u8 id;
30 SysCallFunc func;
31 const char* name;
32};
33
34#define PARAM(n) Core::g_app_core->GetReg(n)
35#define RETURN(n) Core::g_app_core->SetReg(0, n)
diff --git a/src/core/hle/hle_syscall.cpp b/src/core/hle/hle_syscall.cpp
new file mode 100644
index 000000000..c8a516848
--- /dev/null
+++ b/src/core/hle/hle_syscall.cpp
@@ -0,0 +1,22 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include "core/hle/function_wrappers.h"
6#include "core/hle/hle_syscall.h"
7
8////////////////////////////////////////////////////////////////////////////////////////////////////
9
10
11
12Result SVC_ConnectToPort(void* out, const char* port_name) {
13 NOTICE_LOG(OSHLE, "SVC_ConnectToPort called, port_name: %s", port_name);
14 return 0;
15}
16
17const SysCall SysCallTable[] = {
18 {0x2D, WrapI_VC<SVC_ConnectToPort>, "svcConnectToPort"},
19};
20
21void Register_SysCalls() {
22}
diff --git a/src/core/hle/hle_syscall.h b/src/core/hle/hle_syscall.h
new file mode 100644
index 000000000..506dcfc78
--- /dev/null
+++ b/src/core/hle/hle_syscall.h
@@ -0,0 +1,42 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8
9////////////////////////////////////////////////////////////////////////////////////////////////////
10
11//template <class T>
12//class KernelObject {
13//public:
14// virtual ~KernelObject() {}
15//
16// T GetNative() const {
17// return m_native;
18// }
19//
20// void SetNative(const T& native) {
21// m_native = native;
22// }
23//
24// virtual const char *GetTypeName() {return "[BAD KERNEL OBJECT TYPE]";}
25// virtual const char *GetName() {return "[UNKNOWN KERNEL OBJECT]";}
26//
27//private:
28// T m_native;
29//};
30
31//class Handle : public KernelObject<u32> {
32// const char* GetTypeName() {
33// return "Handle";
34// }
35//};
36
37
38typedef u32 Handle;
39typedef s32 Result;
40
41
42Result ConnectToPort(Handle* out, const char* port_name);