summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authoretheisen <etheisen@cvs.openbsd.org>1996-10-23 05:23:40 +0000
committeretheisen <etheisen@cvs.openbsd.org>1996-10-23 05:23:40 +0000
commit8828bb30112279b5b23ddfdbd09842da6451e73e (patch)
treeb1a85979e7fc2fa12997415cb9a00d96319f5d74 /sys/arch/i386
parentd4aef8efb9456064317fb5f3eb233f7bd66384d7 (diff)
Get memory configuration from boot blocks or /boot when it becomes
available. Use MEM_COMPUTE option to use old behavior. Use EXTMEM_SIZE to override extended memory size.
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/i386/locore.s9
-rw-r--r--sys/arch/i386/i386/machdep.c21
2 files changed, 24 insertions, 6 deletions
diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s
index 1cbf0d0eb1d..a663de843fc 100644
--- a/sys/arch/i386/i386/locore.s
+++ b/sys/arch/i386/i386/locore.s
@@ -156,7 +156,7 @@
*/
.data
- .globl _cpu,_cpu_vendor,_cold,_esym,_boothowto,_bootdev,_atdevbase
+ .globl _cpu,_cpu_vendor,_cold,_cnvmem,_extmem,_esym,_boothowto,_bootdev,_atdevbase
.globl _cyloffset,_proc0paddr,_curpcb,_PTDpaddr,_dynamic_gdt
#if NAPM > 0
#include <machine/apmvar.h>
@@ -172,6 +172,8 @@ _cpu: .long 0 # are we 386, 386sx, or 486
_cpu_vendor: .space 16 # vendor string returned by `cpuid' instruction
_cold: .long 1 # cold till we are not
_esym: .long 0 # ptr to end of syms
+_cnvmem: .long 0 # conventional memory size
+_extmem: .long 0 # extended memory size
_atdevbase: .long 0 # location of start of iomem in virtual
_cyloffset: .long 0
_proc0paddr: .long 0
@@ -204,6 +206,11 @@ start: movw $0x1234,0x472 # warm boot
addl $KERNBASE,%eax
1: movl %eax,RELOC(_esym)
+ movl 20(%esp),%eax
+ movl %eax,RELOC(_extmem)
+ movl 24(%esp),%eax
+ movl %eax,RELOC(_cnvmem)
+
#if NAPM > 0
/*
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index b898c27b1d1..29c5365a391 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.24 1996/09/21 07:15:33 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.25 1996/10/23 05:23:39 etheisen Exp $ */
/* $NetBSD: machdep.c,v 1.202 1996/05/18 15:54:59 christos Exp $ */
/*-
@@ -160,6 +160,9 @@ void consinit __P((void));
static int exec_nomid __P((struct proc *, struct exec_package *));
#endif
+extern long cnvmem; /* BIOS's conventional memory size */
+extern long extmem; /* BIOS's extended memory size */
+
/*
* Machine-dependent startup code
*/
@@ -187,7 +190,10 @@ cpu_startup()
printf(version);
startrtclock();
+
identifycpu();
+ printf("BIOS mem = %ldk conventional, %ldk extended\n",
+ cnvmem, extmem);
printf("real mem = %d\n", ctob(physmem));
/*
@@ -1153,6 +1159,7 @@ init386(first_avail)
isa_defaultirq();
#endif
+#ifdef MEM_COMPUTE /* Default config - get sizes from bootblocks */
splhigh();
enable_intr();
@@ -1166,12 +1173,16 @@ init386(first_avail)
*/
biosbasemem = (mc146818_read(NULL, NVRAM_BASEHI) << 8) |
mc146818_read(NULL, NVRAM_BASELO);
-#ifdef EXTMEM_SIZE
- biosextmem = EXTMEM_SIZE;
-#else
biosextmem = (mc146818_read(NULL, NVRAM_EXTHI) << 8) |
mc146818_read(NULL, NVRAM_EXTLO);
-#endif /* EXTMEM_SIZE */
+#else
+ biosbasemem = cnvmem; /* Base memory as reported by BIOS call */
+ biosextmem = extmem; /* Extended memory as reported by BIOS call */
+#endif
+
+#ifdef EXTMEM_SIZE /* Override memory size */
+ biosextmem = EXTMEM_SIZE;
+#endif
/* Round down to whole pages. */
biosbasemem &= -(NBPG / 1024);