The event manager handles exceptions and interrupts. It is the main dependency for the communications with hardware devices and for the syscall manager since they are based on software interrupts. This manager is only used by the kernel and exports no syscalls. We will use the 8259A PIC.
In k, IDT descriptors are interrupt gates and nested interrupts are not supported. Exceptions are not handled, but you should create your own bluescreen to protect your CPU from faulting!
You don’t have to write any syscall, you just need to get those interrupts working to go on with k!
- Write the IDT management functions
- allocate/clean the IDT
- set an interrupt gate in the IDT
- Write the context saving/restoring routines in assembly code
- Implement the exceptions and interrupts wrappers
- Write a function which builds the IDT and loads it with
- Initialize the PIC
- send ICWs to both master and slave PICs
- mask all interrupts
- Write very simple debug handlers like:
- printing an error message when executing a division by zero
- printing a string when a key is pressed
- Do not forget to enable hardware interrupts using the
Possible bug causes
- You forgot to save or restore some registers in your context
- You did not consider that gcc automatically generates the prolog/epilog for C functions
- The stack is misaligned when
- PICs are not acknowledged after returning from an ISR (Interrupt SubRoutine)
- Intel manual Vol. 3A chapter 6 (INTERRUPT AND EXCEPTION HANDLING)