|
From: | Richard Henderson |
Subject: | Re: [PATCH v1 3/8] target/riscv: Remove the hardcoded HGATP_MODE macro |
Date: | Mon, 5 Apr 2021 07:54:42 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
On 4/2/21 1:02 PM, Alistair Francis wrote:
Signed-off-by: Alistair Francis <alistair.francis@wdc.com> --- target/riscv/cpu_bits.h | 11 ----------- target/riscv/cpu_helper.c | 21 ++++++++++++++++----- 2 files changed, 16 insertions(+), 16 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
@@ -621,9 +626,15 @@ static void raise_mmu_exception(CPURISCVState *env, target_ulong address, get_field(env->satp, SATP_MODE) != VM_1_10_MBARE && !pmp_violation; } else { - page_fault_exceptions = - get_field(env->hgatp, HGATP_MODE) != VM_1_10_MBARE && - !pmp_violation; + if (riscv_cpu_is_32bit(env)) { + page_fault_exceptions = + get_field(env->hgatp, SATP32_MODE) != VM_1_10_MBARE && + !pmp_violation; + } else { + page_fault_exceptions = + get_field(env->hgatp, SATP64_MODE) != VM_1_10_MBARE && + !pmp_violation; + }
Looks like you could simplify this to extract the vm in each if branch, then do the comparison afterward.
if (first) { vm = ... } else if (32bit) { vm = ... } else { vm = ... } page_fault_exceptions = vm != VM_1_10_MBARE && !pmp_violation; r~
[Prev in Thread] | Current Thread | [Next in Thread] |