ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
libosd_full.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 
25 #include <kernel.h>
26 #include <syscallnr.h>
27 #include <osd_config.h>
28 
29 extern unsigned char osdsrc[];
30 extern unsigned int size_osdsrc;
31 
32 struct SyscallData{
33  int syscall_num;
34  void *function;
35 };
36 
37 static struct SyscallData SyscallPatchEntries[]={
38  {
39  0x5A,
40  &kCopy
41  },
42  {
43  0x5B,
44  (void*)0x80074000
45  },
46  {
47  // 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).
48  0xFFFFC402, // 0x80011F80+(-15358*4)=0x80002F88, where 0x80011F80 is the start of the syscall table.
49  NULL
50  },
51  {
53  NULL
54  },
55  {
57  NULL
58  },
59  {
61  NULL
62  },
63  {
65  NULL
66  },
67 };
68 
69 void InitOsd(void){
70  unsigned int i;
71 
72  if(PatchIsNeeded()){
74  Copy((unsigned int*)0x80074000, (unsigned int*)osdsrc, size_osdsrc);
75 
76  FlushCache(0);
77  FlushCache(2);
79 
80  for(i=2; i<7; i++){
82  }
83  }
84 }
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[]
unsigned int size_osdsrc
void InitOsd(void)
Definition: libosd_full.c:69
static struct SyscallData SyscallPatchEntries[]
Definition: libosd_full.c:37
int syscall_num
Definition: libosd.c:27
#define __NR_GetOsdConfigParam2
Definition: syscallnr.h:130
#define __NR_GetOsdConfigParam
Definition: syscallnr.h:90
#define __NR_SetOsdConfigParam
Definition: syscallnr.h:89
#define __NR_SetOsdConfigParam2
Definition: syscallnr.h:129
#define NULL
Definition: tamtypes.h:91