Initializing own stack and moar multiboot stuff

- Not relying on Grub/Multiboot setting up stack for us
- Preparing Multiboot headers so one day we can has graphical mode
This commit is contained in:
Jarkko Toivanen 2023-06-14 03:44:25 +03:00
parent aaffd2351f
commit 99e0b4debb
Signed by: jt
GPG key ID: 9151B109B73ECAD5

View file

@ -1,17 +1,27 @@
format elf format elf
use32 use32
MULTIBOOT_PAGE_ALIGN equ (1 shl 0) MULTIBOOT_PAGE_ALIGN equ (1 shl 0)
MULTIBOOT_MEMORY_INFO equ (1 shl 1) MULTIBOOT_MEMORY_INFO equ (1 shl 1)
MULTIBOOT_VIDEO_REQUEST equ (0 shl 2)
MULTIBOOT_AOUT_KLUDGE equ (1 shl 16) MULTIBOOT_AOUT_KLUDGE equ (1 shl 16)
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002 MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN or MULTIBOOT_MEMORY_INFO MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN or MULTIBOOT_MEMORY_INFO or MULTIBOOT_VIDEO_REQUEST
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
.multiboot: align 4 .multiboot: align 4
dd MULTIBOOT_HEADER_MAGIC dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM dd MULTIBOOT_CHECKSUM
; dd 0 ; header address
; dd 0 ; load address
; dd 0 ; load end address
; dd 0 ; bss end address
; dd 0 ; entry address
; dd 0 ; video mode_type (0:fb, 1:txt) (set flags[2]!)
; dd 1024 ; video width
; dd 768 ; video height
; dd 32 ; video depth
section '.bss' writable align 16 section '.bss' writable align 16
stack_bottom: stack_bottom:
@ -42,14 +52,13 @@ disable_cursor:
_start: _start:
; Setup stack ; Setup stack
;mov esp, stack_top mov esp, stack_top
; Call the main kernel function. ; Call the main kernel function.
call disable_cursor call disable_cursor
call kmain call kmain
@@: @@:
cli cli
hlt hlt