summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2018-03-20 16:39:11 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2018-03-20 16:39:11 +0000
commitfac4539ecb0d0c7929fc898c4d4aca61bbc4c5c7 (patch)
tree34f332c7a028b9a3fbd0a8347dd4f5099893261c /sys/arch
parent4324bf66ed9125a50fd29e4a4ff96ee195555fb6 (diff)
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 f23f849ca41..ab1ead55af6 100644
--- a/sys/arch/i386/i386/kvm86.c
+++ b/sys/arch/i386/i386/kvm86.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm86.c,v 1.12 2018/03/13 13:51:05 bluhm Exp $ */
+/* $OpenBSD: kvm86.c,v 1.13 2018/03/20 16:39:10 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 2ff8e681880..10182b7c63f 100644
--- a/sys/arch/i386/i386/kvm86call.S
+++ b/sys/arch/i386/i386/kvm86call.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm86call.S,v 1.8 2018/03/13 13:51:05 bluhm Exp $ */
+/* $OpenBSD: kvm86call.S,v 1.9 2018/03/20 16:39:10 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