aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxapi/_syscalls.s
diff options
context:
space:
mode:
authorJohn "Lameguy" Wilbert Villamor <lameguy64@gmail.com>2022-09-26 16:49:56 +0800
committerGitHub <noreply@github.com>2022-09-26 16:49:56 +0800
commitc4a2533d21dfd05cde841ea48c67b05e0e6a853f (patch)
treec7ef61653b157b69fb0956709366996ddbc4ecfa /libpsn00b/psxapi/_syscalls.s
parenta8b404b3400c3ebd8e0b923dcaefcc49ea563e36 (diff)
parent86f0064afb8200e60dd80827535cac30d0eab028 (diff)
downloadpsn00bsdk-c4a2533d21dfd05cde841ea48c67b05e0e6a853f.tar.gz
Merge pull request #55 from spicyjpeg/psxmdec
Full MDEC support, C library refactors, cleanups and bugfixes (v0.20)
Diffstat (limited to 'libpsn00b/psxapi/_syscalls.s')
-rw-r--r--libpsn00b/psxapi/_syscalls.s50
1 files changed, 50 insertions, 0 deletions
diff --git a/libpsn00b/psxapi/_syscalls.s b/libpsn00b/psxapi/_syscalls.s
new file mode 100644
index 0000000..24864f3
--- /dev/null
+++ b/libpsn00b/psxapi/_syscalls.s
@@ -0,0 +1,50 @@
+# PSn00bSDK syscall wrappers
+# (C) 2022 spicyjpeg - MPL licensed
+
+.set noreorder
+
+.section .text.EnterCriticalSection
+.global EnterCriticalSection
+.type EnterCriticalSection, @function
+EnterCriticalSection:
+ li $a0, 0x01
+ syscall 0
+
+ jr $ra
+ nop
+
+.section .text.ExitCriticalSection
+.global ExitCriticalSection
+.type ExitCriticalSection, @function
+ExitCriticalSection:
+ li $a0, 0x02
+ syscall 0
+
+ jr $ra
+ nop
+
+.section .text.SwEnterCriticalSection
+.global SwEnterCriticalSection
+.type SwEnterCriticalSection, @function
+SwEnterCriticalSection:
+ mfc0 $a0, $12 # cop0r12 &= ~0x00000401
+ li $a1, -1026
+ and $a0, $a1
+ mtc0 $a0, $12
+ nop
+
+ jr $ra
+ nop
+
+.section .text.SwExitCriticalSection
+.global SwExitCriticalSection
+.type SwExitCriticalSection, @function
+SwExitCriticalSection:
+ mfc0 $a0, $12 # cop0r12 |= 0x00000401
+ nop
+ ori $a0, 0x0401
+ mtc0 $a0, $12
+ nop
+
+ jr $ra
+ nop