aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/x86_64/boot/boot.hpp24
-rw-r--r--arch/x86_64/include/x86_64/boot/ld.hpp9
-rw-r--r--arch/x86_64/include/x86_64/vga/text.hpp11
3 files changed, 30 insertions, 14 deletions
diff --git a/arch/x86_64/include/x86_64/boot/boot.hpp b/arch/x86_64/include/x86_64/boot/boot.hpp
index 3a3620d..6dcd2de 100644
--- a/arch/x86_64/include/x86_64/boot/boot.hpp
+++ b/arch/x86_64/include/x86_64/boot/boot.hpp
@@ -45,26 +45,22 @@
/* clang-format on */
#else
+#include "kapi/boot.hpp" // IWYU pragma: export
+
#include <multiboot2/information.hpp>
-#include <kstd/asm_ptr>
+#include <cstddef>
-namespace teachos::boot::x86_64
+namespace teachos::boot
{
- extern "C"
+ struct information
{
- /**
- * @brief A pointer to the multiboot 2 information structure provided by the boot loader.
- */
- extern kstd::asm_ptr<multiboot2::information_view> multiboot_information_pointer;
-
- /**
- * @brief A pointer to the VGA text mode buffer.
- */
- extern kstd::asm_ptr<std::pair<char, std::byte>> vga_buffer_pointer;
- }
-} // namespace teachos::boot::x86_64
+ multiboot2::information_view const * mbi;
+ std::size_t vga_buffer_index;
+ };
+
+} // namespace teachos::boot
#endif
diff --git a/arch/x86_64/include/x86_64/boot/ld.hpp b/arch/x86_64/include/x86_64/boot/ld.hpp
index 104e6ee..9af3dc8 100644
--- a/arch/x86_64/include/x86_64/boot/ld.hpp
+++ b/arch/x86_64/include/x86_64/boot/ld.hpp
@@ -61,6 +61,15 @@ namespace teachos::boot::x86_64
* To use this symbol for its intended purpose, the address of it shall be taken.
*/
extern std::byte _end_virtual;
+
+ /**
+ * @brief The first byte of the kernel's virtual address space.
+ *
+ * @details
+ * This symbol is defined in the kernel linker script and marks beginning of the kernel virtual address space. To
+ * use this symbol for its intended purpose, the address of it shall be taken.
+ */
+ extern std::byte TEACHOS_VMA;
}
} // namespace teachos::boot::x86_64
diff --git a/arch/x86_64/include/x86_64/vga/text.hpp b/arch/x86_64/include/x86_64/vga/text.hpp
index d8919bf..bb593e7 100644
--- a/arch/x86_64/include/x86_64/vga/text.hpp
+++ b/arch/x86_64/include/x86_64/vga/text.hpp
@@ -4,6 +4,7 @@
#include "kapi/cio.hpp"
#include <cstdint>
+#include <span>
#include <string_view>
namespace teachos::vga::x86_64::text
@@ -100,6 +101,8 @@ namespace teachos::vga::x86_64::text
struct device final : teachos::cio::output_device
{
+ device();
+
/**
* @brief Clear the VGA text mode buffer.
*
@@ -134,6 +137,8 @@ namespace teachos::vga::x86_64::text
}
private:
+ using glyph = std::pair<char, std::byte>;
+
/**
* @brief Move the cursor to a new line, scrolling the buffer if necessary.
*/
@@ -150,6 +155,8 @@ namespace teachos::vga::x86_64::text
*/
auto write(std::string_view code_points, attribute attribute) -> void;
+ auto write(char code_point, attribute attribute) -> void;
+
/**
* @brief Write a string of code points followed by a newline to the VGA text buffer.
*
@@ -160,6 +167,10 @@ namespace teachos::vga::x86_64::text
* @see vga::text::attribute
*/
auto writeln(std::string_view code_points, attribute attribute) -> void;
+
+ std::span<glyph> static const buffer;
+
+ std::size_t m_position{};
};
} // namespace teachos::vga::x86_64::text