Jolix
/joh'liks/ n.,adj. 386BSD

PORTING UNIX TO THE 386: A PRACTICAL APPROACH


William & Lynne Jolitz


Catching terminal processor faults.




Other Processor Faults
386 Processor Exceptions
ExceptionDescriptionPushes an
Error Code?
Divide Division by 0
or division overflow
No
Debug/Trace Single step or
debug hardware condition
No
Breakpoint Executed an INT3 instruction No
Overflow Executed an INTO instruction
when OF bit set
No
Bounds Check Executed an BOUND instruction
which failed
No
Illegal Instruction Executed an unknown instruction No
NPX DNA Numeric processor
device not available
No
Double Fault Recursive fault (fault while
processing a fault)
Yes
NPX Operand Numeric processor accessed
outside of segment
No
Invalid TSS Attempted to task switch to
incorrect task state
Yes
Segment
Not Present
Attempt to access a not
present descriptor
Yes
Stack Segment Problem with current stack
descriptor
Yes
General Protection Protection problem with a
segment descriptor
Yes
Page Page missing or protection
problem with address
Yes
NPX Error Numeric processor signals
an error
No
Figure 7 - 386 Processor Exceptions

Along with address space faults, we found we must map 15 other faults (see Figure 7) into the Berkeley UNIX kernel exception-handling mechanisms. The numeric coprocessor presents special fault-handling challenges, for it can be operating when 386BSD switches to another unrelated process. In that case, we can get a trap that should have been passed to a process other than the one currently running.

If 386BSD receives an unexpected fault while running in the kernel, it must immediately force the kernel down (in UNIX vernacular, to "panic") and attempt to save as much state information as possible for diagnostic purposes. Thus, we differentiated user traps from kernel traps. In most other microprocessors, a bit in the processor flags or status word determines if we are running in the kernel, but the 386 offers no such bit. So, 386BSD examines the contents of the CS segment register when a trap occurs (this is saved by the hardware during an exception) to determine if an instruction was executing in user mode.



<<BACK NEXT >>



Copyright 1989, 1990, 2006 TeleMuse Partners, William Jolitz and Lynne Jolitz