summaryrefslogtreecommitdiff
path: root/stage2/main.asm
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2024-04-11 20:58:38 +0200
committerLizzy Fleckenstein <lizzy@vlhl.dev>2024-04-11 21:05:47 +0200
commit8b90c1f407b4f4aa3802858e23aa90d7dfbe17ad (patch)
tree4080e975e33df6f3c57ff5f3486f97923c9bbbe3 /stage2/main.asm
parenta6669e496e46ef89673103b3330226c7d0201a1a (diff)
downloadcuddles-8b90c1f407b4f4aa3802858e23aa90d7dfbe17ad.tar.xz
bootinfo struct
Diffstat (limited to 'stage2/main.asm')
-rw-r--r--stage2/main.asm27
1 files changed, 21 insertions, 6 deletions
diff --git a/stage2/main.asm b/stage2/main.asm
index fae8d5a..1964720 100644
--- a/stage2/main.asm
+++ b/stage2/main.asm
@@ -1,14 +1,12 @@
[org 0x7E00]
%define PAGETABLE 0x1000
-%define VESAINFO 0x0500
-%define VESAMODE VESAINFO+512
-%define OWNMODE VESAMODE+256
-%define GFXINFO PAGETABLE-10
-;%define MEMMAPCNT GFXINFO-2
+%define VESAMODES 0x500
%define MEMMAP 0x500
setup:
+ mov [bootinfo.ksize], edi
+
; print message
mov ebx, .msg
call print_str
@@ -28,6 +26,15 @@ setup:
.msg:
db 10, 13, "cuddles stage2", 10, 13, 0
+bootinfo:
+ .ksize: dq 0
+ .gfx_pitch: dw 0
+ .gfx_width: dw 0
+ .gfx_height: dw 0
+ .gfx_framebuffer: dq 0
+ .mmap_len: dq 0
+ .mmap_ptr: dq 0
+
%include "stage2/vesa.asm"
%include "stage2/mmap.asm"
%include "stage2/paging.asm"
@@ -46,6 +53,14 @@ long_mode:
mov gs, ax
mov ss, ax
- call load_kernel_elf
+ call load_kernel_elf ; returns entry point in rax
+
+ ; more stack space
+ mov rsp, 0x80000
+ xor rbp, rbp
+
+ ; pass bootinfo as arg
+ mov rdi, bootinfo
+ call rax
kernel_elf: