File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,13 @@ int main()
5151 * track) */
5252 TEST_LOGGER ("MISALIGNED STORE TEST PASSED!\n" );
5353
54- /* misalign instuction fetch */
54+ /*
55+ * misalign instuction fetch
56+ *
57+ * MUST disable ENABLE_EXT_C when building rv32emu before running this test
58+ * since jalr instruction only check misaligned if lacks of compressed
59+ * instruction support
60+ */
5561 misalign_func ();
5662 /* execute the registered trap handler is considered a pass (use gdb to
5763 * track) */
Original file line number Diff line number Diff line change @@ -19,27 +19,27 @@ misalign_func:
1919.section .text
2020.global _start
2121_start:
22- call main
22+ call main
2323 j exit
2424
2525# Assume three traps are delegated to supervisor,
2626# so handle them using supervisor CSR
2727.global misalign_trap_handler
2828misalign_trap_handler:
2929 csrr t0, scause
30-
30+
3131 # Check for misaligned instruction fetch
3232 li t1, CAUSE_MISALIGNED_INSN_FETCH
3333 beq t0, t1, misaligned_insn_fetch_handler
34-
34+
3535 # Check for misaligned load
3636 li t1, CAUSE_MISALIGNED_LOAD
3737 beq t0, t1, misaligned_load_handler
38-
38+
3939 # Check for misaligned store
4040 li t1, CAUSE_MISALIGNED_STORE
4141 beq t0, t1, misaligned_store_handler
42-
42+
4343 # If none of the above, exit failed
4444fail:
4545 li a0, 1
@@ -67,4 +67,3 @@ misaligned_store_handler:
6767 addi t0, t0, 4
6868 csrw sepc, t0
6969 sret
70-
You can’t perform that action at this time.
0 commit comments