From ead0ed6ae18ba65462e4de92999e3753990f21ac Mon Sep 17 00:00:00 2001 From: xamidev Date: Sun, 28 Dec 2025 11:39:39 +0100 Subject: [PATCH] Folder restructuration --- Makefile | 4 +++- src/idt/idt.c | 4 ++-- src/{ => io}/kbd/ps2.c | 6 +++--- src/{ => io}/kbd/ps2.h | 0 src/io/{ => serial}/serial.c | 2 +- src/io/{ => serial}/serial.h | 0 src/io/{ => term}/printf.c | 0 src/io/{ => term}/printf.h | 0 src/io/{ => term}/term.c | 2 +- src/io/{ => term}/term.h | 0 src/kmain.c | 12 ++++++------ src/mem/{ => gdt}/gdt.c | 2 +- src/mem/{ => gdt}/gdt.h | 0 src/mem/{ => misc}/utils.c | 0 src/mem/{ => misc}/utils.h | 0 src/time/timer.c | 2 +- 16 files changed, 18 insertions(+), 16 deletions(-) rename src/{ => io}/kbd/ps2.c (98%) rename src/{ => io}/kbd/ps2.h (100%) rename src/io/{ => serial}/serial.c (98%) rename src/io/{ => serial}/serial.h (100%) rename src/io/{ => term}/printf.c (100%) rename src/io/{ => term}/printf.h (100%) rename src/io/{ => term}/term.c (99%) rename src/io/{ => term}/term.h (100%) rename src/mem/{ => gdt}/gdt.c (98%) rename src/mem/{ => gdt}/gdt.h (100%) rename src/mem/{ => misc}/utils.c (100%) rename src/mem/{ => misc}/utils.h (100%) diff --git a/Makefile b/Makefile index 6a90378..475a555 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ +SOURCES = src/io/kbd/ps2.c src/io/serial/serial.c src/io/term/printf.c src/io/term/term.c src/idt/idt.c src/mem/gdt/gdt.c src/mem/misc/utils.c src/time/timer.c src/kmain.c + build: rm -f *.o - x86_64-elf-gcc -g -c -I src src/kbd/ps2.c src/time/timer.c src/idt/idt.c src/mem/utils.c src/mem/gdt.c src/io/serial.c src/io/term.c src/io/printf.c src/kmain.c -Wall -Wextra -std=gnu99 -nostdlib -ffreestanding -fno-stack-protector -fno-stack-check -fno-PIC -ffunction-sections -fdata-sections -mcmodel=kernel + x86_64-elf-gcc -g -c -I src $(SOURCES) -Wall -Wextra -std=gnu99 -nostdlib -ffreestanding -fno-stack-protector -fno-stack-check -fno-PIC -ffunction-sections -fdata-sections -mcmodel=kernel objcopy -O elf64-x86-64 -B i386 -I binary zap-light16.psf zap-light16.o nasm -f elf64 src/idt/idt.S -o idt_stub.o x86_64-elf-ld -o pepperk -T linker.ld *.o diff --git a/src/idt/idt.c b/src/idt/idt.c index 514e9ab..5f2cb74 100644 --- a/src/idt/idt.c +++ b/src/idt/idt.c @@ -1,8 +1,8 @@ #include "idt.h" #include #include -#include "../io/serial.h" -#include "../kbd/ps2.h" +#include "../io/serial/serial.h" +#include "../io/kbd/ps2.h" struct interrupt_descriptor idt[256]; struct idtr idt_reg; diff --git a/src/kbd/ps2.c b/src/io/kbd/ps2.c similarity index 98% rename from src/kbd/ps2.c rename to src/io/kbd/ps2.c index 3af8242..3a7c835 100644 --- a/src/kbd/ps2.c +++ b/src/io/kbd/ps2.c @@ -1,10 +1,10 @@ // PS/2 Keyboard support -#include "../io/serial.h" -#include "../io/printf.h" +#include "../serial/serial.h" +#include "../term/printf.h" #include "ps2.h" #include -#include "../io/term.h" +#include "../term/term.h" // The key status bitfield will be used to see if ALT, CONTROL, or SHIFT is pressed uint8_t key_status = 0b00000000; diff --git a/src/kbd/ps2.h b/src/io/kbd/ps2.h similarity index 100% rename from src/kbd/ps2.h rename to src/io/kbd/ps2.h diff --git a/src/io/serial.c b/src/io/serial/serial.c similarity index 98% rename from src/io/serial.c rename to src/io/serial/serial.c index 388b5b3..85a3f37 100644 --- a/src/io/serial.c +++ b/src/io/serial/serial.c @@ -1,4 +1,4 @@ -#include "../kernel.h" +#include #include "serial.h" void outb(int port, unsigned char data) diff --git a/src/io/serial.h b/src/io/serial/serial.h similarity index 100% rename from src/io/serial.h rename to src/io/serial/serial.h diff --git a/src/io/printf.c b/src/io/term/printf.c similarity index 100% rename from src/io/printf.c rename to src/io/term/printf.c diff --git a/src/io/printf.h b/src/io/term/printf.h similarity index 100% rename from src/io/printf.h rename to src/io/term/printf.h diff --git a/src/io/term.c b/src/io/term/term.c similarity index 99% rename from src/io/term.c rename to src/io/term/term.c index 50d2552..3686cd2 100644 --- a/src/io/term.c +++ b/src/io/term/term.c @@ -2,7 +2,7 @@ #include #include -#include "kernel.h" +#include #include "term.h" extern struct limine_framebuffer* framebuffer; diff --git a/src/io/term.h b/src/io/term/term.h similarity index 100% rename from src/io/term.h rename to src/io/term/term.h diff --git a/src/kmain.c b/src/kmain.c index 61c48fc..0b1d920 100644 --- a/src/kmain.c +++ b/src/kmain.c @@ -1,15 +1,15 @@ #include #include #include -#include "io/term.h" -#include "io/printf.h" -#include "io/serial.h" -#include "mem/gdt.h" -#include "mem/utils.h" +#include "io/term/term.h" +#include "io/term/printf.h" +#include "io/serial/serial.h" +#include "mem/gdt/gdt.h" +#include "mem/misc/utils.h" #include "idt/idt.h" #include "kernel.h" #include "time/timer.h" -#include "kbd/ps2.h" +#include "io/kbd/ps2.h" // Limine version used __attribute__((used, section(".limine_requests"))) diff --git a/src/mem/gdt.c b/src/mem/gdt/gdt.c similarity index 98% rename from src/mem/gdt.c rename to src/mem/gdt/gdt.c index fb82ae7..01d183c 100644 --- a/src/mem/gdt.c +++ b/src/mem/gdt/gdt.c @@ -1,6 +1,6 @@ #include "gdt.h" #include -#include "../io/serial.h" +#include "../../io/serial/serial.h" // Descriptors are 8-byte wide (64bits) // So the selectors will be (in bytes): 0x0, 0x8, 0x10, 0x18, etc.. diff --git a/src/mem/gdt.h b/src/mem/gdt/gdt.h similarity index 100% rename from src/mem/gdt.h rename to src/mem/gdt/gdt.h diff --git a/src/mem/utils.c b/src/mem/misc/utils.c similarity index 100% rename from src/mem/utils.c rename to src/mem/misc/utils.c diff --git a/src/mem/utils.h b/src/mem/misc/utils.h similarity index 100% rename from src/mem/utils.h rename to src/mem/misc/utils.h diff --git a/src/time/timer.c b/src/time/timer.c index 1fe8565..a436572 100644 --- a/src/time/timer.c +++ b/src/time/timer.c @@ -1,5 +1,5 @@ #include -#include "../io/serial.h" +#include "../io/serial/serial.h" /* For now, the timer module will be using the PIC.