From 991b34eea3249ccf0aa8444c55dcee38980ecfc1 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Tue, 5 Mar 2019 00:15:08 +0100 Subject: [PATCH] some stuff --- boot/loader/loader.asm | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/boot/loader/loader.asm b/boot/loader/loader.asm index 44315fa..0b9da7f 100644 --- a/boot/loader/loader.asm +++ b/boot/loader/loader.asm @@ -27,46 +27,50 @@ [BITS 32] [global _start] -[ORG 0x100000] ; Where GRUB loads us. +[ORG 0x100000] ; Where GRUB loads us. %include "boot/loader/multiboot.inc" +;; Normal entry point, but a little bit unused since we never use it because... _start: - mov ax, cs ; correcting cs after the horrible far jump - mov ds, ax ; hm... And ds too - mov es, ax ; And es because it is jealous + mov ax, cs ; correcting cs after the horrible far jump + mov ds, ax ; hm... And ds too + mov es, ax ; And es because it is jealous ;mov [Bootdrv], dl xor dl, dl - jmp 0x0000:main ; pas sûr + jmp 0x0000:main ; pas sûr +;; Magnificent multiboot header for GRUB ------------------------------------ ;; MB_header: align 4 dd MB_HEADER_MAGIC dd MB_HEADER_FLAGS dd CHECKSUM - dd MB_header ; Header address - dd _start ; Address of code entry point - dd 00 ; (end of code) not necessary - dd 00 ; (bss) not necessary - dd MB_start ; entry address GRUB will start at + dd MB_header ; Header address + dd _start ; Address of code entry point + dd 00 ; (end of code) not necessary + dd 00 ; (bss) not necessary + dd MB_start ; entry address GRUB will start at +;; Multiboot entry point for Grub ------------------------------------------- ;; MB_start: - mov esp, KERNEL_STACK ; Setup the stack - push 0 ; Reset EFLAGS + mov esp, KERNEL_STACK ; Setup the stack + push 0 ; Reset EFLAGS popf - push eax ; 2nd argument is magic number - push ebx ; 1st argument multiboot info pointer + push eax ; 2nd argument is magic number + push ebx ; 1st argument multiboot info pointer call main - add esp, 8 ; Cleanup 8 bytes pushed as arguments - jmp Die + add esp, 8 ; Cleanup arguments "A la MIPS" + jmp Die ; Aufwiedersehen -;; BEGIN OF THE HOLE -------------------------------------------------------- ;; +;; THE HOLE ----------------------------------------------------------------- ;; Die: cli - hlt ; die nooooow + hlt ; die nooooow ;jmp 0xF000:0xFFF0 jmp $ -;; END OF THE HOLE ---------------------------------------------------------- ;; +;; THE CODE ------------------------------------------------------------------;; main: + jmp Die