
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
34 lines
675 B
ArmAsm
34 lines
675 B
ArmAsm
; since we have no stack we have to create one for the OS
|
|
|
|
global loader
|
|
; this section is partly handled by nasm tolerating some minor bs
|
|
MAGIC_NUMBER equ 0x1BADB002
|
|
FLAGS equ 0x0
|
|
CHECKSUM equ -MAGIC_NUMBER
|
|
KERNEL_STACK_SIZE equ 4096
|
|
|
|
|
|
; size in bytes of stack
|
|
extern gdt_configure
|
|
extern test_dispatcher
|
|
|
|
section .text
|
|
; align all instructions to 4 byte boundary by the x86 instruction set law
|
|
align 4
|
|
; dropping our magic and other things into memory
|
|
dd MAGIC_NUMBER
|
|
dd FLAGS
|
|
dd CHECKSUM
|
|
|
|
; sets up our gdt and segment selectors for later use
|
|
|
|
loader:
|
|
; load the gdt that I setup
|
|
call load_gdt
|
|
;call gdt_configure
|
|
call test_dispatcher
|
|
|
|
.loop:
|
|
jmp .loop
|
|
|