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
This commit is contained in:
jhb 2001-03-21 20:08:07 +00:00
parent 7069cc87cc
commit 5d5fc406d7
2 changed files with 8 additions and 8 deletions

View File

@ -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.
#

View File

@ -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.
#