next up previous contents index
Next: 10.8.1 trap_state: saved state Up: 10 Kernel Support Library: Previous: 10.7.8 base_tss_load: load the

(X86) Base Environment: Trap Handling

 

The first 32 vectors in the IDT are used to handle processor exceptions (``traps''). In the base OSKit environment, these vectors are initialized from the base_trap_inittab array (10.8.3) using the base_trap_init function (10.8.2). By default, each exception vector in the processor IDT is set to point to a common assembly language stub that saves a standard trap frame (10.8.1), and calls a designated high-level handler specified in the base_trap_handlers table (10.8.4). Initially, all the entries in this table point to base_trap_default_handler (10.8.5). Custom trap handlers can be installed by changing the appropriate entry in the table. The default action for all traps can be changed by overriding base_trap_default_handler.

This affords client OSes with a variety of choices for modifying the behavior of trap handling. By using the base trap environment unchanged (i.e., the client OS is not expecting or handling traps), all traps will produce a trap dump and panic. This behavior is sufficient for most simple OSKit applications. By setting entries base_trap_handlers, the client can provide its own C language trap handlers while still using the default trap_state structure. The OSKit remote GDB debugging package (10.17.5) does this. Finally, the client OS can override base_trap_inittab to allow for different high-level handlers for every exception type and/or to permit the use of a different trap state format.





University of Utah Flux Research Group