summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-12-02 05:06:42 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-12-02 05:06:42 +0000
commit606cc2e85f23f2919eb02b48385df8bca0119cfc (patch)
tree5b36fd4974e9595228351bac861a05e10e90ad32 /sys/arch
parent8d901c8263c0b8e3dcd4b7e7b1229ace8b8543c9 (diff)
once more
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/machdep.c72
1 files changed, 23 insertions, 49 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 5b220f85b0b..61b5522816f 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.65 1997/12/01 22:58:32 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.66 1997/12/02 05:06:41 mickey Exp $ */
/* $NetBSD: machdep.c,v 1.202 1996/05/18 15:54:59 christos Exp $ */
/*-
@@ -1143,8 +1143,8 @@ void
init386(first_avail)
vm_offset_t first_avail;
{
- int x;
- unsigned biosbasemem, biosextmem;
+ int i;
+ u_int cm, em;
struct region_descriptor region;
extern void consinit __P((void));
@@ -1189,8 +1189,6 @@ init386(first_avail)
ldt[LBSDICALLS_SEL] = ldt[LSYS5CALLS_SEL];
/* exceptions */
- for (x = 0; x < NIDT; x++)
- setgate(&idt[x], &IDTVEC(rsvd), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
setgate(&idt[ 0], &IDTVEC(div), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
setgate(&idt[ 1], &IDTVEC(dbg), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
setgate(&idt[ 2], &IDTVEC(nmi), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
@@ -1206,9 +1204,12 @@ init386(first_avail)
setgate(&idt[ 12], &IDTVEC(stk), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
setgate(&idt[ 13], &IDTVEC(prot), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
setgate(&idt[ 14], &IDTVEC(page), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
+ setgate(&idt[ 15], &IDTVEC(rsvd), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
setgate(&idt[ 16], &IDTVEC(fpu), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
setgate(&idt[ 17], &IDTVEC(align), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
setgate(&idt[ 18], &IDTVEC(rsvd), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
+ for (i = 19; i < NIDT; i++)
+ setgate(&idt[i], &IDTVEC(rsvd), 0, SDT_SYS386TGT, SEL_KPL, GCODE_SEL);
setgate(&idt[128], &IDTVEC(syscall), 0, SDT_SYS386TGT, SEL_UPL, GCODE_SEL);
setregion(&region, gdt, sizeof(gdt) - 1);
@@ -1220,30 +1221,9 @@ init386(first_avail)
isa_defaultirq();
#endif
-#ifdef MEM_COMPUTE /* Default config - get sizes from bootblocks */
- splhigh();
- enable_intr();
-
- /*
- * Use BIOS values stored in RTC CMOS RAM, since probing
- * breaks certain 386 AT relics.
- *
- * XXX Not only does probing break certain 386 AT relics, but
- * not all BIOSes (Dell, Compaq, others) report the correct
- * amount of extended memory.
- */
- biosbasemem = (mc146818_read(NULL, NVRAM_BASEHI) << 8) |
- mc146818_read(NULL, NVRAM_BASELO);
- biosextmem = (mc146818_read(NULL, NVRAM_EXTHI) << 8) |
- mc146818_read(NULL, NVRAM_EXTLO);
-#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;
+ extmem = EXTMEM_SIZE;
#endif
/*
@@ -1256,8 +1236,13 @@ init386(first_avail)
printf("WARNING: CAN'T ALLOCATE BASE RAM FROM IOMEM EXTENT MAP!\n");
}
- avail_end = biosextmem ? IOM_END + biosextmem * 1024
- : biosbasemem * 1024; /* just temporary use */
+ /*
+ * BIOS leaves data in low memory and VM system doesn't work with
+ * phys 0, /boot leaves arguments at page 1.
+ */
+ avail_next = avail_start = NBPG + i386_round_page(bootargc);
+ avail_end = extmem ? IOM_END + extmem * 1024
+ : cnvmem * 1024; /* just temporary use */
if (avail_end > IOM_END && extent_alloc_region(iomem_ex, IOM_END,
(avail_end - IOM_END), EX_NOWAIT)) {
@@ -1266,36 +1251,25 @@ init386(first_avail)
}
/* Round down to whole pages. */
- biosbasemem &= -(NBPG / 1024);
- biosextmem &= -(NBPG / 1024);
-
- /*
- * BIOS leaves data in low memory and VM system doesn't work with
- * phys 0, /boot leaves arguments at page 1.
- */
- avail_start = NBPG + i386_round_page(bootargc);
-
- avail_end = biosextmem ? IOM_END + biosextmem * 1024
- : biosbasemem * 1024;
+ cm = i386_round_page(cnvmem * 1024);
+ em = i386_round_page(extmem * 1024);
/* number of pages of physmem addr space */
- physmem = btoc((biosbasemem + biosextmem) * 1024);
- dumpmem_low = btoc(biosbasemem * 1024);
- dumpmem_high = btoc(biosextmem * 1024);
+ physmem = btoc(cm + em);
+ dumpmem_low = btoc(cm);
+ dumpmem_high = btoc(em);
/*
* Initialize for pmap_free_pages and pmap_next_page.
* These guys should be page-aligned.
+ * We load right after the I/O hole; adjust hole_end to compensate.
*/
- hole_start = biosbasemem * 1024;
-
- /* we load right after the I/O hole; adjust hole_end to compensate */
+ hole_start = cm;
hole_end = round_page(first_avail);
- avail_next = avail_start;
if (physmem < btoc(2 * 1024 * 1024)) {
- printf("warning: too little memory available; running in degraded mode\n"
- "press a key to confirm\n\n");
+ printf("\awarning: too little memory available;"
+ "running in degraded mode\npress a key to confirm\n\n");
cngetc();
}