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

2024-09-08 Thread Alistair Francis
On Tue, Aug 13, 2024 at 8:24 PM Andrew Jones wrote: > > On Tue, Aug 13, 2024 at 10:21:13AM GMT, Philippe Mathieu-Daudé wrote: > > On 13/8/24 10:00, Andrew Jones wrote: > > > On Tue, Aug 13, 2024 at 05:43:07PM GMT, Richard Henderson wrote: > > > > On 8/13/24 17:13, Andrew Jones wrote: > > > > > C d

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

2024-08-13 Thread Andrew Jones
On Tue, Aug 13, 2024 at 10:21:13AM GMT, Philippe Mathieu-Daudé wrote: > On 13/8/24 10:00, Andrew Jones wrote: > > On Tue, Aug 13, 2024 at 05:43:07PM GMT, Richard Henderson wrote: > > > On 8/13/24 17:13, Andrew Jones wrote: > > > > C doesn't extend the sign bit for unsigned types since there isn't a

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

2024-08-13 Thread Philippe Mathieu-Daudé
On 13/8/24 10:00, Andrew Jones wrote: On Tue, Aug 13, 2024 at 05:43:07PM GMT, Richard Henderson wrote: On 8/13/24 17:13, 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

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

2024-08-13 Thread Andrew Jones
On Tue, Aug 13, 2024 at 05:43:07PM GMT, Richard Henderson wrote: > On 8/13/24 17:13, 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.

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

2024-08-13 Thread Richard Henderson
On 8/13/24 17:13, 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 b

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

2024-08-13 Thread Andrew Jones
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 b