summaryrefslogtreecommitdiff
path: root/sys/arch/i386/include/cpu.h
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2018-03-13 13:51:06 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2018-03-13 13:51:06 +0000
commitd0f73983bbaf73f2ac481f54e354a1d3c85dd116 (patch)
treec7b56f49521b2f48dc5a6af177349ea444d63755 /sys/arch/i386/include/cpu.h
parent8449427a6bcd373843363cf05df2497f09bff926 (diff)
Preparation for i386 Meltdown fix:
- provide a cpu_softc for cpu_attach() etc. - replace per PCB TSS with per CPU TSS The first change prepares for cpu_info being embedded in a cpu_full_info. Therefore during autoconf/cpu_attach we hand down a softc. The second change removes the per PCB TSS. We now have one TSS per CPU, thus in cpu_switchto() we only have to patch the ring 0 stack pointer instead of loading a new TSS. This also allows for cleaning up the GDT, so we only have a single slot for the TSS. from hshoexer@; OK deraadt@
Diffstat (limited to 'sys/arch/i386/include/cpu.h')
-rw-r--r--sys/arch/i386/include/cpu.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index e89d43951c0..f3294535bde 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.158 2017/10/17 14:25:35 visa Exp $ */
+/* $OpenBSD: cpu.h,v 1.159 2018/03/13 13:51:05 bluhm Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -46,6 +46,7 @@
#include <machine/psl.h>
#include <machine/segments.h>
#include <machine/intrdefs.h>
+#include <machine/tss.h>
#ifdef MULTIPROCESSOR
#include <machine/i82489reg.h>
@@ -102,7 +103,7 @@ union vmm_cpu_cap {
#ifdef _KERNEL
/* XXX stuff to move to cpuvar.h later */
struct cpu_info {
- struct device ci_dev; /* our device */
+ struct device *ci_dev; /* our device */
struct cpu_info *ci_self; /* pointer to this structure */
struct schedstate_percpu ci_schedstate; /* scheduler state */
struct cpu_info *ci_next; /* next cpu */
@@ -129,7 +130,6 @@ struct cpu_info {
struct pcb *ci_curpcb; /* VA of current HW PCB */
struct pcb *ci_idle_pcb; /* VA of current PCB */
- int ci_idle_tss_sel; /* TSS selector of idle PCB */
struct pmap *ci_curpmap;
struct intrsource *ci_isources[MAX_INTR_SOURCES];
@@ -175,6 +175,7 @@ struct cpu_info {
int ci_want_resched;
union descriptor *ci_gdt;
+ struct i386tss *ci_tss;
volatile int ci_ddb_paused; /* paused due to other proc in ddb */
#define CI_DDB_RUNNING 0
@@ -230,7 +231,7 @@ extern struct cpu_info *cpu_info_list;
#define CPU_INFO_FOREACH(cii, ci) for (cii = 0, ci = cpu_info_list; \
ci != NULL; ci = ci->ci_next)
-#define CPU_INFO_UNIT(ci) ((ci)->ci_dev.dv_unit)
+#define CPU_INFO_UNIT(ci) ((ci)->ci_dev ? (ci)->ci_dev->dv_unit : 0)
#ifdef MULTIPROCESSOR