kernel entry assembly code to avoid compiler anomalies.

This commit is contained in:
Nicolás Ortega Froysa 2018-02-23 17:56:05 +01:00
parent 2aa306c9a3
commit b8fe2bd8a3
No known key found for this signature in database
GPG Key ID: FEC70E3BAE2E69BF
2 changed files with 7 additions and 2 deletions

View File

@ -9,12 +9,13 @@ LDFLAGS=-melf_i386 -Ttext 0x1000 --oformat binary
basicos:
mkdir -p $(BIN)
$(ASM) boot_sect.asm $(AFLAGS) -o boot_sect.bin
$(ASM) kernel_entry.asm -f elf -o kernel_entry.o
$(CC) $(CFLAGS) -c kernel.c -o kernel.o
$(LD) $(LDFLAGS) -o kernel.bin kernel.o
$(LD) $(LDFLAGS) -o kernel.bin kernel_entry.o kernel.o
cat boot_sect.bin kernel.bin > $(BIN)/os-image
.PHONY: clean
clean:
rm *.bin *.o
rm -f *.bin *.o

4
kernel_entry.asm Normal file
View File

@ -0,0 +1,4 @@
[bits 32]
[extern main] ; reference an external label
call main ; call the main function of our kernel
jmp $ ; hang