diff options
author | kato <kato@FreeBSD.org> | 1998-08-19 09:32:15 +0000 |
---|---|---|
committer | kato <kato@FreeBSD.org> | 1998-08-19 09:32:15 +0000 |
commit | 86eca8929ecbf580a7849ff79cb49ed6b4bce7dc (patch) | |
tree | 5a07123d58e756abd1bbda4860c44b392758266b /sys | |
parent | 1524621152bec6b2bc6b9a22a125584602153728 (diff) | |
download | FreeBSD-src-86eca8929ecbf580a7849ff79cb49ed6b4bce7dc.zip FreeBSD-src-86eca8929ecbf580a7849ff79cb49ed6b4bce7dc.tar.gz |
Sync with sys/i386/i386/machdep.c revision 1.304.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/pc98/i386/machdep.c | 22 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 22 |
2 files changed, 32 insertions, 12 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index b762798..5e0c76a 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.89 1998/07/02 12:39:32 kato Exp $ + * $Id: machdep.c,v 1.90 1998/07/11 17:00:33 kato Exp $ */ #include "apm.h" @@ -814,14 +814,15 @@ setregs(p, entry, stack) u_long stack; { struct trapframe *regs = p->p_md.md_regs; - -#ifdef USER_LDT struct pcb *pcb = &p->p_addr->u_pcb; +#ifdef USER_LDT /* was i386_user_cleanup() in NetBSD */ if (pcb->pcb_ldt) { - if (pcb == curpcb) - lldt(GSEL(GUSERLDT_SEL, SEL_KPL)); + if (pcb == curpcb) { + lldt(_default_ldt); + currentldt = _default_ldt; + } kmem_free(kernel_map, (vm_offset_t)pcb->pcb_ldt, pcb->pcb_ldt_len * sizeof(union descriptor)); pcb->pcb_ldt_len = (int)pcb->pcb_ldt = 0; @@ -837,6 +838,14 @@ setregs(p, entry, stack) regs->tf_es = _udatasel; regs->tf_cs = _ucodesel; + /* reset %fs and %gs as well */ + pcb->pcb_fs = _udatasel; + pcb->pcb_gs = _udatasel; + if (pcb == curpcb) { + __asm("mov %0,%%fs" : : "r" (_udatasel)); + __asm("mov %0,%%gs" : : "r" (_udatasel)); + } + /* * Initialize the math emulator (if any) for the current process. * Actually, just clear the bit that says that the emulator has @@ -894,7 +903,6 @@ SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock, * Initialize segments & interrupt table */ -int currentldt; int _default_ldt; #ifdef SMP union descriptor gdt[NGDT + NCPU]; /* global descriptor table */ @@ -1272,7 +1280,9 @@ init386(first) _default_ldt = GSEL(GLDT_SEL, SEL_KPL); lldt(_default_ldt); +#ifdef USER_LDT currentldt = _default_ldt; +#endif #ifdef DDB kdb_init(); diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index b762798..5e0c76a 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.89 1998/07/02 12:39:32 kato Exp $ + * $Id: machdep.c,v 1.90 1998/07/11 17:00:33 kato Exp $ */ #include "apm.h" @@ -814,14 +814,15 @@ setregs(p, entry, stack) u_long stack; { struct trapframe *regs = p->p_md.md_regs; - -#ifdef USER_LDT struct pcb *pcb = &p->p_addr->u_pcb; +#ifdef USER_LDT /* was i386_user_cleanup() in NetBSD */ if (pcb->pcb_ldt) { - if (pcb == curpcb) - lldt(GSEL(GUSERLDT_SEL, SEL_KPL)); + if (pcb == curpcb) { + lldt(_default_ldt); + currentldt = _default_ldt; + } kmem_free(kernel_map, (vm_offset_t)pcb->pcb_ldt, pcb->pcb_ldt_len * sizeof(union descriptor)); pcb->pcb_ldt_len = (int)pcb->pcb_ldt = 0; @@ -837,6 +838,14 @@ setregs(p, entry, stack) regs->tf_es = _udatasel; regs->tf_cs = _ucodesel; + /* reset %fs and %gs as well */ + pcb->pcb_fs = _udatasel; + pcb->pcb_gs = _udatasel; + if (pcb == curpcb) { + __asm("mov %0,%%fs" : : "r" (_udatasel)); + __asm("mov %0,%%gs" : : "r" (_udatasel)); + } + /* * Initialize the math emulator (if any) for the current process. * Actually, just clear the bit that says that the emulator has @@ -894,7 +903,6 @@ SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock, * Initialize segments & interrupt table */ -int currentldt; int _default_ldt; #ifdef SMP union descriptor gdt[NGDT + NCPU]; /* global descriptor table */ @@ -1272,7 +1280,9 @@ init386(first) _default_ldt = GSEL(GLDT_SEL, SEL_KPL); lldt(_default_ldt); +#ifdef USER_LDT currentldt = _default_ldt; +#endif #ifdef DDB kdb_init(); |