ref: 2020190f945dbc264963abec22659df95cd61f04
parent: 153f96ebc6b8a155f2a619faa54cfe11163f75c2
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Nov 1 20:32:46 EDT 2014
pc, pc64: more sanity checking for lowraminit()
--- a/sys/src/9/pc/memory.c
+++ b/sys/src/9/pc/memory.c
@@ -388,6 +388,8 @@
x = PADDR(CPU0END);
bda = (uchar*)KADDR(0x400);
pa = ((bda[0x14]<<8)|bda[0x13])*KB;
+ if(pa > 640*KB)
+ pa = 640*KB;
if(x < pa){
mapfree(&rmapram, x, pa-x);
memset(KADDR(x), 0, pa-x); /* keep us honest */
--- a/sys/src/9/pc64/memory.c
+++ b/sys/src/9/pc64/memory.c
@@ -386,6 +386,8 @@
x = PADDR(CPU0END);
bda = (uchar*)KADDR(0x400);
pa = ((bda[0x14]<<8)|bda[0x13])*KB;
+ if(pa > 640*KB)
+ pa = 640*KB;
if(x < pa){
mapfree(&rmapram, x, pa-x);
memset(KADDR(x), 0, pa-x); /* keep us honest */