Add: GDT, entry initializing for code and data segments
This commit is contained in:
17
loader.s
17
loader.s
@@ -14,6 +14,7 @@ align 4
|
||||
extern kmain
|
||||
|
||||
loader:
|
||||
cli
|
||||
; mov eax, 0xCAFEBABE
|
||||
push dword 42
|
||||
call kmain
|
||||
@@ -21,6 +22,22 @@ loader:
|
||||
.loop:
|
||||
jmp .loop
|
||||
|
||||
global gdt_flush
|
||||
extern gp
|
||||
|
||||
gdt_flush:
|
||||
lgdt [gp]
|
||||
mov ax, 0x10
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
mov ss, ax
|
||||
jmp 0x08:flush2
|
||||
|
||||
flush2:
|
||||
ret
|
||||
|
||||
section .bss
|
||||
align 4
|
||||
kernel_stack:
|
||||
|
||||
Reference in New Issue
Block a user