summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2018-03-31 13:49:04 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2018-03-31 13:49:04 +0000
commit4594091e70e5fbd6f890c9aef1a88b621466b7f5 (patch)
tree63afe3a05807acd459bfa99b6a1397ae58657474 /sys/arch
parent259e24d6a3f2ccbe94f34dd79d6497f182bd23ab (diff)
Recommit preparation for i386 Meltdown fix after OpenBSD 6.3 release.
Switching from per PCB TSS to per CPU TSS broke kvm86 calls to the BIOS. This change fixes the issues. from hshoexer@; reported and tested by semarie@; OK deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/kvm86.c4
-rw-r--r--sys/arch/i386/i386/kvm86call.S9
2 files changed, 8 insertions, 5 deletions
diff --git a/sys/arch/i386/i386/kvm86.c b/sys/arch/i386/i386/kvm86.c
index c3344610655..e540a0215f4 100644
--- a/sys/arch/i386/i386/kvm86.c
+++ b/sys/arch/i386/i386/kvm86.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm86.c,v 1.15 2018/03/31 13:45:03 bluhm Exp $ */
+/* $OpenBSD: kvm86.c,v 1.16 2018/03/31 13:49:03 bluhm Exp $ */
/* $NetBSD: kvm86.c,v 1.10 2005/12/26 19:23:59 perry Exp $ */
/*
* Copyright (c) 2002
@@ -108,7 +108,7 @@ kvm86_init(void)
tss->tss_ioopt = ((caddr_t)vmd->iomap - (caddr_t)&tss) << 16;
/* setup TSS descriptor (including our iomap) */
- setsegment(&vmd->sd, &tss,
+ setsegment(&vmd->sd, tss,
sizeof(struct i386tss) + sizeof(vmd->iomap) - 1,
SDT_SYS386TSS, SEL_KPL, 0, 0);
diff --git a/sys/arch/i386/i386/kvm86call.S b/sys/arch/i386/i386/kvm86call.S
index c7ee01f994f..f1e0d5324bb 100644
--- a/sys/arch/i386/i386/kvm86call.S
+++ b/sys/arch/i386/i386/kvm86call.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm86call.S,v 1.11 2018/03/31 13:45:03 bluhm Exp $ */
+/* $OpenBSD: kvm86call.S,v 1.12 2018/03/31 13:49:03 bluhm Exp $ */
/* $NetBSD: kvm86call.S,v 1.7 2006/04/11 17:14:07 drochner Exp $ */
/*-
@@ -94,12 +94,15 @@ ENTRY(kvm86_call)
leal _C_LABEL(cpu_info_primary),%ecx
#endif
+ movl CPU_INFO_CURPCB(%ecx),%eax
+ pushl %eax /* save curpcb */
+
#ifdef MULTIPROCESSOR
movl CPU_INFO_GDT(%edx),%eax
#else
movl _C_LABEL(gdt),%eax
#endif
- movl GTSS_SEL,%edi
+ movl $GSEL(GTSS_SEL, SEL_KPL),%edi
andl $~0x0200,4(%eax,%edi,1) /* reset "task busy" */
movl 0(%eax,%edi,1),%edx
@@ -185,7 +188,7 @@ ENTRY(kvm86_ret)
leal _C_LABEL(cpu_info_primary),%ecx
movl _C_LABEL(gdt),%eax
#endif
- movl GTSS_SEL,%edi
+ movl $GSEL(GTSS_SEL, SEL_KPL),%edi
movl SCRTSS0, %edx
movl %edx, 0(%eax,%edi,1) /* restore first word */
movl SCRTSS1, %edx