aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-06 09:58:17 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-06 09:58:17 +0000
commit1b33fc5746be4d23b1c4adacc02263fbcf994524 (patch)
treebe5b588bf13aaaf3304084409bf76ca8967ebc42 /arch/x86_64
parent8e3c15daad14dfba76444d83bc4133acd00eaf8a (diff)
downloadteachos-1b33fc5746be4d23b1c4adacc02263fbcf994524.tar.xz
teachos-1b33fc5746be4d23b1c4adacc02263fbcf994524.zip
Add assert method
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/src/kernel/main.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp
index d94cbba..fa1e464 100644
--- a/arch/x86_64/src/kernel/main.cpp
+++ b/arch/x86_64/src/kernel/main.cpp
@@ -6,6 +6,15 @@
namespace teachos::arch::kernel
{
+ auto assert(bool condition) -> void
+ {
+ video::vga::text::write("Assert failed", video::vga::text::common_attributes::green_on_black);
+ while (!condition)
+ {
+ ;
+ }
+ }
+
auto print_mem_info(arch::memory::memory_info * mem_info) -> void
{
video::vga::text::write("Memory info low: ", video::vga::text::common_attributes::green_on_black);
@@ -14,6 +23,10 @@ namespace teachos::arch::kernel
auto print_memory_map(arch::memory::memory_map * mminfo) -> void
{
+ auto expected_entry_size = mminfo->entry_size;
+ constexpr auto actual_size = sizeof(arch::memory::memory_area);
+ assert(expected_entry_size == actual_size);
+
auto remaining_size = mminfo->tag.size - (4 * sizeof(uint32_t));
auto entry_amount = remaining_size / mminfo->entry_size;