PS2SDK
PS2 Homebrew Libraries
srcfile.c
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Licenced under Academic Free License version 2.0
7 # Review ps2sdk README & LICENSE files for further details.
8 */
9 
10 #include "kernel.h"
11 #include "internal.h"
12 
13 struct SyscallData
14 {
15  int syscall;
16  void *function;
17 };
18 
19 #define NUM_ENTRIES 6
20 static struct SyscallData entries[NUM_ENTRIES] = {
21  {0xfc, &SetAlarm},
22  {0xfd, &SetAlarm},
23  {0xfe, &ReleaseAlarm},
24  {0xff, &ReleaseAlarm},
25  {0x12c, &Intc12Handler}, // Overwrites INTC 12 handler without using SetINTCHandler
26  {0x08, &ResumeIntrDispatch}};
27 
28 void *_start(int syscall) __attribute__((section(".start")));
29 
30 void *_start(int syscall)
31 {
32  int i;
33 
34  for (i = 0; i < NUM_ENTRIES; i++) {
35  if (syscall == entries[i].syscall)
36  return entries[i].function;
37  }
38 
39  return NULL;
40 }
kernel.h
SyscallData
Definition: alarm.c:22
__attribute__
typedef __attribute__
Definition: tlbfunc.c:60