target/riscv: leaf PTE check PTE_W missing

When permission bits R, W, and X in PTE all three are zero,
the PTE is a pointter to the next level of the page table;
otherwise, it is a leaf PTE. Here PTE_W is missed.

Change-Id: I82a4cc4e64280f0fcad75b20e51b617520aff29b
Signed-off-by: panciyan <panciyan@eswincomputing.com>
This commit is contained in:
panciyan 2023-03-23 02:45:42 +00:00
parent a01bd76e5c
commit 1479eca38f
1 changed files with 1 additions and 1 deletions

View File

@ -1975,7 +1975,7 @@ static int riscv_address_translate(struct target *target,
if (!(pte & PTE_V) || (!(pte & PTE_R) && (pte & PTE_W)))
return ERROR_FAIL;
if ((pte & PTE_R) || (pte & PTE_X)) /* Found leaf PTE. */
if ((pte & PTE_R) || (pte & PTE_W) || (pte & PTE_X)) /* Found leaf PTE. */
break;
i--;