40static __attribute__((always_inline))
int enterCriticalSection() {
41 register int n asm(
"a0") = 1;
42 register int r asm(
"v0");
43 __asm__
volatile(
"syscall\n" :
"=r"(
r) :
"r"(
n) :
"memory");
47static __attribute__((always_inline))
void leaveCriticalSection() {
48 register int n asm(
"a0") = 2;
49 __asm__
volatile(
"syscall\n" : :
"r"(
n) :
"memory");
53 register int n asm(
"a0") = 3;
54 register int tcb
asm(
"a1") = address;
55 register int r asm(
"v0");
56 __asm__
volatile(
"syscall\n" :
"=r"(
r) :
"r"(
n),
"r"(tcb) :
"memory");
62 register int n asm(
"t1") = 0x03;
63 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
64 return ((
size_t(*)(
int,
const void *,
size_t))0xa0)(fd,
buf,
size);
68 register int n asm(
"t1") = 0x13;
69 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
74 register int n asm(
"t1") = 0x14;
75 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
80static __attribute__((always_inline))
char *syscall_strcat(
char *dst,
const char *
src) {
81 register int n asm(
"t1") = 0x15;
82 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
83 return ((
char *(*)(
char *,
const char *))0xa0)(dst,
src);
86static __attribute__((always_inline))
char *syscall_strncat(
char *dst,
const char *
src,
size_t size) {
87 register int n asm(
"t1") = 0x16;
88 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
89 return ((
char *(*)(
char *,
const char *,
size_t))0xa0)(dst,
src,
size);
93 register int n asm(
"t1") = 0x17;
94 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
95 return ((
int (*)(
const char *,
const char *))0xa0)(
s1,
s2);
98static __attribute__((always_inline))
int syscall_strncmp(
const char *
s1,
const char *
s2,
size_t size) {
99 register int n asm(
"t1") = 0x18;
100 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
101 return ((
int (*)(
const char *,
const char *,
size_t))0xa0)(
s1,
s2,
size);
104static __attribute__((always_inline))
char *syscall_strcpy(
char *dst,
const char *
src) {
105 register int n asm(
"t1") = 0x19;
106 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
107 return ((
char *(*)(
char *,
const char *))0xa0)(dst,
src);
110static __attribute__((always_inline))
char *syscall_strncpy(
char *dst,
const char *
src,
size_t size) {
111 register int n asm(
"t1") = 0x1a;
112 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
113 return ((
char *(*)(
char *,
const char *,
size_t))0xa0)(dst,
src,
size);
116static __attribute__((always_inline))
size_t syscall_strlen(
const char *
s) {
117 register int n asm(
"t1") = 0x1b;
118 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
119 return ((
size_t(*)(
const char *))0xa0)(
s);
123 register int n asm(
"t1") = 0x1c;
124 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
125 return ((
char *(*)(
const char *,
int c))0xa0)(
s,
c);
128static __attribute__((always_inline))
char *syscall_rindex(
const char *
s,
int c) {
129 register int n asm(
"t1") = 0x1d;
130 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
131 return ((
char *(*)(
const char *,
int c))0xa0)(
s,
c);
134static __attribute__((always_inline))
char *syscall_strchr(
const char *
s,
int c) {
135 register int n asm(
"t1") = 0x1e;
136 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
137 return ((
char *(*)(
const char *,
int c))0xa0)(
s,
c);
140static __attribute__((always_inline))
char *syscall_strrchr(
const char *
s,
int c) {
141 register int n asm(
"t1") = 0x1f;
142 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
143 return ((
char *(*)(
const char *,
int c))0xa0)(
s,
c);
147 register int n asm(
"t1") = 0x2a;
148 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
149 return ((
void *(*)(
void *,
const void *,
size_t))0xa0)(dst,
src,
count);
152static __attribute__((always_inline))
void *syscall_memset(
void *dst,
int c,
size_t count) {
153 register int n asm(
"t1") = 0x2b;
154 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
155 return ((
void *(*)(
void *,
int,
size_t))0xa0)(dst,
c,
count);
159 int (*
compar)(
const void *,
const void *)) {
160 register int n asm(
"t1") = 0x31;
161 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
162 ((
void (*)(
void *, size_t, size_t,
int (*)(
const void *,
const void *)))0xa0)(base,
nel,
width,
compar);
166 register int n asm(
"t1") = 0x33;
167 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
168 return ((
void *(*)(
size_t))0xa0)(
size);
172 register int n asm(
"t1") = 0x34;
173 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
178 register int n asm(
"t1") = 0x39;
179 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
183static __attribute__((always_inline))
void syscall__exit(
int code) {
184 register int n asm(
"t1") = 0x3a;
185 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
189static __attribute__((always_inline))
void syscall_puts(
const char *msg) {
190 register int n asm(
"t1") = 0x3e;
191 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
192 ((
void (*)(
const char *))0xa0)(msg);
207static __attribute__((always_inline))
int syscall_unresolvedException() {
208 register int n asm(
"t1") = 0x40;
209 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
210 return ((
int (*)())0xa0)();
213static __attribute__((always_inline))
void syscall_flushCache() {
214 register int n asm(
"t1") = 0x44;
215 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
216 ((
void (*)())0xa0)();
219static __attribute__((always_inline))
int syscall_cdromSeekL(uint8_t *msf) {
220 register int n asm(
"t1") = 0x78;
221 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
222 return ((
int (*)(uint8_t *))0xa0)(msf);
225static __attribute__((always_inline))
int syscall_cdromGetStatus(uint8_t *
ptr) {
226 register int n asm(
"t1") = 0x7c;
227 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
228 return ((
int (*)(uint8_t *))0xa0)(
ptr);
232 register int n asm(
"t1") = 0x7e;
233 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
237static __attribute__((always_inline))
int syscall_cdromInnerInit() {
238 register int n asm(
"t1") = 0x95;
239 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
240 return ((
int (*)())0xa0)();
243static __attribute__((always_inline))
int syscall_addCDRomDevice() {
244 register int n asm(
"t1") = 0x96;
245 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
246 return ((
int (*)())0xa0)();
249static __attribute__((always_inline))
int syscall_addMemoryCardDevice() {
250 register int n asm(
"t1") = 0x97;
251 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
252 return ((
int (*)())0xa0)();
255static __attribute__((always_inline))
int syscall_addConsoleDevice() {
256 register int n asm(
"t1") = 0x98;
257 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
258 return ((
int (*)())0xa0)();
261static __attribute__((always_inline))
int syscall_addDummyConsoleDevice() {
262 register int n asm(
"t1") = 0x99;
263 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
264 return ((
int (*)())0xa0)();
268 register int n asm(
"t1") = 0xa1;
269 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
273static __attribute__((always_inline))
void syscall_enqueueCDRomHandlers() {
274 register int n asm(
"t1") = 0xa2;
275 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
276 ((
void (*)())0xa0)();
279static __attribute__((always_inline))
void syscall_dequeueCDRomHandlers() {
280 register int n asm(
"t1") = 0xa3;
281 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
282 ((
void (*)())0xa0)();
285static __attribute__((always_inline))
void syscall_buLowLevelOpCompleted() {
286 register int n asm(
"t1") = 0xa7;
287 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
288 ((
void (*)())0xa0)();
291static __attribute__((always_inline))
void syscall_buLowLevelOpError1() {
292 register int n asm(
"t1") = 0xa8;
293 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
294 ((
void (*)())0xa0)();
297static __attribute__((always_inline))
void syscall_buLowLevelOpError2() {
298 register int n asm(
"t1") = 0xa9;
299 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
300 ((
void (*)())0xa0)();
303static __attribute__((always_inline))
void syscall_buLowLevelOpError3() {
304 register int n asm(
"t1") = 0xaa;
305 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
306 ((
void (*)())0xa0)();
309static __attribute__((always_inline))
void syscall_buLowLevelOpError4() {
310 register int n asm(
"t1") = 0xae;
311 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
312 ((
void (*)())0xa0)();
315static __attribute__((always_inline))
int syscall_ioabortraw(
int code) {
316 register int n asm(
"t1") = 0xb2;
317 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
318 return ((
int (*)(
int))0xa0)(code);
323 register int n asm(
"t1") = 0x00;
324 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
325 return ((
void *(*)(
unsigned))0xb0)(
size);
329 register int n asm(
"t1") = 0x01;
330 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
335 register int n asm(
"t1") = 0x02;
336 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
341 register int n asm(
"t1") = 0x03;
342 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
343 return ((
int (*)(
uint32_t))0xb0)(timer);
347 register int n asm(
"t1") = 0x04;
348 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
349 return ((
int (*)(
uint32_t))0xb0)(timer);
353 register int n asm(
"t1") = 0x05;
354 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
355 return ((
int (*)(
uint32_t))0xb0)(timer);
359 register int n asm(
"t1") = 0x06;
360 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
361 return ((
int (*)(
uint32_t))0xb0)(timer);
365 register int n asm(
"t1") = 0x07;
366 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
372 register int n asm(
"t1") = 0x08;
373 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
378 register int n asm(
"t1") = 0x09;
379 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
384 register int n asm(
"t1") = 0x0b;
385 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
386 return ((
int (*)(
uint32_t))0xb0)(event);
390 register int n asm(
"t1") = 0x0c;
391 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
392 return ((
int (*)(
uint32_t))0xb0)(event);
396 register int n asm(
"t1") = 0x12;
397 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
401static __attribute__((always_inline))
void syscall_startPad() {
402 register int n asm(
"t1") = 0x13;
403 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
404 ((
void (*)())0xb0)();
407static __attribute__((always_inline))
void syscall_stopPad() {
408 register int n asm(
"t1") = 0x14;
409 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
410 ((
void (*)())0xb0)();
413static __attribute__((always_inline, noreturn))
void syscall_returnFromException() {
414 register int n asm(
"t1") = 0x17;
415 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
420static __attribute__((always_inline))
void syscall_setDefaultExceptionJmpBuf() {
421 register int n asm(
"t1") = 0x18;
422 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
423 ((
void (*)())0xb0)();
427 register int n asm(
"t1") = 0x20;
428 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
432static __attribute__((always_inline))
int syscall_open(
const char *filename,
int mode) {
433 register int n asm(
"t1") = 0x32;
434 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
435 return ((
int (*)(
const char *,
int))0xb0)(filename,
mode);
439 register int n asm(
"t1") = 0x34;
440 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
444static __attribute__((always_inline))
int syscall_close(
int fd) {
445 register int n asm(
"t1") = 0x36;
446 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
447 return ((
int (*)(
int))0xb0)(fd);
450static __attribute__((always_inline))
void syscall_putchar(
int c) {
451 register int n asm(
"t1") = 0x3d;
452 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
457 register int n asm(
"t1") = 0x47;
458 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
459 return ((
int (*)(
const struct Device *))0xb0)(device);
462static __attribute__((always_inline))
int syscall_cardInfoInternal(
int deviceID) {
463 register int n asm(
"t1") = 0x4d;
464 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
465 return ((
int (*)(
int))0xb0)(deviceID);
469 register int n asm(
"t1") = 0x4e;
470 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
471 return ((
int (*)(
int,
int,
const uint8_t *))0xb0)(deviceID,
sector,
buffer);
475 register int n asm(
"t1") = 0x4f;
476 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
480static __attribute__((always_inline))
void syscall_mcAllowNewCard() {
481 register int n asm(
"t1") = 0x50;
482 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
483 ((
void (*)())0xb0)();
487 register int n asm(
"t1") = 0x51;
488 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
489 return ((uint8_t * (*)(
uint32_t))0xb0)(
c);
492static __attribute__((always_inline))
int syscall_mcGetLastDevice() {
493 register int n asm(
"t1") = 0x58;
494 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
495 return ((
int (*)())0xb0)();
499static __attribute__((always_inline))
int syscall_enqueueRCntIrqs(
int priority) {
500 register int n asm(
"t1") = 0x00;
501 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
502 return ((
int (*)(
int))0xc0)(priority);
505static __attribute__((always_inline))
int syscall_enqueueSyscallHandler(
int priority) {
506 register int n asm(
"t1") = 0x01;
507 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
508 return ((
int (*)(
int))0xc0)(priority);
512 register int n asm(
"t1") = 0x02;
513 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
518 register int n asm(
"t1") = 0x03;
519 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
523static __attribute__((always_inline))
void syscall_installExceptionHandler() {
524 register int n asm(
"t1") = 0x07;
525 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
526 ((
void (*)())0xc0)();
529static __attribute__((always_inline))
void syscall_kernInitheap(
void *base,
size_t size) {
530 register int n asm(
"t1") = 0x08;
531 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
536 register int n asm(
"t1") = 0x0a;
537 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
541static __attribute__((always_inline))
int syscall_enqueueIrqHandler(
int priority) {
542 register int n asm(
"t1") = 0x0c;
543 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
544 return ((
int (*)(
int))0xc0)(priority);
550 register int n asm(
"t1") = 0x0d;
551 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
555static __attribute__((always_inline))
void syscall_setupFileIO(
int installTTY) {
556 register int n asm(
"t1") = 0x12;
557 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
558 ((
void (*)(
int))0xc0)(installTTY);
562 register int n asm(
"t1") = 0x15;
563 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
567static __attribute__((always_inline))
void syscall_cdevscan() {
568 register int n asm(
"t1") = 0x16;
569 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
570 ((
void (*)())0xc0)();
574 register int n asm(
"t1") = 0x17;
575 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
579static __attribute__((always_inline))
int syscall_ioabort(
const char *msg) {
580 register int n asm(
"t1") = 0x19;
581 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
582 return ((
int (*)(
const char *))0xc0)(msg);
585static __attribute__((always_inline))
void syscall_setDeviceStatus(
int status) {
586 register int n asm(
"t1") = 0x1a;
587 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
591static __attribute__((always_inline))
void syscall_patchA0table() {
592 register int n asm(
"t1") = 0x1c;
593 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
594 ((
void (*)())0xc0)();
597static __attribute__((always_inline))
int syscall_getDeviceStatus() {
598 register int n asm(
"t1") = 0x1d;
599 __asm__
volatile(
"" :
"=r"(
n) :
"r"(
n));
600 return ((
int (*)())0xc0)();
volatile uint32_t * ptr
Definition cop0.c:80
uint32_t r
Definition cpu.c:222
fptr __preinit_array_start[] __attribute__((weak))
Definition cxxglue.c:76
int n
Definition dcache.c:225
ramsyscall_printf("=== e01_kseg1_reads_no_fill ===\n")
syscall_qsort(input, size, sizeof(input[0]), icmp)
char * s
Definition string.c:48
Definition circularbuffer.h:37
uint32_t s1
Definition setjmp.h:32
int romsyscall_printf(const char *fmt,...)
static int value
Definition syscalls.h:535
static void * buffer
Definition syscalls.h:231
static uint32_t spec
Definition syscalls.h:364
static size_t nel
Definition syscalls.h:158
static size_t size_t width
Definition syscalls.h:158
static size_t size1
Definition syscalls.h:395
static uint16_t target
Definition syscalls.h:334
static const char * s2
Definition syscalls.h:92
static const void size_t count
Definition syscalls.h:146
static int ret
Definition syscalls.h:73
static uint32_t uint32_t void(* handler)())
Definition syscalls.h:371
static int c
Definition syscalls.h:122
static struct HandlerInfo * info
Definition syscalls.h:511
static const void * buf
Definition syscalls.h:61
static int sector
Definition syscalls.h:468
static size_t void size_t size2
Definition syscalls.h:395
static const void size_t size
Definition syscalls.h:61
static uint16_t uint16_t flags
Definition syscalls.h:334
static size_t size_t int(* compar)(const void *, const void *))
Definition syscalls.h:159
static size_t void * buffer2
Definition syscalls.h:395
static const char * src
Definition syscalls.h:80
static void uint32_t mode
Definition syscalls.h:231
static int code2
Definition syscalls.h:267
void uint32_t(classId, spec)