summaryrefslogtreecommitdiff
path: root/kernel/idt.h
blob: aafa477e39215755d6581df094e447571fd9dddc (plain)
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
#ifndef IDT_H
#define IDT_H

#include "types.h"

typedef struct {
	uint16_t base_low;
	uint16_t segment;
	uint16_t flags;
	uint16_t base_high;
} __attribute__((packed)) idt_entry;

typedef struct {
	uint16_t limit;
	idt_entry* base;
} __attribute__((packed)) idt_ptr;

#define idt_entry_init(b, s, f) { \
	.base_low = (b & 0xffff), \
	.base_high = (b >> 16 & 0xffff), \
	.segment = (s), \
	.flags = (f)}

#define idt_entry_null { \
	.base_low = 0, \
	.base_high = 0, \
	.segment = 0, \
	.flags = 0}

void idt_init();

#endif