I'm working on my own hobby OS called 'KiteOS'. I've written some GDT (In GAS), and I was hoping you could take a look at it.
Here is the code:
gdt.s - Holds the GDT data
Code: Select all
.section .rodata
gdt_begin:
gdt_null:
.long 0
.long 0
gdt_code:
.word 0xFFFF
.word 0x0000
.byte 0x0000
.byte 0b10011011
.byte 0b11011111
.byte 0x0000
gdt_data:
.word 0xFFFF
.word 0x0000
.byte 0x0000
.byte 0b10010011
.byte 0b11011111
.byte 0x0000
gdt_end:
.globl gdt_desc
gdt_desc:
.word gdt_end - gdt_begin - 1
.long gdt_begin
Code: Select all
.section .text
.global init
.type init, @function
.extern gdt_desc
init:
cli
lgdt gdt_desc
ljmp $0x08, $reload
reload:
movw $0x10, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
movw %ax, %ss
.cont_init:
ret
Does/should this code work? The OS boots completely fine and the kernel_main C functions is called.
Thanks for your time.