diff options
author | Ryan Buchner <ryan.buchner@arilinc.com> | 2022-05-07 22:36:02 -0700 |
---|---|---|
committer | Ryan Buchner <ryan.buchner@arilinc.com> | 2022-05-11 10:33:26 -0700 |
commit | ccfeaa99732479b029ce95fc9b09968c7f3b1f64 (patch) | |
tree | 4f547dd5c1165a25b0af4b8a6d5de86df85079fc | |
parent | 996634f0be06099401eec5165428b3ecc4a72fb6 (diff) | |
download | riscv-isa-sim-ccfeaa99732479b029ce95fc9b09968c7f3b1f64.zip riscv-isa-sim-ccfeaa99732479b029ce95fc9b09968c7f3b1f64.tar.gz riscv-isa-sim-ccfeaa99732479b029ce95fc9b09968c7f3b1f64.tar.bz2 |
Check for reserved PBMT values during tablewalks and fault if found
See #990.
-rw-r--r-- | riscv/mmu.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/riscv/mmu.cc b/riscv/mmu.cc index 3868c70..d0a55f0 100644 --- a/riscv/mmu.cc +++ b/riscv/mmu.cc @@ -302,6 +302,8 @@ reg_t mmu_t::s2xlate(reg_t gva, reg_t gpa, access_type type, access_type trap_ty break; } else if (!pbmte && (pte & PTE_PBMT)) { break; + } else if ((pte & PTE_PBMT) == PTE_PBMT) { + break; } else if (PTE_TABLE(pte)) { // next level of page table if (pte & (PTE_D | PTE_A | PTE_U | PTE_N | PTE_PBMT)) break; @@ -393,6 +395,8 @@ reg_t mmu_t::walk(reg_t addr, access_type type, reg_t mode, bool virt, bool hlvx break; } else if (!pbmte && (pte & PTE_PBMT)) { break; + } else if ((pte & PTE_PBMT) == PTE_PBMT) { + break; } else if (PTE_TABLE(pte)) { // next level of page table if (pte & (PTE_D | PTE_A | PTE_U | PTE_N | PTE_PBMT)) break; |