aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/video
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-12-15 17:13:12 +0100
committerFelix Morgner <felix.morgner@ost.ch>2025-12-15 17:13:12 +0100
commit7b9482ae637126ac9337876e60f519b493437711 (patch)
tree6fc71a253c8b0325d303bd34c95b564ba536ed14 /arch/x86_64/src/video
parent116f9332a206767c45095950f09f7c7447b561cf (diff)
parenta9eeec745e29d89afd48ee43d09432eb6fc35be7 (diff)
downloadteachos-7b9482ae637126ac9337876e60f519b493437711.tar.xz
teachos-7b9482ae637126ac9337876e60f519b493437711.zip
os: rework kernel architecture
Rework the code structure and architecture of the kernel by separating platform-dependent and platform-independent code more cleanly. As of this patchset, full feature parity has not been achieved. Nonetheless, a sufficient subset of functionality has been ported to the new architecture to demonstrate the feasibility of the new structure.
Diffstat (limited to 'arch/x86_64/src/video')
-rw-r--r--arch/x86_64/src/video/vga/text.cpp66
1 files changed, 0 insertions, 66 deletions
diff --git a/arch/x86_64/src/video/vga/text.cpp b/arch/x86_64/src/video/vga/text.cpp
deleted file mode 100644
index b070a0a..0000000
--- a/arch/x86_64/src/video/vga/text.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "arch/video/vga/text.hpp"
-
-#include "arch/video/vga/io.hpp"
-#include "memory/asm_pointer.hpp"
-
-#include <algorithm>
-#include <string_view>
-#include <utility>
-
-extern "C" std::pair<char, teachos::arch::video::vga::text::attribute> * vga_buffer_pointer;
-
-namespace teachos::arch::video::vga::text
-{
- namespace
- {
- auto constexpr DEFAULT_TEXT_BUFFER_WIDTH = 80U;
- auto constexpr DEFAULT_TEXT_BUFFER_HEIGHT = 25U;
-
- auto constinit text_buffer = teachos::memory::asm_pointer{vga_buffer_pointer};
- } // namespace
-
- auto clear(attribute attribute) -> void
- {
- *text_buffer = reinterpret_cast<decltype(text_buffer)::pointer>(DEFAULT_VGA_TEXT_BUFFER_ADDRESS);
- std::ranges::fill_n(*text_buffer, 2000, std::pair{' ', attribute});
- }
-
- auto cursor(bool enabled) -> void
- {
- auto cursor_disable_byte = std::byte{!enabled} << 5;
-
- crtc::address_port::write(crtc::registers::cursor_start);
- crtc::data_port::write(vga::crtc::data_port::read() | cursor_disable_byte);
- }
-
- auto newline() -> void
- {
- auto base = reinterpret_cast<decltype(text_buffer)::pointer>(DEFAULT_VGA_TEXT_BUFFER_ADDRESS);
- auto & raw_buffer = *text_buffer;
- auto current_line = (raw_buffer - base) / DEFAULT_TEXT_BUFFER_WIDTH;
- auto next_line = current_line + 1;
-
- if (next_line >= DEFAULT_TEXT_BUFFER_HEIGHT)
- {
- auto begin = base + DEFAULT_TEXT_BUFFER_WIDTH;
- auto end = base + DEFAULT_TEXT_BUFFER_WIDTH * DEFAULT_TEXT_BUFFER_HEIGHT;
- std::ranges::move(begin, end, base);
- raw_buffer = base + current_line * DEFAULT_TEXT_BUFFER_WIDTH;
- }
- else
- {
- raw_buffer = base + next_line * DEFAULT_TEXT_BUFFER_WIDTH;
- }
- }
-
- auto write_char(char code_point, attribute attribute) -> void
- {
- auto & p = *text_buffer;
- (*p++) = std::pair{code_point, attribute};
- };
-
- auto write(std::string_view code_points, attribute attribute) -> void
- {
- std::ranges::for_each(code_points, [&](auto code_point) { write_char(code_point, attribute); });
- }
-} // namespace teachos::arch::video::vga::text