aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include/x86_64/boot/ld.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/include/x86_64/boot/ld.hpp')
-rw-r--r--arch/x86_64/include/x86_64/boot/ld.hpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/x86_64/include/x86_64/boot/ld.hpp b/arch/x86_64/include/x86_64/boot/ld.hpp
new file mode 100644
index 0000000..b073863
--- /dev/null
+++ b/arch/x86_64/include/x86_64/boot/ld.hpp
@@ -0,0 +1,61 @@
+//! @file
+//! The interface to linker script defined symbols.
+//!
+//! This header provides declarations for symbols that are defined in the linker script itself. The symbols declared
+//! here provide important information, for example the start and end of the kernel image in virtual and physical
+//! memory.
+//!
+//! Any variables defined in this file must not be read themselves, but rather their address shall be taken, yielding a
+//! pointer to the memory location the represent.
+//!
+//! @note The symbols declared in this header are declared using C-language linkage in order to suppress name mangling.
+//!
+//! @see arch/x86_64/scripts/kernel.ld
+
+#ifndef TEACHOS_X86_64_BOOT_LD_HPP
+#define TEACHOS_X86_64_BOOT_LD_HPP
+
+#include <cstddef>
+
+namespace teachos::boot::x86_64
+{
+
+ extern "C"
+ {
+ //! The beginning of the kernel image in physical memory
+ //!
+ //! This symbol marks the start of the kernel image in physical memory.
+ //!
+ //! @see _end_physical
+ extern std::byte _start_physical;
+
+ //! The first byte after the loaded kernel image.
+ //!
+ //! This symbol marks the end of the kernel image in physical memory.
+ //!
+ //! @see _start_physical
+ extern std::byte _end_physical;
+
+ //! The first byte of the loaded kernel image in the virtual address space.
+ //!
+ //! This symbol and marks the start of the kernel image in virtual memory.
+ //!
+ //! @see _end_virtual
+ extern std::byte _start_virtual;
+
+ //! The first byte after the loaded kernel image in the virtual address space.
+ //!
+ //! This symbol marks the end of the kernel image in virtual memory.
+ //!
+ //! @see _start_virtual
+ extern std::byte _end_virtual;
+
+ //! The first byte of the kernel's virtual address space.
+ //!
+ //! This symbol marks beginning of the kernel virtual address space.
+ extern std::byte TEACHOS_VMA;
+ }
+
+} // namespace teachos::boot::x86_64
+
+#endif