aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2001-02-23 01:25:02 +0000
committerPeter Wemm <peter@FreeBSD.org>2001-02-23 01:25:02 +0000
commitf1532aadeefd1f9ee9f9b5d94d049a54bb5bc0e6 (patch)
treeba3d3896f4228f9ccb25a9cb23b96d2ef8ce7b0c /sys
parent7aea583ef191ba44b47476846be42aa21c9e04b1 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/cpu_switch.S3
-rw-r--r--sys/amd64/amd64/genassym.c8
-rw-r--r--sys/amd64/amd64/machdep.c9
-rw-r--r--sys/amd64/amd64/mp_machdep.c3
-rw-r--r--sys/amd64/amd64/mptable.c3
-rw-r--r--sys/amd64/amd64/pmap.c1
-rw-r--r--sys/amd64/amd64/swtch.s3
-rw-r--r--sys/amd64/amd64/sys_machdep.c10
-rw-r--r--sys/amd64/amd64/vm_machdep.c10
-rw-r--r--sys/amd64/include/mptable.h3
-rw-r--r--sys/amd64/include/pcb.h4
-rw-r--r--sys/amd64/include/pcb_ext.h2
-rw-r--r--sys/amd64/include/pcpu.h2
-rw-r--r--sys/conf/NOTES7
-rw-r--r--sys/conf/options.i3861
-rw-r--r--sys/conf/options.pc981
-rw-r--r--sys/i386/conf/NOTES7
-rw-r--r--sys/i386/i386/genassym.c8
-rw-r--r--sys/i386/i386/machdep.c9
-rw-r--r--sys/i386/i386/mp_machdep.c3
-rw-r--r--sys/i386/i386/mptable.c3
-rw-r--r--sys/i386/i386/pmap.c1
-rw-r--r--sys/i386/i386/swtch.s3
-rw-r--r--sys/i386/i386/sys_machdep.c10
-rw-r--r--sys/i386/i386/vm_machdep.c10
-rw-r--r--sys/i386/include/globaldata.h2
-rw-r--r--sys/i386/include/mptable.h3
-rw-r--r--sys/i386/include/pcb.h4
-rw-r--r--sys/i386/include/pcb_ext.h2
-rw-r--r--sys/i386/include/pcpu.h2
-rw-r--r--sys/i386/svr4/svr4_machdep.c5
-rw-r--r--sys/kern/subr_smp.c3
-rw-r--r--sys/pc98/i386/machdep.c9
-rw-r--r--sys/pc98/pc98/machdep.c9
34 files changed, 20 insertions, 143 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
index c780d6f8c68b8..f5f7441451a81 100644
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -37,7 +37,6 @@
*/
#include "opt_npx.h"
-#include "opt_user_ldt.h"
#include <machine/asmacros.h>
#include <machine/ipl.h>
@@ -241,7 +240,6 @@ sw1b:
/* XXX FIXME: we should be restoring the local APIC TPR */
#endif /* SMP */
-#ifdef USER_LDT
cmpl $0, PCB_USERLDT(%edx)
jnz 1f
movl __default_ldt,%eax
@@ -254,7 +252,6 @@ sw1b:
call _set_user_ldt
popl %edx
2:
-#endif
/* This must be done after loading the user LDT. */
.globl cpu_switch_load_gs
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index fa6124ceaec05..44c91b69a3683 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -37,8 +37,6 @@
* $FreeBSD$
*/
-#include "opt_user_ldt.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/assym.h>
@@ -115,10 +113,7 @@ ASSYM(PCB_EBX, offsetof(struct pcb, pcb_ebx));
ASSYM(PCB_EIP, offsetof(struct pcb, pcb_eip));
ASSYM(TSS_ESP0, offsetof(struct i386tss, tss_esp0));
-#ifdef USER_LDT
ASSYM(PCB_USERLDT, offsetof(struct pcb, pcb_ldt));
-#endif
-
ASSYM(PCB_GS, offsetof(struct pcb, pcb_gs));
ASSYM(PCB_DR0, offsetof(struct pcb, pcb_dr0));
ASSYM(PCB_DR1, offsetof(struct pcb, pcb_dr1));
@@ -177,10 +172,7 @@ ASSYM(GD_SWITCHTIME, offsetof(struct globaldata, gd_switchtime));
ASSYM(GD_SWITCHTICKS, offsetof(struct globaldata, gd_switchticks));
ASSYM(GD_COMMON_TSSD, offsetof(struct globaldata, gd_common_tssd));
ASSYM(GD_TSS_GDT, offsetof(struct globaldata, gd_tss_gdt));
-
-#ifdef USER_LDT
ASSYM(GD_CURRENTLDT, offsetof(struct globaldata, gd_currentldt));
-#endif
ASSYM(GD_WITNESS_SPIN_CHECK, offsetof(struct globaldata, gd_witness_spin_check));
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 256e0ee0469ae..f1a5bb076a8b6 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -49,7 +49,6 @@
#include "opt_msgbuf.h"
#include "opt_npx.h"
#include "opt_perfmon.h"
-#include "opt_user_ldt.h"
#include "opt_userconfig.h"
#include <sys/param.h>
@@ -1048,10 +1047,8 @@ setregs(p, entry, stack, ps_strings)
struct trapframe *regs = p->p_md.md_regs;
struct pcb *pcb = &p->p_addr->u_pcb;
-#ifdef USER_LDT
- /* was i386_user_cleanup() in NetBSD */
- user_ldt_free(pcb);
-#endif
+ if (pcb->pcb_ldt)
+ user_ldt_free(pcb);
bzero((char *)regs, sizeof(struct trapframe));
regs->tf_eip = entry;
@@ -1939,9 +1936,7 @@ init386(first)
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
/* exceptions */
for (x = 0; x < NIDT; x++)
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 06d65488c470a..f6d23dd1d3094 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -26,7 +26,6 @@
*/
#include "opt_cpu.h"
-#include "opt_user_ldt.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -521,9 +520,7 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
gdt[myid * NGDT + GPROC0_SEL].sd.sd_type = SDT_SYS386TSS;
diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c
index 06d65488c470a..f6d23dd1d3094 100644
--- a/sys/amd64/amd64/mptable.c
+++ b/sys/amd64/amd64/mptable.c
@@ -26,7 +26,6 @@
*/
#include "opt_cpu.h"
-#include "opt_user_ldt.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -521,9 +520,7 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
gdt[myid * NGDT + GPROC0_SEL].sd.sd_type = SDT_SYS386TSS;
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index b41dfb07beb4c..52a5e3c056192 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -71,7 +71,6 @@
#include "opt_disable_pse.h"
#include "opt_pmap.h"
#include "opt_msgbuf.h"
-#include "opt_user_ldt.h"
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s
index c780d6f8c68b8..f5f7441451a81 100644
--- a/sys/amd64/amd64/swtch.s
+++ b/sys/amd64/amd64/swtch.s
@@ -37,7 +37,6 @@
*/
#include "opt_npx.h"
-#include "opt_user_ldt.h"
#include <machine/asmacros.h>
#include <machine/ipl.h>
@@ -241,7 +240,6 @@ sw1b:
/* XXX FIXME: we should be restoring the local APIC TPR */
#endif /* SMP */
-#ifdef USER_LDT
cmpl $0, PCB_USERLDT(%edx)
jnz 1f
movl __default_ldt,%eax
@@ -254,7 +252,6 @@ sw1b:
call _set_user_ldt
popl %edx
2:
-#endif
/* This must be done after loading the user LDT. */
.globl cpu_switch_load_gs
diff --git a/sys/amd64/amd64/sys_machdep.c b/sys/amd64/amd64/sys_machdep.c
index e242b73bac08c..cf05d730a23f7 100644
--- a/sys/amd64/amd64/sys_machdep.c
+++ b/sys/amd64/amd64/sys_machdep.c
@@ -35,8 +35,6 @@
*
*/
-#include "opt_user_ldt.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
@@ -68,10 +66,8 @@
-#ifdef USER_LDT
static int i386_get_ldt __P((struct proc *, char *));
static int i386_set_ldt __P((struct proc *, char *));
-#endif
static int i386_get_ioperm __P((struct proc *, char *));
static int i386_set_ioperm __P((struct proc *, char *));
int i386_extend_pcb __P((struct proc *));
@@ -91,7 +87,6 @@ sysarch(p, uap)
int error = 0;
switch(uap->op) {
-#ifdef USER_LDT
case I386_GET_LDT:
error = i386_get_ldt(p, uap->parms);
break;
@@ -99,7 +94,6 @@ sysarch(p, uap)
case I386_SET_LDT:
error = i386_set_ldt(p, uap->parms);
break;
-#endif
case I386_GET_IOPERM:
error = i386_get_ioperm(p, uap->parms);
break;
@@ -242,10 +236,9 @@ done:
return (error);
}
-#ifdef USER_LDT
/*
* Update the GDT entry pointing to the LDT to point to the LDT of the
- * current process. Do not staticize.
+ * current process.
*/
void
set_user_ldt(struct pcb *pcb)
@@ -499,4 +492,3 @@ i386_set_ldt(p, args)
splx(s);
return(error);
}
-#endif /* USER_LDT */
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 1c5cf8a953df7..2cc597a5fccf8 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -42,7 +42,6 @@
*/
#include "opt_npx.h"
-#include "opt_user_ldt.h"
#ifdef PC98
#include "opt_pc98.h"
#endif
@@ -126,7 +125,6 @@ cpu_fork(p1, p2, flags)
struct pcb *pcb2;
if ((flags & RFPROC) == 0) {
-#ifdef USER_LDT
if ((flags & RFMEM) == 0) {
/* unshare user LDT */
struct pcb *pcb1 = &p1->p_addr->u_pcb;
@@ -138,7 +136,6 @@ cpu_fork(p1, p2, flags)
set_user_ldt(pcb1);
}
}
-#endif
return;
}
@@ -188,7 +185,6 @@ cpu_fork(p1, p2, flags)
*/
pcb2->pcb_ext = 0;
-#ifdef USER_LDT
/* Copy the LDT, if necessary. */
if (pcb2->pcb_ldt != 0) {
if (flags & RFMEM) {
@@ -198,7 +194,6 @@ cpu_fork(p1, p2, flags)
pcb2->pcb_ldt->ldt_len);
}
}
-#endif
/*
* Now, cpu_switch() can schedule the new process.
@@ -249,9 +244,8 @@ cpu_exit(p)
ctob(IOPAGES + 1));
pcb->pcb_ext = 0;
}
-#ifdef USER_LDT
- user_ldt_free(pcb);
-#endif
+ if (pcb->pcb_ldt)
+ user_ldt_free(pcb);
if (pcb->pcb_flags & PCB_DBREGS) {
/*
* disable all hardware breakpoints
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h
index 06d65488c470a..f6d23dd1d3094 100644
--- a/sys/amd64/include/mptable.h
+++ b/sys/amd64/include/mptable.h
@@ -26,7 +26,6 @@
*/
#include "opt_cpu.h"
-#include "opt_user_ldt.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -521,9 +520,7 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
gdt[myid * NGDT + GPROC0_SEL].sd.sd_type = SDT_SYS386TSS;
diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h
index 618c340f95ac7..ebc3965d1ea8d 100644
--- a/sys/amd64/include/pcb.h
+++ b/sys/amd64/include/pcb.h
@@ -61,11 +61,7 @@ struct pcb {
int pcb_dr6;
int pcb_dr7;
-#ifdef USER_LDT
struct pcb_ldt *pcb_ldt; /* per process (user) LDT */
-#else
- struct pcb_ldt *pcb_ldt_dontuse;
-#endif
struct save87 pcb_savefpu; /* floating point state for 287/387 */
u_char pcb_flags;
#define FP_SOFTFP 0x01 /* process using software fltng pnt emulator */
diff --git a/sys/amd64/include/pcb_ext.h b/sys/amd64/include/pcb_ext.h
index 482ec96a9cabb..2856c7b5aa4e5 100644
--- a/sys/amd64/include/pcb_ext.h
+++ b/sys/amd64/include/pcb_ext.h
@@ -53,11 +53,9 @@ struct pcb_ldt {
#ifdef _KERNEL
-#ifdef USER_LDT
void set_user_ldt __P((struct pcb *));
struct pcb_ldt *user_ldt_alloc __P((struct pcb *, int));
void user_ldt_free __P((struct pcb *));
-#endif
#endif
diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h
index 3b7bca5297c2e..d2873efcbf0d5 100644
--- a/sys/amd64/include/pcpu.h
+++ b/sys/amd64/include/pcpu.h
@@ -60,7 +60,7 @@ struct globaldata {
int gd_switchticks;
struct segment_descriptor gd_common_tssd;
struct segment_descriptor *gd_tss_gdt;
- int gd_currentldt; /* only used for USER_LDT */
+ int gd_currentldt;
u_int gd_cpuid;
u_int gd_other_cpus;
SLIST_ENTRY(globaldata) gd_allcpu;
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 4ebc8c2c21bec..a613a71a45995 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -284,13 +284,6 @@ options GPL_MATH_EMULATE #Support for x87 emulation via
options COMPAT_43
#
-# Allow user-mode programs to manipulate their local descriptor tables.
-# This option is required for the WINE Windows(tm) emulator, and is
-# not used by anything else (that we know of).
-#
-options USER_LDT #allow user-level control of i386 ldt
-
-#
# These three options provide support for System V Interface
# Definition-style interprocess communication, in the form of shared
# memory, semaphores, and message queues, respectively.
diff --git a/sys/conf/options.i386 b/sys/conf/options.i386
index d07b6996b1759..65cebb7b1ad8f 100644
--- a/sys/conf/options.i386
+++ b/sys/conf/options.i386
@@ -2,7 +2,6 @@
DISABLE_PSE
IDE_DELAY
-USER_LDT
MATH_EMULATE opt_math_emulate.h
GPL_MATH_EMULATE opt_math_emulate.h
PMAP_SHPGPERPROC opt_pmap.h
diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98
index 4265745b2d665..b85bf24d18a1c 100644
--- a/sys/conf/options.pc98
+++ b/sys/conf/options.pc98
@@ -2,7 +2,6 @@
DISABLE_PSE
IDE_DELAY
-USER_LDT
MATH_EMULATE opt_math_emulate.h
GPL_MATH_EMULATE opt_math_emulate.h
PMAP_SHPGPERPROC opt_pmap.h
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 4ebc8c2c21bec..a613a71a45995 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -284,13 +284,6 @@ options GPL_MATH_EMULATE #Support for x87 emulation via
options COMPAT_43
#
-# Allow user-mode programs to manipulate their local descriptor tables.
-# This option is required for the WINE Windows(tm) emulator, and is
-# not used by anything else (that we know of).
-#
-options USER_LDT #allow user-level control of i386 ldt
-
-#
# These three options provide support for System V Interface
# Definition-style interprocess communication, in the form of shared
# memory, semaphores, and message queues, respectively.
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index fa6124ceaec05..44c91b69a3683 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -37,8 +37,6 @@
* $FreeBSD$
*/
-#include "opt_user_ldt.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/assym.h>
@@ -115,10 +113,7 @@ ASSYM(PCB_EBX, offsetof(struct pcb, pcb_ebx));
ASSYM(PCB_EIP, offsetof(struct pcb, pcb_eip));
ASSYM(TSS_ESP0, offsetof(struct i386tss, tss_esp0));
-#ifdef USER_LDT
ASSYM(PCB_USERLDT, offsetof(struct pcb, pcb_ldt));
-#endif
-
ASSYM(PCB_GS, offsetof(struct pcb, pcb_gs));
ASSYM(PCB_DR0, offsetof(struct pcb, pcb_dr0));
ASSYM(PCB_DR1, offsetof(struct pcb, pcb_dr1));
@@ -177,10 +172,7 @@ ASSYM(GD_SWITCHTIME, offsetof(struct globaldata, gd_switchtime));
ASSYM(GD_SWITCHTICKS, offsetof(struct globaldata, gd_switchticks));
ASSYM(GD_COMMON_TSSD, offsetof(struct globaldata, gd_common_tssd));
ASSYM(GD_TSS_GDT, offsetof(struct globaldata, gd_tss_gdt));
-
-#ifdef USER_LDT
ASSYM(GD_CURRENTLDT, offsetof(struct globaldata, gd_currentldt));
-#endif
ASSYM(GD_WITNESS_SPIN_CHECK, offsetof(struct globaldata, gd_witness_spin_check));
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 256e0ee0469ae..f1a5bb076a8b6 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -49,7 +49,6 @@
#include "opt_msgbuf.h"
#include "opt_npx.h"
#include "opt_perfmon.h"
-#include "opt_user_ldt.h"
#include "opt_userconfig.h"
#include <sys/param.h>
@@ -1048,10 +1047,8 @@ setregs(p, entry, stack, ps_strings)
struct trapframe *regs = p->p_md.md_regs;
struct pcb *pcb = &p->p_addr->u_pcb;
-#ifdef USER_LDT
- /* was i386_user_cleanup() in NetBSD */
- user_ldt_free(pcb);
-#endif
+ if (pcb->pcb_ldt)
+ user_ldt_free(pcb);
bzero((char *)regs, sizeof(struct trapframe));
regs->tf_eip = entry;
@@ -1939,9 +1936,7 @@ init386(first)
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
/* exceptions */
for (x = 0; x < NIDT; x++)
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index 06d65488c470a..f6d23dd1d3094 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -26,7 +26,6 @@
*/
#include "opt_cpu.h"
-#include "opt_user_ldt.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -521,9 +520,7 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
gdt[myid * NGDT + GPROC0_SEL].sd.sd_type = SDT_SYS386TSS;
diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c
index 06d65488c470a..f6d23dd1d3094 100644
--- a/sys/i386/i386/mptable.c
+++ b/sys/i386/i386/mptable.c
@@ -26,7 +26,6 @@
*/
#include "opt_cpu.h"
-#include "opt_user_ldt.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -521,9 +520,7 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
gdt[myid * NGDT + GPROC0_SEL].sd.sd_type = SDT_SYS386TSS;
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index b41dfb07beb4c..52a5e3c056192 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -71,7 +71,6 @@
#include "opt_disable_pse.h"
#include "opt_pmap.h"
#include "opt_msgbuf.h"
-#include "opt_user_ldt.h"
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index c780d6f8c68b8..f5f7441451a81 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -37,7 +37,6 @@
*/
#include "opt_npx.h"
-#include "opt_user_ldt.h"
#include <machine/asmacros.h>
#include <machine/ipl.h>
@@ -241,7 +240,6 @@ sw1b:
/* XXX FIXME: we should be restoring the local APIC TPR */
#endif /* SMP */
-#ifdef USER_LDT
cmpl $0, PCB_USERLDT(%edx)
jnz 1f
movl __default_ldt,%eax
@@ -254,7 +252,6 @@ sw1b:
call _set_user_ldt
popl %edx
2:
-#endif
/* This must be done after loading the user LDT. */
.globl cpu_switch_load_gs
diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c
index e242b73bac08c..cf05d730a23f7 100644
--- a/sys/i386/i386/sys_machdep.c
+++ b/sys/i386/i386/sys_machdep.c
@@ -35,8 +35,6 @@
*
*/
-#include "opt_user_ldt.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
@@ -68,10 +66,8 @@
-#ifdef USER_LDT
static int i386_get_ldt __P((struct proc *, char *));
static int i386_set_ldt __P((struct proc *, char *));
-#endif
static int i386_get_ioperm __P((struct proc *, char *));
static int i386_set_ioperm __P((struct proc *, char *));
int i386_extend_pcb __P((struct proc *));
@@ -91,7 +87,6 @@ sysarch(p, uap)
int error = 0;
switch(uap->op) {
-#ifdef USER_LDT
case I386_GET_LDT:
error = i386_get_ldt(p, uap->parms);
break;
@@ -99,7 +94,6 @@ sysarch(p, uap)
case I386_SET_LDT:
error = i386_set_ldt(p, uap->parms);
break;
-#endif
case I386_GET_IOPERM:
error = i386_get_ioperm(p, uap->parms);
break;
@@ -242,10 +236,9 @@ done:
return (error);
}
-#ifdef USER_LDT
/*
* Update the GDT entry pointing to the LDT to point to the LDT of the
- * current process. Do not staticize.
+ * current process.
*/
void
set_user_ldt(struct pcb *pcb)
@@ -499,4 +492,3 @@ i386_set_ldt(p, args)
splx(s);
return(error);
}
-#endif /* USER_LDT */
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index 1c5cf8a953df7..2cc597a5fccf8 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -42,7 +42,6 @@
*/
#include "opt_npx.h"
-#include "opt_user_ldt.h"
#ifdef PC98
#include "opt_pc98.h"
#endif
@@ -126,7 +125,6 @@ cpu_fork(p1, p2, flags)
struct pcb *pcb2;
if ((flags & RFPROC) == 0) {
-#ifdef USER_LDT
if ((flags & RFMEM) == 0) {
/* unshare user LDT */
struct pcb *pcb1 = &p1->p_addr->u_pcb;
@@ -138,7 +136,6 @@ cpu_fork(p1, p2, flags)
set_user_ldt(pcb1);
}
}
-#endif
return;
}
@@ -188,7 +185,6 @@ cpu_fork(p1, p2, flags)
*/
pcb2->pcb_ext = 0;
-#ifdef USER_LDT
/* Copy the LDT, if necessary. */
if (pcb2->pcb_ldt != 0) {
if (flags & RFMEM) {
@@ -198,7 +194,6 @@ cpu_fork(p1, p2, flags)
pcb2->pcb_ldt->ldt_len);
}
}
-#endif
/*
* Now, cpu_switch() can schedule the new process.
@@ -249,9 +244,8 @@ cpu_exit(p)
ctob(IOPAGES + 1));
pcb->pcb_ext = 0;
}
-#ifdef USER_LDT
- user_ldt_free(pcb);
-#endif
+ if (pcb->pcb_ldt)
+ user_ldt_free(pcb);
if (pcb->pcb_flags & PCB_DBREGS) {
/*
* disable all hardware breakpoints
diff --git a/sys/i386/include/globaldata.h b/sys/i386/include/globaldata.h
index 3b7bca5297c2e..d2873efcbf0d5 100644
--- a/sys/i386/include/globaldata.h
+++ b/sys/i386/include/globaldata.h
@@ -60,7 +60,7 @@ struct globaldata {
int gd_switchticks;
struct segment_descriptor gd_common_tssd;
struct segment_descriptor *gd_tss_gdt;
- int gd_currentldt; /* only used for USER_LDT */
+ int gd_currentldt;
u_int gd_cpuid;
u_int gd_other_cpus;
SLIST_ENTRY(globaldata) gd_allcpu;
diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h
index 06d65488c470a..f6d23dd1d3094 100644
--- a/sys/i386/include/mptable.h
+++ b/sys/i386/include/mptable.h
@@ -26,7 +26,6 @@
*/
#include "opt_cpu.h"
-#include "opt_user_ldt.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -521,9 +520,7 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
gdt[myid * NGDT + GPROC0_SEL].sd.sd_type = SDT_SYS386TSS;
diff --git a/sys/i386/include/pcb.h b/sys/i386/include/pcb.h
index 618c340f95ac7..ebc3965d1ea8d 100644
--- a/sys/i386/include/pcb.h
+++ b/sys/i386/include/pcb.h
@@ -61,11 +61,7 @@ struct pcb {
int pcb_dr6;
int pcb_dr7;
-#ifdef USER_LDT
struct pcb_ldt *pcb_ldt; /* per process (user) LDT */
-#else
- struct pcb_ldt *pcb_ldt_dontuse;
-#endif
struct save87 pcb_savefpu; /* floating point state for 287/387 */
u_char pcb_flags;
#define FP_SOFTFP 0x01 /* process using software fltng pnt emulator */
diff --git a/sys/i386/include/pcb_ext.h b/sys/i386/include/pcb_ext.h
index 482ec96a9cabb..2856c7b5aa4e5 100644
--- a/sys/i386/include/pcb_ext.h
+++ b/sys/i386/include/pcb_ext.h
@@ -53,11 +53,9 @@ struct pcb_ldt {
#ifdef _KERNEL
-#ifdef USER_LDT
void set_user_ldt __P((struct pcb *));
struct pcb_ldt *user_ldt_alloc __P((struct pcb *, int));
void user_ldt_free __P((struct pcb *));
-#endif
#endif
diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h
index 3b7bca5297c2e..d2873efcbf0d5 100644
--- a/sys/i386/include/pcpu.h
+++ b/sys/i386/include/pcpu.h
@@ -60,7 +60,7 @@ struct globaldata {
int gd_switchticks;
struct segment_descriptor gd_common_tssd;
struct segment_descriptor *gd_tss_gdt;
- int gd_currentldt; /* only used for USER_LDT */
+ int gd_currentldt;
u_int gd_cpuid;
u_int gd_other_cpus;
SLIST_ENTRY(globaldata) gd_allcpu;
diff --git a/sys/i386/svr4/svr4_machdep.c b/sys/i386/svr4/svr4_machdep.c
index 231a9d8c8aafd..00bb45ac8ccc0 100644
--- a/sys/i386/svr4/svr4_machdep.c
+++ b/sys/i386/svr4/svr4_machdep.c
@@ -503,7 +503,7 @@ svr4_sys_sysarch(p, v)
struct svr4_sys_sysarch_args *v;
{
struct svr4_sys_sysarch_args *uap = v;
-#ifdef USER_LDT
+#if 0 /* USER_LDT */
#if defined(__NetBSD__)
caddr_t sg = stackgap_init(p->p_emul);
#else
@@ -511,12 +511,13 @@ svr4_sys_sysarch(p, v)
#endif
int error;
#endif
+
switch (uap->op) {
case SVR4_SYSARCH_FPHW:
return 0;
case SVR4_SYSARCH_DSCR:
-#ifdef USER_LDT
+#if 0 /* USER_LDT */
#warning "USER_LDT doesn't work - are you sure you want this?"
{
struct i386_set_ldt_args sa, *sap;
diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c
index 06d65488c470a..f6d23dd1d3094 100644
--- a/sys/kern/subr_smp.c
+++ b/sys/kern/subr_smp.c
@@ -26,7 +26,6 @@
*/
#include "opt_cpu.h"
-#include "opt_user_ldt.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -521,9 +520,7 @@ init_secondary(void)
lidt(&r_idt);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
gdt[myid * NGDT + GPROC0_SEL].sd.sd_type = SDT_SYS386TSS;
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index 429d97e220f4f..1eee512472d5c 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -49,7 +49,6 @@
#include "opt_msgbuf.h"
#include "opt_npx.h"
#include "opt_perfmon.h"
-#include "opt_user_ldt.h"
#include "opt_userconfig.h"
#include <sys/param.h>
@@ -1061,10 +1060,8 @@ setregs(p, entry, stack, ps_strings)
struct trapframe *regs = p->p_md.md_regs;
struct pcb *pcb = &p->p_addr->u_pcb;
-#ifdef USER_LDT
- /* was i386_user_cleanup() in NetBSD */
- user_ldt_free(pcb);
-#endif
+ if (pcb->pcb_ldt)
+ user_ldt_free(pcb);
bzero((char *)regs, sizeof(struct trapframe));
regs->tf_eip = entry;
@@ -2248,9 +2245,7 @@ init386(first)
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
/* exceptions */
for (x = 0; x < NIDT; x++)
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 429d97e220f4f..1eee512472d5c 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -49,7 +49,6 @@
#include "opt_msgbuf.h"
#include "opt_npx.h"
#include "opt_perfmon.h"
-#include "opt_user_ldt.h"
#include "opt_userconfig.h"
#include <sys/param.h>
@@ -1061,10 +1060,8 @@ setregs(p, entry, stack, ps_strings)
struct trapframe *regs = p->p_md.md_regs;
struct pcb *pcb = &p->p_addr->u_pcb;
-#ifdef USER_LDT
- /* was i386_user_cleanup() in NetBSD */
- user_ldt_free(pcb);
-#endif
+ if (pcb->pcb_ldt)
+ user_ldt_free(pcb);
bzero((char *)regs, sizeof(struct trapframe));
regs->tf_eip = entry;
@@ -2248,9 +2245,7 @@ init386(first)
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
lldt(_default_ldt);
-#ifdef USER_LDT
PCPU_SET(currentldt, _default_ldt);
-#endif
/* exceptions */
for (x = 0; x < NIDT; x++)