diff --git a/Makefile b/Makefile index 577db7a..098565f 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ clean: -@rm build/*.o build/*.elf 2> /dev/null || true build/start32.o: build/ src/start32.asm - fasm src/start32.asm build/start32.o + nasm -felf32 src/start32.asm -o build/start32.o build/kernel-i386.elf: build/start32.o tcc -m32 -nostdlib -Wl,-Ttext,0x100000 -o build/kernel-i386.elf src/*.c build/start32.o image: build/kernel-i386.elf mount diff --git a/README.md b/README.md index 3e1702f..b6df57b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Multiboot compatible stupid useless OS-like project. ## Compatibility 32bit x86 legacy BIOS system ## Building -FASM and TinyCCompiler are used. +NASM and TinyCCompiler are used. TCC might need manual compilation for 32bit crosscompilation on 64bit systems. Just download the source and `make cross` or something. diff --git a/src/start32.asm b/src/start32.asm index 4293474..ac78236 100644 --- a/src/start32.asm +++ b/src/start32.asm @@ -1,15 +1,13 @@ -format elf -use32 - -MULTIBOOT_PAGE_ALIGN equ (1 shl 0) -MULTIBOOT_MEMORY_INFO equ (1 shl 1) -MULTIBOOT_VIDEO_REQUEST equ (1 shl 2) -MULTIBOOT_AOUT_KLUDGE equ (1 shl 16) MULTIBOOT_HEADER_MAGIC equ 0x1BADB002 -MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN or MULTIBOOT_MEMORY_INFO or MULTIBOOT_VIDEO_REQUEST +MULTIBOOT_PAGE_ALIGN equ 1 << 0 +MULTIBOOT_MEMORY_INFO equ 1 << 1 +MULTIBOOT_VIDEO_REQUEST equ 0 << 2 +MULTIBOOT_AOUT_KLUDGE equ 0 << 16 +MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_REQUEST MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) -section '.multiboot' align 4 +section .multiboot +align 4 dd MULTIBOOT_HEADER_MAGIC dd MULTIBOOT_HEADER_FLAGS dd MULTIBOOT_CHECKSUM @@ -23,14 +21,15 @@ section '.multiboot' align 4 dd 768 ; video height dd 32 ; video depth -section '.bss' writable align 16 +section .bss +align 16 stack_bottom: - rb 16384 + resb 16384 stack_top: -section '.text' executable - public _start - extrn kmain +section .text + global _start + extern kmain _start: ; Setup stack @@ -41,8 +40,7 @@ _start: push eax call kmain - -@@: +.hang: cli hlt - jmp @b + jmp .hang