From: Duje Mihanović Date: Tue, 21 Jun 2022 14:54:06 +0000 (+0200) Subject: Separate generic and arch-specific headers X-Git-Tag: 0.1.1~1 X-Git-Url: https://git.dujemihanovic.xyz/?a=commitdiff_plain;h=d895d72c4e8625b435add9067fe8f7298de2d301;p=nameless-os.git Separate generic and arch-specific headers --- diff --git a/Makefile b/Makefile index 0e56c23..714528a 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,13 @@ export AS = yasm +ASFLAGS = -g dwarf2 -f elf export CC = i686-elf-gcc QEMU = qemu-system-i386 -monitor stdio export GIT_REV = $(shell git describe --long HEAD) -CFLAGS = -g -fgnu89-inline -Iinclude/arch/x86 -ffreestanding -DGIT_COMMIT=\"$(GIT_REV)\" +CFLAGS = -g -fgnu89-inline -Ikernel/include -Ikernel/include/arch/x86 -ffreestanding -DGIT_COMMIT=\"$(GIT_REV)\" -KERNEL_OBJ = kernel/entry.o kernel/arch/x86/tty/tty.o kernel/drivers/irq/i8259a.o kernel/arch/x86/irq/idt.o kernel/arch/x86/irq/sample_handler.o kernel/kernel.o +KERNEL_OBJ = kernel/entry.o kernel/arch/x86/halt.o kernel/arch/x86/tty/tty.o kernel/drivers/irq/i8259a.o kernel/arch/x86/irq/idt.o kernel/arch/x86/irq/sample_handler.o kernel/kernel.o BOOTLOADER_OBJ = boot/x86/mbr boot/x86/vbr-fat32 boot/x86/stage3/LOADER.BIN boot/x86/stage3/loader.elf @@ -41,9 +42,6 @@ boot/x86/disk.img: boot/x86/mbr boot/x86/vbr-fat32 boot/x86/stage3/LOADER.BIN bo kernel/kernel.bin: ${KERNEL_OBJ} kernel/linker.ld $(CC) -ffreestanding -nostdlib -o $@ -T kernel/linker.ld ${KERNEL_OBJ} -kernel/entry.o: kernel/entry.s - $(AS) -f elf $< -o $@ - kernel/arch/x86/irq/sample_handler.o: kernel/arch/x86/irq/sample_handler.c $(CC) $(CFLAGS) -mgeneral-regs-only -c $< -o $@ diff --git a/kernel/arch/x86/halt.s b/kernel/arch/x86/halt.s new file mode 100644 index 0000000..aded520 --- /dev/null +++ b/kernel/arch/x86/halt.s @@ -0,0 +1,9 @@ +; x86-specific routine for halting + +bits 32 +global halt + +halt: + cli + hlt + jmp $-1 diff --git a/include/arch/x86/io.h b/kernel/include/arch/x86/io.h similarity index 100% rename from include/arch/x86/io.h rename to kernel/include/arch/x86/io.h diff --git a/include/arch/x86/irq/i8259a.h b/kernel/include/arch/x86/irq/i8259a.h similarity index 100% rename from include/arch/x86/irq/i8259a.h rename to kernel/include/arch/x86/irq/i8259a.h diff --git a/include/arch/x86/irq/idt.h b/kernel/include/arch/x86/irq/idt.h similarity index 100% rename from include/arch/x86/irq/idt.h rename to kernel/include/arch/x86/irq/idt.h diff --git a/include/arch/x86/mm/paging.h b/kernel/include/arch/x86/mm/paging.h similarity index 100% rename from include/arch/x86/mm/paging.h rename to kernel/include/arch/x86/mm/paging.h diff --git a/include/arch/x86/panic.h b/kernel/include/panic.h similarity index 87% rename from include/arch/x86/panic.h rename to kernel/include/panic.h index c66d6c7..f481e0c 100644 --- a/include/arch/x86/panic.h +++ b/kernel/include/panic.h @@ -1,13 +1,7 @@ #ifndef PANIC_H #define PANIC_H -void halt() -{ - asm("cli":); -loop: - asm("hlt":); - goto loop; -} +extern void halt(); #define PANIC(msg) \ kprint("PANIC (", VGA_COLOR_BRIGHT_RED);\ diff --git a/include/arch/x86/tty.h b/kernel/include/tty.h similarity index 95% rename from include/arch/x86/tty.h rename to kernel/include/tty.h index f2049a2..3e1aab0 100644 --- a/include/arch/x86/tty.h +++ b/kernel/include/tty.h @@ -1,5 +1,5 @@ -#ifndef X86_TTY_H -#define X86_TTY_H +#ifndef TTY_H +#define TTY_H #include