USER_LDT
Craig Dooley
craig at xlnx-x.net
Fri Dec 19 19:33:50 PST 2003
Heres a patch to take out the USER_LDT option. It adds the option SVR4_USER_LDT to replace it though. It is only used in one file, but apparently USER_LDT breaks svr4 emulation (I dont have any binaries to test). This worked running mplayer with a win32 plugin (quicktime 6).
-Craig
--
------------------------------------------------------------------------
Craig Dooley craig at xxxxxxxxxx
------------------------------------------------------------------------
Index: conf/options.i386
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/conf/options.i386,v
retrieving revision 1.3
diff -u -r1.3 options.i386
--- conf/options.i386 1 Aug 2003 10:58:59 -0000 1.3
+++ conf/options.i386 20 Dec 2003 03:03:14 -0000
@@ -3,7 +3,7 @@
DISABLE_PSE
IDE_DELAY
-USER_LDT
+SVR4_USER_LDT
MATH_EMULATE opt_math_emulate.h
GPL_MATH_EMULATE opt_math_emulate.h
PMAP_SHPGPERPROC opt_pmap.h
Index: conf/options.pc98
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/conf/options.pc98,v
retrieving revision 1.3
diff -u -r1.3 options.pc98
--- conf/options.pc98 1 Aug 2003 10:58:59 -0000 1.3
+++ conf/options.pc98 20 Dec 2003 03:03:28 -0000
@@ -3,7 +3,7 @@
DISABLE_PSE
IDE_DELAY
-USER_LDT
+SVR4_USER_LDT
MATH_EMULATE opt_math_emulate.h
GPL_MATH_EMULATE opt_math_emulate.h
PMAP_SHPGPERPROC opt_pmap.h
Index: emulation/linux/i386/linux_machdep.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/emulation/linux/i386/linux_machdep.c,v
retrieving revision 1.13
diff -u -r1.13 linux_machdep.c
--- emulation/linux/i386/linux_machdep.c 16 Nov 2003 19:08:27 -0000 1.13
+++ emulation/linux/i386/linux_machdep.c 20 Dec 2003 02:26:43 -0000
@@ -726,11 +726,6 @@
break;
}
- if (error == EOPNOTSUPP) {
- printf("linux: modify_ldt needs kernel option USER_LDT\n");
- error = ENOSYS;
- }
-
return (error);
}
Index: emulation/svr4/i386/svr4_machdep.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/emulation/svr4/i386/svr4_machdep.c,v
retrieving revision 1.7
diff -u -r1.7 svr4_machdep.c
--- emulation/svr4/i386/svr4_machdep.c 27 Aug 2003 06:07:11 -0000 1.7
+++ emulation/svr4/i386/svr4_machdep.c 20 Dec 2003 03:05:25 -0000
@@ -486,17 +486,18 @@
svr4_sys_sysarch(struct svr4_sys_sysarch_args *v)
{
struct svr4_sys_sysarch_args *uap = v;
-#ifdef USER_LDT
+#ifdef SVR4_USER_LDT
caddr_t sg = stackgap_init(p->p_emul);
int error;
-#endif
+#endif /* SVR4_USER_LDT */
+
switch (uap->op) {
case SVR4_SYSARCH_FPHW:
return 0;
case SVR4_SYSARCH_DSCR:
-#ifdef USER_LDT
-#warning "USER_LDT doesn't work - are you sure you want this?"
+#ifdef SVR4_USER_LDT
+#warning "SVR4_USER_LDT doesn't work - are you sure you want this?"
{
struct i386_set_ldt_args sa, *sap;
struct sys_sysarch_args ua;
@@ -559,7 +560,7 @@
return sys_sysarch(p, &ua, retval);
}
-#endif
+#endif /* SVR4_USER_LDT */
default:
printf("svr4_sysarch(%d), a1 %p\n", uap->op,
Index: i386/i386/genassym.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/i386/genassym.c,v
retrieving revision 1.32
diff -u -r1.32 genassym.c
--- i386/i386/genassym.c 21 Nov 2003 05:29:07 -0000 1.32
+++ i386/i386/genassym.c 20 Dec 2003 02:27:46 -0000
@@ -38,8 +38,6 @@
* $DragonFly: src/sys/i386/i386/genassym.c,v 1.32 2003/11/21 05:29:07 dillon Exp $
*/
-#include "opt_user_ldt.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/assym.h>
@@ -135,9 +133,7 @@
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));
@@ -189,9 +185,7 @@
ASSYM(GD_INTR_NESTING_LEVEL, offsetof(struct mdglobaldata, mi.gd_intr_nesting_level));
ASSYM(GD_REQFLAGS, offsetof(struct mdglobaldata, mi.gd_reqflags));
-#ifdef USER_LDT
ASSYM(GD_CURRENTLDT, offsetof(struct mdglobaldata, gd_currentldt));
-#endif
ASSYM(RQF_IPIQ, RQF_IPIQ);
ASSYM(RQF_INTPEND, RQF_INTPEND);
Index: i386/i386/globals.s
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/i386/globals.s,v
retrieving revision 1.18
diff -u -r1.18 globals.s
--- i386/i386/globals.s 24 Aug 2003 22:36:43 -0000 1.18
+++ i386/i386/globals.s 20 Dec 2003 02:23:06 -0000
@@ -27,8 +27,6 @@
* $DragonFly: src/sys/i386/i386/globals.s,v 1.18 2003/08/24 22:36:43 hsu Exp $
*/
-#include "opt_user_ldt.h"
-
#include <machine/asmacros.h>
#include <machine/pmap.h>
@@ -68,10 +66,8 @@
.set gd_common_tssd,globaldata + GD_COMMON_TSSD
.set gd_tss_gdt,globaldata + GD_TSS_GDT
-#ifdef USER_LDT
.globl gd_currentldt
.set gd_currentldt,globaldata + GD_CURRENTLDT
-#endif
/*
* The BSP version of these get setup in locore.s and pmap.c, while
Index: i386/i386/machdep.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/i386/machdep.c,v
retrieving revision 1.48
diff -u -r1.48 machdep.c
--- i386/i386/machdep.c 7 Dec 2003 01:17:53 -0000 1.48
+++ i386/i386/machdep.c 20 Dec 2003 02:27:21 -0000
@@ -54,7 +54,6 @@
#include "opt_msgbuf.h"
#include "opt_perfmon.h"
#include "opt_swap.h"
-#include "opt_user_ldt.h"
#include "opt_userconfig.h"
#include <sys/param.h>
@@ -920,10 +919,8 @@
pcb->pcb_gs = _udatasel;
load_gs(_udatasel);
-#ifdef USER_LDT
/* was i386_user_cleanup() in NetBSD */
user_ldt_free(pcb);
-#endif
bzero((char *)regs, sizeof(struct trapframe));
regs->tf_eip = entry;
@@ -1870,9 +1867,7 @@
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
lldt(_default_ldt);
-#ifdef USER_LDT
gd->gd_currentldt = _default_ldt;
-#endif
/* spinlocks and the BGL */
init_locks();
@@ -2597,7 +2592,6 @@
#include "opt_cpu.h"
#include "opt_htt.h"
-#include "opt_user_ldt.h"
/*
Index: i386/i386/mp_machdep.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/i386/mp_machdep.c,v
retrieving revision 1.18
diff -u -r1.18 mp_machdep.c
--- i386/i386/mp_machdep.c 3 Nov 2003 22:50:11 -0000 1.18
+++ i386/i386/mp_machdep.c 20 Dec 2003 02:21:40 -0000
@@ -28,7 +28,6 @@
#include "opt_cpu.h"
#include "opt_htt.h"
-#include "opt_user_ldt.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -455,9 +454,7 @@
lidt(&r_idt);
lldt(_default_ldt);
-#ifdef USER_LDT
mdcpu->gd_currentldt = _default_ldt;
-#endif
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
gdt[myid * NGDT + GPROC0_SEL].sd.sd_type = SDT_SYS386TSS;
Index: i386/i386/pmap.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/i386/pmap.c,v
retrieving revision 1.25
diff -u -r1.25 pmap.c
--- i386/i386/pmap.c 4 Nov 2003 01:05:28 -0000 1.25
+++ i386/i386/pmap.c 20 Dec 2003 02:21:21 -0000
@@ -72,7 +72,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>
Index: i386/i386/swtch.s
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/i386/swtch.s,v
retrieving revision 1.28
diff -u -r1.28 swtch.s
--- i386/i386/swtch.s 25 Sep 2003 23:49:03 -0000 1.28
+++ i386/i386/swtch.s 20 Dec 2003 02:21:12 -0000
@@ -39,7 +39,6 @@
*/
#include "use_npx.h"
-#include "opt_user_ldt.h"
#include <sys/rtprio.h>
@@ -343,7 +342,6 @@
/*
* Restore the user LDT if we have one
*/
-#ifdef USER_LDT
cmpl $0, PCB_USERLDT(%edx)
jnz 1f
movl _default_ldt,%eax
@@ -356,7 +354,6 @@
call set_user_ldt
popl %edx
2:
-#endif
/*
* Restore the %gs segment register, which must be done after
* loading the user LDT. Since user processes can modify the
Index: i386/i386/sys_machdep.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/i386/sys_machdep.c,v
retrieving revision 1.11
diff -u -r1.11 sys_machdep.c
--- i386/i386/sys_machdep.c 26 Aug 2003 21:42:18 -0000 1.11
+++ i386/i386/sys_machdep.c 20 Dec 2003 02:20:40 -0000
@@ -36,8 +36,6 @@
*
*/
-#include "opt_user_ldt.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
@@ -71,10 +69,8 @@
-#ifdef USER_LDT
static int i386_get_ldt (struct proc *, char *, int *);
static int i386_set_ldt (struct proc *, char *, int *);
-#endif
static int i386_get_ioperm (struct proc *, char *);
static int i386_set_ioperm (struct proc *, char *);
int i386_extend_pcb (struct proc *);
@@ -90,7 +86,6 @@
int error = 0;
switch(uap->op) {
-#ifdef USER_LDT
case I386_GET_LDT:
error = i386_get_ldt(p, uap->parms, &uap->sysmsg_result);
break;
@@ -98,7 +93,6 @@
case I386_SET_LDT:
error = i386_set_ldt(p, uap->parms, &uap->sysmsg_result);
break;
-#endif
case I386_GET_IOPERM:
error = i386_get_ioperm(p, uap->parms);
break;
@@ -237,7 +231,6 @@
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.
@@ -503,4 +496,3 @@
kmem_free(kernel_map, (vm_offset_t)descs, descs_size);
return (0);
}
-#endif /* USER_LDT */
Index: i386/i386/vm_machdep.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/i386/vm_machdep.c,v
retrieving revision 1.25
diff -u -r1.25 vm_machdep.c
--- i386/i386/vm_machdep.c 3 Nov 2003 17:11:18 -0000 1.25
+++ i386/i386/vm_machdep.c 20 Dec 2003 02:18:46 -0000
@@ -44,7 +44,6 @@
#include "use_npx.h"
#include "use_isa.h"
-#include "opt_user_ldt.h"
#ifdef PC98
#include "opt_pc98.h"
#endif
@@ -129,7 +128,6 @@
struct pcb *pcb2;
if ((flags & RFPROC) == 0) {
-#ifdef USER_LDT
if ((flags & RFMEM) == 0) {
/* unshare user LDT */
struct pcb *pcb1 = p1->p_thread->td_pcb;
@@ -141,7 +139,6 @@
set_user_ldt(pcb1);
}
}
-#endif
return;
}
@@ -204,7 +201,6 @@
*/
pcb2->pcb_ext = 0;
-#ifdef USER_LDT
/* Copy the LDT, if necessary. */
if (pcb2->pcb_ldt != 0) {
if (flags & RFMEM) {
@@ -214,7 +210,6 @@
pcb2->pcb_ldt->ldt_len);
}
}
-#endif
/*
* Now, cpu_switch() can schedule the new process.
@@ -284,9 +279,7 @@
ctob(IOPAGES + 1));
pcb->pcb_ext = 0;
}
-#ifdef USER_LDT
user_ldt_free(pcb);
-#endif
if (pcb->pcb_flags & PCB_DBREGS) {
/*
* disable all hardware breakpoints
Index: i386/include/globaldata.h
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/include/globaldata.h,v
retrieving revision 1.20
diff -u -r1.20 globaldata.h
--- i386/include/globaldata.h 27 Aug 2003 02:03:17 -0000 1.20
+++ i386/include/globaldata.h 20 Dec 2003 02:17:57 -0000
@@ -70,7 +70,7 @@
int gd_fpending; /* fast interrupt pending */
int gd_ipending; /* normal interrupt pending */
int gd_idelayed; /* delayed software ints */
- int gd_currentldt; /* USER_LDT */
+ int gd_currentldt;
int gd_private_tss;
u_int gd_cpu_lockid;
u_int gd_other_cpus;
Index: i386/include/pcb.h
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/include/pcb.h,v
retrieving revision 1.7
diff -u -r1.7 pcb.h
--- i386/include/pcb.h 26 Aug 2003 21:42:18 -0000 1.7
+++ i386/include/pcb.h 20 Dec 2003 02:17:32 -0000
@@ -62,11 +62,7 @@
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
union savefpu pcb_save;
u_char pcb_flags;
#define FP_SOFTFP 0x01 /* process using software fltng pnt emulator */
Index: i386/include/pcb_ext.h
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/i386/include/pcb_ext.h,v
retrieving revision 1.4
diff -u -r1.4 pcb_ext.h
--- i386/include/pcb_ext.h 26 Aug 2003 21:42:18 -0000 1.4
+++ i386/include/pcb_ext.h 20 Dec 2003 02:16:57 -0000
@@ -54,11 +54,9 @@
#ifdef _KERNEL
-#ifdef USER_LDT
void set_user_ldt (struct pcb *);
struct pcb_ldt *user_ldt_alloc (struct pcb *, int);
void user_ldt_free (struct pcb *);
-#endif
#endif
Index: pc98/i386/machdep.c
===================================================================
RCS file: /usr/srcs/dcvs/src/sys/pc98/i386/machdep.c,v
retrieving revision 1.13
diff -u -r1.13 machdep.c
--- pc98/i386/machdep.c 3 Nov 2003 22:50:17 -0000 1.13
+++ pc98/i386/machdep.c 20 Dec 2003 02:22:43 -0000
@@ -54,7 +54,6 @@
#include "opt_msgbuf.h"
#include "opt_perfmon.h"
#include "opt_swap.h"
-#include "opt_user_ldt.h"
#include "opt_userconfig.h"
#include <sys/param.h>
@@ -1033,10 +1032,8 @@
pcb->pcb_gs = _udatasel;
load_gs(_udatasel);
-#ifdef USER_LDT
/* was i386_user_cleanup() in NetBSD */
user_ldt_free(pcb);
-#endif
bzero((char *)regs, sizeof(struct trapframe));
regs->tf_eip = entry;
@@ -1994,9 +1991,7 @@
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
lldt(_default_ldt);
-#ifdef USER_LDT
currentldt = _default_ldt;
-#endif
/* exceptions */
for (x = 0; x < NIDT; x++)
More information about the Submit
mailing list