mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-11 03:39:59 +00:00
7334ffa373
* Format all handwritten asm and document some * Use c preprocessor for constants * Fix * Fix PI_STATUS_ERROR, some label improvements * Avoid hi/lo for constants * Some more comments * Properly mark functions as functions and their sizes * Fix merge * Improvements * Review suggestions, rework procedure start/end macros to be more like libreultra * Move IPL3 symbol definitions into ipl3.s * Fix undefined_syms, add include and language guards to asm.h and fix the comment in gbi.h * Consistent hex capitalization, add some MIPS builtin defines to CC_CHECK to behave properly * Add -no-pad-sections assembler option and clean up alignment in gu files and bzero * Further suggestions and improvements * Matrix conversion function clarifications * Fix passing AVOID_UB to gcc * Suggestions * Suggestions, global interrupt mask improvements * Further suggestions, interrupt mask comments * Comments fixes, rdb.h * Switch from # comments to // comments, remove unnecesary .set gp=64 directives * Further review suggestions * Missed one
53 lines
1.2 KiB
ArmAsm
53 lines
1.2 KiB
ArmAsm
#include "ultra64/asm.h"
|
|
#include "ultra64/r4300.h"
|
|
#include "ultra64/thread.h"
|
|
|
|
.set noat
|
|
.set noreorder
|
|
|
|
.section .text
|
|
|
|
.balign 16
|
|
|
|
LEAF(__osDisableInt)
|
|
lui $t2, %hi(__OSGlobalIntMask)
|
|
addiu $t2, $t2, %lo(__OSGlobalIntMask)
|
|
lw $t3, ($t2)
|
|
andi $t3, $t3, SR_IMASK
|
|
mfc0 $t0, C0_SR
|
|
li $at, ~SR_IE
|
|
and $t1, $t0, $at
|
|
mtc0 $t1, C0_SR
|
|
andi $v0, $t0, SR_IE
|
|
lw $t0, ($t2)
|
|
andi $t0, $t0, SR_IMASK
|
|
beq $t0, $t3, No_Change_Global_Int
|
|
lui $t2, %hi(__osRunningThread)
|
|
//! @bug this addiu should be lw, it may never come up in practice as to reach this code
|
|
//! the CPU bits of __OSGlobalIntMask must have changed while this function is running.
|
|
addiu $t2, $t2, %lo(__osRunningThread)
|
|
lw $t1, THREAD_SR($t2)
|
|
andi $t2, $t1, SR_IMASK
|
|
and $t2, $t2, $t0
|
|
li $at, ~SR_IMASK
|
|
and $t1, $t1, $at
|
|
or $t1, $t1, $t2
|
|
li $at, ~SR_IE
|
|
and $t1, $t1, $at
|
|
mtc0 $t1, C0_SR
|
|
nop
|
|
nop
|
|
No_Change_Global_Int:
|
|
jr $ra
|
|
nop
|
|
END(__osDisableInt)
|
|
|
|
LEAF(__osRestoreInt)
|
|
mfc0 $t0, C0_SR
|
|
or $t0, $t0, $a0
|
|
mtc0 $t0, C0_SR
|
|
nop
|
|
nop
|
|
jr $ra
|
|
nop
|
|
END(__osRestoreInt)
|