diff options
author | David Guillen Fandos | 2021-04-03 23:43:32 +0200 |
---|---|---|
committer | David Guillen Fandos | 2021-04-03 23:43:32 +0200 |
commit | 5bee4d66c2e461b3a4e804b2806bdea3938a4577 (patch) | |
tree | e6f0aa68c15c069a18b6c44874775fd094888906 /psp | |
parent | 5b5a4db6c2963ba72a3adcace6ec055ac65f2f3d (diff) | |
download | picogpsp-5bee4d66c2e461b3a4e804b2806bdea3938a4577.tar.gz picogpsp-5bee4d66c2e461b3a4e804b2806bdea3938a4577.tar.bz2 picogpsp-5bee4d66c2e461b3a4e804b2806bdea3938a4577.zip |
Do not use stack in mips stubs
No need for it (faster) and avoid mis-aligning it across calls
Diffstat (limited to 'psp')
-rw-r--r-- | psp/mips_stub.S | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/psp/mips_stub.S b/psp/mips_stub.S index 1c4ad4b..08151db 100644 --- a/psp/mips_stub.S +++ b/psp/mips_stub.S @@ -391,8 +391,7 @@ execute_read_spsr: # $4: Current pc execute_swi: - add $sp, $sp, -4 # push $ra - sw $ra, ($sp) + sw $ra, REG_SAVE3($16) sw $4, SUPERVISOR_LR($16) # store next PC in the supervisor's LR collapse_flags # get cpsr in $2 sw $2, SUPERVISOR_SPSR($16) # save cpsr in SUPERVISOR_CPSR @@ -402,10 +401,10 @@ execute_swi: save_registers li $4, 3 # 3 is supervisor mode cfncall set_cpu_mode, 5 # set the CPU mode to supervisor + lw $ra, REG_SAVE3($16) restore_registers - lw $ra, ($sp) # pop $ra jr $ra # return - add $sp, $sp, 4 # fix stack (delay slot) + nop # $4: pc to restore to # returns in $4 @@ -420,15 +419,13 @@ execute_spsr_restore: lw $1, SPSR_BASE($2) # $1 = spsr[cpu_mode] sw $1, REG_CPSR($16) # cpsr = spsr[cpu_mode] extract_flags_body # extract flags from $1 - addiu $sp, $sp, -4 - sw $ra, ($sp) + sw $ra, REG_SAVE3($16) save_registers cfncall execute_spsr_restore_body, 6 # do the dirty work in this C function restore_registers - addu $4, $2, $0 # move return value to $4 - lw $ra, ($sp) + lw $ra, REG_SAVE3($16) jr $ra - addiu $sp, $sp, 4 + addu $4, $2, $0 # move return value to $4 no_spsr_restore: jr $ra |