Another piece of cruft...

     option USER_LDT
     Enable userland manipulation of per-process Local Descriptor Table (LDT)
     entries; see i386_set_ldt(2) and the machdep.userldt sysctl(8).  This
     option is supported on the i386 architecture.

... for which there is consensus that it can go way.

This diff removes
* option USER_LDT and everything depending on it,
* the machdep.userldt sysctl,
* the i386_[gs]et_ldt syscall stubs in libi386, and
* the i386_[gs]et_ldt regression test.

Note: PMAP_FORK is a special hook that is only enabled on i386 with
USER_LDT.


Index: sys/arch/i386/conf/GENERIC
===================================================================
RCS file: /cvs/src/sys/arch/i386/conf/GENERIC,v
retrieving revision 1.812
diff -u -p -r1.812 GENERIC
--- sys/arch/i386/conf/GENERIC  28 Feb 2016 15:46:18 -0000      1.812
+++ sys/arch/i386/conf/GENERIC  2 Mar 2016 16:48:25 -0000
@@ -17,7 +17,6 @@ option                USER_PCICONF    # user-space PCI co
 
 #option                VM86            # Virtual 8086 emulation
 option         KVM86           # Kernel Virtual 8086 emulation
-option         USER_LDT        # user-settable LDT; see i386_set_ldt(2)
 option         APERTURE        # in-kernel aperture driver for XFree86
 option         MTRR            # CPU memory range attributes control
 
Index: sys/arch/i386/i386/gdt.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/gdt.c,v
retrieving revision 1.35
diff -u -p -r1.35 gdt.c
--- sys/arch/i386/i386/gdt.c    11 Feb 2015 05:54:48 -0000      1.35
+++ sys/arch/i386/i386/gdt.c    2 Mar 2016 19:47:39 -0000
@@ -221,28 +221,3 @@ tss_free(int sel)
 
        gdt_put_slot(IDXSEL(sel));
 }
-
-#ifdef USER_LDT
-/*
- * Caller must have pmap locked for both of these functions.
- */
-void
-ldt_alloc(struct pmap *pmap, union descriptor *ldt, size_t len)
-{
-       int slot;
-
-       slot = gdt_get_slot();
-       setgdt(slot, ldt, len - 1, SDT_SYSLDT, SEL_KPL, 0, 0);
-       pmap->pm_ldt_sel = GSEL(slot, SEL_KPL);
-}
-
-void
-ldt_free(struct pmap *pmap)
-{
-       int slot;
-
-       slot = IDXSEL(pmap->pm_ldt_sel);
-
-       gdt_put_slot(slot);
-}
-#endif /* USER_LDT */
Index: sys/arch/i386/i386/machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.579
diff -u -p -r1.579 machdep.c
--- sys/arch/i386/i386/machdep.c        27 Dec 2015 04:31:34 -0000      1.579
+++ sys/arch/i386/i386/machdep.c        2 Mar 2016 19:51:22 -0000
@@ -189,10 +189,6 @@ void (*cpu_idle_enter_fcn)(void) = NULL;
 int    cpu_apmhalt = 0;        /* sysctl'd to 1 for halt -p hack */
 #endif
 
-#ifdef USER_LDT
-int    user_ldt_enable = 0;    /* sysctl'd to 1 to enable */
-#endif
-
 struct uvm_constraint_range  isa_constraint = { 0x0, 0x00ffffffUL };
 struct uvm_constraint_range  dma_constraint = { 0x0, 0xffffffffUL };
 struct uvm_constraint_range *uvm_md_constraints[] = {
@@ -2907,10 +2903,6 @@ setregs(struct proc *p, struct exec_pack
        p->p_md.md_flags &= ~MDP_USEDFPU;
 #endif
 
-#ifdef USER_LDT
-       pmap_ldt_cleanup(p);
-#endif
-
        /*
         * Reset the code segment limit to I386_MAX_EXE_ADDR in the pmap;
         * this gets copied into the GDT for GUCODE_SEL by pmap_activate().
@@ -3585,11 +3577,6 @@ cpu_sysctl(int *name, u_int namelen, voi
                else
                        return (sysctl_int(oldp, oldlenp, newp, newlen,
                            &kbd_reset));
-#ifdef USER_LDT
-       case CPU_USERLDT:
-               return (sysctl_int(oldp, oldlenp, newp, newlen,
-                   &user_ldt_enable));
-#endif
        case CPU_OSFXSR:
                return (sysctl_rdint(oldp, oldlenp, newp, i386_use_fxsave));
        case CPU_SSE:
Index: sys/arch/i386/i386/pmap.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/pmap.c,v
retrieving revision 1.186
diff -u -p -r1.186 pmap.c
--- sys/arch/i386/i386/pmap.c   23 Oct 2015 09:36:09 -0000      1.186
+++ sys/arch/i386/i386/pmap.c   2 Mar 2016 20:03:09 -0000
@@ -1362,20 +1362,6 @@ pmap_destroy(struct pmap *pmap)
        uvm_km_free(kernel_map, pmap->pm_pdir, pmap->pm_pdirsize);
        pmap->pm_pdir = 0;
 
-#ifdef USER_LDT
-       if (pmap->pm_flags & PMF_USER_LDT) {
-               /*
-                * no need to switch the LDT; this address space is gone,
-                * nothing is using it.
-                *
-                * No need to lock the pmap for ldt_free (or anything else),
-                * we're the last one to use it.
-                */
-               ldt_free(pmap);
-               uvm_km_free(kernel_map, (vaddr_t)pmap->pm_ldt,
-                           pmap->pm_ldt_len * sizeof(union descriptor));
-       }
-#endif
        pool_put(&pmap_pmap_pool, pmap);
 }
 
@@ -1389,75 +1375,6 @@ pmap_reference(struct pmap *pmap)
 {
        atomic_inc_int(&pmap->pm_obj.uo_refs);
 }
