diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2025-07-14 16:25:00 +0000 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2025-07-14 16:25:00 +0000 |
| commit | ec572bff8150e2f8cd2dc99e053c5e8c8a0b99e3 (patch) | |
| tree | f66048c99b5015bf9cb7603b7be09c2a28d766ee /arch/x86_64/CMakeLists.txt | |
| parent | 25483b7af8df6b08d460f807fda04c6d409bd44e (diff) | |
| download | teachos-ec572bff8150e2f8cd2dc99e053c5e8c8a0b99e3.tar.xz teachos-ec572bff8150e2f8cd2dc99e053c5e8c8a0b99e3.zip | |
arch: prepare interfaces
Diffstat (limited to 'arch/x86_64/CMakeLists.txt')
| -rw-r--r-- | arch/x86_64/CMakeLists.txt | 314 |
1 files changed, 178 insertions, 136 deletions
diff --git a/arch/x86_64/CMakeLists.txt b/arch/x86_64/CMakeLists.txt index c8ff216..19bc78c 100644 --- a/arch/x86_64/CMakeLists.txt +++ b/arch/x86_64/CMakeLists.txt @@ -1,156 +1,198 @@ -#[============================================================================[ -# The Kernel Library -#]============================================================================] - -set(TEACHOS_KERNEL_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/kernel.ld") -mark_as_advanced(TEACHOS_KERNEL_LINKER_SCRIPT) - -target_sources("_kernel" PRIVATE - "src/kernel/main.cpp" - "src/kernel/cpu/control_register.cpp" - "src/kernel/cpu/gdtr.cpp" - "src/kernel/cpu/idtr.cpp" - "src/kernel/cpu/if.cpp" - "src/kernel/cpu/call.cpp" - "src/kernel/cpu/msr.cpp" - "src/kernel/cpu/segment_register.cpp" - "src/kernel/cpu/tlb.cpp" - "src/kernel/cpu/tr.cpp" -) - -target_link_options("_kernel" PRIVATE - "-T${TEACHOS_KERNEL_LINKER_SCRIPT}" -) - -set_target_properties("_kernel" PROPERTIES - LINK_DEPENDS "${TEACHOS_KERNEL_LINKER_SCRIPT}" -) +add_library("arch-x86_64" OBJECT) +add_library("arch::x86_64" ALIAS "arch-x86_64") -#[============================================================================[ -# The Bootstrap Library -#]============================================================================] - -target_sources("_boot" PRIVATE - "src/boot/boot.s" - "src/boot/crti.s" - "src/boot/crtn.s" - "src/boot/multiboot.s" +target_include_directories("arch-x86_64" PUBLIC + "include" ) -#[============================================================================[ -# The Video Library -#]============================================================================] +target_link_libraries("arch-x86_64" PUBLIC + "kern" -target_sources("_video" PRIVATE - "src/video/vga/text.cpp" + "libs::multiboot2" ) -#[============================================================================[ -# The Memory Library -#]============================================================================] - -target_sources("_memory" PRIVATE - "src/memory/main.cpp" - "src/memory/multiboot/elf_symbols_section.cpp" - "src/memory/multiboot/reader.cpp" - "src/memory/allocator/area_frame_allocator.cpp" - "src/memory/allocator/tiny_frame_allocator.cpp" - "src/memory/allocator/physical_frame.cpp" - "src/memory/paging/page_entry.cpp" - "src/memory/paging/page_table.cpp" - "src/memory/paging/temporary_page.cpp" - "src/memory/paging/virtual_page.cpp" - "src/memory/paging/active_page_table.cpp" - "src/memory/paging/inactive_page_table.cpp" - "src/memory/heap/bump_allocator.cpp" - "src/memory/heap/user_heap_allocator.cpp" - "src/memory/heap/memory_block.cpp" - "src/memory/heap/linked_list_allocator.cpp" - "src/memory/heap/global_heap_allocator.cpp" +target_link_options("arch-x86_64" PUBLIC + "-T${CMAKE_CURRENT_SOURCE_DIR}/scripts/kernel.ld" ) -target_link_libraries("_memory" PUBLIC - "libs::kstd" - "libs::multiboot2" +set_target_properties("arch-x86_64" PROPERTIES + LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/kernel.ld" ) #[============================================================================[ -# The Exception handling Library +# arch::any Implementation #]============================================================================] -target_sources("_exception" PRIVATE - "src/exception_handling/assert.cpp" - "src/exception_handling/abort.cpp" - "src/exception_handling/panic.cpp" - "src/exception_handling/pure_virtual.cpp" +target_sources("arch-x86_64" PRIVATE + "src/io.cpp" + "src/memory.cpp" + "src/system.cpp" ) #[============================================================================[ -# The Context switching Library +# Bootstrap Code #]============================================================================] -target_sources("_context" PRIVATE - "src/context_switching/segment_descriptor_table/access_byte.cpp" - "src/context_switching/segment_descriptor_table/gdt_flags.cpp" - "src/context_switching/segment_descriptor_table/global_descriptor_table_pointer.cpp" - "src/context_switching/segment_descriptor_table/global_descriptor_table.cpp" - "src/context_switching/segment_descriptor_table/segment_descriptor_base.cpp" - "src/context_switching/segment_descriptor_table/segment_descriptor_extension.cpp" - "src/context_switching/main.cpp" - "src/context_switching/syscall/main.cpp" - "src/context_switching/syscall/syscall_enable.cpp" - "src/context_switching/syscall/syscall_handler.cpp" - "src/context_switching/interrupt_descriptor_table/gate_descriptor.cpp" - "src/context_switching/interrupt_descriptor_table/idt_flags.cpp" - "src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table_pointer.cpp" - "src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp" - "src/context_switching/interrupt_descriptor_table/ist_offset.cpp" - "src/context_switching/interrupt_descriptor_table/segment_selector.cpp" +target_sources("arch-x86_64" PRIVATE + "src/boot/boot.s" + "src/boot/crti.s" + "src/boot/crtn.s" + "src/boot/multiboot.s" ) -target_link_libraries("_context" PUBLIC - "libs::kstd" -) - -#[============================================================================[ -# The Interrupt Handlers -#]============================================================================] - -target_sources("_interrupt_handling" PRIVATE - "src/interrupt_handling/generic_interrupt_handler.cpp" -) - -#[============================================================================[ -# The User code -#]============================================================================] - -target_sources("_context" PRIVATE - "src/user/main.cpp" -) - -#[============================================================================[ -# The Bootable ISO Image -#]============================================================================] - -find_package("grub-mkrescue") - -if(grub-mkrescue_FOUND) - file(GENERATE - OUTPUT "isofs/boot/grub/grub.cfg" - INPUT "support/grub.cfg.in" - ) - - add_custom_target("bootable-iso" - COMMAND "${GRUB_MKRESCUE_EXE}" - "-o" - "${PROJECT_BINARY_DIR}/teachos-$<CONFIGURATION>.iso" - "${CMAKE_CURRENT_BINARY_DIR}/isofs" - "$<TARGET_FILE:teachos::kernel>" - "2>/dev/null" - DEPENDS - "$<TARGET_FILE:teachos::kernel>" - "isofs/boot/grub/grub.cfg" - BYPRODUCTS "${PROJECT_BINARY_DIR}/teachos-$<CONFIGURATION>.iso" - COMMENT "Creating bootable ISO image" - ) -endif() +# #[============================================================================[ +# # The Kernel Library +# #]============================================================================] + +# set(TEACHOS_KERNEL_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/kernel.ld") +# mark_as_advanced(TEACHOS_KERNEL_LINKER_SCRIPT) + +# target_sources("_kernel" PRIVATE +# "src/kernel/main.cpp" +# "src/kernel/cpu/control_register.cpp" +# "src/kernel/cpu/gdtr.cpp" +# "src/kernel/cpu/idtr.cpp" +# "src/kernel/cpu/if.cpp" +# "src/kernel/cpu/call.cpp" +# "src/kernel/cpu/msr.cpp" +# "src/kernel/cpu/segment_register.cpp" +# "src/kernel/cpu/tlb.cpp" +# "src/kernel/cpu/tr.cpp" +# ) + +# target_link_options("_kernel" PRIVATE +# "-T${TEACHOS_KERNEL_LINKER_SCRIPT}" +# ) + +# set_target_properties("_kernel" PROPERTIES +# LINK_DEPENDS "${TEACHOS_KERNEL_LINKER_SCRIPT}" +# ) + +# #[============================================================================[ +# # The Bootstrap Library +# #]============================================================================] + +# target_sources("_boot" PRIVATE +# "src/boot/boot.s" +# "src/boot/crti.s" +# "src/boot/crtn.s" +# "src/boot/multiboot.s" +# ) + +# #[============================================================================[ +# # The Video Library +# #]============================================================================] + +# target_sources("_video" PRIVATE +# "src/video/vga/text.cpp" +# ) + +# #[============================================================================[ +# # The Memory Library +# #]============================================================================] + +# target_sources("_memory" PRIVATE +# "src/memory/main.cpp" +# "src/memory/multiboot/elf_symbols_section.cpp" +# "src/memory/multiboot/reader.cpp" +# "src/memory/allocator/area_frame_allocator.cpp" +# "src/memory/allocator/tiny_frame_allocator.cpp" +# "src/memory/allocator/physical_frame.cpp" +# "src/memory/paging/page_entry.cpp" +# "src/memory/paging/page_table.cpp" +# "src/memory/paging/temporary_page.cpp" +# "src/memory/paging/virtual_page.cpp" +# "src/memory/paging/active_page_table.cpp" +# "src/memory/paging/inactive_page_table.cpp" +# "src/memory/heap/bump_allocator.cpp" +# "src/memory/heap/user_heap_allocator.cpp" +# "src/memory/heap/memory_block.cpp" +# "src/memory/heap/linked_list_allocator.cpp" +# "src/memory/heap/global_heap_allocator.cpp" +# ) + +# target_link_libraries("_memory" PUBLIC +# "libs::kstd" +# "libs::multiboot2" +# ) + +# #[============================================================================[ +# # The Exception handling Library +# #]============================================================================] + +# target_sources("_exception" PRIVATE +# "src/exception_handling/assert.cpp" +# "src/exception_handling/abort.cpp" +# "src/exception_handling/panic.cpp" +# "src/exception_handling/pure_virtual.cpp" +# ) + +# #[============================================================================[ +# # The Context switching Library +# #]============================================================================] + +# target_sources("_context" PRIVATE +# "src/context_switching/segment_descriptor_table/access_byte.cpp" +# "src/context_switching/segment_descriptor_table/gdt_flags.cpp" +# "src/context_switching/segment_descriptor_table/global_descriptor_table_pointer.cpp" +# "src/context_switching/segment_descriptor_table/global_descriptor_table.cpp" +# "src/context_switching/segment_descriptor_table/segment_descriptor_base.cpp" +# "src/context_switching/segment_descriptor_table/segment_descriptor_extension.cpp" +# "src/context_switching/main.cpp" +# "src/context_switching/syscall/main.cpp" +# "src/context_switching/syscall/syscall_enable.cpp" +# "src/context_switching/syscall/syscall_handler.cpp" +# "src/context_switching/interrupt_descriptor_table/gate_descriptor.cpp" +# "src/context_switching/interrupt_descriptor_table/idt_flags.cpp" +# "src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table_pointer.cpp" +# "src/context_switching/interrupt_descriptor_table/interrupt_descriptor_table.cpp" +# "src/context_switching/interrupt_descriptor_table/ist_offset.cpp" +# "src/context_switching/interrupt_descriptor_table/segment_selector.cpp" +# ) + +# target_link_libraries("_context" PUBLIC +# "libs::kstd" +# ) + +# #[============================================================================[ +# # The Interrupt Handlers +# #]============================================================================] + +# target_sources("_interrupt_handling" PRIVATE +# "src/interrupt_handling/generic_interrupt_handler.cpp" +# ) + +# #[============================================================================[ +# # The User code +# #]============================================================================] + +# target_sources("_context" PRIVATE +# "src/user/main.cpp" +# ) + +# #[============================================================================[ +# # The Bootable ISO Image +# #]============================================================================] + +# find_package("grub-mkrescue") + +# if(grub-mkrescue_FOUND) +# file(GENERATE +# OUTPUT "isofs/boot/grub/grub.cfg" +# INPUT "support/grub.cfg.in" +# ) + +# add_custom_target("bootable-iso" +# COMMAND "${GRUB_MKRESCUE_EXE}" +# "-o" +# "${PROJECT_BINARY_DIR}/teachos-$<CONFIGURATION>.iso" +# "${CMAKE_CURRENT_BINARY_DIR}/isofs" +# "$<TARGET_FILE:teachos::kernel>" +# "2>/dev/null" +# DEPENDS +# "$<TARGET_FILE:teachos::kernel>" +# "isofs/boot/grub/grub.cfg" +# BYPRODUCTS "${PROJECT_BINARY_DIR}/teachos-$<CONFIGURATION>.iso" +# COMMENT "Creating bootable ISO image" +# ) +# endif() |
