diff options
| author | Nic Gaffney <gaffney_nic@protonmail.com> | 2023-12-11 04:47:44 -0600 |
|---|---|---|
| committer | Nic Gaffney <gaffney_nic@protonmail.com> | 2023-12-11 04:47:44 -0600 |
| commit | 626bd9a53b1085b56ee54c900bfafdad79967725 (patch) | |
| tree | ff0cf34a11301e2cd362a4c7a2f568232b143a8a /src/header/boot.s | |
| parent | 083a88b7e1b2456fe10110b83027793348f3aa42 (diff) | |
| download | gftos-626bd9a53b1085b56ee54c900bfafdad79967725.tar.gz | |
added a couple small things, nothing really changed
Diffstat (limited to 'src/header/boot.s')
| -rw-r--r-- | src/header/boot.s | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/header/boot.s b/src/header/boot.s index 5eaa794..b66b249 100644 --- a/src/header/boot.s +++ b/src/header/boot.s @@ -3,7 +3,8 @@ MBMEMINFO equ 1<<1 ; Provide memory map*/ MBFLAGS equ MBALIGN | MBMEMINFO ; Multiboot flag field*/ MAGIC equ 0x1BADB002 ;Lets bootloader find header*/ CHECKSUM equ -(MAGIC + MBFLAGS) ; Proves we are multiboot via checksum*/ - +CODESEG equ 0x08 +DATASEG equ 0x10 section .multiboot align 4 @@ -18,19 +19,23 @@ resb 16384 stack_top: section .text +global gdtr +gdtr: + dw 0 + dd 0 global _start:function (_start.end - _start) _start: mov esp, stack_top extern get_gdtr call get_gdtr - extern gdtr - mov [gdtr], eax cli lgdt [gdtr] + mov eax, cr0 + or al, 1 + mov cr0, eax - - call reloadSegments ; this motherfucker is what is causing so many issues + call reloadSegments [bits 32] extern kernel_main @@ -42,14 +47,13 @@ _start: jmp .hang .end: - - reloadSegments: - JMP 0x0008:.reload_CS ; should def define a CODESEG +reloadSegments: + JMP CODESEG:.reload_CS ; should def define a CODESEG .reload_CS: - MOV AX, 0x0010 + MOV AX, DATASEG MOV DS, AX - MOV ES, AX - MOV FS, AX - MOV GS, AX - MOV SS, AX + MOV ES, AX // TODO: Setup proper extra segment + MOV FS, AX // TODO: Setup proper General purpose segments + MOV GS, AX // ... + MOV SS, AX // TODO: Setup proper stack segment RET |
