blob: 19c9e4cee65e191bd92b63cc6eb529fd187f5170 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#ifndef _JOVE_x86_64_HAL_IDT_H
#define _JOVE_x86_64_HAL_IDT_H 1
#include <stdint.h>
#include "jove.h"
#include "../x86_64.h"
struct idt_entry
{
uint16_t offset_0_15;
uint16_t segment_selector;
union {
struct {
uint8_t ist : 3;
uint8_t zero_1 : 5;
uint8_t type : 4;
uint8_t zero_2 : 1;
uint8_t dpl : 2;
uint8_t p : 1;
};
uint16_t flags;
};
uint16_t offset_16_31;
uint32_t offset_32_63;
uint32_t resv;
};
#define IDT_INTERRUPT_GATE 0xE
struct idt_descriptor
{
uint16_t limit;
uint64_t base;
} PACKED;
struct int_stackframe
{
struct cpu_state state;
uint64_t int_num, int_err;
uint64_t int_rip, int_cs, int_flags, int_rsp, int_rss;
};
#define IDT_ENTRIES 48
#define IDT_EXCEPT_DE 0
#define IDT_EXCEPT_DB 1
#define IDT_EXCEPT_NMI 2
#define IDT_EXCEPT_BP 3
#define IDT_EXCEPT_OF 4
#define IDT_EXCEPT_BR 5
#define IDT_EXCEPT_UD 6
#define IDT_EXCEPT_NM 7
#define IDT_EXCEPT_DF 8
#define IDT_EXCEPT_TS 10
#define IDT_EXCEPT_NP 11
#define IDT_EXCEPT_SS 12
#define IDT_EXCEPT_GP 13
#define IDT_EXCEPT_PF 14
#define IDT_EXCEPT_MF 16
#define IDT_EXCEPT_AC 17
#define IDT_EXCEPT_MC 18
#define IDT_EXCEPT_XM 19
#define IDT_EXCEPT_VE 20
#define IDT_EXCEPT_CP 21
struct int_user_handle
{
uintmax_t pid;
int (*handle)(struct int_stackframe*);
};
extern struct int_user_handle __int_user_handles[IDT_ENTRIES];
#endif
|