Fixed those damn __sseek and __swrite problems!
[akaros.git] / include / trap.h
1 /* See COPYRIGHT for copyright information. */
2
3 #ifndef ROS_KERN_TRAP_H
4 #define ROS_KERN_TRAP_H
5 #ifndef ROS_KERNEL
6 # error "This is an ROS kernel header; user programs should not #include it"
7 #endif
8
9 #define MSR_IA32_SYSENTER_CS 0x174
10 #define MSR_IA32_SYSENTER_ESP 0x175
11 #define MSR_IA32_SYSENTER_EIP 0x176
12
13 #include <arch/mmu.h>
14 #include <ros/trap.h>
15
16 // func ptr for interrupt service routines
17 typedef void (*isr_t)(trapframe_t* tf, void* data);
18 typedef struct InterruptHandler {
19         isr_t isr;
20         void* data;
21 } handler_t;
22
23 /* The kernel's interrupt descriptor table */
24 extern gatedesc_t idt[];
25 extern taskstate_t ts;
26
27 void idt_init(void);
28 void register_interrupt_handler(handler_t (COUNT(256)table)[], uint8_t int_num,
29                                 isr_t handler, void* data);
30 void (IN_HANDLER print_regs)(push_regs_t *regs);
31 void (IN_HANDLER print_trapframe)(trapframe_t *tf);
32 void (IN_HANDLER page_fault_handler)(trapframe_t *tf);
33 void backtrace(trapframe_t *tf);
34
35 void sysenter_init(void);
36 extern void sysenter_handler();
37 #endif /* ROS_KERN_TRAP_H */