00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 #ifndef __MACHDEP_GATES_H__
00011 #define __MACHDEP_GATES_H__     1
00012 #include <libc.h>
00013 
00014 #define TASKGATE_ENTER \
00015   u_int __fake_bp;\
00016   __asm __volatile ("movl %%esp, %0" : "=m" (__fake_bp));\
00017   __entry_point:
00018  
00019 #define TASKGATE_LEAVE \
00020  __asm __volatile ("movl %0, %%esp" : : "m" (__fake_bp));\
00021  __asm __volatile ("iret");\
00022  goto __entry_point;
00023 
00024 
00025 
00026 void handle_nmi(int n);
00027 void setgate2(struct gate_descriptor *gd, void *func, int args, int type, int dpl, int xx);
00028 void setgate(struct gate_descriptor *gd, void *func, int args, int type, int dpl);
00029 void setsegment2(struct segment_descriptor *sd, void *base, size_t limit, int type, int dpl, int def32, int gran, int xx);
00030 void setsegment(struct segment_descriptor *sd, void *base, size_t limit, int type, int dpl, int def32, int gran);
00031 void settaskgate2(struct gate_descriptor *gd, u_int selector, int args, int type, int dpl, int xx);
00032 void settaskgate(struct gate_descriptor *gd, u_int selector, int args, int type, int dpl);
00033 void gdt_dump(t_printf_fn printf_fn, char *s, union descriptor *base, int slot);
00034 void idt_dump(t_printf_fn printf_fn, char *s, union descriptor *base, int slot);
00035 void tss_dump(t_printf_fn printf_fn, char *s, t_tss *tss);
00036 #endif