pc64: fix ulongs for address of devarchs realmodemem file

This commit is contained in:
cinap_lenrek 2014-05-26 00:45:10 +02:00
parent 15fc6c1cc0
commit 3dc82dc04b

View file

@ -1010,20 +1010,22 @@ archctlwrite(Chan*, void *a, long n, vlong)
static long static long
rmemrw(int isr, void *a, long n, vlong off) rmemrw(int isr, void *a, long n, vlong off)
{ {
uintptr addr = off;
if(off < 0 || n < 0) if(off < 0 || n < 0)
error("bad offset/count"); error("bad offset/count");
if(isr){ if(isr){
if(off >= MB) if(addr >= MB)
return 0; return 0;
if(off+n >= MB) if(addr+n >= MB)
n = MB - off; n = MB - addr;
memmove(a, KADDR((ulong)off), n); memmove(a, KADDR(addr), n);
}else{ }else{
/* allow vga framebuf's access */ /* allow vga framebuf's write access */
if(off >= MB || off+n > MB || if(addr >= MB || addr+n > MB ||
(off < 0xA0000 || off+n > 0xB0000+0x10000)) (addr < 0xA0000 || addr+n > 0xB0000+0x10000))
error("bad offset/count in write"); error("bad offset/count in write");
memmove(KADDR((ulong)off), a, n); memmove(KADDR(addr), a, n);
} }
return n; return n;
} }