Pip
Architecture-dependent parts of Pip: MAL, IAL and boot
idt.h
Go to the documentation of this file.
1 /*******************************************************************************/
2 /* © Université de Lille, The Pip Development Team (2015-2021) */
3 /* */
4 /* This software is a computer program whose purpose is to run a minimal, */
5 /* hypervisor relying on proven properties such as memory isolation. */
6 /* */
7 /* This software is governed by the CeCILL license under French law and */
8 /* abiding by the rules of distribution of free software. You can use, */
9 /* modify and/ or redistribute the software under the terms of the CeCILL */
10 /* license as circulated by CEA, CNRS and INRIA at the following URL */
11 /* "http://www.cecill.info". */
12 /* */
13 /* As a counterpart to the access to the source code and rights to copy, */
14 /* modify and redistribute granted by the license, users are provided only */
15 /* with a limited warranty and the software's author, the holder of the */
16 /* economic rights, and the successive licensors have only limited */
17 /* liability. */
18 /* */
19 /* In this respect, the user's attention is drawn to the risks associated */
20 /* with loading, using, modifying and/or developing or reproducing the */
21 /* software by the user in light of its specific status of free software, */
22 /* that may mean that it is complicated to manipulate, and that also */
23 /* therefore means that it is reserved for developers and experienced */
24 /* professionals having in-depth computer knowledge. Users are therefore */
25 /* encouraged to load and test the software's suitability as regards their */
26 /* requirements in conditions enabling the security of their systems and/or */
27 /* data to be ensured and, more generally, to use and operate it in the */
28 /* same conditions as regards security. */
29 /* */
30 /* The fact that you are presently reading this means that you have had */
31 /* knowledge of the CeCILL license and that you accept its terms. */
32 /*******************************************************************************/
33 
34 #ifndef __IDT__
35 #define __IDT__
36 
37 #include <stdint.h>
38 
44  unsigned offset_low : 16; //<! Lower bits of handler address
45  unsigned segment : 16; //<! Segment selector
46  unsigned rfu : 5; //<! Reserved
47  unsigned zero : 3; //<! Always zero smh
48  unsigned type : 5; //<! TRAP_GATE_TYPE or INTERRUPT_GATE_TYPE
49  unsigned dpl : 2; //<! Descriptor Privilege Level
50  unsigned present : 1; //<! Present flag (validity)
51  unsigned offset_high : 16; //<! Higher bits of handler address
52 };
55 
56 
62  unsigned rfu0 : 16; //<! Reserved
63  unsigned segment : 16; //<! TSS segment selector
64  unsigned rfu1 : 8; //<! Reserved
65  unsigned type : 5; //<! TASK_GATE_TYPE
66  unsigned dpl : 2; //<! Descriptor Privilege Level
67  unsigned present : 1; //<! Present flag (validity)
68  unsigned rfu2 : 16; //<! Reserved
69 };
71 
76 union idt_entry_u {
80 };
81 typedef union idt_entry_u idt_entry_t;
82 
83 #define TASK_GATE_TYPE 0b00101
84 #define INTERRUPT_GATE_TYPE 0b01110
85 #define TRAP_GATE_TYPE 0b01111
86 
91 struct idt_ptr_s
92 {
93  uint16_t limit;
95 } __attribute__((packed));
96 
97 typedef struct idt_ptr_s idt_ptr_t;
98 
99 void idt_init(void);
100 
101 #endif
unsigned offset_low
Definition: idt.h:44
idt_entry_t * base
IDT pointer base.
Definition: idt.h:94
unsigned present
Definition: idt.h:67
Definition: idt.h:43
Interrupt Descriptor Table entry.
Definition: idt.h:76
unsigned type
Definition: idt.h:48
Interrupt Descriptor Table Task entry struct.
Definition: idt.h:61
void idt_init(void)
Definition: idt.c:726
struct idt_ptr_s __attribute__((packed))
unsigned dpl
Definition: idt.h:49
unsigned rfu0
Definition: idt.h:62
unsigned zero
Definition: idt.h:47
idt_int_entry_t interrupt
Definition: idt.h:77
idt_trap_entry_t trap
Definition: idt.h:78
unsigned offset_high
Definition: idt.h:51
unsigned segment
Definition: idt.h:45
unsigned rfu1
Definition: idt.h:64
unsigned dpl
Definition: idt.h:66
unsigned rfu
Definition: idt.h:46
unsigned rfu2
Definition: idt.h:68
unsigned segment
Definition: idt.h:63
uint16_t limit
Address limit.
Definition: idt.h:93
unsigned present
Definition: idt.h:50
unsigned type
Definition: idt.h:65
Definition: idt.h:91
idt_task_entry_t task
Definition: idt.h:79