Go to the source code of this file.
◆ gdt_init()
83 {
84
88
93 .type = 0x9,
94 .s = 0,
95 .dpl = 0,
96 .p = 1,
98 .avl = 0,
99 .rsv1 = 0,
100 .g = 0,
103 .res1 = 0,
104 .clear = 0,
105 .res2 = 0
106 };
107
109
110 asm volatile(
"movw %%ax, %%gs" ::
"a" (
SEL_UDSEG));
111 asm volatile("movw %%ax, %%fs" :: "a" (0));
112 asm volatile(
"movw %%ax, %%es" ::
"a" (
SEL_KDSEG));
113 asm volatile(
"movw %%ax, %%ds" ::
"a" (
SEL_KDSEG));
114 asm volatile(
"movw %%ax, %%ss" ::
"a" (
SEL_KDSEG));
115 asm volatile("pushq %%rbx\n"
116 "movabs $1f, %%rax\n"
117 "pushq %%rax\n"
118 "lretq\n"
119 "1:\n" ::
"b" (
SEL_KCSEG):
"cc",
"memory");
120
121 lldt (0);
122}
static struct segment_desc gdt[SEL_CNT]
Definition: gdt.c:64
struct desc_ptr gdt_ds
Definition: gdt.c:75
#define SEL_KDSEG
Definition: loader.h:37
#define SEL_KCSEG
Definition: loader.h:36
#define SEL_UDSEG
Definition: loader.h:38
#define SEL_TSS
Definition: loader.h:40
unsigned long long int uint64_t
Definition: stdint.h:29
uint32_t base_63_32
Definition: gdt.c:53
unsigned base_23_16
Definition: gdt.c:43
unsigned base_15_0
Definition: gdt.c:42
unsigned lim_15_0
Definition: gdt.c:41
struct task_state * tss
Definition: tss.c:49
struct task_state * tss_get(void)
Definition: tss.c:63