summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-04-24 17:20:45 +0000
committerdim <dim@FreeBSD.org>2013-04-24 17:20:45 +0000
commitb2f606714ac43344a7c1384f3092ed4b99dcb615 (patch)
tree760b89def4b0c4e6c6b22009e506fa7124ca1f88
parent0d3ea3b043fce01671335e28abde3e1acdbd77fe (diff)
downloadFreeBSD-src-b2f606714ac43344a7c1384f3092ed4b99dcb615.zip
FreeBSD-src-b2f606714ac43344a7c1384f3092ed4b99dcb615.tar.gz
When rebooting (exiting) from the BTX loader, make sure to restore the
GDT from the correct segment, otherwise a triple fault would be caused. In some virtual environments (VMware, VirtualBox, etc) this could lead to a unhandled error or hang in the guest emulation software. Thanks to avg and jhb for a few hints in the right direction. Noticed by: Jeremy Chadwick <jdc@koitsu.org> (and many others) MFC after: 1 week
-rw-r--r--sys/boot/i386/btx/btx/btx.S2
-rw-r--r--sys/boot/pc98/btx/btx/btx.S2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/boot/i386/btx/btx/btx.S b/sys/boot/i386/btx/btx/btx.S
index c41457f..ef3d0c7 100644
--- a/sys/boot/i386/btx/btx/btx.S
+++ b/sys/boot/i386/btx/btx/btx.S
@@ -248,7 +248,7 @@ exit: cli # Disable interrupts
/*
* Restore the GDT in case we caught a kernel trap.
*/
- lgdt gdtdesc # Set GDT
+ lgdt %cs:gdtdesc # Set GDT
/*
* To 16 bits.
*/
diff --git a/sys/boot/pc98/btx/btx/btx.S b/sys/boot/pc98/btx/btx/btx.S
index 1f8ff80..e8710d3 100644
--- a/sys/boot/pc98/btx/btx/btx.S
+++ b/sys/boot/pc98/btx/btx/btx.S
@@ -248,7 +248,7 @@ exit: cli # Disable interrupts
/*
* Restore the GDT in case we caught a kernel trap.
*/
- lgdt gdtdesc # Set GDT
+ lgdt %cs:gdtdesc # Set GDT
/*
* To 16 bits.
*/
OpenPOWER on IntegriCloud