ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
libosd.c
Go to the documentation of this file.
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 
19 #include <kernel.h>
20 #include <syscallnr.h>
21 #include <osd_config.h>
22 
23 extern unsigned char osdsrc[];
24 extern unsigned int size_osdsrc;
25 
26 struct SyscallData{
28  void *function;
29 };
30 
31 static struct SyscallData SyscallPatchEntries[]={
32  {
33  0x5A,
34  &kCopy
35  },
36  {
37  0x5B,
38  (void*)0x80074000
39  },
40  {
41  // This uses the Setup (aka "SetSyscall") syscall to patch the kernel. The address is relative to the start of the syscall table, and is in units of 32-bit pointers (4 bytes).
42  0xFFFFC402, // 0x80011F80+(-15358*4)=0x80002F88, where 0x80011F80 is the start of the syscall table.
43  NULL
44  },
45 };
46 
47 void InitExecPS2(void){
48  unsigned int i;
49 
50  if(PatchIsNeeded()){
52  Copy((unsigned int*)0x80074000, (unsigned int*)osdsrc, size_osdsrc);
53 
54  FlushCache(0);
55  FlushCache(2);
57 
58  for(i=2; i<3; i++){
60  }
61  }
62 }
int PatchIsNeeded(void)
Definition: libosd_common.c:20
void * GetEntryAddress(int syscall)
int Copy(void *dest, const void *src, int size)
void FlushCache(s32 operation)
int kCopy(void *dest, const void *src, int size)
void setup(int syscall_num, void *handler)
unsigned char osdsrc[]
void InitExecPS2(void)
Definition: libosd.c:47
unsigned int size_osdsrc
static struct SyscallData SyscallPatchEntries[]
Definition: libosd.c:31
int syscall_num
Definition: libosd.c:27
#define NULL
Definition: tamtypes.h:91