summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-03-21 20:08:07 +0000
committerjhb <jhb@FreeBSD.org>2001-03-21 20:08:07 +0000
commit5d5fc406d7ed3e2ee9afa1bb9d4a25100a3edd5d (patch)
tree5180a8cd4eec2ca7318f713979daadfe9f47d850 /sys/boot/i386
parent7069cc87ccc9884a8ddbd4289fc107db4a433bfb (diff)
downloadFreeBSD-src-5d5fc406d7ed3e2ee9afa1bb9d4a25100a3edd5d.zip
FreeBSD-src-5d5fc406d7ed3e2ee9afa1bb9d4a25100a3edd5d.tar.gz
Always disable paging when exiting back to real mode after receiving a
fatal trap. Also, reload the GDT register to point to BTX's GDT before playing around with the segment registers to return to real mode. This is helpful if the kernel causes a fatal exception before it has setup its own IDT and fault handlers. For example, if one happens to break mtx_init(). Without these changes BTX would recursively page fault (if paging was not disabled) or triple fault and reset the CPU (without the GDT reload) instead of providing a potentially useful register dump. Reviewed by: rnordier
Diffstat (limited to 'sys/boot/i386')
-rw-r--r--sys/boot/i386/btx/btx/btx.S8
-rw-r--r--sys/boot/i386/btx/btx/btx.s8
2 files changed, 8 insertions, 8 deletions
diff --git a/sys/boot/i386/btx/btx/btx.S b/sys/boot/i386/btx/btx/btx.S
index 72ba555..334bea6 100644
--- a/sys/boot/i386/btx/btx/btx.S
+++ b/sys/boot/i386/btx/btx/btx.S
@@ -255,14 +255,14 @@ exit: cli # Disable interrupts
# Turn off paging.
#
movl %cr0,%eax # Get CR0
-ifdef(`PAGING',`
andl $~0x80000000,%eax # Disable
movl %eax,%cr0 # paging
-')
xorl %ecx,%ecx # Zero
-ifdef(`PAGING',`
movl %ecx,%cr3 # Flush TLB
-')
+#
+# Restore the GDT in case we caught a kernel trap.
+#
+ lgdt gdtdesc # Set GDT
#
# To 16 bits.
#
diff --git a/sys/boot/i386/btx/btx/btx.s b/sys/boot/i386/btx/btx/btx.s
index 72ba555..334bea6 100644
--- a/sys/boot/i386/btx/btx/btx.s
+++ b/sys/boot/i386/btx/btx/btx.s
@@ -255,14 +255,14 @@ exit: cli # Disable interrupts
# Turn off paging.
#
movl %cr0,%eax # Get CR0
-ifdef(`PAGING',`
andl $~0x80000000,%eax # Disable
movl %eax,%cr0 # paging
-')
xorl %ecx,%ecx # Zero
-ifdef(`PAGING',`
movl %ecx,%cr3 # Flush TLB
-')
+#
+# Restore the GDT in case we caught a kernel trap.
+#
+ lgdt gdtdesc # Set GDT
#
# To 16 bits.
#
OpenPOWER on IntegriCloud