L4Re - L4 Runtime Environment
idt.h
Go to the documentation of this file.
1 
9 /*
10  * (c) 2003-2009 Author(s)
11  * economic rights: Technische Universit├Ąt Dresden (Germany)
12  * This file is part of TUD:OS and distributed under the terms of the
13  * GNU Lesser General Public License 2.1.
14  * Please see the COPYING-LGPL-2.1 file for details.
15  */
16 
17 #ifndef __L4UTIL_IDT_H
18 #define __L4UTIL_IDT_H
19 
20 #include <l4/sys/l4int.h>
21 #include <l4/sys/compiler.h>
22 
24 
30 
33 typedef struct
34 {
36 } __attribute__ ((packed)) l4util_idt_desc_t;
37 
40 typedef struct
41 {
43  void *base;
44  l4util_idt_desc_t desc[0];
45 } __attribute__ ((packed)) l4util_idt_header_t;
46 
52 static inline void
53 l4util_idt_entry(l4util_idt_header_t *idt, int nr, void(*handler)(void))
54 {
55  idt->desc[nr].a = (l4_uint64_t)handler & 0x0000ffff;
56  idt->desc[nr].b = 0x0000ef00 | ((l4_uint64_t)handler & 0xffff0000);
57 }
58 
63 static inline void
64 l4util_idt_init(l4util_idt_header_t *idt, int entries)
65 {
66  int i;
67  idt->limit = entries*8 - 1;
68  idt->base = &idt->desc;
69 
70  for (i=0; i<entries; i++)
71  l4util_idt_entry(idt, i, 0);
72 }
73 
77 static inline void
78 l4util_idt_load(l4util_idt_header_t *idt)
79 {
80  asm volatile ("lidt (%%rax) \n\t" : : "a" (idt));
81 }
84 
85 #endif
86 
IDT entry.
Definition: idt.h:33
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition: l4int.h:38
#define EXTERN_C_END
End section with C types and functions.
Definition: compiler.h:187
L4 compiler related defines.
l4_uint16_t limit
limit field (see Intel doc)
Definition: idt.h:42
#define EXTERN_C_BEGIN
Start section with C types and functions.
Definition: compiler.h:186
Header of an IDT table.
Definition: idt.h:40
void * base
idt base (see Intel doc)
Definition: idt.h:43
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition: l4int.h:42
l4_uint64_t b
see Intel doc
Definition: idt.h:35