summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/autoconf.c8
-rw-r--r--sys/arch/i386/i386/cpu.c12
-rw-r--r--sys/arch/i386/i386/genassym.cf4
-rw-r--r--sys/arch/i386/i386/locore.s6
-rw-r--r--sys/arch/i386/i386/machdep.c45
-rw-r--r--sys/arch/i386/i386/pmap.c16
-rw-r--r--sys/arch/i386/include/cpu.h8
-rw-r--r--sys/arch/i386/include/pcb.h8
-rw-r--r--sys/arch/i386/include/pmap.h5
-rw-r--r--sys/arch/i386/include/segments.h9
10 files changed, 29 insertions, 92 deletions
diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c
index 6660ebb992d..6660701dc9f 100644
--- a/sys/arch/i386/i386/autoconf.c
+++ b/sys/arch/i386/i386/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.95 2015/12/27 04:31:34 jsg Exp $ */
+/* $OpenBSD: autoconf.c,v 1.96 2016/03/15 03:17:50 guenther Exp $ */
/* $NetBSD: autoconf.c,v 1.20 1996/05/03 19:41:56 christos Exp $ */
/*-
@@ -122,8 +122,8 @@ cpu_configure(void)
gdt_init(); /* XXX - pcibios uses gdt stuff */
- /* Set up proc0's TSS and LDT */
- i386_proc0_tss_ldt_init();
+ /* Set up proc0's TSS */
+ i386_proc0_tss_init();
#ifdef KVM86
kvm86_init();
@@ -158,7 +158,7 @@ cpu_configure(void)
proc0.p_addr->u_pcb.pcb_cr0 = rcr0();
#ifdef MULTIPROCESSOR
- /* propagate TSS and LDT configuration to the idle pcb's. */
+ /* propagate TSS configuration to the idle pcb's. */
cpu_init_idle_pcbs();
#endif
spl0();
diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c
index a5de783722f..e88373c3898 100644
--- a/sys/arch/i386/i386/cpu.c
+++ b/sys/arch/i386/i386/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.72 2016/03/07 05:32:46 naddy Exp $ */
+/* $OpenBSD: cpu.c,v 1.73 2016/03/15 03:17:50 guenther Exp $ */
/* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */
/*-
@@ -272,8 +272,6 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
sizeof (struct trapframe);
pcb->pcb_pmap = pmap_kernel();
pcb->pcb_cr3 = pcb->pcb_pmap->pm_pdirpa;
-
- cpu_default_ldt(ci); /* Use the `global' ldt until one alloc'd */
#endif
ci->ci_curpmap = pmap_kernel();
@@ -323,7 +321,6 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
#ifdef MULTIPROCESSOR
gdt_alloc_cpu(ci);
- cpu_alloc_ldt(ci);
ci->ci_flags |= CPUF_PRESENT | CPUF_AP;
identifycpu(ci);
sched_init_cpu(ci);
@@ -522,7 +519,7 @@ cpu_init_idle_pcbs(void)
continue;
if ((ci->ci_flags & CPUF_PRESENT) == 0)
continue;
- i386_init_pcb_tss_ldt(ci);
+ i386_init_pcb_tss(ci);
}
}
@@ -579,9 +576,8 @@ cpu_hatch(void *v)
lapic_startclock();
lapic_set_lvt();
gdt_init_cpu(ci);
- cpu_init_ldt(ci);
- lldt(GSEL(GLDT_SEL, SEL_KPL));
+ lldt(0);
npxinit(ci);
@@ -632,7 +628,7 @@ cpu_init_tss(struct i386tss *tss, void *stack, void *func)
tss->__tss_ss = GSEL(GDATA_SEL, SEL_KPL);
tss->tss_cr3 = pmap_kernel()->pm_pdirpa;
tss->tss_esp = (int)((char *)stack + USPACE - 16);
- tss->tss_ldt = GSEL(GLDT_SEL, SEL_KPL);
+ tss->tss_ldt = 0;
tss->__tss_eflags = PSL_MBO | PSL_NT; /* XXX not needed? */
tss->__tss_eip = (int)func;
}
diff --git a/sys/arch/i386/i386/genassym.cf b/sys/arch/i386/i386/genassym.cf
index 37c302bf06a..56857faa88e 100644
--- a/sys/arch/i386/i386/genassym.cf
+++ b/sys/arch/i386/i386/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.38 2016/02/28 15:46:18 naddy Exp $
+# $OpenBSD: genassym.cf,v 1.39 2016/03/15 03:17:51 guenther Exp $
#
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -93,8 +93,6 @@ member pcb_cr3
member pcb_ebp
member pcb_esp
member pcb_cr0
-member pcb_ldt
-member pcb_ldt_sel
member pcb_onfault
member pcb_fpcpu
member pcb_flags
diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s
index e533b6d3684..9581f32d310 100644
--- a/sys/arch/i386/i386/locore.s
+++ b/sys/arch/i386/i386/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.166 2016/03/09 13:46:14 mpi Exp $ */
+/* $OpenBSD: locore.s,v 1.167 2016/03/15 03:17:51 guenther Exp $ */
/* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */
/*-
@@ -1187,8 +1187,8 @@ switch_exited:
movl %ebx, CPUVAR(CURPCB)
/*
- * Activate the address space. The pcb copy of %cr3 and the
- * LDT will be refreshed from the pmap, and because we're
+ * Activate the address space. The pcb copy of %cr3 will
+ * be refreshed from the pmap, and because we're
* curproc they'll both be reloaded into the CPU.
*/
pushl %edi
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 372f439a0ac..cb66e9d4a66 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.581 2016/03/07 05:32:46 naddy Exp $ */
+/* $OpenBSD: machdep.c,v 1.582 2016/03/15 03:17:51 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -454,10 +454,10 @@ cpu_startup(void)
}
/*
- * Set up proc0's TSS and LDT.
+ * Set up proc0's TSS
*/
void
-i386_proc0_tss_ldt_init(void)
+i386_proc0_tss_init(void)
{
int x;
struct pcb *pcb;
@@ -470,8 +470,6 @@ i386_proc0_tss_ldt_init(void)
pcb->pcb_iomap[x] = 0xffffffff;
pcb->pcb_iomap_pad = 0xff;
- pcb->pcb_ldt_sel = pmap_kernel()->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL);
- pcb->pcb_ldt = ldt;
pcb->pcb_cr0 = rcr0();
pcb->pcb_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
pcb->pcb_tss.tss_esp0 = (int)proc0.p_addr + USPACE - 16;
@@ -479,12 +477,12 @@ i386_proc0_tss_ldt_init(void)
proc0.p_md.md_tss_sel = tss_alloc(pcb);
ltr(proc0.p_md.md_tss_sel);
- lldt(pcb->pcb_ldt_sel);
+ lldt(0);
}
#ifdef MULTIPROCESSOR
void
-i386_init_pcb_tss_ldt(struct cpu_info *ci)
+i386_init_pcb_tss(struct cpu_info *ci)
{
int x;
struct pcb *pcb = ci->ci_idle_pcb;
@@ -495,8 +493,6 @@ i386_init_pcb_tss_ldt(struct cpu_info *ci)
pcb->pcb_iomap[x] = 0xffffffff;
pcb->pcb_iomap_pad = 0xff;
- pcb->pcb_ldt_sel = pmap_kernel()->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL);
- pcb->pcb_ldt = ci->ci_ldt;
pcb->pcb_cr0 = rcr0();
ci->ci_idle_tss_sel = tss_alloc(pcb);
}
@@ -2954,7 +2950,6 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack,
* Initialize segments and descriptor tables
*/
-union descriptor ldt[NLDT];
struct gate_descriptor idt_region[NIDT];
struct gate_descriptor *idt = idt_region;
@@ -3062,33 +3057,7 @@ cpu_init_idt(void)
setregion(&region, idt, NIDT * sizeof(idt[0]) - 1);
lidt(&region);
}
-
-void
-cpu_default_ldt(struct cpu_info *ci)
-{
- ci->ci_ldt = ldt;
- ci->ci_ldt_len = sizeof(ldt);
-}
-
-void
-cpu_alloc_ldt(struct cpu_info *ci)
-{
- union descriptor *cpu_ldt;
- size_t len = sizeof(ldt);
-
- cpu_ldt = (union descriptor *)uvm_km_alloc(kernel_map, len);
- bcopy(ldt, cpu_ldt, len);
- ci->ci_ldt = cpu_ldt;
- ci->ci_ldt_len = len;
-}
-
-void
-cpu_init_ldt(struct cpu_info *ci)
-{
- setsegment(&ci->ci_gdt[GLDT_SEL].sd, ci->ci_ldt, ci->ci_ldt_len - 1,
- SDT_SYSLDT, SEL_KPL, 0, 0);
-}
-#endif /* MULTIPROCESSOR */
+#endif /* MULTIPROCESSOR */
void
init386(paddr_t first_avail)
@@ -3105,8 +3074,6 @@ init386(paddr_t first_avail)
setsegment(&gdt[GCODE_SEL].sd, 0, 0xfffff, SDT_MEMERA, SEL_KPL, 1, 1);
setsegment(&gdt[GICODE_SEL].sd, 0, 0xfffff, SDT_MEMERA, SEL_KPL, 1, 1);
setsegment(&gdt[GDATA_SEL].sd, 0, 0xfffff, SDT_MEMRWA, SEL_KPL, 1, 1);
- setsegment(&gdt[GLDT_SEL].sd, ldt, sizeof(ldt) - 1, SDT_SYSLDT,
- SEL_KPL, 0, 0);
setsegment(&gdt[GUCODE_SEL].sd, 0, atop(I386_MAX_EXE_ADDR) - 1,
SDT_MEMERA, SEL_UPL, 1, 1);
setsegment(&gdt[GUDATA_SEL].sd, 0, atop(VM_MAXUSER_ADDRESS) - 1,
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index ba5d469be92..7e81b2ad43f 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.188 2016/03/07 05:32:47 naddy Exp $ */
+/* $OpenBSD: pmap.c,v 1.189 2016/03/15 03:17:51 guenther Exp $ */
/* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */
/*
@@ -1287,11 +1287,6 @@ pmap_create(void)
pmap->pm_hiexec = 0;
pmap->pm_flags = 0;
- /* init the LDT */
- pmap->pm_ldt = NULL;
- pmap->pm_ldt_len = 0;
- pmap->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL);
-
setsegment(&pmap->pm_codeseg, 0, atop(I386_MAX_EXE_ADDR) - 1,
SDT_MEMERA, SEL_UPL, 1, 1);
@@ -1398,13 +1393,6 @@ pmap_switch(struct proc *o, struct proc *p)
opmap = self->ci_curpmap;
pcb->pcb_pmap = pmap;
- /* Get the LDT that this process will actually use */
-#ifdef MULTIPROCESSOR
- pcb->pcb_ldt = pmap->pm_ldt == NULL ? self->ci_ldt : pmap->pm_ldt;
-#else
- pcb->pcb_ldt = pmap->pm_ldt == NULL ? ldt : pmap->pm_ldt;
-#endif
- pcb->pcb_ldt_sel = pmap->pm_ldt_sel;
pcb->pcb_cr3 = pmap->pm_pdirpa;
if (opmap == pmap) {
@@ -1424,8 +1412,6 @@ pmap_switch(struct proc *o, struct proc *p)
self->ci_gdt[GUCODE_SEL].sd = pmap->pm_codeseg;
self->ci_gdt[GUFS_SEL].sd = pcb->pcb_threadsegs[TSEG_FS];
self->ci_gdt[GUGS_SEL].sd = pcb->pcb_threadsegs[TSEG_GS];
-
- lldt(pcb->pcb_ldt_sel);
}
void
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index 3d9bc1bef7a..18166923abd 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.146 2016/03/03 12:41:30 naddy Exp $ */
+/* $OpenBSD: cpu.h,v 1.147 2016/03/15 03:17:51 guenther Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -142,8 +142,6 @@ struct cpu_info {
int ci_want_resched;
union descriptor *ci_gdt;
- union descriptor *ci_ldt; /* per-cpu default LDT */
- int ci_ldt_len; /* in bytes */
volatile int ci_ddb_paused; /* paused due to other proc in ddb */
#define CI_DDB_RUNNING 0
@@ -387,8 +385,8 @@ extern void (*update_cpuspeed)(void);
/* machdep.c */
void dumpconf(void);
void cpu_reset(void);
-void i386_proc0_tss_ldt_init(void);
-void i386_init_pcb_tss_ldt(struct cpu_info *);
+void i386_proc0_tss_init(void);
+void i386_init_pcb_tss(struct cpu_info *);
void cpuid(u_int32_t, u_int32_t *);
/* locore.s */
diff --git a/sys/arch/i386/include/pcb.h b/sys/arch/i386/include/pcb.h
index 8fd23c94a81..62fafde53f4 100644
--- a/sys/arch/i386/include/pcb.h
+++ b/sys/arch/i386/include/pcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcb.h,v 1.18 2015/05/05 02:13:46 guenther Exp $ */
+/* $OpenBSD: pcb.h,v 1.19 2016/03/15 03:17:51 guenther Exp $ */
/* $NetBSD: pcb.h,v 1.21 1996/01/08 13:51:42 mycroft Exp $ */
/*-
@@ -58,11 +58,9 @@ struct pcb {
#define pcb_esp pcb_tss.tss_esp
#define pcb_ebp pcb_tss.tss_ebp
#define pcb_cs pcb_tss.tss_cs
-#define pcb_ldt_sel pcb_tss.tss_ldt
- union descriptor *pcb_ldt; /* per process (user) LDT */
- int pcb_ldt_len; /* number of LDT entries */
- union savefpu pcb_savefpu; /* floating point state for FPU */
int pcb_cr0; /* saved image of CR0 */
+ int __pcb_padding; /* for 16-byte align of pcb_savefpu */
+ union savefpu pcb_savefpu; /* floating point state for FPU */
struct segment_descriptor pcb_threadsegs[2];
/* per-thread descriptors */
/*
diff --git a/sys/arch/i386/include/pmap.h b/sys/arch/i386/include/pmap.h
index 656ad424e9c..1614b117cab 100644
--- a/sys/arch/i386/include/pmap.h
+++ b/sys/arch/i386/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.81 2016/03/07 05:32:47 naddy Exp $ */
+/* $OpenBSD: pmap.h,v 1.82 2016/03/15 03:17:51 guenther Exp $ */
/* $NetBSD: pmap.h,v 1.44 2000/04/24 17:18:18 thorpej Exp $ */
/*
@@ -106,9 +106,6 @@ struct pmap {
int pm_flags; /* see below */
struct segment_descriptor pm_codeseg; /* cs descriptor for process */
- union descriptor *pm_ldt; /* user-set LDT */
- int pm_ldt_len; /* number of LDT entries */
- int pm_ldt_sel; /* LDT selector */
};
/*
diff --git a/sys/arch/i386/include/segments.h b/sys/arch/i386/include/segments.h
index f19433322a0..8fe19ab2299 100644
--- a/sys/arch/i386/include/segments.h
+++ b/sys/arch/i386/include/segments.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: segments.h,v 1.20 2011/03/23 16:54:35 pirofti Exp $ */
+/* $OpenBSD: segments.h,v 1.21 2016/03/15 03:17:51 guenther Exp $ */
/* $NetBSD: segments.h,v 1.23 1996/02/01 22:31:03 mycroft Exp $ */
/*-
@@ -116,7 +116,7 @@ struct region_descriptor {
} __packed;
#ifdef _KERNEL
-extern union descriptor *gdt, ldt[];
+extern union descriptor *gdt;
extern struct gate_descriptor idt_region[];
extern struct gate_descriptor *idt;
@@ -126,9 +126,6 @@ void setsegment(struct segment_descriptor *, void *, size_t, int, int,
int, int);
void unsetgate(struct gate_descriptor *);
void cpu_init_idt(void);
-void cpu_default_ldt(struct cpu_info *);
-void cpu_alloc_ldt(struct cpu_info *);
-void cpu_init_ldt(struct cpu_info *);
int idt_vec_alloc(int, int);
void idt_vec_set(int, void (*)(void));
@@ -214,7 +211,7 @@ void idt_vec_free(int);
#define GNULL_SEL 0 /* Null descriptor */
#define GCODE_SEL 1 /* Kernel code descriptor */
#define GDATA_SEL 2 /* Kernel data descriptor */
-#define GLDT_SEL 3 /* Default LDT descriptor */
+#define GLDT_SEL 3 /* Default LDT descriptor (UNUSED) */
#define GCPU_SEL 4 /* per-CPU segment */
#define GUCODE_SEL 5 /* User code descriptor (a stack short) */
#define GUDATA_SEL 6 /* User data descriptor */