feat(gdt): add macros for generic kernel segment descriptors
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
parent
ed803673c4
commit
02811acc2c
10
k/gdt.c
10
k/gdt.c
@ -78,10 +78,7 @@ static void load_gdt(void)
|
||||
|
||||
static void load_ds(void)
|
||||
{
|
||||
struct segment_selector selector;
|
||||
selector.index = KERNEL_DS_INDEX;
|
||||
selector.table_indicator = 0;
|
||||
selector.rpl = 0;
|
||||
struct segment_selector selector = KERNEL_DS_SEGMENT_SELECTOR;
|
||||
|
||||
asm volatile("movw %0, %%ax\n"
|
||||
"movw %%ax, %%ds\n"
|
||||
@ -95,10 +92,7 @@ static void load_ds(void)
|
||||
|
||||
static void load_cs(void)
|
||||
{
|
||||
struct segment_selector selector;
|
||||
selector.index = KERNEL_CS_INDEX;
|
||||
selector.table_indicator = 0;
|
||||
selector.rpl = 0;
|
||||
struct segment_selector selector = KERNEL_CS_SEGMENT_SELECTOR;
|
||||
|
||||
asm volatile("pushl %0\n"
|
||||
"pushl $1f\n"
|
||||
|
3
k/gdt.h
3
k/gdt.h
@ -9,6 +9,9 @@
|
||||
#define KERNEL_CS_INDEX 1
|
||||
#define KERNEL_DS_INDEX 2
|
||||
|
||||
#define KERNEL_CS_SEGMENT_SELECTOR {0, 0, KERNEL_CS_INDEX}
|
||||
#define KERNEL_DS_SEGMENT_SELECTOR {0, 0, KERNEL_DS_INDEX}
|
||||
|
||||
struct gdt_entry
|
||||
{
|
||||
uint16_t limit_1 : 16; // 16 lsbs of the segment limit
|
||||
|
Loading…
Reference in New Issue
Block a user