summaryrefslogtreecommitdiff
path: root/sys/arch/i386/stand
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-02-15 19:55:16 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-02-15 19:55:16 +0000
commitc64ecb5f2ebfdcefa740a2dd2c119ada8afe3ffc (patch)
tree9afb06d552bb948c2c8df649ade266597ccaf9ce /sys/arch/i386/stand
parentccac0a62dc56277bb1ace24af52f5380fb5c3a1f (diff)
fix the possible 4G overflow issues
Diffstat (limited to 'sys/arch/i386/stand')
-rw-r--r--sys/arch/i386/stand/libsa/memprobe.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/arch/i386/stand/libsa/memprobe.c b/sys/arch/i386/stand/libsa/memprobe.c
index 7f2dba44310..ade44eccda6 100644
--- a/sys/arch/i386/stand/libsa/memprobe.c
+++ b/sys/arch/i386/stand/libsa/memprobe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memprobe.c,v 1.34 2000/03/05 18:40:59 niklas Exp $ */
+/* $OpenBSD: memprobe.c,v 1.35 2002/02/15 19:55:15 mickey Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -133,7 +133,7 @@ bios_E801(mp)
mp++;
mp->addr = (1024 * 1024) * 16; /* 16MB */
- mp->size = (m2 & 0xffff) * 64 * 1024;
+ mp->size = (m2 & 0xffff) * 64L * 1024;
mp->type = BIOS_MAP_FREE;
return ++mp;
@@ -259,7 +259,7 @@ static __inline bios_memmap_t *
badprobe(mp)
register bios_memmap_t *mp;
{
- int ram;
+ u_int64_t ram;
#ifdef DEBUG
printf("scan ");
#endif
@@ -337,13 +337,12 @@ memprobe()
* We drop "machine {cnvmem,extmem}" commands.
*/
if(im->addr < IOM_BEGIN)
- cnvmem = max(cnvmem, im->addr + im->size);
+ cnvmem = max(cnvmem,
+ im->addr + im->size) / 1024;
if(im->addr >= IOM_END)
- extmem += im->size;
+ extmem += im->size / 1024;
}
}
- cnvmem /= 1024;
- extmem /= 1024;
/* Check if gate A20 is on */
printf("a20=o%s] ", checkA20()? "n" : "ff!");
@@ -362,7 +361,7 @@ dump_biosmem(tm)
for(p = tm; p->type != BIOS_MAP_END; p++) {
printf("Region %d: type %u at 0x%x for %uKB\n", p - tm,
- p->type, (u_int)p->addr, (u_int)p->size / 1024);
+ p->type, (u_int)p->addr, (u_int)(p->size / 1024));
if(p->type == BIOS_MAP_FREE)
total += p->size / 1024;