diff --git a/build/confs/x86.conf b/build/confs/x86.conf index 6793052..888aa19 100644 --- a/build/confs/x86.conf +++ b/build/confs/x86.conf @@ -26,7 +26,7 @@ cp ../kernel/arch/x86/imports/compile_typeinfo.sh dsss_imports/.;\ cp ../kernel/arch/x86/imports/architecture.d dsss_imports/.;\ echo ; \ echo Compiling Assembly for target: x86_64 ;\ -echo '--> boot.S';\ +echo '--> boot.s';\ yasm -felf32 -mx86 -o dsss_objs/O/kernel.arch.x86.boot.boot.o ../kernel/arch/x86/boot/boot.s;\ \ echo ; \ diff --git a/kernel/arch/x86/boot/boot.s b/kernel/arch/x86/boot/boot.s index 72a943b..a43ce89 100644 --- a/kernel/arch/x86/boot/boot.s +++ b/kernel/arch/x86/boot/boot.s @@ -20,10 +20,10 @@ bits 32 ; externs given by the linker script extern _edata extern _end +extern _boot -; extern to the load.s -extern start64 -extern stack +; extern for kmain +extern kmain ; other definitions @@ -32,14 +32,6 @@ extern stack ; define the starting point for this module global start global _start -start: -_start: - - ; Stash values for multiboot we won't touch until 64 bit mode - mov esi, ebx - mov edi, eax - - jmp start32 ; the multiboot header needs to be aligned at ; a 32 bit boundary @@ -51,23 +43,40 @@ _start: dd MULTIBOOT_HEADER_FLAGS dd -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) dd multiboot_header - dd _start + dd _boot dd _edata dd _end dd _start ; the 32 bit entry -global start32 -start32: +start: +_start: ; disable interrupts cli -_loop: - jmp _loop - nop - nop - nop - nop + ; establish stack (point to bottom) + mov esp, stack+STACK_SIZE + + ; pass multiboot information + push eax + push ebx + + ; call kmain + call kmain + +_halt: + + cli + + hlt + jmp _halt + nop nop + +section .bss +align 32 +stack: + resb STACK_SIZE + diff --git a/kernel/arch/x86/linker.ld b/kernel/arch/x86/linker.ld index 53d1a64..5a5506e 100644 --- a/kernel/arch/x86/linker.ld +++ b/kernel/arch/x86/linker.ld @@ -21,6 +21,8 @@ kernel_VMA = 0x100000; kernel_LMA = 0x100000; /* start from the entry point */ + +OUTPUT_FORMAT("elf32-i386") ENTRY(_start) SECTIONS {