[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-riscv] [Qemu-devel] [PATCH] riscv: rv32: Root page table addre
Re: [Qemu-riscv] [Qemu-devel] [PATCH] riscv: rv32: Root page table address can be larger than 32-bit
Thu, 1 Aug 2019 09:53:03 +0800
On Thu, Aug 1, 2019 at 1:35 AM Richard Henderson
> On 7/31/19 5:45 AM, Bin Meng wrote:
> > - target_ulong base;
> > + hwaddr base;
> > - target_ulong pte_addr = base + idx * ptesize;
> > + hwaddr pte_addr = base + idx * ptesize;
> I believe that you either need
> base + (hwaddr)idx * ptesize
> or change the type of idx to hwaddr above.
> Otherwise the multiply overflows before it gets promoted with the add.
I am not sure how (idx * ptesize) could overflow. It represents the
offset by a page table which is [0, 4096).