aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxapi/_syscalls.s
blob: 24864f37748aa3bd477932dacea1d0d0ce032ddb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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