MIPS64: Properly preserve $gp in art_quick_test_suspend
$gp register was restored in RESTORE_SAVE_EVERYTHING_CALLEE_SAVE_FRAME
with value from $t8, but $t8 has been clobbered in the meantime.
Calculation of $gp is done as a part of the macro
SETUP_SAVE_EVERYTHING_CALLEE_SAVE_FRAME. This allows us to use version
of .cpsetup where $gp is preserved on the stack, instead in another
register.
This fixes over 60 ART tests.
Additionally this suppresses assembler warnings for MIPS32 and MIPS64:
Warning: used $at without ".set noat"
Test: mma test-art-target-run-test on QEMU
Change-Id: Ic92680c3cb2a4405353b3640c836e92c0231bd15
diff --git a/runtime/arch/mips/quick_entrypoints_mips.S b/runtime/arch/mips/quick_entrypoints_mips.S
index b926bdf..9b24128 100644
--- a/runtime/arch/mips/quick_entrypoints_mips.S
+++ b/runtime/arch/mips/quick_entrypoints_mips.S
@@ -352,8 +352,11 @@
// Set up $gp, clobbering $ra and using the branch delay slot for a useful instruction.
bal 1f
+ .set push
+ .set noat
sw $at, 144($sp)
.cfi_rel_offset 1, 144
+ .set pop
1:
.cpload $ra
@@ -460,8 +463,11 @@
.cfi_restore 3
lw $v0, 148($sp)
.cfi_restore 2
+ .set push
+ .set noat
lw $at, 144($sp)
.cfi_restore 1
+ .set pop
addiu $sp, $sp, 256 # pop frame
.cfi_adjust_cfa_offset -256
diff --git a/runtime/arch/mips64/quick_entrypoints_mips64.S b/runtime/arch/mips64/quick_entrypoints_mips64.S
index 0a37909..3469de2 100644
--- a/runtime/arch/mips64/quick_entrypoints_mips64.S
+++ b/runtime/arch/mips64/quick_entrypoints_mips64.S
@@ -334,8 +334,6 @@
.cfi_rel_offset 31, 488
sd $s8, 480($sp)
.cfi_rel_offset 30, 480
- sd $gp, 472($sp)
- .cfi_rel_offset 28, 472
sd $t9, 464($sp)
.cfi_rel_offset 25, 464
sd $t8, 456($sp)
@@ -387,11 +385,13 @@
// Set up $gp, clobbering $ra and using the branch delay slot for a useful instruction.
bal 1f
+ .set push
+ .set noat
sd $at, 272($sp)
.cfi_rel_offset 1, 272
+ .set pop
1:
- // TODO: Can we avoid the unnecessary move $t8<-$gp?
- .cpsetup $ra, $t8, 1b
+ .cpsetup $ra, 472, 1b
// Save FP registers.
s.d $f31, 264($sp)
@@ -472,12 +472,11 @@
l.d $f0, 16($sp)
// Restore core registers.
+ .cpreturn
ld $ra, 488($sp)
.cfi_restore 31
ld $s8, 480($sp)
.cfi_restore 30
- ld $gp, 472($sp)
- .cfi_restore 28
ld $t9, 464($sp)
.cfi_restore 25
ld $t8, 456($sp)
@@ -526,10 +525,12 @@
.cfi_restore 3
ld $v0, 280($sp)
.cfi_restore 2
+ .set push
+ .set noat
ld $at, 272($sp)
.cfi_restore 1
+ .set pop
- .cpreturn
daddiu $sp, $sp, 496
.cfi_adjust_cfa_offset -496
.endm