aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-12-09 15:16:50 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-12-09 15:16:50 +0000
commit4ff0477e844fe13620b02c197a8db4c01809399f (patch)
treec69c89b7c86886c51083818f1de6f51cad5e115c /arch/x86_64/src/memory
parent50e2bda01928bfbad90a91439ac6326473a698b4 (diff)
downloadteachos-4ff0477e844fe13620b02c197a8db4c01809399f.tar.xz
teachos-4ff0477e844fe13620b02c197a8db4c01809399f.zip
Fix method writing to wrong CR register and improve doxygen comments.
Diffstat (limited to 'arch/x86_64/src/memory')
-rw-r--r--arch/x86_64/src/memory/cpu/control_register.cpp6
-rw-r--r--arch/x86_64/src/memory/main.cpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86_64/src/memory/cpu/control_register.cpp b/arch/x86_64/src/memory/cpu/control_register.cpp
index 7624244..298874f 100644
--- a/arch/x86_64/src/memory/cpu/control_register.cpp
+++ b/arch/x86_64/src/memory/cpu/control_register.cpp
@@ -66,9 +66,9 @@ namespace teachos::arch::memory::cpu
}
}
- auto set_cr2_bit(cr2_flags flag) -> void
+ auto set_cr0_bit(cr0_flags flag) -> void
{
- auto const cr2 = read_control_register(control_register::CR2);
- write_control_register(control_register::CR2, static_cast<std::underlying_type<cr2_flags>::type>(flag) | cr2);
+ auto const cr0 = read_control_register(control_register::CR0);
+ write_control_register(control_register::CR0, static_cast<std::underlying_type<cr0_flags>::type>(flag) | cr0);
}
} // namespace teachos::arch::memory::cpu
diff --git a/arch/x86_64/src/memory/main.cpp b/arch/x86_64/src/memory/main.cpp
index 34ce113..2f01c5e 100644
--- a/arch/x86_64/src/memory/main.cpp
+++ b/arch/x86_64/src/memory/main.cpp
@@ -38,7 +38,7 @@ namespace teachos::arch::memory
auto const memory_information = multiboot::read_multiboot2();
allocator::area_frame_allocator allocator(memory_information);
- cpu::set_cr2_bit(memory::cpu::cr2_flags::WRITE_PROTECT);
+ cpu::set_cr0_bit(memory::cpu::cr0_flags::WRITE_PROTECT);
cpu::set_efer_bit(memory::cpu::efer_flags::NXE);
paging::kernel_mapper kernel(allocator, memory_information);