From 10abeae984c14ff1ea411bb964d49ecf773ea237 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Thu, 23 Aug 2001 01:42:21 +0000 Subject: Merge 386/machdep.c rev 1.467: fix bugs/miscalculations Forgotten by: iwasaki --- sys/pc98/i386/machdep.c | 22 ++++++++++++---------- sys/pc98/pc98/machdep.c | 22 ++++++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) (limited to 'sys') diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 75b911020705a..9c680471abc01 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -1842,14 +1842,12 @@ void init386(first) int first; { - int x; struct gate_descriptor *gdp; - int gsel_tss; + int gsel_tss, metadata_missing, off, x; #ifndef SMP /* table descriptors - used to load tables by microp */ struct region_descriptor r_gdt, r_idt; #endif - int off; proc0.p_addr = proc0paddr; @@ -1862,11 +1860,12 @@ init386(first) pc98_init_dmac(); #endif + metadata_missing = 0; if (bootinfo.bi_modulep) { preload_metadata = (caddr_t)bootinfo.bi_modulep + KERNBASE; preload_bootstrap_relocate(KERNBASE); } else { - printf("WARNING: loader(8) metadata is missing!\n"); + metadata_missing = 1; } if (bootinfo.bi_envp) kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE; @@ -1883,18 +1882,18 @@ init386(first) * XXX text protection is temporarily (?) disabled. The limit was * i386_btop(round_page(etext)) - 1. */ - gdt_segs[GCODE_SEL].ssd_limit = i386_btop(0) - 1; - gdt_segs[GDATA_SEL].ssd_limit = i386_btop(0) - 1; + gdt_segs[GCODE_SEL].ssd_limit = atop(0 - 1); + gdt_segs[GDATA_SEL].ssd_limit = atop(0 - 1); #ifdef SMP gdt_segs[GPRIV_SEL].ssd_limit = - i386_btop(sizeof(struct privatespace)) - 1; + atop(sizeof(struct privatespace) - 1); gdt_segs[GPRIV_SEL].ssd_base = (int) &SMP_prvspace[0]; gdt_segs[GPROC0_SEL].ssd_base = (int) &SMP_prvspace[0].globaldata.gd_common_tss; SMP_prvspace[0].globaldata.gd_prvspace = &SMP_prvspace[0].globaldata; #else gdt_segs[GPRIV_SEL].ssd_limit = - i386_btop(sizeof(struct globaldata)) - 1; + atop(sizeof(struct globaldata) - 1); gdt_segs[GPRIV_SEL].ssd_base = (int) &__globaldata; gdt_segs[GPROC0_SEL].ssd_base = (int) &__globaldata.gd_common_tss; @@ -1951,8 +1950,8 @@ init386(first) * the code segment cannot be written to directly. */ #define VM_END_USER_R_ADDRESS (VM_END_USER_RW_ADDRESS + UPAGES * PAGE_SIZE) - ldt_segs[LUCODE_SEL].ssd_limit = i386_btop(VM_END_USER_R_ADDRESS) - 1; - ldt_segs[LUDATA_SEL].ssd_limit = i386_btop(VM_END_USER_RW_ADDRESS) - 1; + ldt_segs[LUCODE_SEL].ssd_limit = atop(VM_END_USER_R_ADDRESS - 1); + ldt_segs[LUDATA_SEL].ssd_limit = atop(VM_END_USER_RW_ADDRESS - 1); for (x = 0; x < sizeof ldt_segs / sizeof ldt_segs[0]; x++) ssdtosd(&ldt_segs[x], &ldt[x].sd); @@ -1995,6 +1994,9 @@ init386(first) */ cninit(); + if (metadata_missing) + printf("WARNING: loader(8) metadata is missing!\n"); + #ifdef DEV_ISA isa_defaultirq(); #endif diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 75b911020705a..9c680471abc01 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -1842,14 +1842,12 @@ void init386(first) int first; { - int x; struct gate_descriptor *gdp; - int gsel_tss; + int gsel_tss, metadata_missing, off, x; #ifndef SMP /* table descriptors - used to load tables by microp */ struct region_descriptor r_gdt, r_idt; #endif - int off; proc0.p_addr = proc0paddr; @@ -1862,11 +1860,12 @@ init386(first) pc98_init_dmac(); #endif + metadata_missing = 0; if (bootinfo.bi_modulep) { preload_metadata = (caddr_t)bootinfo.bi_modulep + KERNBASE; preload_bootstrap_relocate(KERNBASE); } else { - printf("WARNING: loader(8) metadata is missing!\n"); + metadata_missing = 1; } if (bootinfo.bi_envp) kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE; @@ -1883,18 +1882,18 @@ init386(first) * XXX text protection is temporarily (?) disabled. The limit was * i386_btop(round_page(etext)) - 1. */ - gdt_segs[GCODE_SEL].ssd_limit = i386_btop(0) - 1; - gdt_segs[GDATA_SEL].ssd_limit = i386_btop(0) - 1; + gdt_segs[GCODE_SEL].ssd_limit = atop(0 - 1); + gdt_segs[GDATA_SEL].ssd_limit = atop(0 - 1); #ifdef SMP gdt_segs[GPRIV_SEL].ssd_limit = - i386_btop(sizeof(struct privatespace)) - 1; + atop(sizeof(struct privatespace) - 1); gdt_segs[GPRIV_SEL].ssd_base = (int) &SMP_prvspace[0]; gdt_segs[GPROC0_SEL].ssd_base = (int) &SMP_prvspace[0].globaldata.gd_common_tss; SMP_prvspace[0].globaldata.gd_prvspace = &SMP_prvspace[0].globaldata; #else gdt_segs[GPRIV_SEL].ssd_limit = - i386_btop(sizeof(struct globaldata)) - 1; + atop(sizeof(struct globaldata) - 1); gdt_segs[GPRIV_SEL].ssd_base = (int) &__globaldata; gdt_segs[GPROC0_SEL].ssd_base = (int) &__globaldata.gd_common_tss; @@ -1951,8 +1950,8 @@ init386(first) * the code segment cannot be written to directly. */ #define VM_END_USER_R_ADDRESS (VM_END_USER_RW_ADDRESS + UPAGES * PAGE_SIZE) - ldt_segs[LUCODE_SEL].ssd_limit = i386_btop(VM_END_USER_R_ADDRESS) - 1; - ldt_segs[LUDATA_SEL].ssd_limit = i386_btop(VM_END_USER_RW_ADDRESS) - 1; + ldt_segs[LUCODE_SEL].ssd_limit = atop(VM_END_USER_R_ADDRESS - 1); + ldt_segs[LUDATA_SEL].ssd_limit = atop(VM_END_USER_RW_ADDRESS - 1); for (x = 0; x < sizeof ldt_segs / sizeof ldt_segs[0]; x++) ssdtosd(&ldt_segs[x], &ldt[x].sd); @@ -1995,6 +1994,9 @@ init386(first) */ cninit(); + if (metadata_missing) + printf("WARNING: loader(8) metadata is missing!\n"); + #ifdef DEV_ISA isa_defaultirq(); #endif -- cgit v1.3