Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/lib/asm/osMapTLB.s
7858 views
1
.set noreorder // don't insert nops after branches
2
.set gp=64
3
4
#include "macros.inc"
5
6
7
.section .text, "ax"
8
9
// This file is handwritten
10
11
// void osMapTLB(s32 index, OSPageMask pm, void *vaddr, u32 evenpaddr, u32 oddpaddr, s32 asid);
12
glabel osMapTLB
13
mfc0 $t0, $10
14
mtc0 $a0, $0
15
mtc0 $a1, $5
16
lw $t1, 0x14($sp) #asid
17
beq $t1, -1, .L803214D8
18
li $t4, 1
19
li $t2, 30
20
b .L803214DC
21
or $a2, $a2, $t1 #vaddr
22
.L803214D8:
23
li $t2, 31
24
.L803214DC:
25
mtc0 $a2, $10 #vaddr
26
beq $a3, -1, .L80321500 #even paddr
27
nop
28
srl $t3, $a3, 6 #evenpaddr
29
or $t3, $t3, $t2
30
mtc0 $t3, $2
31
b .L80321504
32
nop
33
.L80321500:
34
mtc0 $t4, $2
35
.L80321504:
36
lw $t3, 0x10($sp) #oddpaddr
37
beq $t3, -1, .L80321528
38
nop
39
srl $t3, $t3, 6
40
or $t3, $t3, $t2
41
mtc0 $t3, $3
42
b .L80321540
43
nop
44
.L80321528:
45
mtc0 $t4, $3
46
bne $a3, -1, .L80321540 #evenpaddr
47
nop
48
lui $t3, 0x8000
49
mtc0 $t3, $10
50
.L80321540:
51
nop
52
tlbwi
53
nop
54
nop
55
nop
56
nop
57
mtc0 $t0, $10
58
jr $ra
59
nop #file gets padded but
60
nop
61
nop
62
nop
63
64
65