aboutsummaryrefslogtreecommitdiff
path: root/kernel/boot/gdt/gdt.s
blob: ee50e4e29f29ea48034c190cc24b5ffdaee236c8 (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
.intel_syntax noprefix

.global _GDT_flush
.type _GDT_flush, @function
_GDT_flush:
  /* First Argument (Pointer to the GDT) */
  mov eax, [esp + 4]
  
  /* Load GDT */
  lgdt [eax]

  /* Offset For Kernel Data Segment (16 bits) */
  mov eax, 0x10

  /* Set the Data Segment Selectors */
  mov ds, ax
  mov es, ax
  mov fs, ax
  mov gs, ax
  mov ss, ax

  /* Set the Code Segment Selector */
  jmp 0x08:.flush

.flush:
  ret