From 28f5b5b6ed0de4e6cf4d84b692bc32dc0fe6b23a Mon Sep 17 00:00:00 2001 From: David Harris Date: Thu, 27 Feb 2025 03:28:18 -0800 Subject: [PATCH 1/2] Fixed more MMU tests --- tests/coverage/tlbMP.S | 11 +++++------ tests/coverage/tlbmisc.S | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/tests/coverage/tlbMP.S b/tests/coverage/tlbMP.S index 5f35c5879..7c7a76bbd 100644 --- a/tests/coverage/tlbMP.S +++ b/tests/coverage/tlbMP.S @@ -29,7 +29,6 @@ #include "WALLY-init-lib.h" -# run-elf.bash find this in project description main: # Page table root address at 0x80010000 li t5, 0x9000000000080010 @@ -64,12 +63,12 @@ finished: .align 16 # Page table situated at 0x80010000 pagetable: - .8byte 0x200044C1 + .8byte 0x20004401 .align 12 - .8byte 0x00000000200048C1 - .8byte 0x00000000200048C1 - .8byte 0x00000000200048C1 + .8byte 0x0000000020004801 + .8byte 0x0000000020004801 + .8byte 0x0000000020004801 .align 12 // megapages starting at 8000 0000 going to 8480 0000 (32*2 MiB beyond that) @@ -154,7 +153,7 @@ pagetable: .8byte 0x20F000CF .8byte 0x20F800CF - .8byte 0x20004CC1 + .8byte 0x20004C01 // Kilopage entry, for addresses from 8400, 0000 to 841F, FFFF // point to ... diff --git a/tests/coverage/tlbmisc.S b/tests/coverage/tlbmisc.S index 9e660bdc4..edc2b5ec5 100644 --- a/tests/coverage/tlbmisc.S +++ b/tests/coverage/tlbmisc.S @@ -330,17 +330,17 @@ fixsatptraphandler: .align 16 # root Page table situated at 0x80010000 pagetable: - .8byte 0x200044C1 # VA 0x00000000-0x7F_FFFFFFFF: PTE at 0x80011000 C1 dirty, accessed, valid + .8byte 0x20004401 # VA 0x00000000-0x7F_FFFFFFFF: PTE at 0x80011000 01 valid .8byte 0x00000000000010CF # misaligned terapage at 0x80_00000000 .8byte 0x00000000000000CF # access fault terapage at 0x100_00000000 - .8byte 0x40000000200044C1 # Bad PBMT at VA 0x180_0000000 + .8byte 0x4000000020004401 # Bad PBMT at VA 0x180_0000000 # next page table at 0x80011000 .align 12 .8byte 0x00000000000010CF # misaligned gigapage at 0x00000000 - .8byte 0x00000000200058C1 # PTE for pages at 0x40000000 pointing to 0x80150000 - .8byte 0x00000000200048C1 # gigapage at 0x80000000 pointing to 0x80120000 - .8byte 0x00000000000000C1 # gigapage at VA 0xC0000000 causes access fault + .8byte 0x0000000020005801 # PTE for pages at 0x40000000 pointing to 0x80150000 + .8byte 0x0000000020004801 # gigapage at 0x80000000 pointing to 0x80120000 + .8byte 0x0000000000000001 # gigapage at VA 0xC0000000 causes access fault .8byte 0x0 .8byte 0x0 .8byte 0x0 @@ -351,16 +351,16 @@ SpecialPage: # Next page table at 0x80012000 for gigapage at 0x80000000 .align 12 - .8byte 0x0000000020004CC1 # for VA starting at 80000000 (pointer to NAPOT 64 KiB pages Page table at 80013000) + .8byte 0x0000000020004C01 # for VA starting at 80000000 (pointer to NAPOT 64 KiB pages Page table at 80013000) .8byte 0x0000000020014CCF # for VA starting at 80200000 (misaligned megapage) - .8byte 0x00000000200050C1 # for VA starting at 80400000 (bad PBMT pages page table at 0x80014000) - .8byte 0x4000000020004CC1 # for VA starting at 80600000 (bad entry: nonleaf PTE can't have PBMT != 0) - .8byte 0x00000000200054C1 # for VA starting at 80800000 (testing rwx permissiosn with cbom/cboz . page table at 0x80015000) - .8byte 0x0000000020004CC1 # for VA starting at 80A00000 (pointer to NAPOT 64 KiB pages like at 80000000. page table at 0x80013000) + .8byte 0x0000000020005001 # for VA starting at 80400000 (bad PBMT pages page table at 0x80014000) + .8byte 0x4000000020004C01 # for VA starting at 80600000 (bad entry: nonleaf PTE can't have PBMT != 0) + .8byte 0x0000000020005401 # for VA starting at 80800000 (testing rwx permissiosn with cbom/cboz . page table at 0x80015000) + .8byte 0x0000000020004C01 # for VA starting at 80A00000 (pointer to NAPOT 64 KiB pages like at 80000000. page table at 0x80013000) .8byte 0x0F00000020004CCF # for VA starting at 80C00000 (bad reserved field in bits 60:54) .8byte 0x000000002000000F # for VA starting at 80E00000 (megapage not dirty or accessed) - .8byte 0x0000000000004CC1 # for VA starting at 81000000 (nonleaf pointing to unimplemented memory causes access fault) - .8byte 0x4000000020004CC1 # for VA starting at 81200000 (nonleaf with PBMT nonzero causes page fault) + .8byte 0x0000000000004C01 # for VA starting at 81000000 (nonleaf pointing to unimplemented memory causes access fault) + .8byte 0x4000000020004C01 # for VA starting at 81200000 (nonleaf with PBMT nonzero causes page fault) .8byte 0x00000000000000CF # for VA starting at 81400000 (megapage with access fault) .8byte 0x0000000020004CC1 .8byte 0x0000000020004CC1 From d7a026e736e4fed1e946d2be2451d36fd664e372 Mon Sep 17 00:00:00 2001 From: David Harris Date: Thu, 27 Feb 2025 03:37:23 -0800 Subject: [PATCH 2/2] Fixed more MMU tests with bad non-leaf A/D PTE bits --- tests/coverage/hptwAccessFault.S | 12 +- tests/coverage/tlbNAPOT.S | 234 +++++++++++++++---------------- 2 files changed, 123 insertions(+), 123 deletions(-) diff --git a/tests/coverage/hptwAccessFault.S b/tests/coverage/hptwAccessFault.S index 86f681d21..cb918a6e3 100644 --- a/tests/coverage/hptwAccessFault.S +++ b/tests/coverage/hptwAccessFault.S @@ -85,17 +85,17 @@ finished: .align 16 # Page table situated at 0x80010000 pagetable: - .8byte 0x200044C1 - .8byte 0x300044C1 # point to invalid region of physical memory + .8byte 0x20004401 + .8byte 0x30004401 # point to invalid region of physical memory .align 12 - .8byte 0x00000040200048C1 - .8byte 0x00000000200048C1 - .8byte 0x00000000200048C1 + .8byte 0x0000004020004801 + .8byte 0x0000000020004801 + .8byte 0x0000000020004801 .align 12 - .8byte 0x0000000020004CC1 + .8byte 0x0000000020004C01 .align 12 #80000000 diff --git a/tests/coverage/tlbNAPOT.S b/tests/coverage/tlbNAPOT.S index c38472ad0..859476d23 100644 --- a/tests/coverage/tlbNAPOT.S +++ b/tests/coverage/tlbNAPOT.S @@ -138,56 +138,56 @@ ipf: .align 16 # root Page table situated at 0x80010000 pagetable: - .8byte 0x200044C1 // old page table was 200040 which just pointed to itself! wrong + .8byte 0x20004401 // old page table was 200040 which just pointed to itself! wrong # next page table at 0x80011000 .align 12 .8byte 0x0000000000000000 # gigapage at 0x00000000 - .8byte 0x00000000200058C1 # gigapage at 0x40000000 used for non-NAPOT with PPN bit 3 set - .8byte 0x00000000200048C1 # gigapage at 0x80000000 used for testing NAPOT huge pages - .8byte 0x00000000200050C1 # gigapage at 0xC0000000 mapped to ill-formed NAPOT with wrong PPN + .8byte 0x0000000020005801 # gigapage at 0x40000000 used for non-NAPOT with PPN bit 3 set + .8byte 0x0000000020004801 # gigapage at 0x80000000 used for testing NAPOT huge pages + .8byte 0x0000000020005001 # gigapage at 0xC0000000 mapped to ill-formed NAPOT with wrong PPN # Next page table at 0x80012000 for gigapage at 0x80000000 .align 12 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 - .8byte 0x0000000020004CC1 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 + .8byte 0x0000000020004C01 # Leaf page table at 0x80013000 with NAPOT pages .align 12 @@ -262,44 +262,44 @@ pagetable: # Next page table at 0x80014000: mega-sized, pointing to malformed NAPOT for gigapage at 0xC9000000 .align 12 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 - .8byte 0x00000000200054C1 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 + .8byte 0x0000000020005401 # Leaf page table at 0x80015000 with malformed NAPOT pages (wrong PPN) starting at 0xC0000000 .align 12 @@ -352,43 +352,43 @@ pagetable: # Next page table at 0x80016000: mega-sized, pointing to properly formed PTE with 1 in PPN bit 3 for gigapage at 0x40000000 .align 12 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 - .8byte 0x0000000020005CC1 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 + .8byte 0x0000000020005C01 # Leaf page table at 0x80017000 with properly formed PTE with bit 4 of PPN set but no NAPOT .align 12