From cad047a927dd9c1253d5439835399f003ab865bc Mon Sep 17 00:00:00 2001 From: Teodor Date: Tue, 14 Apr 2026 16:40:58 +0000 Subject: [PATCH] forgot to add notes for assignment 3 --- notes/work-summary-2026-04-11-to-14.md | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/notes/work-summary-2026-04-11-to-14.md b/notes/work-summary-2026-04-11-to-14.md index e69de29..6b98e31 100644 --- a/notes/work-summary-2026-04-11-to-14.md +++ b/notes/work-summary-2026-04-11-to-14.md @@ -0,0 +1,43 @@ +# Summary of Work Done on Interrupt System + +## Overview + +The last 4 days, work was done on implementing interrupt support for the OSDev_18 project. The goal was to allow the kernel to handle both CPU exceptions and hardware interrupts. + +This included setting up the Interrupt Descriptor Table (IDT), implementing basic Interrupt Service Routines (ISRs), adding support for hardware interrupts (IRQs), and handling keyboard input. After completing these steps, the system is now able to respond to interrupts and display output when they occur. + +## IDT Implementation + +The Interrupt Descriptor Table (IDT) was implemented to define how the CPU should respond to interrupts. + +A structure for IDT entries was created, storing the handler address, segment selector, and flags. An IDT pointer structure was also defined to hold the base and size of the table. + +The IDT is initialized in IdtInitialize() and loaded using the lidt instruction. A helper function is used to set up each descriptor. + +## ISR Implementation + +Interrupt Service Routines (ISRs) were implemented to handle CPU exceptions. + +A Registers structure was created to store the CPU state during an interrupt. The IsrHandler() function uses this information to determine which interrupt occurred and prints a message to the terminal. + +Interrupts can also be triggered manually for testing purposes. + +## IRQ Implementation + +Support for hardware interrupts (IRQs) was added for IRQ0 to IRQ15. + +The Programmable Interrupt Controller (PIC) was remapped so that IRQs do not overlap with CPU exceptions. An IrqHandler() function was implemented to handle incoming hardware interrupts and dispatch them to registered handlers. + +End-of-interrupt signals are sent to the PIC after handling each interrupt. + +## Keyboard Implementation + +Keyboard input was implemented using IRQ1. + +A keyboard handler reads scancodes from port 0x60 and translates them into ASCII characters using a lookup table. The characters are stored in a buffer and printed to the screen. + +This allows the system to respond to user input from the keyboard. + +## Conclusion + +The system now supports basic interrupt handling, including CPU exceptions and hardware interrupts. This is an important step towards building a more advanced and interactive operating system. \ No newline at end of file