mirror of
https://github.com/opnsense/src.git
synced 2026-04-27 17:17:19 -04:00
Merge 386/machdep.c rev 1.467: fix bugs/miscalculations
Forgotten by: iwasaki
This commit is contained in:
parent
b65110f80b
commit
10abeae984
2 changed files with 24 additions and 20 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue