2 Copyright 2010, jimmikaelkael <jimmikaelkael@wanadoo.fr>
3 Licenced under Academic Free License version 3.0
4 Review Open-PS2-Loader README & LICENSE files for further details.
6 code to be patched into the ExecPS2 syscall on SCPH-10000
19 .globl p_ChangeThreadPriority
20 .globl p_CancelWakeUpThread
21 .globl p_TerminateThread
30 .globl p_InitializeINTC
31 .globl p_InitializeTIMER
33 .globl p_InitializeFPU
34 .globl p_InitializeScratchPad
36 .globl SoftPeripheralEEReset
40 * SoftPeripheralEEReset
42 .ent SoftPeripheralEEReset
43 SoftPeripheralEEReset:
64 lw $v0, p_InitializeGS
76 lw $v0, p_InitializeINTC
78 ori $a0, $zero, 0xdffd
80 /* Initialize TIMER */
81 lw $v0, p_InitializeTIMER
85 /* Do a ResetEE (initialize DMAC, VU0, VU1, GIF, VIF0, VIF1, IPU) */
88 addiu $a0, $zero, 0x7f
91 lw $v0, p_InitializeFPU
95 /* Initialize Scratch Pad */
96 lw $v0, p_InitializeScratchPad
103 .end SoftPeripheralEEReset
111 addiu $sp, $sp, -0xB0
124 daddu $s5, $a0, $zero /* store elf entry point into s5 */
125 daddu $s4, $a2, $zero /* store argc into s4 */
126 addiu $s1, $zero, 0x4c
129 sw $a1, 0x0000($sp) /* store gp pointer */
130 sw $a3, 0x0004($sp) /* store argv */
132 lw $t0, p_program_thid
135 lw $v0, p_CancelWakeUpThread
137 daddu $a0, $s3, $zero
139 daddu $a0, $s3, $zero
140 lw $v0, p_ChangeThreadPriority
142 daddu $a1, $zero, $zero
145 /* terminate all threads */
156 lw $v0, p_DeleteThread
158 daddu $a0, $s0, $zero
162 lw $v0, p_TerminateThread
164 daddu $a0, $s0, $zero
165 lw $v0, p_DeleteThread
167 daddu $a0, $s0, $zero
174 lw $v0, p_kFNC80004e68
176 daddu $s0, $zero, $zero
178 lw $v0, p_kFNC800021b0
182 /* Does a soft pheripheral EE reset */
184 jal SoftPeripheralEEReset
185 sw $zero, 0x0000($v0)
187 /* copy elf args to kernel memory */
191 lw $a0, p_elfargs /* pointer where to store elf args in kernel memory */
200 daddu $a0, $v0, $zero
207 addiu $v0, $zero, 0x4c
211 lw $a2, p_kFNC80002ac0
219 sh $zero, 0x001a($v0)
220 sh $zero, 0x0018($v0)
221 sw $zero, 0x0024($v0)
222 sw $zero, 0x001c($v0)
224 sw $zero, 0x0020($v0)
226 lw $v1, p_kFNC80002a80
230 /* return entry point */
231 daddu $v0, $s5, $zero
266 p_CancelWakeUpThread:
269 p_ChangeThreadPriority:
311 p_InitializeScratchPad: