POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/arch/x86/event.h
Go to the documentation of this file.
00001 /*
00002  *                               POK header
00003  * 
00004  * The following file is a part of the POK project. Any modification should
00005  * made according to the POK licence. You CANNOT use this file or a part of
00006  * this file is this part of a file for your own project
00007  *
00008  * For more information on the POK licence, please see our LICENCE FILE
00009  *
00010  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
00011  *
00012  *                                      Copyright (c) 2007-2009 POK team 
00013  *
00014  * Created by julien on Thu Jan 15 23:34:13 2009 
00015  */
00016 
00017 
00018 #ifndef __POK_X86_EVENT_H__
00019 #define __POK_X86_EVENT_H__
00020 
00021 #include <types.h>
00022 #include <arch/x86/interrupt.h>
00023 
00024 #include "gdt.h"
00025 
00026 typedef enum e_idte_type
00027 {
00028   IDTE_TASK = 5,
00029   IDTE_INTERRUPT = 6,
00030   IDTE_TRAP = 7
00031 } e_idte_type;
00032 
00033 typedef struct
00034 {
00035   uint32_t      offset_low:16;
00036   uint32_t      segsel:16;
00037   uint32_t      res0:8;
00038   uint32_t      type:3;
00039   uint32_t      d:1;
00040   uint32_t      res1:1;
00041   uint32_t      dpl:2;
00042   uint32_t      present:1;
00043   uint32_t      offset_high:16;
00044 } __attribute__((packed)) idt_entry_t;
00045 
00046 #define EXCEPTION_DIVIDE_ERROR          0
00047 #define EXCEPTION_DEBUG                 1
00048 #define EXCEPTION_NMI                   2
00049 #define EXCEPTION_BREAKPOINT            3
00050 #define EXCEPTION_OVERFLOW              4
00051 #define EXCEPTION_BOUNDRANGE            5
00052 #define EXCEPTION_INVALIDOPCODE         6
00053 #define EXCEPTION_NOMATH_COPROC         7
00054 #define EXCEPTION_DOUBLEFAULT           8
00055 #define EXCEPTION_COPSEG_OVERRUN        9
00056 #define EXCEPTION_INVALID_TSS           10
00057 #define EXCEPTION_SEGMENT_NOT_PRESENT   11
00058 #define EXCEPTION_STACKSEG_FAULT        12
00059 #define EXCEPTION_GENERAL_PROTECTION    13
00060 #define EXCEPTION_PAGEFAULT             14
00061 #define EXCEPTION_RESERVED              15
00062 #define EXCEPTION_FPU_FAULT             16
00063 #define EXCEPTION_ALIGNEMENT_CHECK      17
00064 #define EXCEPTION_MACHINE_CHECK         18
00065 #define EXCEPTION_SIMD_FAULT            19
00066 
00067 void  pok_idt_set_gate(uint16_t index,
00068                        uint16_t segsel,
00069                        uint32_t offset,
00070                        e_idte_type t,
00071                        int dpl);
00072 pok_ret_t pok_idt_init();
00073 pok_ret_t pok_exception_init();
00074 pok_ret_t pok_event_init();
00075 pok_ret_t pok_syscall_init();
00076 
00077 #endif /* !__POK_X86_EVENT_H__ */
00078