[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-riscv] [Qemu-devel] [PATCH] riscv: rv32: Root page table addre
From: |
Bin Meng |
Subject: |
Re: [Qemu-riscv] [Qemu-devel] [PATCH] riscv: rv32: Root page table address can be larger than 32-bit |
Date: |
Thu, 1 Aug 2019 09:53:03 +0800 |
Hi Richard,
On Thu, Aug 1, 2019 at 1:35 AM Richard Henderson
<address@hidden> wrote:
>
> 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).
Regards,
Bin