progress?

This commit is contained in:
2025-05-31 20:28:00 -04:00
parent 013b5a557e
commit c50d3f14a6
4 changed files with 39 additions and 2 deletions

View File

@ -20,7 +20,13 @@ void exception_handler(unsigned int i)
kerror("EXCEPTION"); kerror("EXCEPTION");
printf("Exeption: %u\n", i); printf("Exeption: %u\n", i);
#endif #endif
if (i <= 31)
__asm__ volatile ("cli; hlt"); // hangs the computer __asm__ volatile ("cli; hlt"); // hangs the computer
if (i == PIC_PIT) {
printf("Sending EOI instruction to PIT\n");
PIC_sendEOI(0);
}
} }
void idt_set_descriptor(uint8_t vector, void *isr, uint8_t flags) void idt_set_descriptor(uint8_t vector, void *isr, uint8_t flags)
@ -52,7 +58,8 @@ void idt_init(void)
__asm__ volatile("lidt %0" : : "m"(idtr)); // load the new IDT __asm__ volatile("lidt %0" : : "m"(idtr)); // load the new IDT
PIC_remap(0x20, 0x28); PIC_remap(0x20, 0x28);
IRQ_set_mask(0xfd); // unmask IRQ1 //IRQ_set_mask(0xfd); // unmask IRQ1
pic_disable(); //TODO: this is ending a timer interrupt even though its masked off..
__asm__ volatile("sti"); // set the interrupt flag __asm__ volatile("sti"); // set the interrupt flag
#ifdef __TESTING__ #ifdef __TESTING__

View File

@ -3,6 +3,7 @@ extern exception_handler
%macro isr_err_stub 1 %macro isr_err_stub 1
isr_stub_%+%1: isr_stub_%+%1:
pushad pushad
cld
push dword %1 push dword %1
call exception_handler call exception_handler
popad popad
@ -12,6 +13,7 @@ isr_stub_%+%1:
%macro isr_no_err_stub 1 %macro isr_no_err_stub 1
isr_stub_%+%1: isr_stub_%+%1:
pushad pushad
cld
push dword %1 push dword %1
call exception_handler call exception_handler
popad popad

View File

@ -31,6 +31,23 @@
#define PIC_READ_ISR 0x0b /** OCW3 irq service next CMD read **/ #define PIC_READ_ISR 0x0b /** OCW3 irq service next CMD read **/
#define PIC_PIT 32
#define PIC_KEYB 33
#define PIC_CASCADE 34 // never raised
#define PIC_COM2 35
#define PIC_COM1 36
#define PIC_LPT2 37
#define PIC_FLOPPY_DISK 38
#define PIC_LPT1 39 // usually spurious interrupt
#define PIC_CMOS 40
#define PIC_FREE_ONE 41
#define PIC_FREE_TWO 42
#define PIC_FREE_THREE 43
#define PIC_PS2_MOUSE 44
#define PIC_FPU 45
#define PIC_ATA_ONE 46
#define PIC_ATA_TWO 47
void PIC_sendEOI(uint8_t irq); void PIC_sendEOI(uint8_t irq);
/** /**

View File

@ -22,4 +22,15 @@ void kmain(void)
serial_initialize(); serial_initialize();
#endif #endif
/**
* The computer is now hanging on INTERRUPT 32,
* this is good because that means the PIC is working, its the timer interrupt
* we need to now implement the ISR routines in exception_handler,
* first i want to implement all of the code for the basic exceptions..
* then i want to setup the PIC triggers
*
* now for keyboard stuff, i believe i need to start looking into setting up a ps/2 driver before the interrupts will even start arriving..
*
*/
} }