ps2sdk
1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
patch_user_mem_clear.c
Go to the documentation of this file.
1
6
#include <
tamtypes.h
>
7
#include <
kernel.h
>
8
9
int
sbv_patch_user_mem_clear
(
void
*start)
10
{
11
int
ret = -1;
12
u32
*p;
13
14
DI
();
15
ee_kmode_enter
();
16
17
for
(p = (
unsigned
int
*)0x80001000; p < (
unsigned
int
*)0x80080000; p++) {
18
/*
19
* Search for function call and patch $a0
20
* lui $a0, 0x0008
21
* jal InitializeUserMemory
22
* ori $a0, $a0, 0x2000
23
*/
24
if
(p[0] == 0x3c040008 && (p[1] & 0xfc000000) == 0x0c000000 && p[2] == 0x34842000) {
25
p[0] = 0x3c040000 | ((
unsigned
int)start >> 16);
26
p[2] = 0x34840000 | ((
unsigned
int)start & 0xffff);
27
ret = 0;
28
break
;
29
}
30
}
31
32
ee_kmode_exit
();
33
EI
();
34
35
return
ret;
36
}
kernel.h
ee_kmode_exit
static int ee_kmode_exit()
Definition:
kernel.h:198
ee_kmode_enter
static int ee_kmode_enter()
Definition:
kernel.h:181
DI
#define DI
Definition:
kernel.h:24
EI
#define EI
Definition:
kernel.h:25
sbv_patch_user_mem_clear
int sbv_patch_user_mem_clear(void *start)
Definition:
patch_user_mem_clear.c:9
tamtypes.h
u32
unsigned int u32
Definition:
tamtypes.h:30
ee
sbv
src
patch_user_mem_clear.c
Generated on Thu Feb 11 2021 11:42:23 for ps2sdk by
1.9.2