Implemented Higher Half Kernel!

- Minor makefile chnages
- stage3.c "prekernel", sets up memory stuff and jumps to kernel
- kernel is now at 0xC0000000 - 3GB+ "higher half"
- Added some global variables in memory/addresses.h
This commit is contained in:
2024-05-26 15:49:48 +02:00
parent 01323c5874
commit e9abfc2e4a
11 changed files with 135 additions and 65 deletions
+12 -8
View File
@@ -24,12 +24,12 @@ filesystem: bootloader kernel $(C_FILES) $(FONTS)
@dd if=/dev/zero of=kern.iso bs=512 count=2880 status=none
# TODO: Make this not so manual
@dd if=$(BUILD)/boot.bin of=kern.iso bs=512 seek=0 conv=notrunc status=none
@dd if=$(BUILD)/filetable.bin of=kern.iso bs=512 seek=5 conv=notrunc status=none
@dd if=$(BUILD)/kernel.bin of=kern.iso bs=512 seek=6 conv=notrunc status=none
@dd if=$(BUILD)/term16n.bin of=kern.iso bs=512 seek=46 conv=notrunc status=none
@dd if=$(BUILD)/testfont.bin of=kern.iso bs=512 seek=50 conv=notrunc status=none
@dd if=$(SRC)/fs/test.txt of=kern.iso bs=512 seek=54 conv=notrunc status=none
@dd if=$(BUILD)/calc.bin of=kern.iso bs=512 seek=55 conv=notrunc status=none
@dd if=$(BUILD)/filetable.bin of=kern.iso bs=512 seek=15 conv=notrunc status=none
@dd if=$(BUILD)/kernel.bin of=kern.iso bs=512 seek=16 conv=notrunc status=none
@dd if=$(BUILD)/term16n.bin of=kern.iso bs=512 seek=56 conv=notrunc status=none
@dd if=$(BUILD)/testfont.bin of=kern.iso bs=512 seek=60 conv=notrunc status=none
@dd if=$(SRC)/fs/test.txt of=kern.iso bs=512 seek=64 conv=notrunc status=none
@dd if=$(BUILD)/calc.bin of=kern.iso bs=512 seek=65 conv=notrunc status=none
$(BUILD):
@[ -d $(BUILD) ] || mkdir $(BUILD)
@@ -41,14 +41,18 @@ bootloader: $(SRC)/stage1.asm $(SRC)/stage2.asm
@$(AS) -fbin -o $(BUILD)/stage1.bin $(SRC)/stage1.asm
@echo "Assembling $(SRC)/stage2.asm..."
@$(AS) -fbin -o $(BUILD)/stage2.bin $(SRC)/stage2.asm
@cat $(BUILD)/stage1.bin $(BUILD)/stage2.bin > $(BUILD)/boot.bin
@echo "Compiling $(SRC)/stage3.c..."
@$(CC) $(CFLAGS) -Iinclude -o $(BUILD)/stage3.o -c $(SRC)/stage3.c
@$(LD) -T$(SRC)/stage3.ld -z notext --oformat binary -o $(BUILD)/stage3.bin $(BUILD)/stage3.o
@cat $(BUILD)/stage1.bin $(BUILD)/stage2.bin $(BUILD)/stage3.bin > $(BUILD)/boot.bin
@rm $(BUILD)/stage3.o
# Kernel: This target is responsible for creating kernel.bin
kernel: $(SRC)/kernel.c
@echo "Compiling $(SRC)/kernel.c..."
@$(CC) $(CFLAGS) -Iinclude -o $(BUILD)/kernel.o -c $(SRC)/kernel.c
@$(LD) -T$(SRC)/kernel.ld -z notext --oformat binary -o $(BUILD)/kernel.bin $(BUILD)/kernel.o
@rm $(BUILD)/*.o
@rm $(BUILD)/kernel.o
$(C_FILES):
@echo "Compiling $(SRC)/$@.c..."