39 lines
662 B
C
39 lines
662 B
C
#include <stdint.h>
|
|
|
|
#include "idt.h"
|
|
#include "interrupt.h"
|
|
|
|
typedef uint64_t uword_t;
|
|
|
|
extern void isr_wrapper();
|
|
|
|
struct interrupt_frame
|
|
{
|
|
uword_t ip;
|
|
uword_t cs;
|
|
uword_t flags;
|
|
uword_t sp;
|
|
uword_t ss;
|
|
};
|
|
|
|
void interrupt_handler()
|
|
{
|
|
printf("interrupted\n");
|
|
// panic("ee");
|
|
}
|
|
|
|
|
|
void setup_ints() {
|
|
set_idt_ent(0x80, (uint64_t)&isr_wrapper, 0, 0, INT64);
|
|
init_idt();
|
|
|
|
typedef void (*MyFunctionType)(void);
|
|
MyFunctionType handler_0x80 = get_idt_fn(0x80);
|
|
printf("interrupt handler: %x\n", handler_0x80);
|
|
// interrupt_handler(0);
|
|
|
|
|
|
__asm__ volatile("int $0x80");
|
|
|
|
printf("interrupt handled!\n");
|
|
} |