Re: [PATCH] target/riscv/pmp: fix NAPOT range computation overflow

2022-04-18 Thread Alistair Francis
On Sat, Apr 9, 2022 at 2:25 AM Nicolas Pitre wrote: > > There is an overflow with the current code where a pmpaddr value of > 0x1fff is decoded as sa=0 and ea=0 whereas it should be sa=0 and > ea=0x. > > Fix that by simplifying the computation. There is in fact no need for > ctz64() no

Re: [PATCH] target/riscv/pmp: fix NAPOT range computation overflow

2022-04-13 Thread Alistair Francis
On Sat, Apr 9, 2022 at 2:25 AM Nicolas Pitre wrote: > > There is an overflow with the current code where a pmpaddr value of > 0x1fff is decoded as sa=0 and ea=0 whereas it should be sa=0 and > ea=0x. > > Fix that by simplifying the computation. There is in fact no need for > ctz64() no

[PATCH] target/riscv/pmp: fix NAPOT range computation overflow

2022-04-08 Thread Nicolas Pitre
There is an overflow with the current code where a pmpaddr value of 0x1fff is decoded as sa=0 and ea=0 whereas it should be sa=0 and ea=0x. Fix that by simplifying the computation. There is in fact no need for ctz64() nor special case for -1 to achieve proper results. Signed-off-by