L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
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
33typedef struct
34{
36} __attribute__ ((packed)) l4util_idt_desc_t;
37
40typedef struct
41{
43 void *base;
44 l4util_idt_desc_t desc[0];
45} __attribute__ ((packed)) l4util_idt_header_t;
46
52static inline void
53l4util_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
63static inline void
64l4util_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
77static inline void
78l4util_idt_load(l4util_idt_header_t *idt)
79{
80 asm volatile ("lidt (%%rax) \n\t" : : "a" (idt));
81}
84
85#endif
86
L4 compiler related defines.
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition l4int.h:38
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:42
#define EXTERN_C_BEGIN
Start section with C types and functions.
Definition compiler.h:192
#define EXTERN_C_END
End section with C types and functions.
Definition compiler.h:193
IDT entry.
Definition idt.h:34
l4_uint64_t b
see Intel doc
Definition idt.h:35
Header of an IDT table.
Definition idt.h:41
l4_uint16_t limit
limit field (see Intel doc)
Definition idt.h:42
void * base
idt base (see Intel doc)
Definition idt.h:43