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:
parent
8bed3a9646
commit
fa18e883b2
@ -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.
|
||||
#
|
||||
|
@ -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.
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user