-
Notifications
You must be signed in to change notification settings - Fork 4
/
syscalls.s
281 lines (228 loc) · 4.14 KB
/
syscalls.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
/*
* DIP plugin for Custom IOS.
*
* Copyright (C) 2008-2010 Waninkoko, WiiGator.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
.macro syscall vec_sys
.long 0xE6000010 + (\vec_sys<<5)
bx lr
.endm
/*
* IOS syscalls
*/
.code 32
.global os_thread_create
os_thread_create:
syscall 0x0
.code 32
.global os_thread_joint
os_thread_joint:
syscall 0x1
.code 32
.global os_thread_cancel
os_thread_cancel:
syscall 0x2
.code 32
.global os_get_thread_id
os_get_thread_id:
syscall 0x3
.code 32
.global os_get_parent_thread_id
os_get_parent_thread_id:
syscall 0x4
.code 32
.global os_thread_continue
os_thread_continue:
syscall 0x5
.code 32
.global os_thread_stop
os_thread_stop:
syscall 0x6
.code 32
.global os_thread_yield
os_thread_yiel:
syscall 0x7
.code 32
.global os_thread_get_priority
os_thread_get_priority :
syscall 0x8
.code 32
.global os_thread_set_priority
os_thread_set_priority:
syscall 0x9
.code 32
.global os_message_queue_create
os_message_queue_create:
syscall 0xa
.code 32
.global os_message_queue_destroy
os_message_queue_destroy:
syscall 0xb
.code 32
.global os_message_queue_send
os_message_queue_send:
syscall 0xc
.code 32
.global os_message_queue_send_now
os_message_queue_send_now:
syscall 0xd
.code 32
.global os_message_queue_receive
os_message_queue_receive:
syscall 0xe
.code 32
.global os_register_event_handler
os_register_event_handler:
syscall 0xf
.code 32
.global os_unregister_event_handler
os_unregister_event_handler:
syscall 0x10
.code 32
.global os_create_timer
os_create_timer:
syscall 0x11
.code 32
.global os_restart_timer
os_restart_timer:
syscall 0x12
.code 32
.global os_stop_timer
os_stop_timer:
syscall 0x13
.code 32
.global os_destroy_timer
os_destroy_timer:
syscall 0x14
.code 32
.global os_timer_now
os_timer_now:
syscall 0x15
.code 32
.global os_heap_create
os_heap_create:
syscall 0x16
.code 32
.global os_heap_destroy
os_heap_destroy:
syscall 0x17
.code 32
.global os_heap_alloc
os_heap_alloc:
syscall 0x18
.code 32
.global os_heap_alloc_aligned
os_heap_alloc_aligned:
syscall 0x19
.code 32
.global os_heap_free
os_heap_free:
syscall 0x1a
.code 32
.global os_device_register
os_device_register:
syscall 0x1b
.code 32
.global os_open
os_open:
syscall 0x1c
.code 32
.global os_close
os_close:
syscall 0x1d
.code 32
.global os_read
os_read:
syscall 0x1e
.code 32
.global os_write
os_write:
syscall 0x1f
.code 32
.global os_seek
os_seek:
syscall 0x20
.code 32
.global os_ioctl
os_ioctl:
syscall 0x21
.code 32
.global os_ioctlv
os_ioctlv:
syscall 0x22
.code 32
.global os_open_async
os_open_async:
syscall 0x23
.code 32
.global os_close_async
os_close_async:
syscall 0x24
.code 32
.global os_read_async
os_read_async:
syscall 0x25
.code 32
.global os_write_async
os_write_async:
syscall 0x26
.code 32
.global os_seek_async
os_seek_async:
syscall 0x27
.code 32
.global os_ioctl_async
os_ioctl_async:
syscall 0x28
.code 32
.global os_ioctlv_async
os_ioctlv_async:
syscall 0x29
.code 32
.global os_message_queue_ack
os_message_queue_ack:
syscall 0x2a
.code 32
.global os_software_IRQ
os_software_IRQ:
syscall 0x34
.code 32
.global os_sync_before_read
os_sync_before_read:
syscall 0x3f
.code 32
.global os_sync_after_write
os_sync_after_write:
syscall 0x40
.code 32
.global os_virt_to_phys
os_virt_to_phys:
syscall 0x4f
.code 32
.global os_syscall_50
os_syscall_50:
syscall 0x50
/*
* ARM syscalls
*/
.code 32
.global write
write:
mov r2, lr
adds r1, r0, #0
movs r0, #4
svc 0xab
bx r2