diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/references/WALLY-mmu-sv32-01.reference_output b/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/references/WALLY-mmu-sv32-01.reference_output index aa60ea21..011aec86 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/references/WALLY-mmu-sv32-01.reference_output +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/references/WALLY-mmu-sv32-01.reference_output @@ -4,6 +4,7 @@ beef0033 beef0077 beef0099 beef0440 +beef0bb0 11100393 00008067 beef0055 @@ -35,8 +36,11 @@ beef0110 0000000f 0000000c 00000bad -beef0770 # Test 8.3.1.3.5: check successful read/write when A=0 and SVADU=1 -beef0aa0 # Test 8.3.1.3.6: check successful read/write when D=0 and SVADU=1 +0000000f +0000000d +00000bad +0000000f +beef0bb0 beef0077 # Test 12.3.1.4.1: successful read back of saved value with new memory mapping 00000009 # Test 12.3.1.5.1: ecall from going to m mode from s mode 00000000 # previous value of mprv before being set diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-mmu-sv32-01.S b/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-mmu-sv32-01.S index a8d9ae7c..0faa5b2e 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-mmu-sv32-01.S +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-mmu-sv32-01.S @@ -24,7 +24,7 @@ #include "WALLY-TEST-LIB-32.h" RVTEST_ISA("RV32I") -RVTEST_CASE(0,"//check ISA:=regex(.*32.*);check ISA:=regex(.*I.*); def Drvtest_mtrap_routine=True;def TEST_CASE_1=True; def NO_SAIL=True;",mmu) +RVTEST_CASE(0,"//check ISA:=regex(.*32.*);check ISA:=regex(.*I.*); def Drvtest_mtrap_routine=True;def TEST_CASE_1=True;",mmu) INIT_TESTS @@ -86,6 +86,7 @@ test_cases: .4byte 0x800E3130, 0xBEEF0077, write32_test # 8.3.1.3.2 .4byte 0x808017E0, 0xBEEF0099, write32_test # 8.3.1.1.4 kilopage .4byte 0x80805EA0, 0xBEEF0440, write32_test # 8.3.1.3.3 +.4byte 0x80803AA0, 0xBEEF0BB0, write32_test # 8.3.1.3.7 .4byte 0x8000FFA0, 0x11100393, write32_test # write executable code for "li x7, 0x111; ret" to executable region. .4byte 0x8000FFA4, 0x00008067, write32_test # Used for 8.3.1.3.1, 8.3.1.3.2 @@ -97,6 +98,7 @@ test_cases: .4byte 0x800E3130, 0xBEEF0077, read32_test .4byte 0x808017E0, 0xBEEF0099, read32_test .4byte 0x80805EA0, 0xBEEF0440, read32_test +.4byte 0x80803AA0, 0xBEEF0BB0, read32_test .4byte 0x8000FFA0, 0x11100393, read32_test .4byte 0x8000FFA4, 0x00008067, read32_test @@ -156,13 +158,16 @@ test_cases: # *** fetches on pages with X = 1 already tested in 8.3.1.3.1 .4byte 0xBFFDE0, 0xbad, executable_test # instr page fault when X=0 +# In the following two tests, SVADU is not supported, so the software handles the A/D bits +# Since SVADU is 0, Accesses to A/D=0 causes a fault for the trap handler to fix those bits + # test 8.3.1.3.6 Accessed flag == 0 -.4byte 0x3020, 0xBEEF0770, write32_test # Write success when A=0 and SVADU is enabled -.4byte 0x3020, 0xBEEF0770, read32_test # Read success when A=0 and SVADU is enabled +.4byte 0x3020, 0xBEEF0770, write32_test # store page fault when A=0 +.4byte 0x3808, 0xBEEF0990, read32_test # load page fault when A=0 # test 8.3.1.3.7 Dirty flag == 0 -.4byte 0x4658, 0xBEEF0AA0, write32_test # write successs when D=0 and SVADU is enabled -.4byte 0x4658, 0xBEEF0AA0, read32_test # read success when D=0 +.4byte 0x4658, 0xBEEF0AA0, write32_test # store page fault when D=0 +.4byte 0x4AA0, 0xBEEF0BB0, read32_test # read success when D=0 # =========== test 8.3.1.4 SATP Register =========== diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/references/WALLY-mmu-sv39-01.reference_output b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/references/WALLY-mmu-sv39-01.reference_output index 64b2e79d..00160424 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/references/WALLY-mmu-sv39-01.reference_output +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/references/WALLY-mmu-sv39-01.reference_output @@ -12,6 +12,8 @@ beef0099 # Read test success from confirming writes of known values 0220dead beef0440 # Read test success from confirming writes of known values 0330dead +beef0bb0 # Read test success from confirming writes of known values +0440dead beef0000 # Test 12.3.1.1.4: Read test success from checking translation works 0000dead beef0055 # Read test success from checking translation works @@ -84,9 +86,15 @@ beef0110 # Test 12.3.1.3.4: read test success 00000000 00000bad 00000000 -beef0770 # Test 8.3.1.3.5: check successful read/write when A=0 and SVADU=1 -0990dead -beef0aa0 # Test 8.3.1.3.6: check successful read/write when D=0 and SVADU=1 +0000000f # Test 12.3.1.3.6: write test with page fault +00000000 +0000000d # read test with page fault +00000000 +00000bad +00000000 +0000000f # Test 12.3.1.3.7: write test with page fault +00000000 +beef0bb0 # read test success 0440dead beef0000 # Test 12.3.1.4.1: read test success from new page table mapping 0000dead diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/references/WALLY-mmu-sv48-01.reference_output b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/references/WALLY-mmu-sv48-01.reference_output index 7982cdeb..6a53dd66 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/references/WALLY-mmu-sv48-01.reference_output +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/references/WALLY-mmu-sv48-01.reference_output @@ -14,6 +14,8 @@ beef0099 # read 6 0220dead beef0440 # read 7 0330dead +beef0bb0 # read 8 +0440dead beef0cc0 # Test 12.3.1.1.4: 4 read test successes 0ee0dead beef0000 # read 2 @@ -91,10 +93,16 @@ beef0110 # Test 12.3.1.3.4: read test success 0000000c # Test 12.3.1.3.5: executable test with page fault 00000000 00000bad -00000000 -beef0770 # Test 8.3.1.3.5: check successful read/write when A=0 and SVADU=1 -0990dead -beef0aa0 # Test 8.3.1.3.6: check successful read/write when D=0 and SVADU=1 +00000000 +0000000f # Test 12.3.1.3.6: write test with page fault +00000000 +0000000d # read test with page fault +00000000 +00000bad +00000000 +0000000f # Test 12.3.1.3.7: write test with page fault +00000000 +beef0bb0 # read test success 0440dead beef0000 # Test 12.3.1.4.1: read test success on new page table mapping 0000dead diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-mmu-sv39-01.S b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-mmu-sv39-01.S index d59b0788..ed11d0bd 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-mmu-sv39-01.S +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-mmu-sv39-01.S @@ -23,7 +23,7 @@ #include "WALLY-TEST-LIB-64.h" RVTEST_ISA("RV64I") -RVTEST_CASE(0,"//check ISA:=regex(.*64.*);check ISA:=regex(.*I.*);def TEST_CASE_1=True;def NO_SAIL=True",mmu-sv39) +RVTEST_CASE(0,"//check ISA:=regex(.*64.*);check ISA:=regex(.*I.*);def TEST_CASE_1=True;",mmu-sv39) INIT_TESTS @@ -100,6 +100,7 @@ test_cases: .8byte 0x80205AA0, 0x0000806711100393, write64_test# 8.3.1.3.5 write same executable code .8byte 0x80201888, 0x0220DEADBEEF0099, write64_test# 8.3.1.1.4 .8byte 0x84212348, 0x0330DEADBEEF0440, write64_test# 8.3.1.3.3 +.8byte 0x80203AA0, 0x0440DEADBEEF0BB0, write64_test# 8.3.1.3.7 # test 8.3.1.1.3 read values back from Paddrs without translation (this also verifies the previous test) .8byte 0x0, 0x0, goto_baremetal# satp.MODE = baremetal / no translation. @@ -110,6 +111,7 @@ test_cases: .8byte 0x80203130, 0x0110DEADBEEF0077, read64_test .8byte 0x80201888, 0x0220DEADBEEF0099, read64_test .8byte 0x84212348, 0x0330DEADBEEF0440, read64_test +.8byte 0x80203AA0, 0x0440DEADBEEF0BB0, read64_test # test 8.3.1.1.4 check translation works in sv39, read the same values from previous tests, this time with Vaddrs .8byte 0x8000D, 0x0, goto_sv39 # satp.MODE = sv39, with base page table PPN = 0x8000D and ASID = 0. current VPN: gigapage at 0x80000000. @@ -171,13 +173,16 @@ test_cases: # *** fetches on pages with X = 1 already tested in 8.3.1.3.1 .8byte 0x5AA0, 0x1, executable_test # instr page fault when X=0 +# In the following two tests, SVADU is not supported, so the software handles the A/D bits +# Since SVADU is 0, Accesses to A/D=0 causes a fault for the trap handler to fix those bits + # test 8.3.1.3.6 Accessed flag == 0 -.8byte 0x36D0, 0x0990DEADBEEF0770, write64_test # Write success when A=0 and SVADU is enabled -.8byte 0x36D0, 0x0990DEADBEEF0770, read64_test # Read success when A=0 and SVADU is enabled +.8byte 0x36D0, 0x0990DEADBEEF0770, write64_test# store page fault when A=0 +.8byte 0x3AB8, 0x0990DEADBEEF0990, read64_test# load page fault when A=0 # test 8.3.1.3.7 Dirty flag == 0 -.8byte 0x4658, 0x0440DEADBEEF0AA0, write64_test # Write success when D=0 and SVADU is enabled -.8byte 0x4658, 0x0440DEADBEEF0AA0, read64_test # read success when D=0 +.8byte 0x4658, 0x0440DEADBEEF0AA0, write64_test# store page fault when D=0 +.8byte 0x4AA0, 0x0440DEADBEEF0BB0, read64_test# read success when D=0 # =========== test 8.3.1.4 SATP Register =========== diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-mmu-sv48-01.S b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-mmu-sv48-01.S index 58df6d64..4948abe2 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-mmu-sv48-01.S +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-mmu-sv48-01.S @@ -23,7 +23,7 @@ #include "WALLY-TEST-LIB-64.h" RVTEST_ISA("RV64I") -RVTEST_CASE(0,"//check ISA:=regex(.*64.*);check ISA:=regex(.*I.*);def TEST_CASE_1=True;def NO_SAIL=True",sv48) +RVTEST_CASE(0,"//check ISA:=regex(.*64.*);check ISA:=regex(.*I.*);def TEST_CASE_1=True;",sv48) INIT_TESTS @@ -114,6 +114,7 @@ test_cases: .8byte 0x80200130, 0x0110DEADBEEF0077, write64_test # 8.3.1.3.2 .8byte 0x85212348, 0x0330DEADBEEF0440, write64_test # 8.3.1.3.3 .8byte 0x88888000, 0x0000806711100393, write64_test # 8.3.1.3.5 write same executable code +.8byte 0x80203AA0, 0x0440DEADBEEF0BB0, write64_test # 8.3.1.3.7 # test 8.3.1.1.3 read values back from Paddrs without translation (this also verifies the previous test) .8byte 0x0, 0x0, goto_baremetal # satp.MODE = baremetal / no translation. @@ -125,6 +126,7 @@ test_cases: .8byte 0x80200130, 0x0110DEADBEEF0077, read64_test .8byte 0x80201888, 0x0220DEADBEEF0099, read64_test .8byte 0x85212348, 0x0330DEADBEEF0440, read64_test +.8byte 0x80203AA0, 0x0440DEADBEEF0BB0, read64_test # test 8.3.1.1.4 check translation works in sv48, read the same values from previous tests, this time with Vaddrs .8byte 0x8000D, 0x0, goto_sv48 # satp.MODE = sv48, with base page table PPN = 0x8000D and ASID = 0. current VPN: megapage at 0x80000000. Nothing written to output @@ -187,13 +189,16 @@ test_cases: # executes on pages with X = 1 already tested in 8.3.1.3.1 .8byte 0x010088888000, 0x2, executable_test # execute fault when X=0 +# In the following two tests, SVADU is not supported, so the software handles the A/D bits +# Since SVADU is 0, Accesses to A/D=0 causes a fault for the trap handler to fix those bits + # test 8.3.1.3.6 Accessed flag == 0 -.8byte 0x802036D0, 0x0990DEADBEEF0770, write64_test # Write success when A=0 and SVADU is enabled -.8byte 0x802036D0, 0x0990DEADBEEF0770, read64_test # Read success when A=0 and SVADU is enabled +.8byte 0x802036D0, 0x0990DEADBEEF0770, write64_test # write fault when A=0 +.8byte 0x80203AB8, 0x0990DEADBEEF0990, read64_test# read fault when A=0 # test 8.3.1.3.7 Dirty flag == 0 -.8byte 0x80204658, 0x0440DEADBEEF0AA0, write64_test # Write success when D=0 and SVADU is enabled -.8byte 0x80204658, 0x0440DEADBEEF0AA0, read64_test # read success when D=0 +.8byte 0x80204658, 0x0440DEADBEEF0AA0, write64_test # write fault when D=0 +.8byte 0x80204AA0, 0x0440DEADBEEF0BB0, read64_test# read success when D=0 # =========== test 8.3.1.4 SATP Register ===========