fixing up some missing bits in isr.c and isr.h

This commit is contained in:
Gregory Kenneth Bowne 2023-10-08 12:22:16 -07:00
parent 1630352383
commit e99a09639d
3 changed files with 22 additions and 3 deletions

View File

@ -3,8 +3,6 @@
#include <stdint.h>
// Define the isr_regs structure
// IDT entry structure
struct idt_entry
{

View File

@ -12,8 +12,20 @@ enum
SERIAL_PORT_INTERRUPT = 0x24
};
void dummy_isr(struct isr_regs *regs)
{
printf("Timer interrupt occurred!\n");
}
// ISR table
void (*isr_table[256])(struct isr_regs *regs);
void (*isr_table[256])(struct isr_regs *regs) = {
// initialize the dummy isr_table
[TIMER_INTERRUPT] = dummy_isr, // Timer interrupt
[KEYBOARD_INTERRUPT] = dummy_isr, // Keyboard interrupt
[NETWORK_INTERRUPT] = dummy_isr, // Network interrupt
[DISK_INTERRUPT] = dummy_isr, // Disk interrupt
[SERIAL_PORT_INTERRUPT] = dummy_isr // Serial port interrupt
};
// Register an ISR
void isr_register(uint8_t num, void (*handler)(struct isr_regs *regs))

View File

@ -3,6 +3,15 @@
#include <stdint.h>
struct isr_regs
{
uint32_t gs, fs, es, ds; // Segment selectors
uint32_t edi, esi, ebp, esp; // Pushed by pusha instruction
uint32_t ebx, edx, ecx, eax; // Pushed by the interrupt handler
uint32_t int_no, err_code; // Interrupt number and error code (if applicable)
uint32_t eip, cs, eflags, esp_at_signal; // Pushed by the processor automatically
};
// Structure for storing register values during an ISR
struct idt_regs
{