feat(kernel): implement Phase 2 - IDT64, 8259 PIC, 100Hz PIT timer & PS/2 keyboard driver
This commit is contained in:
1 parent
eec88c14c0
commit
7251770d7f
16 files changed
+863
-19
No files matched your search
+37
-12
@@ -1,8 +1,12 @@
|
||||
#include <airlys/kernel.h>
|
||||
#include <airlys/vga.h>
|
||||
#include <airlys/idt.h>
|
||||
#include <airlys/pic.h>
|
||||
#include <airlys/timer.h>
|
||||
#include <airlys/keyboard.h>
|
||||
|
||||
void kernel_main(uint64_t magic, uint64_t addr) {
|
||||
/* Initialize hardware VGA terminal console */
|
||||
/* Step 1: Initialize hardware VGA terminal console */
|
||||
vga_init();
|
||||
|
||||
/* Banner & Sovereign Branding */
|
||||
@@ -12,14 +16,13 @@ void kernel_main(uint64_t magic, uint64_t addr) {
|
||||
vga_puts(" / \\ |_ _| _ \\| | \\ \\ / / ___| \n");
|
||||
vga_puts(" / _ \\ | || |_) | | \\ V /\\___ \\ \n");
|
||||
vga_puts(" / ___ \\ | || _ <| |___| | ___) |\n");
|
||||
vga_puts(" /_/ \\_\\___|_| \\_\\_____|_| |____/ SOVEREIGN OS KERNEL v0.1.0\n");
|
||||
vga_puts(" /_/ \\_\\___|_| \\_\\_____|_| |____/ SOVEREIGN OS KERNEL v0.2.0\n");
|
||||
vga_puts("================================================================================\n");
|
||||
|
||||
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
|
||||
vga_puts(" [OK] Airlys Kernel Genesis initialized successfully!\n");
|
||||
vga_puts(" [OK] Architecture : x86_64 (64-Bit Long Mode)\n");
|
||||
vga_puts(" [OK] Creator : Er. Adam Eehan (Founder & CEO, Aira Group)\n");
|
||||
vga_puts(" [OK] Co-Pilot : Sovereign AI Aira 3 Ultra (Engine v3.6)\n");
|
||||
vga_puts(" [OK] Airlys Kernel Architecture : x86_64 Long Mode (64-Bit)\n");
|
||||
vga_puts(" [OK] Lead Systems Architect : Er. Adam Eehan (Founder & CEO, Aira Group)\n");
|
||||
vga_puts(" [OK] Engineering Co-Pilot : Sovereign AI Aira 3 Ultra (Engine v3.6)\n");
|
||||
|
||||
vga_set_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK);
|
||||
vga_puts("--------------------------------------------------------------------------------\n");
|
||||
@@ -27,19 +30,41 @@ void kernel_main(uint64_t magic, uint64_t addr) {
|
||||
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
|
||||
vga_puts(" [*] Bootloader Magic : ");
|
||||
vga_puthex(magic);
|
||||
vga_puts("\n");
|
||||
vga_puts(" [*] Multiboot Info : ");
|
||||
vga_puts(" | Multiboot Info: ");
|
||||
vga_puthex(addr);
|
||||
vga_puts("\n");
|
||||
|
||||
/* Step 2: Initialize 64-bit Interrupt Descriptor Table (IDT) */
|
||||
idt_init();
|
||||
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
|
||||
vga_puts(" [*] Physical VGA Memory Map: 0x000B8000 (80x25 Text Mode)\n");
|
||||
vga_puts(" [*] Preemptive Subsystems: Ready for Stage 2 (GDT & IDT Interrupts)\n");
|
||||
vga_puts(" [OK] CPU IDT Loaded : 256 Gates (Vectors 0..255 active)\n");
|
||||
|
||||
/* Step 3: Remap 8259 Dual Programmable Interrupt Controllers */
|
||||
pic_init();
|
||||
vga_puts(" [OK] Dual 8259 PIC Remapped : Master IRQ 32..39, Slave IRQ 40..47\n");
|
||||
|
||||
/* Step 4: Initialize Programmable Interval Timer (PIT) at 100 Hz */
|
||||
timer_init(100);
|
||||
vga_puts(" [OK] Programmable Interval Timer: 100 Hz (10ms preemptive tick interval)\n");
|
||||
|
||||
/* Step 5: Initialize PS/2 Keyboard Driver */
|
||||
keyboard_init();
|
||||
vga_puts(" [OK] PS/2 Hardware Keyboard : Scan Code Set 1 Driver active\n");
|
||||
|
||||
/* Step 6: Enable CPU Hardware Interrupts */
|
||||
__asm__ volatile ("sti");
|
||||
vga_set_color(VGA_COLOR_GREEN, VGA_COLOR_BLACK);
|
||||
vga_puts(" [OK] Hardware Interrupts Active : STI executed (IF=1)\n");
|
||||
|
||||
vga_set_color(VGA_COLOR_LIGHT_MAGENTA, VGA_COLOR_BLACK);
|
||||
vga_puts("\n >>> Airlys System Idle Loop Active. CPU Halted awaiting hardware ticks.\n");
|
||||
vga_puts("\n ------------------------------------------------------------------------------\n");
|
||||
vga_puts(" >>> Interactive Console Active. Type on your keyboard to test hardware input:\n");
|
||||
vga_puts(" ------------------------------------------------------------------------------\n\n");
|
||||
|
||||
/* Infinite safe idle loop */
|
||||
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
|
||||
vga_puts("airlys> ");
|
||||
|
||||
/* Infinite safe idle loop awaiting hardware interrupts */
|
||||
for (;;) {
|
||||
__asm__ volatile ("hlt");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user