shithub: riscv

Download patch

ref: a8f64e53fe2a2a27440dd9441800e8210cb1a00f
parent: 6184a4ef2eba1d49f0386e9ce94f4877d3d9edb2
author: cinap_lenrek <[email protected]>
date: Sat Jun 6 11:44:17 EDT 2020

archacpi: use 64-bit uvlong for physical addresses

--- a/sys/src/9/pc/archacpi.c
+++ b/sys/src/9/pc/archacpi.c
@@ -46,7 +46,7 @@
 
 /* physical addresses visited by maptable() */
 static int ntblpa;
-static uintptr tblpa[64];
+static uvlong tblpa[64];
 
 /* successfully mapped tables */
 static int ntblmap;
@@ -104,18 +104,16 @@
 }
 
 static void
-maptable(uvlong xpa)
+maptable(uvlong pa)
 {
 	uchar *p, *e;
-	uintptr pa;
 	u32int l;
 	Tbl *t;
 	int i;
 
-	pa = xpa;
-	if((uvlong)pa != xpa || pa == 0 || pa+7 < pa)
+	if(-pa < 8)
 		return;
-		
+
 	if(ntblpa >= nelem(tblpa) || ntblmap >= nelem(tblmap))
 		return;
 
@@ -131,7 +129,7 @@
 	l = get32(t->len);
 	if(l < Tblsz
 	|| l >= 0x10000000
-	|| pa+l-1 < pa){
+	|| -pa < l){
 		vunmap(t, 8);
 		return;
 	}
@@ -519,7 +517,7 @@
 static long
 readmem(Chan*, void *v, long n, vlong o)
 {
-	uintptr pa = (uintptr)o;
+	uvlong pa = (uvlong)o;
 	void *t;
 
 	if((n = memcheck(pa, n)) <= 0)
@@ -539,7 +537,7 @@
 static long
 writemem(Chan*, void *v, long n, vlong o)
 {
-	uintptr pa = (uintptr)o;
+	uvlong pa = (uvlong)o;
 	void *t;
 
 	if(memcheck(pa, n) != n)
@@ -778,7 +776,7 @@
 static int
 identify(void)
 {
-	uintptr pa;
+	uvlong pa;
 	char *cp;
 
 	if((cp = getconf("*acpi")) == nil)