-
-#if defined(PMAP_FORK)
-/*
- * pmap_fork: perform any necessary data structure manipulation when
- * a VM space is forked.
- */
-
-void
-pmap_fork(struct pmap *pmap1, struct pmap *pmap2)
-{
-#ifdef USER_LDT
-       /* Copy the LDT, if necessary. */
-       if (pmap1->pm_flags & PMF_USER_LDT) {
-               union descriptor *new_ldt;
-               size_t len;
-
-               len = pmap1->pm_ldt_len * sizeof(union descriptor);
-               new_ldt = (union descriptor *)uvm_km_alloc(kernel_map, len);
-               if (new_ldt == NULL) {
-                       /* XXX needs to be able to fail properly */
-                       panic("pmap_fork: out of kva");
-               }
-               bcopy(pmap1->pm_ldt, new_ldt, len);
-               pmap2->pm_ldt = new_ldt;
-               pmap2->pm_ldt_len = pmap1->pm_ldt_len;
-               pmap2->pm_flags |= PMF_USER_LDT;
-               ldt_alloc(pmap2, new_ldt, len);
-       }
-#endif /* USER_LDT */
-}
-#endif /* PMAP_FORK */
-
-#ifdef USER_LDT
-/*
- * pmap_ldt_cleanup: if the pmap has a local LDT, deallocate it, and
- * restore the default.
- */
-
-void
-pmap_ldt_cleanup(struct proc *p)
-{
-       struct pcb *pcb = &p->p_addr->u_pcb;
-       pmap_t pmap = p->p_vmspace->vm_map.pmap;
-       union descriptor *old_ldt = NULL;
-       size_t len = 0;
-
-       if (pmap->pm_flags & PMF_USER_LDT) {
-               ldt_free(pmap);
-               pmap->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL);
-               pcb->pcb_ldt_sel = pmap->pm_ldt_sel;
-               /* Reset the cached address of the LDT that this process uses */
-#ifdef MULTIPROCESSOR
-               pcb->pcb_ldt = curcpu()->ci_ldt;
-#else
-               pcb->pcb_ldt = ldt;
-#endif
-               if (pcb == curpcb)
-                       lldt(pcb->pcb_ldt_sel);
-               old_ldt = pmap->pm_ldt;
-               len = pmap->pm_ldt_len * sizeof(union descriptor);
-               pmap->pm_ldt = NULL;
-               pmap->pm_ldt_len = 0;
-               pmap->pm_flags &= ~PMF_USER_LDT;
-       }
-
-       if (old_ldt != NULL)
-               uvm_km_free(kernel_map, (vaddr_t)old_ldt, len);
-}
-#endif /* USER_LDT */
 
 void
 pmap_activate(struct proc *p)
