diff options
| author | salmonik <salmonik@tuta.io> | 2026-07-31 02:28:10 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-07-31 02:28:10 +0200 |
| commit | af8d5aa4538ac71f11a5418ef94ae478868a0484 (patch) | |
| tree | c235d89cbdd1486dd2239d08abc750be2e5a88d2 /src/main.rs | |
| parent | Initial commit: raisernics toy kernel (diff) | |
| download | rs-dos-af8d5aa4538ac71f11a5418ef94ae478868a0484.tar.gz rs-dos-af8d5aa4538ac71f11a5418ef94ae478868a0484.zip | |
interrupts: IDT, PIC remap, PIT timer, PS/2 keyboard IRQ
- IDT with 256 entries, loaded via lidt (CS read from current context)
- PIC 8259A remapped to vectors 32-47, timer+keyboard IRQs unmasked
- PIT channel 0 at ~100 Hz (mode 2, rate generator)
- PS/2 keyboard IRQ (IRQ1 → vector 33): reads port 0x60, pushes byte
to lock-free SPSC ring buffer
- Timer IRQ (IRQ0 → vector 32): sends EOI, increments tick counter
- ps2::poll_key() now reads from ring buffer with cli/sti+hlt for
race-free sleep (instead of busy-polling the data port)
- build.rs: use idiomatic Result<_, Box<dyn Error>> return type
- tools/qemu.sh: fix SC2207 shellcheck warning
Diffstat (limited to '')
| -rw-r--r-- | src/main.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 2b1df77..9a901f5 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -9,6 +9,7 @@ extern crate alloc; | |||
| 9 | 9 | ||
| 10 | mod font; | 10 | mod font; |
| 11 | mod gop; | 11 | mod gop; |
| 12 | mod interrupts; | ||
| 12 | mod memory; | 13 | mod memory; |
| 13 | mod ps2; | 14 | mod ps2; |
| 14 | mod serial; | 15 | mod serial; |
| @@ -127,6 +128,10 @@ pub extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut SystemT | |||
| 127 | ps2::init(); | 128 | ps2::init(); |
| 128 | serial_println!("ps2: keyboard initialized"); | 129 | serial_println!("ps2: keyboard initialized"); |
| 129 | 130 | ||
| 131 | // Interrupts — IDT, PIC, PIT timer, keyboard IRQ handler | ||
| 132 | interrupts::init(); | ||
| 133 | serial_println!("intr: IDT loaded, PIC remapped, timer ~100 Hz"); | ||
| 134 | |||
| 130 | // Memory: the bump allocator was set up during capture_memory_map. | 135 | // Memory: the bump allocator was set up during capture_memory_map. |
| 131 | // `alloc::Vec`, `alloc::String`, `format!` etc. are now usable. | 136 | // `alloc::Vec`, `alloc::String`, `format!` etc. are now usable. |
| 132 | 137 | ||
