summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaxv <maxv@NetBSD.org>2017-02-05 10:42:21 +0000
committermaxv <maxv@NetBSD.org>2017-02-05 10:42:21 +0000
commit3203c4bb9ecc7116ee7df1860cccd00537f9ece9 (patch)
tree6bc37df3931cce51231d9e3751c72b55d2ab0cf2
parentf63fe260b0fd44d2a222c8a25a302cbadbca87ed (diff)
Rename ldt->ldtstore and gdt->gdtstore on i386. It reduces the diff with
amd64, and makes it easier to track down these variables on nxr - 'ldt' and 'gdt' being common keywords.
-rw-r--r--sys/arch/i386/i386/gdt.c45
-rw-r--r--sys/arch/i386/i386/machdep.c85
-rw-r--r--sys/arch/i386/include/segments.h4
-rw-r--r--sys/arch/x86/x86/sys_machdep.c10
-rw-r--r--sys/arch/xen/x86/cpu.c8
-rw-r--r--sys/arch/xen/x86/xenfunc.c6
-rw-r--r--sys/compat/linux/arch/i386/linux_machdep.c6
7 files changed, 85 insertions, 79 deletions
diff --git a/sys/arch/i386/i386/gdt.c b/sys/arch/i386/i386/gdt.c
index 397675cb45a..9eadc5c2628 100644
--- a/sys/arch/i386/i386/gdt.c
+++ b/sys/arch/i386/i386/gdt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gdt.c,v 1.56 2016/12/17 14:27:53 maxv Exp $ */
+/* $NetBSD: gdt.c,v 1.57 2017/02/05 10:42:21 maxv Exp $ */
/*-
* Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.56 2016/12/17 14:27:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.57 2017/02/05 10:42:21 maxv Exp $");
#include "opt_multiprocessor.h"
#include "opt_xen.h"
@@ -85,7 +85,7 @@ void
setgdt(int sel, const void *base, size_t limit, int type, int dpl, int def32,
int gran)
{
- struct segment_descriptor *sd = &gdt[sel].sd;
+ struct segment_descriptor *sd = &gdtstore[sel].sd;
CPU_INFO_ITERATOR cii;
struct cpu_info *ci;
@@ -115,8 +115,8 @@ gdt_init(void)
vaddr_t va;
struct cpu_info *ci = &cpu_info_primary;
- max_len = MAXGDTSIZ * sizeof(gdt[0]);
- min_len = MINGDTSIZ * sizeof(gdt[0]);
+ max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
+ min_len = MINGDTSIZ * sizeof(gdtstore[0]);
gdt_size[0] = MINGDTSIZ;
gdt_count[0] = NGDT;
@@ -130,10 +130,11 @@ gdt_init(void)
gdt_free[1] = GNULL_SEL;
#endif
- old_gdt = gdt;
- gdt = (union descriptor *)uvm_km_alloc(kernel_map, max_len,
+ old_gdt = gdtstore;
+ gdtstore = (union descriptor *)uvm_km_alloc(kernel_map, max_len,
0, UVM_KMF_VAONLY);
- for (va = (vaddr_t)gdt; va < (vaddr_t)gdt + min_len; va += PAGE_SIZE) {
+ for (va = (vaddr_t)gdtstore; va < (vaddr_t)gdtstore + min_len;
+ va += PAGE_SIZE) {
pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_ZERO);
if (pg == NULL) {
panic("gdt_init: no pages");
@@ -142,8 +143,8 @@ gdt_init(void)
VM_PROT_READ | VM_PROT_WRITE, 0);
}
pmap_update(pmap_kernel());
- memcpy(gdt, old_gdt, NGDT * sizeof(gdt[0]));
- ci->ci_gdt = gdt;
+ memcpy(gdtstore, old_gdt, NGDT * sizeof(gdtstore[0]));
+ ci->ci_gdt = gdtstore;
setsegment(&ci->ci_gdt[GCPU_SEL].sd, ci,
sizeof(struct cpu_info) - 1, SDT_MEMRWA, SEL_KPL, 1, 0);
@@ -156,8 +157,8 @@ gdt_init(void)
void
gdt_alloc_cpu(struct cpu_info *ci)
{
- int max_len = MAXGDTSIZ * sizeof(gdt[0]);
- int min_len = MINGDTSIZ * sizeof(gdt[0]);
+ int max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
+ int min_len = MINGDTSIZ * sizeof(gdtstore[0]);
struct vm_page *pg;
vaddr_t va;
@@ -174,7 +175,7 @@ gdt_alloc_cpu(struct cpu_info *ci)
}
pmap_update(pmap_kernel());
memset(ci->ci_gdt, 0, min_len);
- memcpy(ci->ci_gdt, gdt, gdt_count[0] * sizeof(gdt[0]));
+ memcpy(ci->ci_gdt, gdtstore, gdt_count[0] * sizeof(gdtstore[0]));
setsegment(&ci->ci_gdt[GCPU_SEL].sd, ci,
sizeof(struct cpu_info) - 1, SDT_MEMRWA, SEL_KPL, 1, 0);
}
@@ -191,11 +192,11 @@ gdt_init_cpu(struct cpu_info *ci)
struct region_descriptor region;
size_t max_len;
- max_len = MAXGDTSIZ * sizeof(gdt[0]);
+ max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
setregion(&region, ci->ci_gdt, max_len - 1);
lgdt(&region);
#else
- size_t len = gdt_size[0] * sizeof(gdt[0]);
+ size_t len = gdt_size[0] * sizeof(gdtstore[0]);
unsigned long frames[len >> PAGE_SHIFT];
vaddr_t va;
pt_entry_t *ptp;
@@ -233,7 +234,7 @@ gdt_reload_cpu(struct cpu_info *ci)
struct region_descriptor region;
size_t max_len;
- max_len = MAXGDTSIZ * sizeof(gdt[0]);
+ max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
setregion(&region, ci->ci_gdt, max_len - 1);
lgdt(&region);
}
@@ -252,16 +253,16 @@ gdt_grow(int which)
struct vm_page *pg;
vaddr_t va;
- old_len = gdt_size[which] * sizeof(gdt[0]);
+ old_len = gdt_size[which] * sizeof(gdtstore[0]);
gdt_size[which] <<= 1;
new_len = old_len << 1;
#ifdef XEN
if (which != 0) {
- size_t max_len = MAXGDTSIZ * sizeof(gdt[0]);
+ size_t max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
if (old_len == 0) {
gdt_size[which] = MINGDTSIZ;
- new_len = gdt_size[which] * sizeof(gdt[0]);
+ new_len = gdt_size[which] * sizeof(gdtstore[0]);
}
for (CPU_INFO_FOREACH(cii, ci)) {
for(va = (vaddr_t)(ci->ci_gdt) + old_len + max_len;
@@ -325,9 +326,9 @@ gdt_get_slot1(int which)
if (gdt_free[which] != GNULL_SEL) {
slot = gdt_free[which];
- gdt_free[which] = gdt[slot].gd.gd_selector;
+ gdt_free[which] = gdtstore[slot].gd.gd_selector;
} else {
- offset = which * MAXGDTSIZ * sizeof(gdt[0]);
+ offset = which * MAXGDTSIZ * sizeof(gdtstore[0]);
if (gdt_next[which] != gdt_count[which] + offset)
panic("gdt_get_slot botch 1");
if (gdt_next[which] - offset >= gdt_size[which]) {
@@ -369,7 +370,7 @@ gdt_put_slot1(int slot, int which)
d.gd.gd_type = SDT_SYSNULL;
d.gd.gd_selector = gdt_free[which];
- update_descriptor(&gdt[slot], &d);
+ update_descriptor(&gdtstore[slot], &d);
gdt_free[which] = slot;
}
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 8044166d042..48cf2c0e94f 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.777 2017/01/22 20:17:10 maxv Exp $ */
+/* $NetBSD: machdep.c,v 1.778 2017/02/05 10:42:21 maxv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.777 2017/01/22 20:17:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.778 2017/02/05 10:42:21 maxv Exp $");
#include "opt_beep.h"
#include "opt_compat_ibcs2.h"
@@ -505,8 +505,8 @@ i386_proc0_tss_ldt_init(void)
pcb->pcb_esp0 = uvm_lwp_getuarea(l) + USPACE - 16;
pcb->pcb_iopl = SEL_KPL;
l->l_md.md_regs = (struct trapframe *)pcb->pcb_esp0 - 1;
- memcpy(&pcb->pcb_fsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_fsd));
- memcpy(&pcb->pcb_gsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_gsd));
+ memcpy(&pcb->pcb_fsd, &gdtstore[GUDATA_SEL], sizeof(pcb->pcb_fsd));
+ memcpy(&pcb->pcb_gsd, &gdtstore[GUDATA_SEL], sizeof(pcb->pcb_gsd));
memset(l->l_md.md_watchpoint, 0, sizeof(*l->l_md.md_watchpoint));
#ifndef XEN
@@ -838,8 +838,8 @@ setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
fpu_save_area_clear(l, pack->ep_osversion >= 699002600
? __INITIAL_NPXCW__ : __NetBSD_COMPAT_NPXCW__);
- memcpy(&pcb->pcb_fsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_fsd));
- memcpy(&pcb->pcb_gsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_gsd));
+ memcpy(&pcb->pcb_fsd, &gdtstore[GUDATA_SEL], sizeof(pcb->pcb_fsd));
+ memcpy(&pcb->pcb_gsd, &gdtstore[GUDATA_SEL], sizeof(pcb->pcb_gsd));
memset(l->l_md.md_watchpoint, 0, sizeof(*l->l_md.md_watchpoint));
@@ -867,8 +867,8 @@ setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
* Initialize segments and descriptor tables
*/
-union descriptor *gdt, *ldt;
-union descriptor *pentium_idt;
+union descriptor *gdtstore, *ldtstore;
+union descriptor *pentium_idt;
extern vaddr_t lwp0uarea;
void
@@ -959,34 +959,37 @@ initgdt(union descriptor *tgdt)
{
KASSERT(tgdt != NULL);
- gdt = tgdt;
+ gdtstore = tgdt;
#ifdef XEN
u_long frames[16];
#else
struct region_descriptor region;
- memset(gdt, 0, NGDT*sizeof(*gdt));
-#endif /* XEN */
+ memset(gdtstore, 0, NGDT * sizeof(*gdtstore));
+#endif
+
/* make gdt gates and memory segments */
- setsegment(&gdt[GCODE_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[GUCODE_SEL].sd, 0, x86_btop(I386_MAX_EXE_ADDR) - 1,
+ setsegment(&gdtstore[GCODE_SEL].sd, 0, 0xfffff,
+ SDT_MEMERA, SEL_KPL, 1, 1);
+ setsegment(&gdtstore[GDATA_SEL].sd, 0, 0xfffff,
+ SDT_MEMRWA, SEL_KPL, 1, 1);
+ setsegment(&gdtstore[GUCODE_SEL].sd, 0, x86_btop(I386_MAX_EXE_ADDR) - 1,
SDT_MEMERA, SEL_UPL, 1, 1);
- setsegment(&gdt[GUCODEBIG_SEL].sd, 0, 0xfffff,
+ setsegment(&gdtstore[GUCODEBIG_SEL].sd, 0, 0xfffff,
SDT_MEMERA, SEL_UPL, 1, 1);
- setsegment(&gdt[GUDATA_SEL].sd, 0, 0xfffff,
+ setsegment(&gdtstore[GUDATA_SEL].sd, 0, 0xfffff,
SDT_MEMRWA, SEL_UPL, 1, 1);
#if NBIOSCALL > 0
/* bios trampoline GDT entries */
- setsegment(&gdt[GBIOSCODE_SEL].sd, 0, 0xfffff, SDT_MEMERA, SEL_KPL, 0,
- 0);
- setsegment(&gdt[GBIOSDATA_SEL].sd, 0, 0xfffff, SDT_MEMRWA, SEL_KPL, 0,
- 0);
+ setsegment(&gdtstore[GBIOSCODE_SEL].sd, 0, 0xfffff,
+ SDT_MEMERA, SEL_KPL, 0, 0);
+ setsegment(&gdtstore[GBIOSDATA_SEL].sd, 0, 0xfffff,
+ SDT_MEMRWA, SEL_KPL, 0, 0);
#endif
- setsegment(&gdt[GCPU_SEL].sd, &cpu_info_primary,
+ setsegment(&gdtstore[GCPU_SEL].sd, &cpu_info_primary,
sizeof(struct cpu_info) - 1, SDT_MEMRWA, SEL_KPL, 1, 0);
#ifndef XEN
- setregion(&region, gdt, NGDT * sizeof(gdt[0]) - 1);
+ setregion(&region, gdtstore, NGDT * sizeof(gdtstore[0]) - 1);
lgdt(&region);
#else /* !XEN */
/*
@@ -997,7 +1000,7 @@ initgdt(union descriptor *tgdt)
xpmap_phys_to_machine_mapping =
(unsigned long *)xen_start_info.mfn_list;
- frames[0] = xpmap_ptom((uint32_t)gdt - KERNBASE) >> PAGE_SHIFT;
+ frames[0] = xpmap_ptom((uint32_t)gdtstore - KERNBASE) >> PAGE_SHIFT;
{ /*
* Enter the gdt page RO into the kernel map. We can't
* use pmap_kenter_pa() here, because %fs is not
@@ -1009,10 +1012,11 @@ initgdt(union descriptor *tgdt)
extern pt_entry_t xpmap_pg_nx;
pt_entry_t pte;
- pte = pmap_pa2pte((vaddr_t)gdt - KERNBASE);
+ pte = pmap_pa2pte((vaddr_t)gdtstore - KERNBASE);
pte |= PG_k | PG_RO | xpmap_pg_nx | PG_V;
- if (HYPERVISOR_update_va_mapping((vaddr_t)gdt, pte, UVMF_INVLPG) < 0) {
+ if (HYPERVISOR_update_va_mapping((vaddr_t)gdtstore, pte,
+ UVMF_INVLPG) < 0) {
panic("gdt page RO update failed.\n");
}
@@ -1153,7 +1157,7 @@ init386(paddr_t first_avail)
/* Use the dummy page as a gdt */
extern vaddr_t xen_dummy_page;
- gdt = (void *)xen_dummy_page;
+ gdtstore = (void *)xen_dummy_page;
/* Determine physical address space */
avail_end = ctob((paddr_t)xen_start_info.nr_pages);
@@ -1170,7 +1174,7 @@ init386(paddr_t first_avail)
* initialised. initgdt() uses pmap_kenter_pa so it can't be called
* before the above variables are set.
*/
- initgdt(gdt);
+ initgdt(gdtstore);
mutex_init(&pte_lock, MUTEX_DEFAULT, IPL_VM);
#endif /* XEN */
@@ -1262,31 +1266,32 @@ init386(paddr_t first_avail)
pmap_update(pmap_kernel());
pentium_idt = (union descriptor *)pentium_idt_vaddr;
- tgdt = gdt;
+ tgdt = gdtstore;
idt = (struct gate_descriptor *)idt_vaddr;
- gdt = (union descriptor *)gdt_vaddr;
- ldt = (union descriptor *)ldt_vaddr;
+ gdtstore = (union descriptor *)gdt_vaddr;
+ ldtstore = (union descriptor *)ldt_vaddr;
- memcpy(gdt, tgdt, NGDT * sizeof(*gdt));
+ memcpy(gdtstore, tgdt, NGDT * sizeof(*gdtstore));
- setsegment(&gdt[GLDT_SEL].sd, ldt, NLDT * sizeof(ldt[0]) - 1,
- SDT_SYSLDT, SEL_KPL, 0, 0);
+ setsegment(&gdtstore[GLDT_SEL].sd, ldtstore,
+ NLDT * sizeof(ldtstore[0]) - 1, SDT_SYSLDT, SEL_KPL, 0, 0);
#else
HYPERVISOR_set_callbacks(
GSEL(GCODE_SEL, SEL_KPL), (unsigned long)hypervisor_callback,
GSEL(GCODE_SEL, SEL_KPL), (unsigned long)failsafe_callback);
- ldt = (union descriptor *)idt_vaddr;
+ ldtstore = (union descriptor *)idt_vaddr;
#endif /* XEN */
/* make ldt gates and memory segments */
- setgate(&ldt[LSYS5CALLS_SEL].gd, &IDTVEC(osyscall), 1,
+ setgate(&ldtstore[LSYS5CALLS_SEL].gd, &IDTVEC(osyscall), 1,
SDT_SYS386CGT, SEL_UPL, GSEL(GCODE_SEL, SEL_KPL));
- ldt[LUCODE_SEL] = gdt[GUCODE_SEL];
- ldt[LUCODEBIG_SEL] = gdt[GUCODEBIG_SEL];
- ldt[LUDATA_SEL] = gdt[GUDATA_SEL];
- ldt[LSOL26CALLS_SEL] = ldt[LBSDICALLS_SEL] = ldt[LSYS5CALLS_SEL];
+ ldtstore[LUCODE_SEL] = gdtstore[GUCODE_SEL];
+ ldtstore[LUCODEBIG_SEL] = gdtstore[GUCODEBIG_SEL];
+ ldtstore[LUDATA_SEL] = gdtstore[GUDATA_SEL];
+ ldtstore[LSOL26CALLS_SEL] = ldtstore[LBSDICALLS_SEL] =
+ ldtstore[LSYS5CALLS_SEL];
#ifndef XEN
/* exceptions */
@@ -1305,7 +1310,7 @@ init386(paddr_t first_avail)
setgate(&idt[0xd2], &IDTVEC(svr4_fasttrap), 0, SDT_SYS386IGT,
SEL_UPL, GSEL(GCODE_SEL, SEL_KPL));
- setregion(&region, gdt, NGDT * sizeof(gdt[0]) - 1);
+ setregion(&region, gdtstore, NGDT * sizeof(gdtstore[0]) - 1);
lgdt(&region);
cpu_init_idt();
diff --git a/sys/arch/i386/include/segments.h b/sys/arch/i386/include/segments.h
index 8e5114513fc..03fafeff0ef 100644
--- a/sys/arch/i386/include/segments.h
+++ b/sys/arch/i386/include/segments.h
@@ -1,4 +1,4 @@
-/* $NetBSD: segments.h,v 1.57 2016/09/02 08:28:06 maxv Exp $ */
+/* $NetBSD: segments.h,v 1.58 2017/02/05 10:42:21 maxv Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -190,7 +190,7 @@ struct region_descriptor {
#endif
#ifdef _KERNEL
-extern union descriptor *gdt, *ldt;
+extern union descriptor *gdtstore, *ldtstore;
extern struct gate_descriptor *idt;
void setgate(struct gate_descriptor *, void *, int, int, int, int);
diff --git a/sys/arch/x86/x86/sys_machdep.c b/sys/arch/x86/x86/sys_machdep.c
index 2140bd5cecd..8a7a33859ff 100644
--- a/sys/arch/x86/x86/sys_machdep.c
+++ b/sys/arch/x86/x86/sys_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_machdep.c,v 1.30 2016/09/24 21:13:44 dholland Exp $ */
+/* $NetBSD: sys_machdep.c,v 1.31 2017/02/05 10:42:21 maxv Exp $ */
/*-
* Copyright (c) 1998, 2007, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.30 2016/09/24 21:13:44 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.31 2017/02/05 10:42:21 maxv Exp $");
#include "opt_mtrr.h"
#include "opt_perfctrs.h"
@@ -175,7 +175,7 @@ x86_get_ldt1(struct lwp *l, struct x86_get_ldt_args *ua, union descriptor *cp)
lp = pmap->pm_ldt;
} else {
nldt = NLDT;
- lp = ldt;
+ lp = ldtstore;
}
if (ua->start > nldt) {
@@ -272,7 +272,7 @@ x86_set_ldt1(struct lwp *l, struct x86_set_ldt_args *ua,
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 !=
+ (gdtstore[IDXSEL(desc->gd.gd_selector)].sd.sd_dpl !=
SEL_UPL))) {
return EACCES;
}
@@ -347,7 +347,7 @@ x86_set_ldt1(struct lwp *l, struct x86_set_ldt_args *ua,
old_ldt = NULL;
old_len = 0;
old_sel = -1;
- memcpy(new_ldt, ldt, NLDT * sizeof(union descriptor));
+ memcpy(new_ldt, ldtstore, NLDT * sizeof(union descriptor));
}
/* Apply requested changes. */
diff --git a/sys/arch/xen/x86/cpu.c b/sys/arch/xen/x86/cpu.c
index 260eb639690..c7d447c2ea3 100644
--- a/sys/arch/xen/x86/cpu.c
+++ b/sys/arch/xen/x86/cpu.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.107 2017/02/02 08:57:04 maxv Exp $ */
+/* $NetBSD: cpu.c,v 1.108 2017/02/05 10:42:21 maxv Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.107 2017/02/02 08:57:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.108 2017/02/05 10:42:21 maxv Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -863,7 +863,7 @@ xen_init_amd64_vcpuctxt(struct cpu_info *ci, struct vcpu_guest_context *initctx,
return;
}
#else /* i386 */
-extern union descriptor *ldt;
+extern union descriptor *ldtstore;
extern void Xsyscall(void);
static void
@@ -941,7 +941,7 @@ xen_init_i386_vcpuctxt(struct cpu_info *ci, struct vcpu_guest_context *initctx,
initctx->gdt_ents = gdt_ents;
/* LDT */
- initctx->ldt_base = (unsigned long)ldt;
+ initctx->ldt_base = (unsigned long)ldtstore;
initctx->ldt_ents = NLDT;
/* Kernel context state */
diff --git a/sys/arch/xen/x86/xenfunc.c b/sys/arch/xen/x86/xenfunc.c
index fcf61de8230..42d001fa210 100644
--- a/sys/arch/xen/x86/xenfunc.c
+++ b/sys/arch/xen/x86/xenfunc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xenfunc.c,v 1.15 2016/12/13 10:21:33 kamil Exp $ */
+/* $NetBSD: xenfunc.c,v 1.16 2017/02/05 10:42:21 maxv Exp $ */
/*
*
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenfunc.c,v 1.15 2016/12/13 10:21:33 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenfunc.c,v 1.16 2017/02/05 10:42:21 maxv Exp $");
#include <sys/param.h>
@@ -70,7 +70,7 @@ lldt(u_short sel)
return;
/* __PRINTK(("ldt %x\n", IDXSELN(sel))); */
if (sel == GSEL(GLDT_SEL, SEL_KPL))
- xen_set_ldt((vaddr_t)ldt, NLDT);
+ xen_set_ldt((vaddr_t)ldtstore, NLDT);
else
xen_set_ldt(ci->ci_gdt[IDXSELN(sel)].ld.ld_base,
ci->ci_gdt[IDXSELN(sel)].ld.ld_entries);
diff --git a/sys/compat/linux/arch/i386/linux_machdep.c b/sys/compat/linux/arch/i386/linux_machdep.c
index 394c5579284..7e93588cbdb 100644
--- a/sys/compat/linux/arch/i386/linux_machdep.c
+++ b/sys/compat/linux/arch/i386/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_machdep.c,v 1.162 2016/07/13 15:59:54 maxv Exp $ */
+/* $NetBSD: linux_machdep.c,v 1.163 2017/02/05 10:42:22 maxv Exp $ */
/*-
* Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.162 2016/07/13 15:59:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.163 2017/02/05 10:42:22 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@@ -535,7 +535,7 @@ linux_read_ldt(struct lwp *l, const struct linux_sys_modify_ldt_args *uap,
error = x86_get_ldt1(l, &gl, ldt_buf);
/* NB gl.num might have changed */
if (error == 0) {
- *retval = gl.num * sizeof *ldt;
+ *retval = gl.num * sizeof(*ldtstore);
error = copyout(ldt_buf, SCARG(uap, ptr),
gl.num * sizeof *ldt_buf);
}