multiboot stuff '-'

This commit is contained in:
Adrien Bourmault 2019-02-12 14:58:26 +01:00
parent 643eeb6e3c
commit d8a43e0688
1 changed files with 34 additions and 12 deletions

View File

@ -25,16 +25,40 @@
%define DEBUG
[BITS 16]
[ORG 0x1000]
[BITS 32]
[global _start]
[ORG 0x100000] ; Where GRUB loads us.
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
%include "boot/loader/multiboot.inc"
mov [Bootdrv], dl
xor dl, dl
jmp 0x0000:main
_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 [Bootdrv], dl
xor dl, dl
jmp 0x0000:main ;; pas sûr
[align 4]
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd CHECKSUM
dd multiboot_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
MB_start:
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
call main
add esp, 8 ; Cleanup 8 bytes pushed as arguments
jmp Die
%include "boot/loader/cpu/cpuid.asm"
%include "boot/loader/io/rmterm.asm"
@ -42,6 +66,8 @@ jmp 0x0000:main
main:
;; XXX NEED TO SWITCH TO RM HERE ;;
;; compatibility check
push si
mov si, Init
@ -92,10 +118,6 @@ main:
push dword [VGA_HEIGHT]
jmp (CODE_SELECTOR-GDT64):main32
;; THE HOLE ----------------------------------------------------------------- ;;
ErrorNo64:
mov si, NoLongMode
call PrintB
Die:
cli
hlt ; die nooooow