aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src')
-rw-r--r--arch/x86_64/src/memory/paging/page_entry.cpp2
-rw-r--r--arch/x86_64/src/video/vga/text.cpp21
2 files changed, 11 insertions, 12 deletions
diff --git a/arch/x86_64/src/memory/paging/page_entry.cpp b/arch/x86_64/src/memory/paging/page_entry.cpp
index f13e645..aae5013 100644
--- a/arch/x86_64/src/memory/paging/page_entry.cpp
+++ b/arch/x86_64/src/memory/paging/page_entry.cpp
@@ -55,5 +55,5 @@ namespace teachos::arch::memory::paging
flags = frame.start_address() | additional_flags.to_ulong();
}
- auto entry::get_flags() -> std::bitset<64U> { return flags.to_ulong() & ~PHYSICAL_ADDRESS_MASK; }
+ auto entry::get_flags() const -> std::bitset<64U> { return flags.to_ulong() & ~PHYSICAL_ADDRESS_MASK; }
} // namespace teachos::arch::memory::paging
diff --git a/arch/x86_64/src/video/vga/text.cpp b/arch/x86_64/src/video/vga/text.cpp
index 9eef288..0137ddb 100644
--- a/arch/x86_64/src/video/vga/text.cpp
+++ b/arch/x86_64/src/video/vga/text.cpp
@@ -11,9 +11,8 @@ namespace teachos::arch::video::vga::text
{
namespace
{
- auto constexpr default_text_buffer_address = 0xb8000;
- auto constexpr default_text_buffer_width = 80;
- auto constexpr default_text_buffer_height = 25;
+ auto constexpr DEFAULT_TEXT_BUFFER_WIDTH = 80U;
+ auto constexpr DEFAULT_TEXT_BUFFER_HEIGHT = 25U;
extern "C" std::pair<char, attribute> * vga_buffer_pointer;
auto constinit text_buffer = teachos::memory::asm_pointer{vga_buffer_pointer};
@@ -21,7 +20,7 @@ namespace teachos::arch::video::vga::text
auto clear(attribute attribute) -> void
{
- *text_buffer = reinterpret_cast<decltype(text_buffer)::pointer>(default_text_buffer_address);
+ *text_buffer = reinterpret_cast<decltype(text_buffer)::pointer>(DEFAULT_VGA_TEXT_BUFFER_ADDRESS);
std::ranges::fill_n(*text_buffer, 2000, std::pair{' ', attribute});
}
@@ -35,21 +34,21 @@ namespace teachos::arch::video::vga::text
auto newline() -> void
{
- auto base = reinterpret_cast<decltype(text_buffer)::pointer>(default_text_buffer_address);
+ 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 current_line = (raw_buffer - base) / DEFAULT_TEXT_BUFFER_WIDTH;
auto next_line = current_line + 1;
- if (next_line >= default_text_buffer_height)
+ 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;
+ 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;
+ raw_buffer = base + current_line * DEFAULT_TEXT_BUFFER_WIDTH;
}
else
{
- raw_buffer = base + next_line * default_text_buffer_width;
+ raw_buffer = base + next_line * DEFAULT_TEXT_BUFFER_WIDTH;
}
}