fix(idt): fix args struct to get err_code and int_code
This commit is contained in:
parent
79c2edc93f
commit
aaa72211ec
7
k/idt.c
7
k/idt.c
@ -3,7 +3,7 @@
|
||||
|
||||
static struct idt idt = { 0 };
|
||||
|
||||
struct idt_entry_info infos[] = {
|
||||
static struct idt_entry_info infos[] = {
|
||||
{int_de, INTERRUPT_TYPE}, {int_db, INTERRUPT_TYPE},
|
||||
{int_nmi, INTERRUPT_TYPE}, {int_bp, TRAP_TYPE},
|
||||
{int_of, TRAP_TYPE}, {int_br, INTERRUPT_TYPE},
|
||||
@ -17,10 +17,9 @@ struct idt_entry_info infos[] = {
|
||||
{int_ve, INTERRUPT_TYPE}
|
||||
};
|
||||
|
||||
void handle_interrupt(struct int_args args)
|
||||
void handle_interrupt(struct int_args *args)
|
||||
{
|
||||
(void)args;
|
||||
printf("INTERRUPT\r\n");
|
||||
printf("INTERRUPT: %d, error code: %d\r\n", args->int_code, args->err_code);
|
||||
return;
|
||||
}
|
||||
|
||||
|
12
k/idt.h
12
k/idt.h
@ -38,9 +38,17 @@ struct idt_r
|
||||
} __attribute__ ((packed));
|
||||
|
||||
// FIXME: This struct is used to get int_code and err_code pushed to the stack
|
||||
// by the isr (but isn't working now)
|
||||
// by the isr. We can refactor this by offsetting esp before pushing it.
|
||||
struct int_args
|
||||
{
|
||||
uint32_t edi;
|
||||
uint32_t esi;
|
||||
uint32_t ebp;
|
||||
uint32_t esp;
|
||||
uint32_t ebx;
|
||||
uint32_t edx;
|
||||
uint32_t ecx;
|
||||
uint32_t eax;
|
||||
uint32_t int_code;
|
||||
uint32_t err_code;
|
||||
} __attribute__ ((packed));
|
||||
@ -53,6 +61,6 @@ struct idt_entry_info
|
||||
};
|
||||
|
||||
void init_idt(void);
|
||||
void handle_interrupt(struct int_args args);
|
||||
void handle_interrupt(struct int_args *args);
|
||||
|
||||
#endif /* !IDT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user