diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-04-30 20:44:46 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-04-30 20:44:46 -0700 |
commit | 3d45ca302dbf5ac22cfac8fb025c05c735c35e26 (patch) | |
tree | bc0184068ab372b75d30feb6ef2f1e0465c67fa3 /p | |
parent | 0fc840489c21530a8bfdaecac1131fcd20bdaea2 (diff) | |
download | env-3d45ca302dbf5ac22cfac8fb025c05c735c35e26.zip env-3d45ca302dbf5ac22cfac8fb025c05c735c35e26.tar.gz env-3d45ca302dbf5ac22cfac8fb025c05c735c35e26.tar.bz2 |
ERET -> xRET; change memory map
Diffstat (limited to 'p')
-rw-r--r-- | p/link.ld | 2 | ||||
-rw-r--r-- | p/riscv_test.h | 28 |
2 files changed, 17 insertions, 13 deletions
@@ -2,7 +2,7 @@ OUTPUT_ARCH( "riscv" ) SECTIONS { - . = 0; + . = 0x80000000; .text.init : { *(.text.init) } .text : { *(.text) } .data ALIGN(0x1000) : { *(.data) } diff --git a/p/riscv_test.h b/p/riscv_test.h index cdc256e..903f23f 100644 --- a/p/riscv_test.h +++ b/p/riscv_test.h @@ -91,18 +91,21 @@ _start: \ /* reset vector */ \ j reset_vector; \ - /* NMI vector */ \ - j other_exception; \ - /* trap vector */ \ +trap_vector: \ /* test whether the test came from pass/fail */ \ - la t5, ecall; \ - csrr t6, mepc; \ + csrr t5, mcause; \ + li t6, CAUSE_USER_ECALL; \ + beq t5, t6, write_tohost; \ + li t6, CAUSE_SUPERVISOR_ECALL; \ + beq t5, t6, write_tohost; \ + li t6, CAUSE_MACHINE_ECALL; \ beq t5, t6, write_tohost; \ /* if an mtvec_handler is defined, jump to it */ \ la t5, mtvec_handler; \ - bnez t5, mtvec_handler; \ + beqz t5, 1f; \ + jr t5; \ /* was it an interrupt or an exception? */ \ - csrr t5, mcause; \ + 1: csrr t5, mcause; \ bgez t5, handle_exception; \ INTERRUPT_HANDLER; \ handle_exception: \ @@ -117,6 +120,8 @@ reset_vector: \ RISCV_MULTICORE_DISABLE; \ CHECK_XLEN; \ li TESTNUM, 0; \ + la t0, trap_vector; \ + csrw mtvec, t0; \ /* if an stvec_handler is defined, delegate exceptions to it */ \ la t0, stvec_handler; \ beqz t0, 1f; \ @@ -137,7 +142,7 @@ reset_vector: \ la t0, 1f; \ csrw mepc, t0; \ csrr a0, mhartid; \ - eret; \ + mret; \ 1: //----------------------------------------------------------------------- @@ -145,8 +150,7 @@ reset_vector: \ //----------------------------------------------------------------------- #define RVTEST_CODE_END \ -ecall: ecall; \ - j ecall + unimp //----------------------------------------------------------------------- // Pass/Fail Macro @@ -155,7 +159,7 @@ ecall: ecall; \ #define RVTEST_PASS \ fence; \ li TESTNUM, 1; \ - j ecall + ecall #define TESTNUM x28 #define RVTEST_FAIL \ @@ -163,7 +167,7 @@ ecall: ecall; \ 1: beqz TESTNUM, 1b; \ sll TESTNUM, TESTNUM, 1; \ or TESTNUM, TESTNUM, 1; \ - j ecall + ecall //----------------------------------------------------------------------- // Data Section Macro |