QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [Qemu-devel] [PATCH] riscv: rv32: Root page table address can be larger than 32-bit
@ 2019-07-31 12:45 Bin Meng
  2019-07-31 17:35 ` Richard Henderson
  2019-08-08  2:49 ` [Qemu-devel] [PATCH v2] " Bin Meng
  0 siblings, 2 replies; 12+ messages in thread
From: Bin Meng @ 2019-07-31 12:45 UTC (permalink / raw)
  To: Alistair Francis, Palmer Dabbelt, Bastian Koppelmann,
	Sagar Karandikar, QEMU devel, QEMU riscv

For RV32, the root page table's PPN has 22 bits hence its address
bits could be larger than the maximum bits that target_ulong is
able to represent. Use hwaddr instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 target/riscv/cpu_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
index e32b612..3150a6a 100644
--- a/target/riscv/cpu_helper.c
+++ b/target/riscv/cpu_helper.c
@@ -176,7 +176,7 @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
 
     *prot = 0;
 
-    target_ulong base;
+    hwaddr base;
     int levels, ptidxbits, ptesize, vm, sum;
     int mxr = get_field(env->mstatus, MSTATUS_MXR);
 
@@ -239,7 +239,7 @@ restart:
                            ((1 << ptidxbits) - 1);
 
         /* check that physical address of PTE is legal */
-        target_ulong pte_addr = base + idx * ptesize;
+        hwaddr pte_addr = base + idx * ptesize;
 
         if (riscv_feature(env, RISCV_FEATURE_PMP) &&
             !pmp_hart_has_privs(env, pte_addr, sizeof(target_ulong),
-- 
2.7.4



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, back to index

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 12:45 [Qemu-devel] [PATCH] riscv: rv32: Root page table address can be larger than 32-bit Bin Meng
2019-07-31 17:35 ` Richard Henderson
2019-08-01  1:53   ` Bin Meng
2019-08-01 14:16     ` Richard Henderson
2019-08-01 14:57       ` Bin Meng
2019-08-07 20:55         ` Palmer Dabbelt
2019-08-08  1:49           ` Bin Meng
2019-08-08  2:49 ` [Qemu-devel] [PATCH v2] " Bin Meng
2019-08-10  1:49   ` Alistair Francis
2019-08-14  9:46     ` Bin Meng
2019-08-19  6:00       ` Bin Meng
2019-08-27 23:37         ` Palmer Dabbelt

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git