sm64

A Super Mario 64 decompilation
Log | Files | Refs | README | LICENSE

osMapTLB.s (1146B)


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