gdt: make gdt setup run before kmain
This commit is contained in:
@@ -6,11 +6,27 @@ section .text
|
||||
dd 0x00
|
||||
dd - (0x1BADB002+0x00)
|
||||
|
||||
section .gdt
|
||||
%include "src/gdt.asm"
|
||||
|
||||
section .text
|
||||
global start
|
||||
extern kmain ; this function is gonna be located in our c code(kernel.c)
|
||||
|
||||
start:
|
||||
cli ;clears the interrupts
|
||||
|
||||
lgdt [gdt]
|
||||
mov ax, DATA_SEG
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
mov ss, ax
|
||||
jmp CODE_SEG:.huita
|
||||
|
||||
.huita:
|
||||
push ebx
|
||||
call kmain ;send processor to continue execution from the kamin funtion in c code
|
||||
|
||||
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
gdt_start:
|
||||
; null entry
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
gdt_code:
|
||||
dw 0xffff ; 00-15 limit
|
||||
dw 0 ; 16-31 base
|
||||
db 0 ; 32-39 base
|
||||
db 10011010b ; 40-47 access
|
||||
db 11001111b ; 48-55 limit (48-51) and flags (52-55)
|
||||
db 0 ; 56-63 base
|
||||
|
||||
gdt_data:
|
||||
dw 0xffff ; 00-15 limit
|
||||
dw 0 ; 16-31 base
|
||||
db 0 ; 32-39 base
|
||||
db 10010010b ; 40-47 access
|
||||
db 11001111b ; 48-55 limit (48-51) and flags (52-55)
|
||||
db 0 ; 56-63 base
|
||||
|
||||
gdt_end:
|
||||
|
||||
|
||||
gdt:
|
||||
dw gdt_end - gdt_start - 1 ; length
|
||||
dd gdt_start ; address
|
||||
|
||||
CODE_SEG equ gdt_code - gdt_start
|
||||
DATA_SEG equ gdt_data - gdt_start
|
||||
+1
-1
@@ -12,7 +12,7 @@ void kmain()
|
||||
{
|
||||
terminal_initialize();
|
||||
printf("KatauOS booting up\n");
|
||||
gdt_install();
|
||||
// gdt_install();
|
||||
isr_install();
|
||||
printf("Kernel init sequence completed\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user