Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
target/riscv: Merge checks for reserved pte flags
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-Id: <20230325105429.1142530-24-richard.henderson@linaro.org>
Message-Id: <20230412114333.118895-24-richard.henderson@linaro.org>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
rth7680 authored and alistair23 committed May 5, 2023
1 parent 356c833 commit a9d2e3e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions target/riscv/cpu_helper.c
Expand Up @@ -962,14 +962,14 @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
/* Reserved without Svpbmt. */
return TRANSLATE_FAIL;
}
if ((pte & (PTE_R | PTE_W | PTE_X)) == PTE_W) {
/* Reserved leaf PTE flags: PTE_W */
return TRANSLATE_FAIL;
}
if ((pte & (PTE_R | PTE_W | PTE_X)) == (PTE_W | PTE_X)) {
/* Reserved leaf PTE flags: PTE_W + PTE_X */

/* Check for reserved combinations of RWX flags. */
switch (pte & (PTE_R | PTE_W | PTE_X)) {
case PTE_W:
case PTE_W | PTE_X:
return TRANSLATE_FAIL;
}

if ((pte & PTE_U) &&
((mode != PRV_U) && (!sum || access_type == MMU_INST_FETCH))) {
/*
Expand Down

0 comments on commit a9d2e3e

Please sign in to comment.