qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] target/riscv32: Fix masking of physical address


From: Richard Henderson
Subject: Re: [PATCH v2] target/riscv32: Fix masking of physical address
Date: Mon, 9 Sep 2024 08:46:39 -0700
User-agent: Mozilla Thunderbird

On 9/9/24 01:32, Andrew Jones wrote:
C doesn't extend the sign bit for unsigned types since there isn't a
sign bit to extend. This means a promotion of a u32 to a u64 results
in the upper 32 bits of the u64 being zero. If that result is then
used as a mask on another u64 the upper 32 bits will be cleared. rv32
physical addresses may be up to 34 bits wide, so we don't want to
clear the high bits while page aligning the address. The fix is to
use hwaddr for the mask, which, even on rv32, is 64-bits wide.

Fixes: af3fc195e3c8 ("target/riscv: Change the TLB page size depends on PMP 
entries.")
Signed-off-by: Andrew Jones<ajones@ventanamicro.com>
---
-v2: Switch from signed long to hwaddr

  target/riscv/cpu_helper.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]