Index: sys/arch/i386/i386/sys_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/sys_machdep.c,v
retrieving revision 1.35
diff -u -p -r1.35 sys_machdep.c
--- sys/arch/i386/i386/sys_machdep.c    8 Sep 2015 07:12:56 -0000       1.35
+++ sys/arch/i386/i386/sys_machdep.c    2 Mar 2016 19:56:28 -0000
@@ -73,248 +73,6 @@ int i386_iopl(struct proc *, void *, reg
 int i386_get_ioperm(struct proc *, void *, register_t *);
 int i386_set_ioperm(struct proc *, void *, register_t *);
 
-#ifdef USER_LDT
-
-#ifdef LDT_DEBUG
-static void i386_print_ldt(int, const struct segment_descriptor *);
-
-static void
-i386_print_ldt(int i, const struct segment_descriptor *d)
-{
-       printf("[%d] lolimit=0x%x, lobase=0x%x, type=%u, dpl=%u, p=%u, "
-           "hilimit=0x%x, xx=%x, def32=%u, gran=%u, hibase=0x%x\n",
-           i, d->sd_lolimit, d->sd_lobase, d->sd_type, d->sd_dpl, d->sd_p,
-           d->sd_hilimit, d->sd_xx, d->sd_def32, d->sd_gran, d->sd_hibase);
-}
-#endif
-
-int
-i386_get_ldt(struct proc *p, void *args, register_t *retval)
-{
-       int error;
-       pmap_t pmap = p->p_vmspace->vm_map.pmap;
-       int nldt, num;
-       union descriptor *lp, *cp;
-       struct i386_get_ldt_args ua;
-
-       if (user_ldt_enable == 0)
-               return (ENOSYS);
-
-       if ((error = copyin(args, &ua, sizeof(ua))) != 0)
-               return (error);
-
-#ifdef LDT_DEBUG
-       printf("i386_get_ldt: start=%d num=%d descs=%p\n", ua.start,
-           ua.num, ua.desc);
-#endif
-
-       if (ua.start < 0 || ua.num < 0 || ua.start > 8192 || ua.num > 8192 ||
-           ua.start + ua.num > 8192)
-               return (EINVAL);
-
-       cp = mallocarray(ua.num, sizeof(union descriptor), M_TEMP, M_WAITOK);
-
-       if (pmap->pm_flags & PMF_USER_LDT) {
-               nldt = pmap->pm_ldt_len;
-               lp = pmap->pm_ldt;
-       } else {
-               nldt = NLDT;
-               lp = ldt;
-       }
-
-       if (ua.start > nldt) {
-               free(cp, M_TEMP, ua.num * sizeof(union descriptor));
-               return (EINVAL);
-       }
-
-       lp += ua.start;
-       num = min(ua.num, nldt - ua.start);
-#ifdef LDT_DEBUG
-       {
-               int i;
-               for (i = 0; i < num; i++)
-                       i386_print_ldt(i, &lp[i].sd);
-       }
-#endif
-
-       memcpy(cp, lp, num * sizeof(union descriptor));
-
-       error = copyout(cp, ua.desc, num * sizeof(union descriptor));
-       if (error == 0)
-               *retval = num;
-
-       free(cp, M_TEMP, ua.num * sizeof(union descriptor));
-       return (error);
-}
-
-int
-i386_set_ldt(struct proc *p, void *args, register_t *retval)
-{
-       int error, i, n;
-       struct pcb *pcb = &p->p_addr->u_pcb;
-       pmap_t pmap = p->p_vmspace->vm_map.pmap;
-       struct i386_set_ldt_args ua;
-       union descriptor *descv;
-       size_t old_len, new_len, ldt_len;
-       union descriptor *old_ldt, *new_ldt;
-
-       if (user_ldt_enable == 0)
-               return (ENOSYS);
-
-       if ((error = copyin(args, &ua, sizeof(ua))) != 0)
-               return (error);
-
-       if (ua.start < 0 || ua.num < 0 || ua.start > 8192 || ua.num > 8192 ||
-           ua.start + ua.num > 8192)
-               return (EINVAL);
-
-       descv = mallocarray(ua.num, sizeof(*descv), M_TEMP, M_NOWAIT);
-       if (descv == NULL)
-               return (ENOMEM);
-
-       if ((error = copyin(ua.desc, descv, sizeof (*descv) * ua.num)) != 0)
-               goto out;
-
-       /* Check descriptors for access violations. */
-       for (i = 0; i < ua.num; i++) {
-               union descriptor *desc = &descv[i];
-
-               switch (desc->sd.sd_type) {
-               case SDT_SYSNULL:
-                       desc->sd.sd_p = 0;
-                       break;
-               case SDT_SYS286CGT:
-               case SDT_SYS386CGT:
-                       /*
-                        * Only allow call gates targeting a segment
-                        * in the LDT or a user segment in the fixed
-                        * part of the gdt.  Segments in the LDT are
-                        * constrained (below) to be user segments.
-                        */
-                       if (desc->gd.gd_p != 0 &&
-                           !ISLDT(desc->gd.gd_selector) &&
-                           ((IDXSEL(desc->gd.gd_selector) >= NGDT) ||
-                            (gdt[IDXSEL(desc->gd.gd_selector)].sd.sd_dpl !=
-                                SEL_UPL))) {
-                               error = EACCES;
-                               goto out;
-                       }
-                       break;
-               case SDT_MEMEC:
-               case SDT_MEMEAC:
-               case SDT_MEMERC:
-               case SDT_MEMERAC:
-                       /* Must be "present" if executable and conforming. */
-                       if (desc->sd.sd_p == 0) {
-                               error = EACCES;
-                               goto out;
-                       }
-                       break;
-               case SDT_MEMRO:
-               case SDT_MEMROA:
-               case SDT_MEMRW:
-               case SDT_MEMRWA:
-               case SDT_MEMROD:
-               case SDT_MEMRODA:
-               case SDT_MEMRWD:
-               case SDT_MEMRWDA:
-               case SDT_MEME:
-               case SDT_MEMEA:
-               case SDT_MEMER:
-               case SDT_MEMERA:
-                       break;
-               default:
-                       /*
-                        * Make sure that unknown descriptor types are
-                        * not marked present.
-                        */
-                       if (desc->sd.sd_p != 0) {
-                               error = EACCES;
-                               goto out;
-                       }
-                       break;
-               }
-
-               if (desc->sd.sd_p != 0) {
-                       /* Only user (ring-3) descriptors may be present. */
-                       if (desc->sd.sd_dpl != SEL_UPL) {
-                               error = EACCES;
-                               goto out;
-                       }
-               }
-       }
-
-       /* allocate user ldt */
-       if (pmap->pm_ldt == 0 || (ua.start + ua.num) > pmap->pm_ldt_len) {
-               if (pmap->pm_flags & PMF_USER_LDT)
-                       ldt_len = pmap->pm_ldt_len;
-               else
-                       ldt_len = 512;
-               while ((ua.start + ua.num) > ldt_len)
-                       ldt_len *= 2;
-               new_len = ldt_len * sizeof(union descriptor);
-
-               new_ldt = (union descriptor *)uvm_km_alloc(kernel_map,
-                   new_len);
-               if (new_ldt == NULL) {
-                       error = ENOMEM;
-                       goto out;
-               }
-
-               if (pmap->pm_ldt != NULL && ldt_len <= pmap->pm_ldt_len) {
-                       /*
-                        * Another thread (re)allocated the LDT to
-                        * sufficient size while we were blocked in
-                        * uvm_km_alloc. Oh well. The new entries
-                        * will quite probably not be right, but
-                        * hey.. not our problem if user applications
-                        * have race conditions like that.
-                        */
-                       uvm_km_free(kernel_map, (vaddr_t)new_ldt, new_len);
-                       goto copy;
-               }
-
-               old_ldt = pmap->pm_ldt;
-
-               if (old_ldt != NULL) {
-                       old_len = pmap->pm_ldt_len * sizeof(union descriptor);
-               } else {
-                       old_len = NLDT * sizeof(union descriptor);
-                       old_ldt = ldt;
-               }
-
-               memcpy(new_ldt, old_ldt, old_len);
-               memset((caddr_t)new_ldt + old_len, 0, new_len - old_len);
-
-               if (old_ldt != ldt)
-                       uvm_km_free(kernel_map, (vaddr_t)old_ldt, old_len);
-
-               pmap->pm_ldt = new_ldt;
-               pmap->pm_ldt_len = ldt_len;
-
-               if (pmap->pm_flags & PMF_USER_LDT)
-                       ldt_free(pmap);
-               else
-                       pmap->pm_flags |= PMF_USER_LDT;
-               ldt_alloc(pmap, new_ldt, new_len);
-               pcb->pcb_ldt_sel = pmap->pm_ldt_sel;
-               if (pcb == curpcb)
-                       lldt(pcb->pcb_ldt_sel);
-
-       }
-copy:
-       /* Now actually replace the descriptors. */
-       for (i = 0, n = ua.start; i < ua.num; i++, n++)
-               pmap->pm_ldt[n] = descv[i];
-
-       *retval = ua.start;
-
-out:
-       free(descv, M_TEMP, ua.num * sizeof(*descv));
-       return (error);
-}
-#endif /* USER_LDT */
-
 #ifdef APERTURE
 extern int allowaperture;
 #endif
@@ -425,16 +183,6 @@ sys_sysarch(struct proc *p, void *v, reg
        int error = 0;
 
        switch(SCARG(uap, op)) {
-#ifdef USER_LDT
-       case I386_GET_LDT:
-               error = i386_get_ldt(p, SCARG(uap, parms), retval);
-               break;
-
-       case I386_SET_LDT:
-               error = i386_set_ldt(p, SCARG(uap, parms), retval);
-               break;
-#endif
-
        case I386_IOPL:
                error = i386_iopl(p, SCARG(uap, parms), retval);
                break;
Index: sys/arch/i386/include/cpu.h
===================================================================
RCS file: /cvs/src/sys/arch/i386/include/cpu.h,v
retrieving revision 1.145
diff -u -p -r1.145 cpu.h
--- sys/arch/i386/include/cpu.h 7 Dec 2015 06:34:14 -0000       1.145
+++ sys/arch/i386/include/cpu.h 2 Mar 2016 16:59:46 -0000
@@ -441,13 +441,6 @@ void       npxdrop(struct proc *);
 void   npxsave_proc(struct proc *, int);
 void   npxsave_cpu(struct cpu_info *, int);
 
-#ifdef USER_LDT
-/* sys_machdep.h */
-extern int user_ldt_enable;
-int    i386_get_ldt(struct proc *, void *, register_t *);
-int    i386_set_ldt(struct proc *, void *, register_t *);
-#endif
-
 /* isa_machdep.c */
 void   isa_defaultirq(void);
 int    isa_nmi(void);
@@ -485,7 +478,6 @@ int cpu_paenable(void *);
 #define CPU_APMWARN            9       /* APM battery warning percentage */
 #define CPU_KBDRESET           10      /* keyboard reset under pcvt */
 #define CPU_APMHALT            11      /* halt -p hack */
-#define CPU_USERLDT            12
 #define CPU_OSFXSR             13      /* uses FXSAVE/FXRSTOR */
 #define CPU_SSE                        14      /* supports SSE */
 #define CPU_SSE2               15      /* supports SSE2 */
@@ -506,7 +498,7 @@ int cpu_paenable(void *);
        { "apmwarn", CTLTYPE_INT }, \
        { "kbdreset", CTLTYPE_INT }, \
        { "apmhalt", CTLTYPE_INT }, \
-       { "userldt", CTLTYPE_INT }, \
+       { 0, 0 }, \
        { "osfxsr", CTLTYPE_INT }, \
        { "sse", CTLTYPE_INT }, \
        { "sse2", CTLTYPE_INT }, \
Index: sys/arch/i386/include/gdt.h
===================================================================
RCS file: /cvs/src/sys/arch/i386/include/gdt.h,v
retrieving revision 1.12
diff -u -p -r1.12 gdt.h
--- sys/arch/i386/include/gdt.h 3 Feb 2009 11:24:19 -0000       1.12
+++ sys/arch/i386/include/gdt.h 2 Mar 2016 19:47:55 -0000
@@ -42,8 +42,6 @@ int gdt_get_slot(void);
 void gdt_init(void);
 void gdt_init_cpu(struct cpu_info *);
 void gdt_reload_cpu(/* XXX struct cpu_info * */ void);
-void ldt_alloc(struct pmap *, union descriptor *, size_t);
-void ldt_free(struct pmap *);
 int tss_alloc(struct pcb *);
 void tss_free(int);
 void setgdt(int, void *, size_t, int, int, int, int);
Index: sys/arch/i386/include/pmap.h
===================================================================
RCS file: /cvs/src/sys/arch/i386/include/pmap.h,v
retrieving revision 1.79
diff -u -p -r1.79 pmap.h
--- sys/arch/i386/include/pmap.h        23 Oct 2015 09:36:09 -0000      1.79
+++ sys/arch/i386/include/pmap.h        2 Mar 2016 20:06:42 -0000
@@ -111,9 +111,6 @@ struct pmap {
        int pm_ldt_sel;                 /* LDT selector */
 };
 
-/* pm_flags */
-#define        PMF_USER_LDT    0x01    /* pmap has user-set LDT */
-
 /*
  * For each managed physical page we maintain a list of <PMAP,VA>s
  * which it is mapped at.  The list is headed by a pv_head structure.
@@ -223,7 +220,6 @@ void pmap_init(void);
 struct pmap *pmap_create(void);
 void pmap_destroy(struct pmap *);
 void pmap_reference(struct pmap *);
-void pmap_fork(struct pmap *, struct pmap *);
 void pmap_remove(struct pmap *, vaddr_t, vaddr_t);
 void pmap_collect(struct pmap *);
 void pmap_activate(struct proc *);
@@ -457,11 +453,6 @@ pmap_is_curpmap(struct pmap *pmap)
 {
        return (pmap_is_active(pmap, curcpu()));
 }
-
-#if defined(USER_LDT)
-void   pmap_ldt_cleanup(struct proc *);
-#define        PMAP_FORK
-#endif /* USER_LDT */
 
 #endif /* _KERNEL */
 
Index: sys/arch/i386/include/sysarch.h
===================================================================
RCS file: /cvs/src/sys/arch/i386/include/sysarch.h,v
retrieving revision 1.12
diff -u -p -r1.12 sysarch.h
--- sys/arch/i386/include/sysarch.h     5 Dec 2012 23:20:12 -0000       1.12
+++ sys/arch/i386/include/sysarch.h     2 Mar 2016 19:59:14 -0000
@@ -7,8 +7,6 @@
 /*
  * Architecture specific syscalls (i386)
  */
-#define I386_GET_LDT   0
-#define I386_SET_LDT   1
 #define        I386_IOPL       2
 #define        I386_GET_IOPERM 3
 #define        I386_SET_IOPERM 4
@@ -18,18 +16,6 @@
 #define        I386_GET_GSBASE 8
 #define        I386_SET_GSBASE 9
 
-struct i386_get_ldt_args {
-       int start;
-       union descriptor *desc;
-       int num;
-};
-
-struct i386_set_ldt_args {
-       int start;
-       union descriptor *desc;
-       int num;
-};
-
 struct i386_iopl_args {
        int iopl;
 };
@@ -50,8 +36,6 @@ int i386_set_threadbase(struct proc *, u
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
-int i386_get_ldt(int, union descriptor *, int);
-int i386_set_ldt(int, union descriptor *, int);
 int i386_iopl(int);
 int i386_get_ioperm(u_long *);
 int i386_set_ioperm(u_long *);
Index: sys/uvm/uvm_map.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_map.c,v
retrieving revision 1.205
diff -u -p -r1.205 uvm_map.c
--- sys/uvm/uvm_map.c   16 Dec 2015 14:22:21 -0000      1.205
+++ sys/uvm/uvm_map.c   2 Mar 2016 20:05:47 -0000
@@ -3738,10 +3738,6 @@ uvmspace_fork(struct process *pr)
                shmfork(vm1, vm2);
 #endif
 
-#ifdef PMAP_FORK
-       pmap_fork(vm1->vm_map.pmap, vm2->vm_map.pmap);
-#endif
-
        return vm2;    
 }
 
Index: sys/uvm/uvm_pmap.h
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_pmap.h,v
retrieving revision 1.25
diff -u -p -r1.25 uvm_pmap.h
--- sys/uvm/uvm_pmap.h  10 Nov 2015 08:21:28 -0000      1.25
+++ sys/uvm/uvm_pmap.h  2 Mar 2016 20:05:27 -0000
@@ -173,10 +173,6 @@ void                pmap_virtual_space(vaddr_t *, vad
 vaddr_t                 pmap_steal_memory(vsize_t, vaddr_t *, vaddr_t *);
 #endif
 
-#if defined(PMAP_FORK)
-void           pmap_fork(pmap_t, pmap_t);
-#endif
-
 /* nested pmaps are used in i386/amd64 vmm */
 #ifndef pmap_nested
 #define pmap_nested(pm) 0
Index: etc/etc.i386/sysctl.conf
===================================================================
RCS file: /cvs/src/etc/etc.i386/sysctl.conf,v
retrieving revision 1.19
diff -u -p -r1.19 sysctl.conf
--- etc/etc.i386/sysctl.conf    29 Feb 2016 19:44:07 -0000      1.19
+++ etc/etc.i386/sysctl.conf    29 Feb 2016 22:33:13 -0000
@@ -2,5 +2,3 @@
 #machdep.apmhalt=1             # 1=powerdown hack, try if halt -p doesn't work
 #machdep.kbdreset=1            # permit console CTRL-ALT-DEL to do a nice halt
 #machdep.lidsuspend=0          # do not suspend laptop upon lid closing
-#machdep.userldt=1             # allow userland programs to play with ldt,
-                               # required by some ports
Index: lib/libarch/i386/Makefile
===================================================================
RCS file: /cvs/src/lib/libarch/i386/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- lib/libarch/i386/Makefile   16 Jul 2014 20:02:17 -0000      1.7
+++ lib/libarch/i386/Makefile   2 Mar 2016 20:35:15 -0000
@@ -1,21 +1,18 @@
 #      $OpenBSD: Makefile,v 1.7 2014/07/16 20:02:17 okan Exp $
 #      $NetBSD: Makefile,v 1.1 1996/02/21 02:45:47 jtk Exp $
 
-MAN+=  i386_get_ldt.2 \
-       i386_get_fsbase.2 i386_get_gsbase.2 \
+MAN+=  i386_get_fsbase.2 i386_get_gsbase.2 \
        i386_iopl.2 i386_get_ioperm.2 \
        i386_vm86.2
 MANSUBDIR=i386
-MLINKS+=i386_get_ldt.2 i386_set_ldt.2 \
-       i386_get_fsbase.2 i386_set_fsbase.2 \
+MLINKS+=i386_get_fsbase.2 i386_set_fsbase.2 \
        i386_get_gsbase.2 i386_set_gsbase.2 \
        i386_get_ioperm.2 i386_set_ioperm.2
 
 .if ${MACHINE} == "i386"
 .PATH: ${LIBC}/i386
 NOPIC=
-SRCS+= i386_get_ldt.c i386_set_ldt.c \
-       i386_iopl.c i386_get_ioperm.c i386_set_ioperm.c \
+SRCS+= i386_iopl.c i386_get_ioperm.c i386_set_ioperm.c \
        i386_get_fsbase.c i386_get_gsbase.c \
        i386_set_fsbase.c i386_set_gsbase.c \
        i386_vm86.c
Index: lib/libarch/i386/i386_get_ldt.2
===================================================================
RCS file: lib/libarch/i386/i386_get_ldt.2
diff -N lib/libarch/i386/i386_get_ldt.2
--- lib/libarch/i386/i386_get_ldt.2     10 Sep 2015 17:55:21 -0000      1.18
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,124 +0,0 @@
-.\"    $OpenBSD: i386_get_ldt.2,v 1.18 2015/09/10 17:55:21 schwarze Exp $
-.\"
-.\" Copyright (c) 1980, 1991 Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     from: @(#)fork.2       6.5 (Berkeley) 3/10/91
-.\"    $NetBSD: i386_get_ldt.2,v 1.3 1996/01/05 14:56:44 pk Exp $
-.\"
-.Dd $Mdocdate: September 10 2015 $
-.Dt I386_GET_LDT 2 i386
-.Os
-.Sh NAME
-.Nm i386_get_ldt ,
-.Nm i386_set_ldt
-.Nd manage i386 per-process Local Descriptor Table entries
-.Sh SYNOPSIS
-.In sys/types.h
-.In machine/segments.h
-.In machine/sysarch.h
-.Ft int
-.Fn i386_get_ldt "int start_sel" "union descriptor *descs" "int num_sels"
-.Ft int
-.Fn i386_set_ldt "int start_sel" "union descriptor *descs" "int num_sels"
-.Sh DESCRIPTION
-.Fn i386_get_ldt
-returns a list of the i386 descriptors in the current process'
-LDT.
-.Fn i386_set_ldt
-sets a list of i386 descriptors in the current process'
-LDT.
-For both routines,
-.Fa start_sel
-specifies the index of the selector in the LDT at which to begin and
-.Fa descs
-points to an array of
-.Fa num_sels
-descriptors to be set or returned.
-.Pp
-Each entry in the
-.Fa descs
-array can be either a segment_descriptor or a gate_descriptor,
-as defined in
-.In i386/segments.h .
-These structures are defined by the architecture
-as disjoint bit-fields, so care must be taken in constructing them.
-.Pp
-Before this API can be used the functionality has to be enabled
-using the machdep.userldt
-.Xr sysctl 8
-variable.
-.Pp
-.Sy Note:
-Code using the
-.Fn i386_get_ldt
-and
-.Fn i386_set_ldt
-functions must be compiled using
-.Cm -li386 .
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn i386_get_ldt
-returns the number of i386 descriptors copied into
-.Fa descs
-from the current process' LDT.
-Otherwise, a value of \-1 is returned and the global
-variable
-.Va errno
-is set to indicate the error.
-.Pp
-Upon successful completion,
-.Fn i386_set_ldt
-returns the first selector set;
-if the kernel allocated a descriptor in the LDT,
-the allocated index is returned.
-Otherwise, a value of \-1 is returned and the global
-variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-.Fn i386_get_ldt
-and
-.Fn i386_set_ldt
-will fail if:
-.Bl -tag -width [EINVAL]
-.It Bq Er EINVAL
-An inappropriate parameter was used for
-.Fa start_sel
-or
-.Fa num_sels .
-.It Bq Er EACCES
-The caller attempted to use a descriptor that would
-circumvent protection or cause a failure.
-.El
-.Sh REFERENCES
-.Rs
-.%A Intel
-.%T i386 Microprocessor Programmer's Reference Manual
-.Re
-.Sh WARNING
-You can really hose your process using this.
Index: lib/libarch/i386/i386_get_ldt.c
===================================================================
RCS file: lib/libarch/i386/i386_get_ldt.c
diff -N lib/libarch/i386/i386_get_ldt.c
--- lib/libarch/i386/i386_get_ldt.c     1 Feb 2016 19:58:44 -0000       1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,45 +0,0 @@
-/*
- *  Copyright (c) 1993 John Brezak
- *  All rights reserved.
- * 
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions
- *  are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. The name of the author may not be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * 
- */
-
-#include <sys/types.h>
-
-#include <machine/segments.h>
-#include <machine/sysarch.h>
-
-int
-i386_get_ldt(int start, union descriptor *desc, int num)
-{
-       struct i386_get_ldt_args p;
-
-       p.start = start;
-       p.desc = desc;
-       p.num = num;
-
-       return sysarch(I386_GET_LDT, &p);
-}
Index: lib/libarch/i386/i386_set_ldt.c
===================================================================
RCS file: lib/libarch/i386/i386_set_ldt.c
diff -N lib/libarch/i386/i386_set_ldt.c
--- lib/libarch/i386/i386_set_ldt.c     1 Feb 2016 19:58:44 -0000       1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,45 +0,0 @@
-/*
- *  Copyright (c) 1993 John Brezak
- *  All rights reserved.
- * 
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions
- *  are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. The name of the author may not be used to endorse or promote products
- *     derived from this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * 
- */
-
-#include <sys/types.h>
-
-#include <machine/segments.h>
-#include <machine/sysarch.h>
-
-int
-i386_set_ldt(int start, union descriptor *desc, int num)
-{
-       struct i386_set_ldt_args p;
-
-       p.start = start;
-       p.desc = desc;
-       p.num = num;
-
-       return sysarch(I386_SET_LDT, &p);
-}
Index: regress/sys/arch/i386/Makefile
===================================================================
RCS file: regress/sys/arch/i386/Makefile
diff -N regress/sys/arch/i386/Makefile
--- regress/sys/arch/i386/Makefile      23 Feb 2002 01:25:11 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,8 +0,0 @@
-#      $OpenBSD: Makefile,v 1.3 2002/02/23 01:25:11 art Exp $
-#      $NetBSD: Makefile,v 1.2 1995/04/20 22:41:43 cgd Exp $
-
-SUBDIR+= ldt
-
-install:
-
-.include <bsd.subdir.mk>
Index: regress/sys/arch/i386/ldt/Makefile
===================================================================
RCS file: regress/sys/arch/i386/ldt/Makefile
diff -N regress/sys/arch/i386/ldt/Makefile
--- regress/sys/arch/i386/ldt/Makefile  16 Jul 2014 20:04:21 -0000      1.8
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,33 +0,0 @@
-#      $OpenBSD: Makefile,v 1.8 2014/07/16 20:04:21 okan Exp $
-#      $NetBSD: Makefile,v 1.3 1995/04/20 22:42:19 cgd Exp $
-#
-# C Optimizer (-O) breaks this program - don't use !!
-CFLAGS=-g
-PROG=  testldt
-
-DPADD+=        ${LIBARCH}
-LDADD+=        -li386
-
-USERLDT_ENABLE!=sysctl -n machdep.userldt
-
-.ifmake !obj && !clean && !cleandir && !depend && !regress
-.INTERRUPT:
-       -@${SUDO} sysctl -q machdep.userldt=${USERLDT_ENABLE}
-
-.END:
-       -@${SUDO} sysctl -q machdep.userldt=${USERLDT_ENABLE}
-.endif
-
-.if ${MACHINE_ARCH} != "i386"
-REGRESS_SKIP="yes"
-.endif
-
-do-testldt:    ${PROG}
-       @${SUDO} sysctl -q machdep.userldt=1
-       ./${PROG}
-
-REGRESS_TARGETS=do-testldt
-REGRESS_ROOT_TARGETS=${REGRESS_TARGETS}
-.PHONY: ${REGRESS_TARGETS}
-
-.include <bsd.regress.mk>
Index: regress/sys/arch/i386/ldt/testldt.c
===================================================================
RCS file: regress/sys/arch/i386/ldt/testldt.c
diff -N regress/sys/arch/i386/ldt/testldt.c
--- regress/sys/arch/i386/ldt/testldt.c 18 Apr 2014 14:38:21 -0000      1.9
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,273 +0,0 @@
-/*     $OpenBSD: testldt.c,v 1.9 2014/04/18 14:38:21 guenther Exp $    */
-/*     $NetBSD: testldt.c,v 1.4 1995/04/20 22:42:38 cgd Exp $  */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <machine/segments.h>
-
-extern int i386_get_ldt(int, union descriptor *, int);
-extern int i386_set_ldt(int, union descriptor *, int);
-
-int verbose = 0;
-struct sigaction segv_act;
-
-static inline void
-set_fs(unsigned long val)
-{
-       __asm__ volatile("mov %0,%%fs"::"r" ((unsigned short) val));
-}
-
-static inline unsigned char
-get_fs_byte(const char * addr)
-{
-       unsigned register char _v;
-
-       __asm__ ("movb %%fs:%1,%0":"=q" (_v):"m" (*addr));
-       return _v;
-}
-
-static inline unsigned short
-get_cs(void)
-{
-       unsigned register short _v;
-
-       __asm__ ("movw %%cs,%0"::"r" ((unsigned short) _v));
-       return _v;
-}
-
-static int
-check_desc(unsigned int desc)
-{
-       desc = LSEL(desc, SEL_UPL);
-       set_fs(desc);
-       return(get_fs_byte((char *) 0));
-}
-
-static void
-gated_call(void)
-{
-       printf("Called from call gate...");
-       __asm__ volatile("popl %ebp");
-       __asm__ volatile(".byte 0xcb");
-}
-
-static struct segment_descriptor *
-make_sd(unsigned base, unsigned limit, int type, int dpl, int seg32, int inpgs)
-{
-       static struct segment_descriptor d;
-
-       d.sd_lolimit = limit & 0x0000ffff;
-       d.sd_lobase  = base & 0x00ffffff;
-       d.sd_type    = type & 0x01f;
-       d.sd_dpl     = dpl & 0x3;
-       d.sd_p       = 1;
-       d.sd_hilimit = (limit & 0x00ff0000) >> 16;
-       d.sd_xx      = 0;
-       d.sd_def32   = seg32?1:0;
-       d.sd_gran    = inpgs?1:0;
-       d.sd_hibase  = (base & 0xff000000) >> 24;
-
-       return (&d);
-}
-
-static struct gate_descriptor *
-make_gd(unsigned offset, unsigned int sel, unsigned stkcpy, int type, int dpl)
-{
-       static struct gate_descriptor d;
-
-       d.gd_looffset = offset & 0x0000ffff;
-       d.gd_selector = sel & 0xffff;
-       d.gd_stkcpy   = stkcpy & 0x1ff;
-       d.gd_type     = type & 0x1ff;
-       d.gd_dpl      = dpl & 0x3;
-       d.gd_p        = 1;
-       d.gd_hioffset = (offset & 0xffff0000) >> 16;
-
-       return(&d);
-}
-
-static void
-print_ldt(union descriptor *dp)
-{
-       unsigned long base_addr, limit, offset, selector, stack_copy;
-       int type, dpl, i;
-       unsigned long *lp = (unsigned long *)dp;
-    
-       /* First 32 bits of descriptor */
-       selector = base_addr = (*lp >> 16) & 0x0000FFFF;
-       offset = limit = *lp & 0x0000FFFF;
-       lp++;
-       
-       /* First 32 bits of descriptor */
-       base_addr |= (*lp & 0xFF000000) | ((*lp << 16) & 0x00FF0000);
-       limit |= (*lp & 0x000F0000);
-       type = dp->sd.sd_type;
-       dpl = dp->sd.sd_dpl;
-       stack_copy = dp->gd.gd_stkcpy;
-       offset |= (*lp >> 16) & 0x0000FFFF;
-    
-       if (type == SDT_SYS386CGT || type == SDT_SYS286CGT)
-               printf("LDT: Gate Off %08.8x, Sel   %05.5x, Stkcpy %d DPL %d, 
Type %d\n",
-                       offset, selector, stack_copy, dpl, type);
-       else
-               printf("LDT: Seg Base %08.8x, Limit %05.5x, DPL %d, Type %d\n",
-                       base_addr, limit, dpl, type);
-       printf("          ");
-       if (*lp & 0x100)
-               printf("Accessed, ");
-       if (*lp & 8000)
-               printf("Present, ");
-       if (type != SDT_SYS386CGT && type != SDT_SYS286CGT) {
-               if (*lp & 0x100000)
-                       printf("User, ");
-               if (*lp & 0x200000)
-                       printf("X, ");
-               if (*lp & 0x400000)
-                       printf("32, ");
-               else
-                       printf("16, ");
-               if (*lp & 0x800000)
-                       printf("page limit, ");
-               else
-                       printf("byte limit, ");
-       }
-       printf("\n");
-       printf("          %08.8x %08.8x\n", *(lp), *(lp-1));
-}
-
-static void busfault(int signal, int code, struct sigcontext *sc)
-{
-       fprintf(stderr, "\nbus fault - investigate.\n");
-       _exit(1);
-}
-
-static void usage(int status)
-{
-       fprintf(stderr, "Usage: testldt [-v]\n");
-        exit(status);
-}
-
-#define MAX_USER_LDT 1024
-main(int argc, char *argv[])
-{
-       union descriptor ldt[MAX_USER_LDT];
-       int num, n, ch;
-       unsigned int cs = get_cs();
-       char *data;
-       struct segment_descriptor *sd;
-       struct gate_descriptor *gd;
-       
-       segv_act.sa_handler = (sig_t) busfault;
-       if (sigaction(SIGBUS, &segv_act, NULL) < 0) {
-               perror("sigaction");
-               exit(1);
-       }
-
-       while ((ch = getopt(argc, argv, "v")) != -1) {
-               switch (ch) {
-               case 'v':
-                   verbose++;
-                   break;
-               default:
-                   usage(1);
-                   break;
-               }
-       }
-
-       printf("Testing i386_get_ldt...\n");
-       if ((num = i386_get_ldt(0, ldt, MAX_USER_LDT)) < 0) {
-               perror("get_ldt");
-               exit(2);
-       }
-       if (num == 0) {
-           fprintf(stderr, "ERROR: i386_get_ldt() return 0 default LDT 
entries.\n");
-           exit(1);
-       }
-
-       if (verbose) {
-           printf("Got %d (default) LDTs\n", num);
-           for (n=0; n < num; n++) {
-               printf("Entry %d: ", n);
-               print_ldt(&ldt[n]);
-           }
-       }
-       
-       /*
-        * mmap a data area and assign an LDT to it
-        */
-       printf("Testing i386_set_ldt...\n");
-       data = (void *) mmap( (char *)0x005f0000, 0x0fff,
-                            PROT_EXEC | PROT_READ | PROT_WRITE,
-                            MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
-       if (data == MAP_FAILED) {
-               perror("mmap");
-               exit(1);
-       }
-       if (verbose) printf("data address: %8.8x\n", data);
-
-       *data = 0x97;
-
-       /* Get the next free LDT and set it to the allocated data. */
-       sd = make_sd((unsigned)data, 4096, SDT_MEMRW, SEL_UPL, 0, 0);
-       if ((num = i386_set_ldt(6, (union descriptor *)sd, 1)) < 0) {
-               perror("set_ldt");
-               exit(1);
-       }
-       if (verbose) printf("setldt returned: %d\n", num);
-       if ((n = i386_get_ldt(num, ldt, 1)) < 0) {
-               perror("get_ldt");
-               exit(1);
-       }
-       if (verbose) {
-               printf("Entry %d: ", num);
-               print_ldt(&ldt[0]);
-       }
-
-       if (verbose) printf("Checking desc (should be 0x97): 0x%x\n", 
check_desc(num));
-       if (check_desc(num) != 0x97) {
-               fprintf(stderr, "ERROR: descriptor check failed: (should be 
0x97): 0x%x\n", check_desc(num));
-               exit(1);
-       }
-       
-       /*
-        * Test a Call Gate
-        */
-       printf("Testing Call Gate...");
-       gd = make_gd((unsigned)gated_call, cs, 0, SDT_SYS386CGT, SEL_UPL);
-       if ((num = i386_set_ldt(5, (union descriptor *)gd, 1)) < 0) {
-               perror("set_ldt: call gate");
-               exit(1);
-       }
-       if (verbose) printf("setldt returned: %d\n", num);
-       if (verbose) printf("Call gate sel = 0x%x\n", LSEL(num, SEL_UPL));
-       if ((n = i386_get_ldt(num, ldt, 1)) < 0) {
-               perror("get_ldt");
-               exit(1);
-       }
-       if (verbose) printf("Entry %d: ", num);
-       if (verbose) print_ldt(&ldt[0]);
-
-#if 0
-       err = setldt(5,
-                    gated_call,        /* Offset */
-                    0x0001,            /* This selector is for the executable 
segment descriptor.  It
-                                          is the standard linux text 
descriptor. */
-                    0x00008c00);       /* Descriptor flags (you can't set all, 
the OS protects some) */
-       printf("setldt returned: %d\n", err);
-#endif
-
-       __asm__ volatile(".byte 0x9a"); /* This is a call to a call gate. */
-       __asm__ volatile(".byte 0x00"); /* Value is ignored in a call gate but 
can be used. */
-       __asm__ volatile(".byte 0x00"); /* by the called procedure. */
-       __asm__ volatile(".byte 0x00");
-       __asm__ volatile(".byte 0x00");
-       __asm__ volatile(".byte 0x2f"); /* Selector 0x002f.      This is index 
= 5 (the call gate), */
-       __asm__ volatile(".byte 0x00"); /* and a requestor priveledge level of 
3. */
-
-       printf("Gated call returned\n");
-       exit (0);
-}
Index: sbin/sysctl/sysctl.8
===================================================================
RCS file: /cvs/src/sbin/sysctl/sysctl.8,v
retrieving revision 1.191
diff -u -p -r1.191 sysctl.8
--- sbin/sysctl/sysctl.8        29 Feb 2016 19:44:07 -0000      1.191
+++ sbin/sysctl/sysctl.8        29 Feb 2016 22:35:07 -0000
@@ -368,7 +368,6 @@ and a few require a kernel compiled with
 .It machdep.apmwarn Ta integer Ta yes
 .It machdep.apmhalt Ta integer Ta yes
 .It machdep.kbdreset Ta integer Ta yes
-.It machdep.userldt Ta integer Ta yes
 .It machdep.osfxsr Ta integer Ta no
 .It machdep.sse Ta integer Ta no
 .It machdep.sse2 Ta integer Ta no
Index: share/man/man3/intro.3
===================================================================
RCS file: /cvs/src/share/man/man3/intro.3,v
retrieving revision 1.73
diff -u -p -r1.73 intro.3
--- share/man/man3/intro.3      14 Nov 2015 23:56:50 -0000      1.73
+++ share/man/man3/intro.3      2 Mar 2016 20:57:23 -0000
@@ -398,7 +398,6 @@ and
 i386 I/O and memory access functions.
 See
 .Xr i386_get_ioperm 2 ,
-.Xr i386_get_ldt 2 ,
 .Xr i386_iopl 2 ,
 and
 .Xr i386_vm86 2 .
Index: share/man/man4/options.4
===================================================================
RCS file: /cvs/src/share/man/man4/options.4,v
retrieving revision 1.241
diff -u -p -r1.241 options.4
--- share/man/man4/options.4    28 Feb 2016 15:46:18 -0000      1.241
+++ share/man/man4/options.4    2 Mar 2016 16:49:55 -0000
@@ -377,17 +377,6 @@ Makes the boot process more verbose for 
 (vendor names and other information is printed, etc.).
 .It Cd option PCMCIAVERBOSE
 Makes the boot process more verbose for PCMCIA peripherals.
-.It Cd option USER_LDT
-Enable userland manipulation of per-process
-Local Descriptor Table (LDT) entries;
-see
-.Xr i386_set_ldt 2
-and the
-.Va machdep.userldt
-.Xr sysctl 8 .
-This option is supported on the
-.Va i386
-architecture.
 .It Cd option USER_PCICONF
 Enables the user level access to the PCI bus configuration space
 through ioctls on the
-- 
Christian "naddy" Weisgerber                          [email protected]

Reply via email to