]> git.dujemihanovic.xyz Git - nameless-os.git/commitdiff
Separate generic and arch-specific headers
authorDuje Mihanović <duje.mihanovic@skole.hr>
Tue, 21 Jun 2022 14:54:06 +0000 (16:54 +0200)
committerDuje Mihanović <duje.mihanovic@skole.hr>
Wed, 22 Jun 2022 16:03:19 +0000 (18:03 +0200)
Makefile
kernel/arch/x86/halt.s [new file with mode: 0644]
kernel/include/arch/x86/io.h [moved from include/arch/x86/io.h with 100% similarity]
kernel/include/arch/x86/irq/i8259a.h [moved from include/arch/x86/irq/i8259a.h with 100% similarity]
kernel/include/arch/x86/irq/idt.h [moved from include/arch/x86/irq/idt.h with 100% similarity]
kernel/include/arch/x86/mm/paging.h [moved from include/arch/x86/mm/paging.h with 100% similarity]
kernel/include/panic.h [moved from include/arch/x86/panic.h with 87% similarity]
kernel/include/tty.h [moved from include/arch/x86/tty.h with 95% similarity]

index 0e56c23ed6081d925a3a0299a6f32c6a6c0a7e92..714528a346d610ace66c17c2933e0ea8e6b7752b 100644 (file)
--- 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 (file)
index 0000000..aded520
--- /dev/null
@@ -0,0 +1,9 @@
+; x86-specific routine for halting
+
+bits 32
+global halt
+
+halt:
+       cli
+       hlt
+       jmp $-1
similarity index 87%
rename from include/arch/x86/panic.h
rename to kernel/include/panic.h
index c66d6c7b06e9c3ad84308653d96c53d951a021dd..f481e0cd0a4a745f7520d5b4430336cce8c641f6 100644 (file)
@@ -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);\
similarity index 95%
rename from include/arch/x86/tty.h
rename to kernel/include/tty.h
index f2049a236e34908b38f36d77f87aab63c338c3d4..3e1aab0de8b4858896ee4e352e616841fe6bc4f7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef X86_TTY_H
-#define X86_TTY_H
+#ifndef TTY_H
+#define TTY_H
 
 #include <stdint.h>