diff --git a/arch/Makefile b/arch/Makefile index 359a3b4..39c0c0f 100644 --- a/arch/Makefile +++ b/arch/Makefile @@ -3,7 +3,7 @@ CCPREFIX = i686-elf- AS = $(CCPREFIX)as CC = $(CCPREFIX)gcc -OBJS = boot.s.o main.c.o logger.c.o console.c.o gdt.c.o idt.c.o isr.c.o isr.asm.o multiboot.c.o protected.asm.o +OBJS = boot.s.o main.c.o logger.c.o console.c.o gdt.c.o idt.c.o isr.c.o isr.asm.o multiboot.c.o protected.asm.cpp.o all: kernel @@ -22,3 +22,9 @@ kernel: $(OBJS) %.asm.o: %.asm nasm -felf -o $@ $< + +%.asm.cpp.o: %.asm.cpp + nasm -felf -o $@ $< + +%.asm.cpp: %.asm + cpp -P $< $@ diff --git a/arch/protected.asm b/arch/protected.asm index 6d93166..5fac058 100644 --- a/arch/protected.asm +++ b/arch/protected.asm @@ -1,3 +1,5 @@ +#include "config.h" + [GLOBAL gdt_flush] [GLOBAL idt_flush] @@ -5,13 +7,13 @@ gdt_flush: mov eax, [esp+4] lgdt [eax] - mov ax, 0x10 + mov ax, GDT_KERNEL_DS_SELECTOR mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax - jmp 0x08:.flush + jmp GDT_KERNEL_CS_SELECTOR:.flush .flush: ret