From 766110435a7ede0c8838ed1d87e53f78957b51d9 Mon Sep 17 00:00:00 2001 From: antifallobst Date: Thu, 20 Apr 2023 23:00:56 +0200 Subject: [PATCH] refactor (kernel): refactored the directory structure --- .gitignore | 2 -- CMakeLists.txt | 23 ++++++++++++++++++- build.sh | 23 ++----------------- {kernel/inc => inc}/boot/boot_info.h | 0 {kernel/inc => inc}/boot/limine.h | 0 {kernel/inc => inc}/drivers/acpi/acpi.h | 0 {kernel/inc => inc}/drivers/acpi/fadt.h | 0 {kernel/inc => inc}/drivers/acpi/rsdp.h | 0 {kernel/inc => inc}/drivers/elf/elf.h | 0 {kernel/inc => inc}/drivers/elf/header.h | 0 {kernel/inc => inc}/drivers/elf/mapping.h | 0 {kernel/inc => inc}/drivers/elf/section.h | 0 {kernel/inc => inc}/drivers/elf/segment.h | 0 {kernel/inc => inc}/drivers/elf/symbol.h | 0 {kernel/inc => inc}/drivers/fs/ramfs.h | 0 {kernel/inc => inc}/drivers/fs/ustar.h | 0 {kernel/inc => inc}/drivers/fs/vfs.h | 0 {kernel/inc => inc}/drivers/graphics/color.h | 0 {kernel/inc => inc}/drivers/graphics/font.h | 0 .../drivers/graphics/framebuffer.h | 0 .../inc => inc}/drivers/graphics/renderer.h | 0 {kernel/inc => inc}/drivers/time/pit.h | 0 {kernel/inc => inc}/mm/heap.h | 0 {kernel/inc => inc}/mm/memory_map.h | 0 {kernel/inc => inc}/mm/page_frame.h | 0 {kernel/inc => inc}/mm/page_map.h | 0 {kernel/inc => inc}/mm/region.h | 0 {kernel/inc => inc}/mm/stack.h | 0 {kernel/inc => inc}/platform/cpu.h | 0 {kernel/inc => inc}/platform/exceptions.h | 0 {kernel/inc => inc}/platform/gdt.h | 0 {kernel/inc => inc}/platform/interrupts.h | 0 {kernel/inc => inc}/platform/syscall.h | 0 {kernel/inc => inc}/proc/file_descriptor.h | 0 {kernel/inc => inc}/proc/process.h | 0 {kernel/inc => inc}/proc/scheduler.h | 0 {kernel/inc => inc}/proc/thread.h | 0 {kernel/inc => inc}/utils/bitmap.h | 0 {kernel/inc => inc}/utils/core.h | 0 {kernel/inc => inc}/utils/io.h | 0 {kernel/inc => inc}/utils/logger.h | 0 {kernel/inc => inc}/utils/math.h | 0 {kernel/inc => inc}/utils/memory.h | 0 {kernel/inc => inc}/utils/panic.h | 0 {kernel/inc => inc}/utils/status.h | 0 {kernel/inc => inc}/utils/stdtypes.h | 0 {kernel/inc => inc}/utils/stream.h | 0 {kernel/inc => inc}/utils/string.h | 0 {kernel/inc => inc}/utils/symbol.h | 0 kernel/kernel.ld => kernel.ld | 0 kernel/CMakeLists.txt | 23 ------------------- {kernel/src => src/boot}/kmain.c | 17 -------------- {kernel/src => src}/boot/limine.c | 0 {kernel/src => src}/drivers/acpi/acpi.c | 0 {kernel/src => src}/drivers/acpi/rsdp.c | 0 {kernel/src => src}/drivers/elf/elf.c | 0 {kernel/src => src}/drivers/elf/header.c | 0 {kernel/src => src}/drivers/elf/mapping.c | 0 {kernel/src => src}/drivers/elf/section.c | 0 {kernel/src => src}/drivers/elf/segment.c | 0 {kernel/src => src}/drivers/elf/symbol.c | 0 {kernel/src => src}/drivers/fs/ramfs.c | 0 {kernel/src => src}/drivers/fs/vfs.c | 0 {kernel/src => src}/drivers/graphics/color.c | 0 {kernel/src => src}/drivers/graphics/font.c | 0 .../src => src}/drivers/graphics/renderer.c | 0 {kernel/src => src}/drivers/time/pit.c | 0 {kernel/src => src}/mm/heap.c | 0 {kernel/src => src}/mm/memory_map.c | 0 {kernel/src => src}/mm/page_frame.c | 0 {kernel/src => src}/mm/page_map.c | 0 {kernel/src => src}/mm/stack.c | 0 {kernel/src => src}/platform/exceptions.c | 0 {kernel/src => src}/platform/gdt.c | 0 {kernel/src => src}/platform/interrupts.c | 0 {kernel/src => src}/platform/syscall.c | 0 {kernel/src => src}/platform/x86/gdt.asm | 0 .../src => src}/platform/x86/interrupts.asm | 0 {kernel/src => src}/platform/x86/paging.asm | 0 {kernel/src => src}/platform/x86/syscall.asm | 0 {kernel/src => src}/proc/file_descriptor.c | 0 {kernel/src => src}/proc/process.c | 0 {kernel/src => src}/proc/scheduler.c | 0 {kernel/src => src}/proc/thread.c | 0 {kernel/src => src}/utils/bitmap.c | 0 {kernel/src => src}/utils/io.c | 0 {kernel/src => src}/utils/logger.c | 0 {kernel/src => src}/utils/math.c | 0 {kernel/src => src}/utils/memory.c | 0 {kernel/src => src}/utils/panic.c | 0 {kernel/src => src}/utils/status.c | 0 {kernel/src => src}/utils/stream.c | 0 {kernel/src => src}/utils/string.c | 0 {kernel/src => src}/utils/symbol.c | 0 94 files changed, 24 insertions(+), 64 deletions(-) rename {kernel/inc => inc}/boot/boot_info.h (100%) rename {kernel/inc => inc}/boot/limine.h (100%) rename {kernel/inc => inc}/drivers/acpi/acpi.h (100%) rename {kernel/inc => inc}/drivers/acpi/fadt.h (100%) rename {kernel/inc => inc}/drivers/acpi/rsdp.h (100%) rename {kernel/inc => inc}/drivers/elf/elf.h (100%) rename {kernel/inc => inc}/drivers/elf/header.h (100%) rename {kernel/inc => inc}/drivers/elf/mapping.h (100%) rename {kernel/inc => inc}/drivers/elf/section.h (100%) rename {kernel/inc => inc}/drivers/elf/segment.h (100%) rename {kernel/inc => inc}/drivers/elf/symbol.h (100%) rename {kernel/inc => inc}/drivers/fs/ramfs.h (100%) rename {kernel/inc => inc}/drivers/fs/ustar.h (100%) rename {kernel/inc => inc}/drivers/fs/vfs.h (100%) rename {kernel/inc => inc}/drivers/graphics/color.h (100%) rename {kernel/inc => inc}/drivers/graphics/font.h (100%) rename {kernel/inc => inc}/drivers/graphics/framebuffer.h (100%) rename {kernel/inc => inc}/drivers/graphics/renderer.h (100%) rename {kernel/inc => inc}/drivers/time/pit.h (100%) rename {kernel/inc => inc}/mm/heap.h (100%) rename {kernel/inc => inc}/mm/memory_map.h (100%) rename {kernel/inc => inc}/mm/page_frame.h (100%) rename {kernel/inc => inc}/mm/page_map.h (100%) rename {kernel/inc => inc}/mm/region.h (100%) rename {kernel/inc => inc}/mm/stack.h (100%) rename {kernel/inc => inc}/platform/cpu.h (100%) rename {kernel/inc => inc}/platform/exceptions.h (100%) rename {kernel/inc => inc}/platform/gdt.h (100%) rename {kernel/inc => inc}/platform/interrupts.h (100%) rename {kernel/inc => inc}/platform/syscall.h (100%) rename {kernel/inc => inc}/proc/file_descriptor.h (100%) rename {kernel/inc => inc}/proc/process.h (100%) rename {kernel/inc => inc}/proc/scheduler.h (100%) rename {kernel/inc => inc}/proc/thread.h (100%) rename {kernel/inc => inc}/utils/bitmap.h (100%) rename {kernel/inc => inc}/utils/core.h (100%) rename {kernel/inc => inc}/utils/io.h (100%) rename {kernel/inc => inc}/utils/logger.h (100%) rename {kernel/inc => inc}/utils/math.h (100%) rename {kernel/inc => inc}/utils/memory.h (100%) rename {kernel/inc => inc}/utils/panic.h (100%) rename {kernel/inc => inc}/utils/status.h (100%) rename {kernel/inc => inc}/utils/stdtypes.h (100%) rename {kernel/inc => inc}/utils/stream.h (100%) rename {kernel/inc => inc}/utils/string.h (100%) rename {kernel/inc => inc}/utils/symbol.h (100%) rename kernel/kernel.ld => kernel.ld (100%) delete mode 100644 kernel/CMakeLists.txt rename {kernel/src => src/boot}/kmain.c (56%) rename {kernel/src => src}/boot/limine.c (100%) rename {kernel/src => src}/drivers/acpi/acpi.c (100%) rename {kernel/src => src}/drivers/acpi/rsdp.c (100%) rename {kernel/src => src}/drivers/elf/elf.c (100%) rename {kernel/src => src}/drivers/elf/header.c (100%) rename {kernel/src => src}/drivers/elf/mapping.c (100%) rename {kernel/src => src}/drivers/elf/section.c (100%) rename {kernel/src => src}/drivers/elf/segment.c (100%) rename {kernel/src => src}/drivers/elf/symbol.c (100%) rename {kernel/src => src}/drivers/fs/ramfs.c (100%) rename {kernel/src => src}/drivers/fs/vfs.c (100%) rename {kernel/src => src}/drivers/graphics/color.c (100%) rename {kernel/src => src}/drivers/graphics/font.c (100%) rename {kernel/src => src}/drivers/graphics/renderer.c (100%) rename {kernel/src => src}/drivers/time/pit.c (100%) rename {kernel/src => src}/mm/heap.c (100%) rename {kernel/src => src}/mm/memory_map.c (100%) rename {kernel/src => src}/mm/page_frame.c (100%) rename {kernel/src => src}/mm/page_map.c (100%) rename {kernel/src => src}/mm/stack.c (100%) rename {kernel/src => src}/platform/exceptions.c (100%) rename {kernel/src => src}/platform/gdt.c (100%) rename {kernel/src => src}/platform/interrupts.c (100%) rename {kernel/src => src}/platform/syscall.c (100%) rename {kernel/src => src}/platform/x86/gdt.asm (100%) rename {kernel/src => src}/platform/x86/interrupts.asm (100%) rename {kernel/src => src}/platform/x86/paging.asm (100%) rename {kernel/src => src}/platform/x86/syscall.asm (100%) rename {kernel/src => src}/proc/file_descriptor.c (100%) rename {kernel/src => src}/proc/process.c (100%) rename {kernel/src => src}/proc/scheduler.c (100%) rename {kernel/src => src}/proc/thread.c (100%) rename {kernel/src => src}/utils/bitmap.c (100%) rename {kernel/src => src}/utils/io.c (100%) rename {kernel/src => src}/utils/logger.c (100%) rename {kernel/src => src}/utils/math.c (100%) rename {kernel/src => src}/utils/memory.c (100%) rename {kernel/src => src}/utils/panic.c (100%) rename {kernel/src => src}/utils/status.c (100%) rename {kernel/src => src}/utils/stream.c (100%) rename {kernel/src => src}/utils/string.c (100%) rename {kernel/src => src}/utils/symbol.c (100%) diff --git a/.gitignore b/.gitignore index e8f71d4..df8d2ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ build cmake-build-debug -.idea -.wiki noxos.log \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index a7f4325..24d880b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,25 @@ cmake_minimum_required(VERSION 3.00) project(NoxOS) -add_subdirectory(kernel) +set(C 99) + +set(CMAKE_NASM_COMPILE_OBJECT "nasm -o ") + + +add_executable(kernel) +add_library (kernel_asm OBJECT) +target_include_directories(kernel PRIVATE inc) +file(GLOB_RECURSE kernel_src_c "src/**/*.c") +file(GLOB_RECURSE kernel_inc "inc/**/*.h") +file(GLOB_RECURSE kernel_src_asm "src/**/*.asm") + + +target_compile_options(kernel PRIVATE -g -fno-stack-protector -fno-stack-check -mno-red-zone -ffreestanding -m64 -march=x86-64 -mabi=sysv) +target_link_options(kernel PRIVATE -nostdlib -static -T "${CMAKE_CURRENT_LIST_DIR}/kernel.ld") + +enable_language(ASM_NASM) +set(CAN_USE_ASSEMBLER TRUE) + +target_sources(kernel_asm PRIVATE ${kernel_src_asm}) +target_sources(kernel PRIVATE ${kernel_src_c} ${kernel_inc} $) + diff --git a/build.sh b/build.sh index 241875d..0f23ab3 100755 --- a/build.sh +++ b/build.sh @@ -1,25 +1,6 @@ #!/usr/bin/bash -# Copyright 2023 Antifallobst -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the “Software”), to deal in -# the Software without restriction, including without limitation the rights to use, -# copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -# Software, and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. +# This file is part of noxos and licensed under the MIT open source license set -e @@ -91,7 +72,7 @@ generate_image() { cp limine/limine.sys iso cp ../limine.cfg iso cp initrd.tar iso - cp cmake/kernel/kernel iso/kernel.elf + cp cmake/kernel iso/kernel.elf xorriso -as mkisofs -b limine-cd.bin \ -no-emul-boot -boot-load-size 4 -boot-info-table \ diff --git a/kernel/inc/boot/boot_info.h b/inc/boot/boot_info.h similarity index 100% rename from kernel/inc/boot/boot_info.h rename to inc/boot/boot_info.h diff --git a/kernel/inc/boot/limine.h b/inc/boot/limine.h similarity index 100% rename from kernel/inc/boot/limine.h rename to inc/boot/limine.h diff --git a/kernel/inc/drivers/acpi/acpi.h b/inc/drivers/acpi/acpi.h similarity index 100% rename from kernel/inc/drivers/acpi/acpi.h rename to inc/drivers/acpi/acpi.h diff --git a/kernel/inc/drivers/acpi/fadt.h b/inc/drivers/acpi/fadt.h similarity index 100% rename from kernel/inc/drivers/acpi/fadt.h rename to inc/drivers/acpi/fadt.h diff --git a/kernel/inc/drivers/acpi/rsdp.h b/inc/drivers/acpi/rsdp.h similarity index 100% rename from kernel/inc/drivers/acpi/rsdp.h rename to inc/drivers/acpi/rsdp.h diff --git a/kernel/inc/drivers/elf/elf.h b/inc/drivers/elf/elf.h similarity index 100% rename from kernel/inc/drivers/elf/elf.h rename to inc/drivers/elf/elf.h diff --git a/kernel/inc/drivers/elf/header.h b/inc/drivers/elf/header.h similarity index 100% rename from kernel/inc/drivers/elf/header.h rename to inc/drivers/elf/header.h diff --git a/kernel/inc/drivers/elf/mapping.h b/inc/drivers/elf/mapping.h similarity index 100% rename from kernel/inc/drivers/elf/mapping.h rename to inc/drivers/elf/mapping.h diff --git a/kernel/inc/drivers/elf/section.h b/inc/drivers/elf/section.h similarity index 100% rename from kernel/inc/drivers/elf/section.h rename to inc/drivers/elf/section.h diff --git a/kernel/inc/drivers/elf/segment.h b/inc/drivers/elf/segment.h similarity index 100% rename from kernel/inc/drivers/elf/segment.h rename to inc/drivers/elf/segment.h diff --git a/kernel/inc/drivers/elf/symbol.h b/inc/drivers/elf/symbol.h similarity index 100% rename from kernel/inc/drivers/elf/symbol.h rename to inc/drivers/elf/symbol.h diff --git a/kernel/inc/drivers/fs/ramfs.h b/inc/drivers/fs/ramfs.h similarity index 100% rename from kernel/inc/drivers/fs/ramfs.h rename to inc/drivers/fs/ramfs.h diff --git a/kernel/inc/drivers/fs/ustar.h b/inc/drivers/fs/ustar.h similarity index 100% rename from kernel/inc/drivers/fs/ustar.h rename to inc/drivers/fs/ustar.h diff --git a/kernel/inc/drivers/fs/vfs.h b/inc/drivers/fs/vfs.h similarity index 100% rename from kernel/inc/drivers/fs/vfs.h rename to inc/drivers/fs/vfs.h diff --git a/kernel/inc/drivers/graphics/color.h b/inc/drivers/graphics/color.h similarity index 100% rename from kernel/inc/drivers/graphics/color.h rename to inc/drivers/graphics/color.h diff --git a/kernel/inc/drivers/graphics/font.h b/inc/drivers/graphics/font.h similarity index 100% rename from kernel/inc/drivers/graphics/font.h rename to inc/drivers/graphics/font.h diff --git a/kernel/inc/drivers/graphics/framebuffer.h b/inc/drivers/graphics/framebuffer.h similarity index 100% rename from kernel/inc/drivers/graphics/framebuffer.h rename to inc/drivers/graphics/framebuffer.h diff --git a/kernel/inc/drivers/graphics/renderer.h b/inc/drivers/graphics/renderer.h similarity index 100% rename from kernel/inc/drivers/graphics/renderer.h rename to inc/drivers/graphics/renderer.h diff --git a/kernel/inc/drivers/time/pit.h b/inc/drivers/time/pit.h similarity index 100% rename from kernel/inc/drivers/time/pit.h rename to inc/drivers/time/pit.h diff --git a/kernel/inc/mm/heap.h b/inc/mm/heap.h similarity index 100% rename from kernel/inc/mm/heap.h rename to inc/mm/heap.h diff --git a/kernel/inc/mm/memory_map.h b/inc/mm/memory_map.h similarity index 100% rename from kernel/inc/mm/memory_map.h rename to inc/mm/memory_map.h diff --git a/kernel/inc/mm/page_frame.h b/inc/mm/page_frame.h similarity index 100% rename from kernel/inc/mm/page_frame.h rename to inc/mm/page_frame.h diff --git a/kernel/inc/mm/page_map.h b/inc/mm/page_map.h similarity index 100% rename from kernel/inc/mm/page_map.h rename to inc/mm/page_map.h diff --git a/kernel/inc/mm/region.h b/inc/mm/region.h similarity index 100% rename from kernel/inc/mm/region.h rename to inc/mm/region.h diff --git a/kernel/inc/mm/stack.h b/inc/mm/stack.h similarity index 100% rename from kernel/inc/mm/stack.h rename to inc/mm/stack.h diff --git a/kernel/inc/platform/cpu.h b/inc/platform/cpu.h similarity index 100% rename from kernel/inc/platform/cpu.h rename to inc/platform/cpu.h diff --git a/kernel/inc/platform/exceptions.h b/inc/platform/exceptions.h similarity index 100% rename from kernel/inc/platform/exceptions.h rename to inc/platform/exceptions.h diff --git a/kernel/inc/platform/gdt.h b/inc/platform/gdt.h similarity index 100% rename from kernel/inc/platform/gdt.h rename to inc/platform/gdt.h diff --git a/kernel/inc/platform/interrupts.h b/inc/platform/interrupts.h similarity index 100% rename from kernel/inc/platform/interrupts.h rename to inc/platform/interrupts.h diff --git a/kernel/inc/platform/syscall.h b/inc/platform/syscall.h similarity index 100% rename from kernel/inc/platform/syscall.h rename to inc/platform/syscall.h diff --git a/kernel/inc/proc/file_descriptor.h b/inc/proc/file_descriptor.h similarity index 100% rename from kernel/inc/proc/file_descriptor.h rename to inc/proc/file_descriptor.h diff --git a/kernel/inc/proc/process.h b/inc/proc/process.h similarity index 100% rename from kernel/inc/proc/process.h rename to inc/proc/process.h diff --git a/kernel/inc/proc/scheduler.h b/inc/proc/scheduler.h similarity index 100% rename from kernel/inc/proc/scheduler.h rename to inc/proc/scheduler.h diff --git a/kernel/inc/proc/thread.h b/inc/proc/thread.h similarity index 100% rename from kernel/inc/proc/thread.h rename to inc/proc/thread.h diff --git a/kernel/inc/utils/bitmap.h b/inc/utils/bitmap.h similarity index 100% rename from kernel/inc/utils/bitmap.h rename to inc/utils/bitmap.h diff --git a/kernel/inc/utils/core.h b/inc/utils/core.h similarity index 100% rename from kernel/inc/utils/core.h rename to inc/utils/core.h diff --git a/kernel/inc/utils/io.h b/inc/utils/io.h similarity index 100% rename from kernel/inc/utils/io.h rename to inc/utils/io.h diff --git a/kernel/inc/utils/logger.h b/inc/utils/logger.h similarity index 100% rename from kernel/inc/utils/logger.h rename to inc/utils/logger.h diff --git a/kernel/inc/utils/math.h b/inc/utils/math.h similarity index 100% rename from kernel/inc/utils/math.h rename to inc/utils/math.h diff --git a/kernel/inc/utils/memory.h b/inc/utils/memory.h similarity index 100% rename from kernel/inc/utils/memory.h rename to inc/utils/memory.h diff --git a/kernel/inc/utils/panic.h b/inc/utils/panic.h similarity index 100% rename from kernel/inc/utils/panic.h rename to inc/utils/panic.h diff --git a/kernel/inc/utils/status.h b/inc/utils/status.h similarity index 100% rename from kernel/inc/utils/status.h rename to inc/utils/status.h diff --git a/kernel/inc/utils/stdtypes.h b/inc/utils/stdtypes.h similarity index 100% rename from kernel/inc/utils/stdtypes.h rename to inc/utils/stdtypes.h diff --git a/kernel/inc/utils/stream.h b/inc/utils/stream.h similarity index 100% rename from kernel/inc/utils/stream.h rename to inc/utils/stream.h diff --git a/kernel/inc/utils/string.h b/inc/utils/string.h similarity index 100% rename from kernel/inc/utils/string.h rename to inc/utils/string.h diff --git a/kernel/inc/utils/symbol.h b/inc/utils/symbol.h similarity index 100% rename from kernel/inc/utils/symbol.h rename to inc/utils/symbol.h diff --git a/kernel/kernel.ld b/kernel.ld similarity index 100% rename from kernel/kernel.ld rename to kernel.ld diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt deleted file mode 100644 index 669f967..0000000 --- a/kernel/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -set(C 99) - -set(CMAKE_NASM_COMPILE_OBJECT "nasm -o ") - - -add_executable(kernel) -add_library (kernel_asm OBJECT) -target_include_directories(kernel PRIVATE inc) -file(GLOB_RECURSE kernel_src_c "**/*.c") -file(GLOB_RECURSE kernel_inc "**/*.h") -file(GLOB_RECURSE kernel_src_asm "**/*.asm") - - -target_compile_options(kernel PRIVATE -g -fno-stack-protector -fno-stack-check -mno-red-zone -ffreestanding -m64 -march=x86-64 -mabi=sysv) -target_link_options(kernel PRIVATE -nostdlib -static -T "${CMAKE_CURRENT_LIST_DIR}/kernel.ld") - -enable_language(ASM_NASM) -set(CAN_USE_ASSEMBLER TRUE) - -target_sources(kernel_asm PRIVATE ${kernel_src_asm}) -target_sources(kernel PRIVATE ${kernel_src_c} ${kernel_inc} $) - - diff --git a/kernel/src/kmain.c b/src/boot/kmain.c similarity index 56% rename from kernel/src/kmain.c rename to src/boot/kmain.c index d4ed1ab..6e2d21e 100644 --- a/kernel/src/kmain.c +++ b/src/boot/kmain.c @@ -58,23 +58,6 @@ void kmain(boot_info_T boot_info) { log(LOG_INFO, "!=====[ Kernel Initialized ]=====!\n"); - log(LOG_DEBUG, "0x0000080000000000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000000000)); - log(LOG_DEBUG, "0x0000080000001000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000001000)); - log(LOG_DEBUG, "0x0000080000002000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000002000)); - log(LOG_DEBUG, "0x0000080000003000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000003000)); - syscall_perform(SYSCALL_MEMORY_MAP, 0x0000080000000000, 4, 0, 0); - log(LOG_DEBUG, "performed 'nx_mmap'"); - log(LOG_DEBUG, "0x0000080000000000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000000000)); - log(LOG_DEBUG, "0x0000080000001000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000001000)); - log(LOG_DEBUG, "0x0000080000002000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000002000)); - log(LOG_DEBUG, "0x0000080000003000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000003000)); - syscall_perform(SYSCALL_MEMORY_UNMAP, 0x0000080000000000, 4, 0, 0); - log(LOG_DEBUG, "performed 'nx_munmap'"); - log(LOG_DEBUG, "0x0000080000000000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000000000)); - log(LOG_DEBUG, "0x0000080000001000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000001000)); - log(LOG_DEBUG, "0x0000080000002000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000002000)); - log(LOG_DEBUG, "0x0000080000003000 --[check]--> %?", page_map_check_memory(g_kernel_page_map, 0x0000080000003000)); - // vfs_node_T* node = vfs_resolve_path(&g_root_fs, "/initrd/test.elf"); // void* buffer = memory_allocate(node->size); // vfs_file_read(node, 0, node->size, buffer); diff --git a/kernel/src/boot/limine.c b/src/boot/limine.c similarity index 100% rename from kernel/src/boot/limine.c rename to src/boot/limine.c diff --git a/kernel/src/drivers/acpi/acpi.c b/src/drivers/acpi/acpi.c similarity index 100% rename from kernel/src/drivers/acpi/acpi.c rename to src/drivers/acpi/acpi.c diff --git a/kernel/src/drivers/acpi/rsdp.c b/src/drivers/acpi/rsdp.c similarity index 100% rename from kernel/src/drivers/acpi/rsdp.c rename to src/drivers/acpi/rsdp.c diff --git a/kernel/src/drivers/elf/elf.c b/src/drivers/elf/elf.c similarity index 100% rename from kernel/src/drivers/elf/elf.c rename to src/drivers/elf/elf.c diff --git a/kernel/src/drivers/elf/header.c b/src/drivers/elf/header.c similarity index 100% rename from kernel/src/drivers/elf/header.c rename to src/drivers/elf/header.c diff --git a/kernel/src/drivers/elf/mapping.c b/src/drivers/elf/mapping.c similarity index 100% rename from kernel/src/drivers/elf/mapping.c rename to src/drivers/elf/mapping.c diff --git a/kernel/src/drivers/elf/section.c b/src/drivers/elf/section.c similarity index 100% rename from kernel/src/drivers/elf/section.c rename to src/drivers/elf/section.c diff --git a/kernel/src/drivers/elf/segment.c b/src/drivers/elf/segment.c similarity index 100% rename from kernel/src/drivers/elf/segment.c rename to src/drivers/elf/segment.c diff --git a/kernel/src/drivers/elf/symbol.c b/src/drivers/elf/symbol.c similarity index 100% rename from kernel/src/drivers/elf/symbol.c rename to src/drivers/elf/symbol.c diff --git a/kernel/src/drivers/fs/ramfs.c b/src/drivers/fs/ramfs.c similarity index 100% rename from kernel/src/drivers/fs/ramfs.c rename to src/drivers/fs/ramfs.c diff --git a/kernel/src/drivers/fs/vfs.c b/src/drivers/fs/vfs.c similarity index 100% rename from kernel/src/drivers/fs/vfs.c rename to src/drivers/fs/vfs.c diff --git a/kernel/src/drivers/graphics/color.c b/src/drivers/graphics/color.c similarity index 100% rename from kernel/src/drivers/graphics/color.c rename to src/drivers/graphics/color.c diff --git a/kernel/src/drivers/graphics/font.c b/src/drivers/graphics/font.c similarity index 100% rename from kernel/src/drivers/graphics/font.c rename to src/drivers/graphics/font.c diff --git a/kernel/src/drivers/graphics/renderer.c b/src/drivers/graphics/renderer.c similarity index 100% rename from kernel/src/drivers/graphics/renderer.c rename to src/drivers/graphics/renderer.c diff --git a/kernel/src/drivers/time/pit.c b/src/drivers/time/pit.c similarity index 100% rename from kernel/src/drivers/time/pit.c rename to src/drivers/time/pit.c diff --git a/kernel/src/mm/heap.c b/src/mm/heap.c similarity index 100% rename from kernel/src/mm/heap.c rename to src/mm/heap.c diff --git a/kernel/src/mm/memory_map.c b/src/mm/memory_map.c similarity index 100% rename from kernel/src/mm/memory_map.c rename to src/mm/memory_map.c diff --git a/kernel/src/mm/page_frame.c b/src/mm/page_frame.c similarity index 100% rename from kernel/src/mm/page_frame.c rename to src/mm/page_frame.c diff --git a/kernel/src/mm/page_map.c b/src/mm/page_map.c similarity index 100% rename from kernel/src/mm/page_map.c rename to src/mm/page_map.c diff --git a/kernel/src/mm/stack.c b/src/mm/stack.c similarity index 100% rename from kernel/src/mm/stack.c rename to src/mm/stack.c diff --git a/kernel/src/platform/exceptions.c b/src/platform/exceptions.c similarity index 100% rename from kernel/src/platform/exceptions.c rename to src/platform/exceptions.c diff --git a/kernel/src/platform/gdt.c b/src/platform/gdt.c similarity index 100% rename from kernel/src/platform/gdt.c rename to src/platform/gdt.c diff --git a/kernel/src/platform/interrupts.c b/src/platform/interrupts.c similarity index 100% rename from kernel/src/platform/interrupts.c rename to src/platform/interrupts.c diff --git a/kernel/src/platform/syscall.c b/src/platform/syscall.c similarity index 100% rename from kernel/src/platform/syscall.c rename to src/platform/syscall.c diff --git a/kernel/src/platform/x86/gdt.asm b/src/platform/x86/gdt.asm similarity index 100% rename from kernel/src/platform/x86/gdt.asm rename to src/platform/x86/gdt.asm diff --git a/kernel/src/platform/x86/interrupts.asm b/src/platform/x86/interrupts.asm similarity index 100% rename from kernel/src/platform/x86/interrupts.asm rename to src/platform/x86/interrupts.asm diff --git a/kernel/src/platform/x86/paging.asm b/src/platform/x86/paging.asm similarity index 100% rename from kernel/src/platform/x86/paging.asm rename to src/platform/x86/paging.asm diff --git a/kernel/src/platform/x86/syscall.asm b/src/platform/x86/syscall.asm similarity index 100% rename from kernel/src/platform/x86/syscall.asm rename to src/platform/x86/syscall.asm diff --git a/kernel/src/proc/file_descriptor.c b/src/proc/file_descriptor.c similarity index 100% rename from kernel/src/proc/file_descriptor.c rename to src/proc/file_descriptor.c diff --git a/kernel/src/proc/process.c b/src/proc/process.c similarity index 100% rename from kernel/src/proc/process.c rename to src/proc/process.c diff --git a/kernel/src/proc/scheduler.c b/src/proc/scheduler.c similarity index 100% rename from kernel/src/proc/scheduler.c rename to src/proc/scheduler.c diff --git a/kernel/src/proc/thread.c b/src/proc/thread.c similarity index 100% rename from kernel/src/proc/thread.c rename to src/proc/thread.c diff --git a/kernel/src/utils/bitmap.c b/src/utils/bitmap.c similarity index 100% rename from kernel/src/utils/bitmap.c rename to src/utils/bitmap.c diff --git a/kernel/src/utils/io.c b/src/utils/io.c similarity index 100% rename from kernel/src/utils/io.c rename to src/utils/io.c diff --git a/kernel/src/utils/logger.c b/src/utils/logger.c similarity index 100% rename from kernel/src/utils/logger.c rename to src/utils/logger.c diff --git a/kernel/src/utils/math.c b/src/utils/math.c similarity index 100% rename from kernel/src/utils/math.c rename to src/utils/math.c diff --git a/kernel/src/utils/memory.c b/src/utils/memory.c similarity index 100% rename from kernel/src/utils/memory.c rename to src/utils/memory.c diff --git a/kernel/src/utils/panic.c b/src/utils/panic.c similarity index 100% rename from kernel/src/utils/panic.c rename to src/utils/panic.c diff --git a/kernel/src/utils/status.c b/src/utils/status.c similarity index 100% rename from kernel/src/utils/status.c rename to src/utils/status.c diff --git a/kernel/src/utils/stream.c b/src/utils/stream.c similarity index 100% rename from kernel/src/utils/stream.c rename to src/utils/stream.c diff --git a/kernel/src/utils/string.c b/src/utils/string.c similarity index 100% rename from kernel/src/utils/string.c rename to src/utils/string.c diff --git a/kernel/src/utils/symbol.c b/src/utils/symbol.c similarity index 100% rename from kernel/src/utils/symbol.c rename to src/utils/symbol.c