Skip to content

Commit fd01e46

Browse files
committed
ma_addr: permit access faults in lieu of misaligned exceptions
1 parent 06ca28c commit fd01e46

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

isa/rv64mi/ma_addr.S

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RVTEST_CODE_BEGIN
2020

2121
# indicate it's a load test
2222
li s1, CAUSE_MISALIGNED_LOAD
23+
li s2, CAUSE_LOAD_ACCESS
2324

2425
#define SEXT(x, n) ((-((x) >> ((n)-1)) << (n)) | ((x) & ((1 << (n))-1)))
2526

@@ -56,6 +57,7 @@ RVTEST_CODE_BEGIN
5657

5758
# indicate it's a store test
5859
li s1, CAUSE_MISALIGNED_STORE
60+
li s2, CAUSE_STORE_ACCESS
5961

6062
/* Check that a misaligned store has some effect and takes no exception,
6163
or takes no effect and generates an exception. This is not very
@@ -96,7 +98,10 @@ RVTEST_CODE_BEGIN
9698
.global mtvec_handler
9799
mtvec_handler:
98100
csrr t0, mcause
99-
bne t0, s1, fail
101+
beq t0, s1, 1f
102+
beq t0, s2, 1f
103+
j fail
104+
1:
100105

101106
csrr t0, mbadaddr
102107
beqz t0, 1f

0 commit comments

Comments
 (0)