blob: e2c5b46e9b38928eaf5e66d1ee52e30ed37893f0 (
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
|
#ifndef GDT_H
#define GDT_H
#include "types.h"
typedef struct {
uint16_t limit_low;
uint16_t base_low;
uint8_t base_mid;
uint16_t flags;
uint8_t base_high;
} __attribute__((packed)) gdt_entry;
typedef struct {
uint16_t limit;
gdt_entry* base;
} __attribute__((packed)) gdt_ptr;
#define gdt_entry_init(b, l, f) { \
.base_low = (b & 0xffff), \
.base_mid = (b >> 16 & 0xff), \
.base_high = (b >> 24 & 0xff), \
.limit_low = (l & 0xffff), \
.flags = (f | (l >> 8 & 0x0f00))}
void gdt_init();
#endif
|