summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2023-09-27 22:25:06 +0200
committerMarcin Bukat <marcin.bukat@gmail.com>2023-09-27 22:49:09 +0200
commitbf8191421701b62da4be9bbd3f2ce8ac4309e101 (patch)
tree6bfb9319b4538090e2563656dcc41cc9b5de2c3c
parent4c533475d8ddf4c965a740e1c6cabde1a1af9a09 (diff)
downloadrockbox-bf8191421701b62da4be9bbd3f2ce8ac4309e101.tar.gz
rockbox-bf8191421701b62da4be9bbd3f2ce8ac4309e101.zip
hwstub: Force alignment of the context buffer
Exception handling code assumes at least word alignment of the context buffer. So far we were lucky that compiler placed it correctly but after compiler upgrade I was hit by the bug caused by missalignment of the context buffer. Credit goes to pamaury
-rw-r--r--utils/hwstub/stub/asm/mips/system.S27
1 files changed, 14 insertions, 13 deletions
diff --git a/utils/hwstub/stub/asm/mips/system.S b/utils/hwstub/stub/asm/mips/system.S
index 7f619c6edd..9e843f7f15 100644
--- a/utils/hwstub/stub/asm/mips/system.S
+++ b/utils/hwstub/stub/asm/mips/system.S
@@ -25,6 +25,7 @@
25 * the code can register a "longjmp" buffer to restore the context in case of 25 * the code can register a "longjmp" buffer to restore the context in case of
26 * fault */ 26 * fault */
27.data 27.data
28.align 4
28.global exception_jmp_ctx_ptr 29.global exception_jmp_ctx_ptr
29exception_jmp_ctx_ptr: 30exception_jmp_ctx_ptr:
30/* buffer contains in order: s0-s7, sp, s8, ra */ 31/* buffer contains in order: s0-s7, sp, s8, ra */
@@ -56,19 +57,19 @@ set_exception_jmp:
56 * a0: exception type (EXCEPTION_*) */ 57 * a0: exception type (EXCEPTION_*) */
57.global restore_exception_jmp 58.global restore_exception_jmp
58restore_exception_jmp: 59restore_exception_jmp:
59 la k1, exception_jmp_ctx_ptr 60 la v0, exception_jmp_ctx_ptr
60 lw s0, 0(k1) 61 lw s0, 0(v0)
61 lw s1, 4(k1) 62 lw s1, 4(v0)
62 lw s2, 8(k1) 63 lw s2, 8(v0)
63 lw s3, 12(k1) 64 lw s3, 12(v0)
64 lw s4, 16(k1) 65 lw s4, 16(v0)
65 lw s5, 20(k1) 66 lw s5, 20(v0)
66 lw s6, 24(k1) 67 lw s6, 24(v0)
67 lw s7, 28(k1) 68 lw s7, 28(v0)
68 lw sp, 32(k1) 69 lw sp, 32(v0)
69 lw s8, 36(k1) 70 lw s8, 36(v0)
70 lw k1, 40(k1) 71 lw v0, 40(v0)
71 mtc0 k1, C0_EPC 72 mtc0 v0, C0_EPC
72#ifdef CONFIG_JZ4760B 73#ifdef CONFIG_JZ4760B
73 /* XBurst has a 3 interlock cycle delay, but we don't know if the interlock 74 /* XBurst has a 3 interlock cycle delay, but we don't know if the interlock
74 * works with eret */ 75 * works with eret */