Module Name: src
Committed By: martin
Date: Tue Mar 13 15:47:45 UTC 2018
Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: genassym.cf locore.S machdep.c
src/sys/arch/i386/i386 [netbsd-8]: genassym.cf locore.S machdep.c
src/sys/arch/x86/include [netbsd-8]: cpu.h
src/sys/arch/x86/x86 [netbsd-8]: intr.c pmap.c sys_machdep.c
src/sys/arch/xen/x86 [netbsd-8]: cpu.c
Log Message:
Pullup the following revisions via patch, requested by maxv in ticket #629:
sys/arch/amd64/amd64/genassym.cf 1.63,1.64
sys/arch/amd64/amd64/locore.S 1.144
sys/arch/amd64/amd64/machdep.c 1.281-1.283
sys/arch/i386/i386/genassym.cf 1.105-1.106
sys/arch/i386/i386/locore.S 1.155
sys/arch/i386/i386/machdep.c 1.802 (adapted),1.803
sys/arch/x86/include/cpu.h 1.85
sys/arch/x86/x86/intr.c 1.115-1.116
sys/arch/x86/x86/pmap.c 1.275
sys/arch/x86/x86/sys_machdep.c 1.45
sys/arch/xen/x86/cpu.c 1.117
Stop sharing the double-fault stack.
Merge the TSS structures into one single cpu_tss structure, and
allocate it dynamically.
To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.10.1 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.123.6.3 -r1.123.6.4 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.255.6.3 -r1.255.6.4 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.99 -r1.99.10.1 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.145.6.2 -r1.145.6.3 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.782.6.3 -r1.782.6.4 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.71.2.1 -r1.71.2.2 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.101.2.1 -r1.101.2.2 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.245.6.3 -r1.245.6.4 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.35.6.2 -r1.35.6.3 src/sys/arch/x86/x86/sys_machdep.c
cvs rdiff -u -r1.110 -r1.110.6.1 src/sys/arch/xen/x86/cpu.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/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.60 src/sys/arch/amd64/amd64/genassym.cf:1.60.10.1
--- src/sys/arch/amd64/amd64/genassym.cf:1.60 Fri Nov 20 11:58:00 2015
+++ src/sys/arch/amd64/amd64/genassym.cf Tue Mar 13 15:47:44 2018
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.60 2015/11/20 11:58:00 maxv Exp $
+# $NetBSD: genassym.cf,v 1.60.10.1 2018/03/13 15:47:44 martin Exp $
#
# Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -223,6 +223,8 @@ define TF_REGSIZE offsetof(struct trapf
# Total size includes registers pushed by hardware
define FRAMESIZE sizeof(struct trapframe)
+define TSS_RSP0 offsetof(struct cpu_tss, tss.tss_rsp0)
+
define CPU_INFO_SCRATCH offsetof(struct cpu_info, ci_scratch)
define CPU_INFO_SELF offsetof(struct cpu_info, ci_self)
define CPU_INFO_RESCHED offsetof(struct cpu_info, ci_want_resched)
@@ -233,7 +235,7 @@ define CPU_INFO_CURLWP offsetof(struct
define CPU_INFO_CURLDT offsetof(struct cpu_info, ci_curldt)
define CPU_INFO_IDLELWP offsetof(struct cpu_info, ci_data.cpu_idlelwp)
define CPU_INFO_PMAP offsetof(struct cpu_info, ci_pmap)
-define CPU_INFO_RSP0 offsetof(struct cpu_info, ci_tss.tss_rsp0)
+define CPU_INFO_TSS offsetof(struct cpu_info, ci_tss)
define CPU_INFO_NSYSCALL offsetof(struct cpu_info, ci_data.cpu_nsyscall)
define CPU_INFO_NTRAP offsetof(struct cpu_info, ci_data.cpu_ntrap)
define CPU_INFO_NINTR offsetof(struct cpu_info, ci_data.cpu_nintr)
Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.123.6.3 src/sys/arch/amd64/amd64/locore.S:1.123.6.4
--- src/sys/arch/amd64/amd64/locore.S:1.123.6.3 Wed Mar 7 14:50:56 2018
+++ src/sys/arch/amd64/amd64/locore.S Tue Mar 13 15:47:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.123.6.3 2018/03/07 14:50:56 martin Exp $ */
+/* $NetBSD: locore.S,v 1.123.6.4 2018/03/13 15:47:44 martin Exp $ */
/*
* Copyright-o-rama!
@@ -1099,7 +1099,8 @@ skip_save:
/* Switch ring0 stack */
#ifndef XEN
movq PCB_RSP0(%r14),%rax
- movq %rax,CPUVAR(RSP0)
+ movq CPUVAR(TSS),%rdi
+ movq %rax,TSS_RSP0(%rdi)
#else
movq %r14,%rdi
callq _C_LABEL(x86_64_switch_context);
Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.255.6.3 src/sys/arch/amd64/amd64/machdep.c:1.255.6.4
--- src/sys/arch/amd64/amd64/machdep.c:1.255.6.3 Mon Jan 1 19:09:03 2018
+++ src/sys/arch/amd64/amd64/machdep.c Tue Mar 13 15:47:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.255.6.3 2018/01/01 19:09:03 snj Exp $ */
+/* $NetBSD: machdep.c,v 1.255.6.4 2018/03/13 15:47:44 martin Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255.6.3 2018/01/01 19:09:03 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255.6.4 2018/03/13 15:47:44 martin Exp $");
/* #define XENDEBUG_LOW */
@@ -291,8 +291,6 @@ struct pool x86_dbregspl;
phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
int mem_cluster_cnt;
-char x86_64_doubleflt_stack[4096];
-
int cpu_dump(void);
int cpu_dumpsize(void);
u_long cpu_dump_mempagecnt(void);
@@ -502,19 +500,25 @@ x86_64_proc0_tss_ldt_init(void)
void
cpu_init_tss(struct cpu_info *ci)
{
- struct x86_64_tss *tss = &ci->ci_tss;
+ struct cpu_tss *cputss;
uintptr_t p;
- tss->tss_iobase = IOMAP_INVALOFF << 16;
- /* tss->tss_ist[0] is filled by cpu_intr_init */
+ cputss = (struct cpu_tss *)uvm_km_alloc(kernel_map,
+ sizeof(struct cpu_tss), 0, UVM_KMF_WIRED|UVM_KMF_ZERO);
+
+ cputss->tss.tss_iobase = IOMAP_INVALOFF << 16;
+ /* cputss->tss.tss_ist[0] is filled by cpu_intr_init */
/* double fault */
- tss->tss_ist[1] = (uint64_t)x86_64_doubleflt_stack + PAGE_SIZE - 16;
+ p = uvm_km_alloc(kernel_map, PAGE_SIZE, 0, UVM_KMF_WIRED);
+ cputss->tss.tss_ist[1] = p + PAGE_SIZE - 16;
/* NMI */
p = uvm_km_alloc(kernel_map, PAGE_SIZE, 0, UVM_KMF_WIRED);
- tss->tss_ist[2] = p + PAGE_SIZE - 16;
- ci->ci_tss_sel = tss_alloc(tss);
+ cputss->tss.tss_ist[2] = p + PAGE_SIZE - 16;
+
+ ci->ci_tss = cputss;
+ ci->ci_tss_sel = tss_alloc(&cputss->tss);
}
void
Index: src/sys/arch/i386/i386/genassym.cf
diff -u src/sys/arch/i386/i386/genassym.cf:1.99 src/sys/arch/i386/i386/genassym.cf:1.99.10.1
--- src/sys/arch/i386/i386/genassym.cf:1.99 Wed Aug 26 03:00:53 2015
+++ src/sys/arch/i386/i386/genassym.cf Tue Mar 13 15:47:44 2018
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.99 2015/08/26 03:00:53 uebayasi Exp $
+# $NetBSD: genassym.cf,v 1.99.10.1 2018/03/13 15:47:44 martin Exp $
#
# Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -256,6 +256,11 @@ else
define IH_NEXT offsetof(struct intrhand, ih_next)
endif
+define TSS_TSS offsetof(struct cpu_tss, tss)
+define TSS_ESP0 offsetof(struct cpu_tss, tss.tss_esp0)
+define TSS_IOBASE offsetof(struct cpu_tss, tss.tss_iobase)
+define TSS_IOMAP offsetof(struct cpu_tss, iomap)
+
define CPU_INFO_SELF offsetof(struct cpu_info, ci_self)
define CPU_INFO_RESCHED offsetof(struct cpu_info, ci_want_resched)
define CPU_INFO_WANT_PMAPLOAD offsetof(struct cpu_info, ci_want_pmapload)
@@ -267,10 +272,6 @@ define CPU_INFO_CURLDT offsetof(struct
define CPU_INFO_IDLELWP offsetof(struct cpu_info, ci_data.cpu_idlelwp)
define CPU_INFO_PMAP offsetof(struct cpu_info, ci_pmap)
define CPU_INFO_TSS offsetof(struct cpu_info, ci_tss)
-define CPU_INFO_TSS_SEL offsetof(struct cpu_info, ci_tss_sel)
-define CPU_INFO_ESP0 offsetof(struct cpu_info, ci_tss.tss_esp0)
-define CPU_INFO_IOBASE offsetof(struct cpu_info, ci_tss.tss_iobase)
-define CPU_INFO_IOMAP offsetof(struct cpu_info, ci_iomap)
define IOMAP_INVALOFF IOMAP_INVALOFF
define CPU_INFO_NSYSCALL offsetof(struct cpu_info, ci_data.cpu_nsyscall)
define CPU_INFO_NTRAP offsetof(struct cpu_info, ci_data.cpu_ntrap)
Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.145.6.2 src/sys/arch/i386/i386/locore.S:1.145.6.3
--- src/sys/arch/i386/i386/locore.S:1.145.6.2 Sat Sep 9 17:29:40 2017
+++ src/sys/arch/i386/i386/locore.S Tue Mar 13 15:47:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.145.6.2 2017/09/09 17:29:40 snj Exp $ */
+/* $NetBSD: locore.S,v 1.145.6.3 2018/03/13 15:47:44 martin Exp $ */
/*
* Copyright-o-rama!
@@ -128,7 +128,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.145.6.2 2017/09/09 17:29:40 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.145.6.3 2018/03/13 15:47:44 martin Exp $");
#include "opt_compat_oldboot.h"
#include "opt_copy_symtab.h"
@@ -1112,7 +1112,8 @@ skip_save:
addl $4,%esp
#else
movl PCB_ESP0(%ebx),%eax
- movl %eax,CPUVAR(ESP0)
+ movl CPUVAR(TSS),%ecx
+ movl %eax,TSS_ESP0(%ecx)
#endif
/* Don't bother with the rest if switching to a system process. */
@@ -1136,7 +1137,8 @@ skip_save:
movl PCB_IOMAP(%ebx),%eax
orl %eax,%eax
jnz .Lcopy_iobitmap
- movl $(IOMAP_INVALOFF << 16),CPUVAR(IOBASE)
+ movl CPUVAR(TSS),%eax
+ movl $(IOMAP_INVALOFF << 16),TSS_IOBASE(%eax)
.Liobitmap_done:
/* Is this process using RAS (restartable atomic sequences)? */
@@ -1200,13 +1202,14 @@ switch_return:
pushl %esi
pushl %edi
movl %eax,%esi /* pcb_iomap */
- movl CPUVAR(SELF),%edi
- leal CPU_INFO_IOMAP(%edi),%edi
+ movl CPUVAR(TSS),%edi
+ leal TSS_IOMAP(%edi),%edi
rep
movsl
popl %edi
popl %esi
- movl $((CPU_INFO_IOMAP - CPU_INFO_TSS) << 16),CPUVAR(IOBASE)
+ movl CPUVAR(TSS),%eax
+ movl $((TSS_IOMAP - TSS_TSS) << 16),TSS_IOBASE(%eax)
jmp .Liobitmap_done
END(cpu_switchto)
Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.782.6.3 src/sys/arch/i386/i386/machdep.c:1.782.6.4
--- src/sys/arch/i386/i386/machdep.c:1.782.6.3 Thu Mar 8 11:33:15 2018
+++ src/sys/arch/i386/i386/machdep.c Tue Mar 13 15:47:45 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.782.6.3 2018/03/08 11:33:15 martin Exp $ */
+/* $NetBSD: machdep.c,v 1.782.6.4 2018/03/13 15:47:45 martin 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.782.6.3 2018/03/08 11:33:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.782.6.4 2018/03/13 15:47:45 martin Exp $");
#include "opt_beep.h"
#include "opt_compat_ibcs2.h"
@@ -483,8 +483,8 @@ cpu_startup(void)
gdt_init();
i386_proc0_tss_ldt_init();
-#ifndef XEN
cpu_init_tss(&cpu_info_primary);
+#ifndef XEN
ltr(cpu_info_primary.ci_tss_sel);
#endif
@@ -618,10 +618,10 @@ cpu_set_tss_gates(struct cpu_info *ci)
ci->ci_doubleflt_stack = (char *)uvm_km_alloc(kernel_map, USPACE, 0,
UVM_KMF_WIRED);
-
- tss_init(&ci->ci_doubleflt_tss, ci->ci_doubleflt_stack,
+ tss_init(&ci->ci_tss->dblflt_tss, ci->ci_doubleflt_stack,
IDTVEC(tss_trap08));
- setsegment(&sd, &ci->ci_doubleflt_tss, sizeof(struct i386tss) - 1,
+
+ setsegment(&sd, &ci->ci_tss->dblflt_tss, sizeof(struct i386tss) - 1,
SDT_SYS386TSS, SEL_KPL, 0, 0);
ci->ci_gdt[GTRAPTSS_SEL].sd = sd;
@@ -638,10 +638,10 @@ cpu_set_tss_gates(struct cpu_info *ci)
*/
ci->ci_ddbipi_stack = (char *)uvm_km_alloc(kernel_map, USPACE, 0,
UVM_KMF_WIRED);
- tss_init(&ci->ci_ddbipi_tss, ci->ci_ddbipi_stack,
+ tss_init(&ci->ci_tss->ddbipi_tss, ci->ci_ddbipi_stack,
x2apic_mode ? Xx2apic_intrddbipi : Xintrddbipi);
- setsegment(&sd, &ci->ci_ddbipi_tss, sizeof(struct i386tss) - 1,
+ setsegment(&sd, &ci->ci_tss->ddbipi_tss, sizeof(struct i386tss) - 1,
SDT_SYS386TSS, SEL_KPL, 0, 0);
ci->ci_gdt[GIPITSS_SEL].sd = sd;
@@ -649,6 +649,7 @@ cpu_set_tss_gates(struct cpu_info *ci)
GSEL(GIPITSS_SEL, SEL_KPL));
#endif
}
+#endif /* XEN */
/*
* Set up TSS and I/O bitmap.
@@ -656,15 +657,24 @@ cpu_set_tss_gates(struct cpu_info *ci)
void
cpu_init_tss(struct cpu_info *ci)
{
- struct i386tss *tss = &ci->ci_tss;
+ struct cpu_tss *cputss;
- tss->tss_iobase = IOMAP_INVALOFF << 16;
- tss->tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
- tss->tss_ldt = GSEL(GLDT_SEL, SEL_KPL);
- tss->tss_cr3 = rcr3();
- ci->ci_tss_sel = tss_alloc(tss);
+ cputss = (struct cpu_tss *)uvm_km_alloc(kernel_map,
+ sizeof(struct cpu_tss), 0, UVM_KMF_WIRED|UVM_KMF_ZERO);
+
+ cputss->tss.tss_iobase = IOMAP_INVALOFF << 16;
+
+#ifndef XEN
+ cputss->tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
+ cputss->tss.tss_ldt = GSEL(GLDT_SEL, SEL_KPL);
+ cputss->tss.tss_cr3 = rcr3();
+#endif
+
+ ci->ci_tss = cputss;
+#ifndef XEN
+ ci->ci_tss_sel = tss_alloc(&cputss->tss);
+#endif
}
-#endif /* XEN */
void *
getframe(struct lwp *l, int sig, int *onstack)
Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.71.2.1 src/sys/arch/x86/include/cpu.h:1.71.2.2
--- src/sys/arch/x86/include/cpu.h:1.71.2.1 Thu Mar 8 11:33:15 2018
+++ src/sys/arch/x86/include/cpu.h Tue Mar 13 15:47:45 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.71.2.1 2018/03/08 11:33:15 martin Exp $ */
+/* $NetBSD: cpu.h,v 1.71.2.2 2018/03/13 15:47:45 martin Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -84,6 +84,15 @@ struct pmap;
#define NIOPORTS 1024 /* # of ports we allow to be mapped */
#define IOMAPSIZE (NIOPORTS / 8) /* I/O bitmap size in bytes */
+struct cpu_tss {
+#ifdef i386
+ struct i386tss dblflt_tss;
+ struct i386tss ddbipi_tss;
+#endif
+ struct i386tss tss;
+ uint8_t iomap[IOMAPSIZE];
+} __packed;
+
/*
* a bunch of this belongs in cpuvar.h; move it later..
*/
@@ -183,13 +192,6 @@ struct cpu_info {
u_int ci_cflush_lsize; /* CLFLUSH insn line size */
struct x86_cache_info ci_cinfo[CAI_COUNT];
- union descriptor *ci_gdt;
-
-#ifdef i386
- struct i386tss ci_doubleflt_tss;
- struct i386tss ci_ddbipi_tss;
-#endif
-
#ifdef PAE
uint32_t ci_pae_l3_pdirpa; /* PA of L3 PD */
pd_entry_t * ci_pae_l3_pdir; /* VA pointer to L3 PD */
@@ -222,8 +224,11 @@ struct cpu_info {
device_t ci_temperature; /* Intel coretemp(4) or equivalent */
device_t ci_vm; /* Virtual machine guest driver */
- struct i386tss ci_tss; /* Per-cpu TSS; shared among LWPs */
- char ci_iomap[IOMAPSIZE]; /* I/O Bitmap */
+ /*
+ * Segmentation-related data.
+ */
+ union descriptor *ci_gdt;
+ struct cpu_tss *ci_tss; /* Per-cpu TSSes; shared among LWPs */
int ci_tss_sel; /* TSS selector of this cpu */
/*
Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.101.2.1 src/sys/arch/x86/x86/intr.c:1.101.2.2
--- src/sys/arch/x86/x86/intr.c:1.101.2.1 Sat Jan 13 21:50:31 2018
+++ src/sys/arch/x86/x86/intr.c Tue Mar 13 15:47:45 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.101.2.1 2018/01/13 21:50:31 snj Exp $ */
+/* $NetBSD: intr.c,v 1.101.2.2 2018/03/13 15:47:45 martin Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.101.2.1 2018/01/13 21:50:31 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.101.2.2 2018/03/13 15:47:45 martin Exp $");
#include "opt_intrdebug.h"
#include "opt_multiprocessor.h"
@@ -1359,7 +1359,7 @@ cpu_intr_init(struct cpu_info *ci)
ci->ci_intrstack = (char *)istack + redzone_const_or_zero(PAGE_SIZE) +
INTRSTACKSIZE - 33 * sizeof(register_t);
#if defined(__x86_64__)
- ci->ci_tss.tss_ist[0] = (uintptr_t)ci->ci_intrstack & ~0xf;
+ ci->ci_tss->tss.tss_ist[0] = (uintptr_t)ci->ci_intrstack & ~0xf;
#endif /* defined(__x86_64__) */
#endif /* defined(INTRSTACKSIZE) */
ci->ci_idepth = -1;
Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.245.6.3 src/sys/arch/x86/x86/pmap.c:1.245.6.4
--- src/sys/arch/x86/x86/pmap.c:1.245.6.3 Tue Mar 6 08:45:59 2018
+++ src/sys/arch/x86/x86/pmap.c Tue Mar 13 15:47:45 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.245.6.3 2018/03/06 08:45:59 martin Exp $ */
+/* $NetBSD: pmap.c,v 1.245.6.4 2018/03/13 15:47:45 martin Exp $ */
/*-
* Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.245.6.3 2018/03/06 08:45:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.245.6.4 2018/03/13 15:47:45 martin Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -2833,8 +2833,8 @@ pmap_load(void)
#ifdef i386
#ifndef XEN
- ci->ci_tss.tss_ldt = pmap->pm_ldt_sel;
- ci->ci_tss.tss_cr3 = pcb->pcb_cr3;
+ ci->ci_tss->tss.tss_ldt = pmap->pm_ldt_sel;
+ ci->ci_tss->tss.tss_cr3 = pcb->pcb_cr3;
#endif /* !XEN */
#endif /* i386 */
Index: src/sys/arch/x86/x86/sys_machdep.c
diff -u src/sys/arch/x86/x86/sys_machdep.c:1.35.6.2 src/sys/arch/x86/x86/sys_machdep.c:1.35.6.3
--- src/sys/arch/x86/x86/sys_machdep.c:1.35.6.2 Sat Sep 9 17:29:41 2017
+++ src/sys/arch/x86/x86/sys_machdep.c Tue Mar 13 15:47:45 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_machdep.c,v 1.35.6.2 2017/09/09 17:29:41 snj Exp $ */
+/* $NetBSD: sys_machdep.c,v 1.35.6.3 2018/03/13 15:47:45 martin Exp $ */
/*
* Copyright (c) 1998, 2007, 2009, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.35.6.2 2017/09/09 17:29:41 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.35.6.3 2018/03/13 15:47:45 martin Exp $");
#include "opt_mtrr.h"
#include "opt_pmc.h"
@@ -500,9 +500,9 @@ x86_set_ioperm(struct lwp *l, void *args
kpreempt_disable();
ci = curcpu();
- memcpy(ci->ci_iomap, pcb->pcb_iomap, sizeof(ci->ci_iomap));
- ci->ci_tss.tss_iobase =
- ((uintptr_t)ci->ci_iomap - (uintptr_t)&ci->ci_tss) << 16;
+ memcpy(ci->ci_tss->iomap, pcb->pcb_iomap, IOMAPSIZE);
+ ci->ci_tss->tss.tss_iobase =
+ ((uintptr_t)&ci->ci_tss->iomap - (uintptr_t)&ci->ci_tss->tss) << 16;
kpreempt_enable();
return error;
Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.110 src/sys/arch/xen/x86/cpu.c:1.110.6.1
--- src/sys/arch/xen/x86/cpu.c:1.110 Thu Mar 23 18:08:06 2017
+++ src/sys/arch/xen/x86/cpu.c Tue Mar 13 15:47:45 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.110 2017/03/23 18:08:06 maxv Exp $ */
+/* $NetBSD: cpu.c,v 1.110.6.1 2018/03/13 15:47:45 martin Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.110 2017/03/23 18:08:06 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.110.6.1 2018/03/13 15:47:45 martin Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -389,6 +389,7 @@ cpu_attach_common(device_t parent, devic
#ifdef TRAPLOG
ci->ci_tlog_base = kmem_zalloc(sizeof(struct tlog), KM_SLEEP);
#endif
+ cpu_init_tss(ci);
} else {
aprint_naive(": %s Processor\n",
caa->cpu_role == CPU_ROLE_SP ? "Single" : "Boot");