Module Name: src Committed By: maxv Date: Sun Feb 5 10:42:22 UTC 2017
Modified Files: src/sys/arch/i386/i386: gdt.c machdep.c src/sys/arch/i386/include: segments.h src/sys/arch/x86/x86: sys_machdep.c src/sys/arch/xen/x86: cpu.c xenfunc.c src/sys/compat/linux/arch/i386: linux_machdep.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/arch/i386/i386/gdt.c cvs rdiff -u -r1.777 -r1.778 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.57 -r1.58 src/sys/arch/i386/include/segments.h cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/x86/sys_machdep.c cvs rdiff -u -r1.107 -r1.108 src/sys/arch/xen/x86/cpu.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/xen/x86/xenfunc.c cvs rdiff -u -r1.162 -r1.163 src/sys/compat/linux/arch/i386/linux_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/i386/i386/gdt.c diff -u src/sys/arch/i386/i386/gdt.c:1.56 src/sys/arch/i386/i386/gdt.c:1.57 --- src/sys/arch/i386/i386/gdt.c:1.56 Sat Dec 17 14:27:53 2016 +++ src/sys/arch/i386/i386/gdt.c Sun Feb 5 10:42:21 2017 @@ -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(®ion, ci->ci_gdt, max_len - 1); lgdt(®ion); #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(®ion, ci->ci_gdt, max_len - 1); lgdt(®ion); } @@ -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; } Index: src/sys/arch/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.777 src/sys/arch/i386/i386/machdep.c:1.778 --- src/sys/arch/i386/i386/machdep.c:1.777 Sun Jan 22 20:17:10 2017 +++ src/sys/arch/i386/i386/machdep.c Sun Feb 5 10:42:21 2017 @@ -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_packa 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_packa * 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(®ion, gdt, NGDT * sizeof(gdt[0]) - 1); + setregion(®ion, gdtstore, NGDT * sizeof(gdtstore[0]) - 1); lgdt(®ion); #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(®ion, gdt, NGDT * sizeof(gdt[0]) - 1); + setregion(®ion, gdtstore, NGDT * sizeof(gdtstore[0]) - 1); lgdt(®ion); cpu_init_idt(); Index: src/sys/arch/i386/include/segments.h diff -u src/sys/arch/i386/include/segments.h:1.57 src/sys/arch/i386/include/segments.h:1.58 --- src/sys/arch/i386/include/segments.h:1.57 Fri Sep 2 08:28:06 2016 +++ src/sys/arch/i386/include/segments.h Sun Feb 5 10:42:21 2017 @@ -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); Index: src/sys/arch/x86/x86/sys_machdep.c diff -u src/sys/arch/x86/x86/sys_machdep.c:1.30 src/sys/arch/x86/x86/sys_machdep.c:1.31 --- src/sys/arch/x86/x86/sys_machdep.c:1.30 Sat Sep 24 21:13:44 2016 +++ src/sys/arch/x86/x86/sys_machdep.c Sun Feb 5 10:42:21 2017 @@ -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_g 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_s 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_s 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. */ Index: src/sys/arch/xen/x86/cpu.c diff -u src/sys/arch/xen/x86/cpu.c:1.107 src/sys/arch/xen/x86/cpu.c:1.108 --- src/sys/arch/xen/x86/cpu.c:1.107 Thu Feb 2 08:57:04 2017 +++ src/sys/arch/xen/x86/cpu.c Sun Feb 5 10:42:21 2017 @@ -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 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 * 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 */ Index: src/sys/arch/xen/x86/xenfunc.c diff -u src/sys/arch/xen/x86/xenfunc.c:1.15 src/sys/arch/xen/x86/xenfunc.c:1.16 --- src/sys/arch/xen/x86/xenfunc.c:1.15 Tue Dec 13 10:21:33 2016 +++ src/sys/arch/xen/x86/xenfunc.c Sun Feb 5 10:42:21 2017 @@ -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); Index: src/sys/compat/linux/arch/i386/linux_machdep.c diff -u src/sys/compat/linux/arch/i386/linux_machdep.c:1.162 src/sys/compat/linux/arch/i386/linux_machdep.c:1.163 --- src/sys/compat/linux/arch/i386/linux_machdep.c:1.162 Wed Jul 13 15:59:54 2016 +++ src/sys/compat/linux/arch/i386/linux_machdep.c Sun Feb 5 10:42:22 2017 @@ -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 stru 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); }