
GDT control is how I would like it to be but there are some issues, namely: 1. far jumping to flush the code segment crashes the whole os(not good) 2. Segment selectors seem fine apart from the code segment thing 3. some administrative issues regarding the structure of the project which is slowly making things painful
18 lines
312 B
ArmAsm
18 lines
312 B
ArmAsm
global load_gdt
|
|
extern gdt_ptr
|
|
|
|
load_gdt:
|
|
lgdt [gdt_ptr]
|
|
mov ax, 0x10 ; offset in the gdt to our data segment
|
|
mov ds, ax
|
|
mov es, ax
|
|
mov fs, ax
|
|
mov gs, ax
|
|
mov ss, ax
|
|
jmp 0x08:flush_cs ; far jump to the code segment
|
|
|
|
flush_cs:
|
|
ret ; here we go back to the caller code but with our segments configured
|
|
|
|
|