diff options
Diffstat (limited to 'source/kernel/arch/x86_64')
| -rw-r--r-- | source/kernel/arch/x86_64/CMakeLists.txt | 58 | ||||
| -rw-r--r-- | source/kernel/arch/x86_64/include/kernel/vga.hpp | 11 | ||||
| -rw-r--r-- | source/kernel/arch/x86_64/kern.ld | 139 | ||||
| -rw-r--r-- | source/kernel/arch/x86_64/src/entry.cpp | 9 | ||||
| -rw-r--r-- | source/kernel/arch/x86_64/src/vga.cpp | 29 | ||||
| -rw-r--r-- | source/kernel/arch/x86_64/support/grub.cfg.in | 7 |
6 files changed, 0 insertions, 253 deletions
diff --git a/source/kernel/arch/x86_64/CMakeLists.txt b/source/kernel/arch/x86_64/CMakeLists.txt deleted file mode 100644 index ffce50c..0000000 --- a/source/kernel/arch/x86_64/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -#[============================================================================[ -# x86_64 specific configuration for the kernel image. -#]============================================================================] - -set(TEACHOS_KERNEL_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/kern.ld") -mark_as_advanced(TEACHOS_KERNEL_LINKER_SCRIPT) - -target_sources("kernel" PRIVATE - "src/entry.cpp" - "src/vga.cpp" -) - -target_include_directories("kernel" PRIVATE - "include" -) - -target_link_options("kernel" PRIVATE - "-T${TEACHOS_KERNEL_LINKER_SCRIPT}" -) - -target_link_libraries("kernel" PRIVATE - "-Wl,--whole-archive" - "teachos::boot" - "-Wl,--no-whole-archive" -) - -set_target_properties("kernel" PROPERTIES - LINK_DEPENDS "${TEACHOS_KERNEL_LINKER_SCRIPT}" -) - -#[============================================================================[ -# Bootable ISO image generation -#]============================================================================] - -find_package("grub-mkrescue") - -if(grub-mkrescue_FOUND) - set(ISO_FILE "${PROJECT_BINARY_DIR}/teachos.iso") - - file(GENERATE - OUTPUT "isofs/boot/grub/grub.cfg" - INPUT "support/grub.cfg.in" - ) - - add_custom_target("bootable-iso" - COMMAND "${GRUB_MKRESCUE_EXE}" - "-o" - "${ISO_FILE}" - "${CMAKE_CURRENT_BINARY_DIR}/isofs" - "$<TARGET_FILE:kernel>" - "2>/dev/null" - DEPENDS - "$<TARGET_FILE:kernel>" - "isofs/boot/grub/grub.cfg" - BYPRODUCTS "${ISO_FILE}" - COMMENT "Creating bootable ISO image" - ) -endif()
\ No newline at end of file diff --git a/source/kernel/arch/x86_64/include/kernel/vga.hpp b/source/kernel/arch/x86_64/include/kernel/vga.hpp deleted file mode 100644 index ee5a808..0000000 --- a/source/kernel/arch/x86_64/include/kernel/vga.hpp +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef TEACHOS_KERNEL_VGA_HPP -#define TEACHOS_KERNEL_VGA_HPP - -#include <string_view> - -namespace teachos::kernel::vga -{ - auto write(std::string_view text, std::byte color) -> void; -} - -#endif
\ No newline at end of file diff --git a/source/kernel/arch/x86_64/kern.ld b/source/kernel/arch/x86_64/kern.ld deleted file mode 100644 index 78cc363..0000000 --- a/source/kernel/arch/x86_64/kern.ld +++ /dev/null @@ -1,139 +0,0 @@ -ENTRY(_start) - -/***************************************************************************** - * Virtual and linear start addresses of the TeachOS kernel - *****************************************************************************/ -TEACHOS_HIGH = -2048M; -TEACHOS_LOW = 1M; - -PHDRS { - boot_rodata PT_LOAD FLAGS(4); - boot_text PT_LOAD FLAGS(5); - boot_data PT_LOAD FLAGS(6); - - text PT_LOAD FLAGS(5); - data PT_LOAD FLAGS(6); - rodata PT_LOAD FLAGS(4); -} - -SECTIONS -{ - /*************************************************************************** - * Load the bootstrap code into low memory. We need to be accessible in - * 32-Bit mode, so we want to live down low, but we need to leave the 1MiB - * hole open since some BIOS functionality resides below it. - ***************************************************************************/ - . = TEACHOS_LOW; - - /*************************************************************************** - * We want to be able to be able to access all memory (linear and virtual) - * during bootstrapping and operation. To achieve this, we define some - * symbols at the beginning. - ***************************************************************************/ - _start_linear = .; - _start_virtual = . + TEACHOS_HIGH; - - /*************************************************************************** - * The bootstrapping infratructure goes first. We first place the read-only - * data, followed by our code, initialized mutable data, and finally our - * uninitialized mutable data. - ***************************************************************************/ - .boot_rodata : - { - KEEP(*(.boot_mbh)) - *(.boot_rodata) - } :boot_rodata - - .boot_text : - { - *(.boot_text) - } :boot_text - - .boot_data : - { - *(.boot_data) - } :boot_data - - .boot_bss : - { - *(.boot_bss) - *(.boot_stack) - } - - /*************************************************************************** - * Now it is time to load the 64-bit kernel code. We virtually load it into - * the upper 2GiB, while adjusting the linear load address appropriately. We - * also make sure to align the loaded data onto a page boundary. - ***************************************************************************/ - . = ALIGN(4K); - . += TEACHOS_HIGH; - - .init ALIGN(4K) : AT(ADDR (.init) - TEACHOS_HIGH) - { - /* - * Make sure that the crt code is wrapped around the compiler generated - * initialization code. - */ - KEEP(*:crti.s.obj(.init)) - KEEP(*(EXCLUDE_FILE (*crti.s.obj crtn.s.obj) .init)) - KEEP(*:crtn.s.obj(.init)) - } :text - - .fini ALIGN(4K) : AT(ADDR (.fini) - TEACHOS_HIGH) - { - /* - * Make sure that the crt code is wrapped around the compiler generated - * finalizer code. - */ - KEEP(*:crti.s.obj(.fini)) - KEEP(*(EXCLUDE_FILE (*crti.s.obj crtn.s.obj).fini)) - KEEP(*:crtn.s.obj(.fini)) - } - - .text ALIGN(4K) : AT(ADDR (.text) - TEACHOS_HIGH) - { - *(.text*) - } - - .rodata ALIGN(4K) : AT (ADDR (.rodata) - TEACHOS_HIGH) - { - *(.rodata) - *(.rodata.*) - } :rodata - - .ctors ALIGN(4K) : AT (ADDR (.ctors) - TEACHOS_HIGH) - { - KEEP(*crtbegin.o(.ctors)) - KEEP(*(EXCLUDE_FILE (*crtend.o) .ctors)) - KEEP(*(SORT(.ctors.*))) - KEEP(*crtend.o(.ctors)) - } :data - - .dtors ALIGN(4K) : AT (ADDR (.dtors) - TEACHOS_HIGH) - { - KEEP(*crtbegin.o(.dtors)) - KEEP(*(EXCLUDE_FILE (*crtend.o) .dtors)) - KEEP(*(SORT(.dtors.*))) - KEEP(*crtend.o(.dtors)) - } - - .data ALIGN(4K) : AT (ADDR (.data) - TEACHOS_HIGH) - { - *(.data*) - } - - .bss ALIGN(4K) : AT (ADDR (.bss) - TEACHOS_HIGH) - { - *(COMMON) - *(.bss*) - } - - /*************************************************************************** - * In accordance with the symbol definitions at the start, we generate some - * symbols to mark the end of our loaded image. - ***************************************************************************/ - _end_virtual = ADDR(.bss) + SIZEOF(.bss); - _end_linear = _end_virtual - TEACHOS_HIGH; - - /DISCARD/ : { *(.comment) } -} diff --git a/source/kernel/arch/x86_64/src/entry.cpp b/source/kernel/arch/x86_64/src/entry.cpp deleted file mode 100644 index fd9d9d0..0000000 --- a/source/kernel/arch/x86_64/src/entry.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "kernel/vga.hpp" - -namespace teachos::kernel -{ - extern "C" auto kernel_main() -> void - { - vga::write("TeachOS is starting up...", static_cast<std::byte>(0x4f)); - } -} // namespace teachos diff --git a/source/kernel/arch/x86_64/src/vga.cpp b/source/kernel/arch/x86_64/src/vga.cpp deleted file mode 100644 index efa2848..0000000 --- a/source/kernel/arch/x86_64/src/vga.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "kernel/vga.hpp" - -#include "boot/asm_pointer.hpp" -#include "boot/pointers.hpp" - -#include <algorithm> -#include <string_view> - -namespace teachos::kernel::vga -{ - - namespace - { - auto constinit text_buffer_pointer = boot::asm_pointer{boot::pointers::vga_buffer_pointer}; - - auto write(char character, std::byte color) -> void - { - auto & p = *text_buffer_pointer; - (*p++) = static_cast<std::byte>(character); - (*p++) = color; - }; - } // namespace - - auto write(std::string_view text, std::byte color) -> void - { - std::ranges::for_each(text, [&](auto character) { write(character, color); }); - } - -} // namespace teachos::kernel::vga
\ No newline at end of file diff --git a/source/kernel/arch/x86_64/support/grub.cfg.in b/source/kernel/arch/x86_64/support/grub.cfg.in deleted file mode 100644 index 49f19ce..0000000 --- a/source/kernel/arch/x86_64/support/grub.cfg.in +++ /dev/null @@ -1,7 +0,0 @@ -timeout=2 -default=0 - -menuentry "TeachOS" { - multiboot2 /$<TARGET_FILE_NAME:kernel> - boot -}
\ No newline at end of file |
