blob: 9e5954478a0cd4f34740804eced8eadaf71681c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
%include "const.inc"
global gdt_flush
section .text: ; start of the text (code) section
align 4 ; the code must be 4 byte aligned
gdt_flush:
mov eax,[esp+4] ; Get the pointer to the GDT, passed as a parameter.
lgdt [eax] ; Load the new GDT pointer
mov ax,GDT_KERNEL_DATA_SELECTOR ; offset in the GDT of the kernel data segment
mov ds,ax ; Load all data segment selectors
mov es,ax
mov fs,ax
mov gs,ax
mov ss,ax
jmp GDT_KERNEL_CODE_SELECTOR:.flush ; far jump [selector:offset]
.flush:
ret
|