aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-12-01 07:46:20 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-12-01 07:46:20 +0000
commite8bbb1ad850a362dfa25ba1ea7bdd838a379def8 (patch)
treed62d371dbd928d97a8957c349eeea3f9577b7345 /arch
parent9af867de0050eef28772f7dee799666ae343950e (diff)
downloadteachos-e8bbb1ad850a362dfa25ba1ea7bdd838a379def8.tar.xz
teachos-e8bbb1ad850a362dfa25ba1ea7bdd838a379def8.zip
Move heap virtual location and allocate multiple variables to test heap.
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/include/arch/memory/heap/concept.hpp2
-rw-r--r--arch/x86_64/src/kernel/main.cpp13
2 files changed, 10 insertions, 5 deletions
diff --git a/arch/x86_64/include/arch/memory/heap/concept.hpp b/arch/x86_64/include/arch/memory/heap/concept.hpp
index 8c8c887..52dba51 100644
--- a/arch/x86_64/include/arch/memory/heap/concept.hpp
+++ b/arch/x86_64/include/arch/memory/heap/concept.hpp
@@ -5,7 +5,7 @@
namespace teachos::arch::memory::heap
{
- std::size_t constexpr HEAP_START = 0x4000'0000;
+ std::size_t constexpr HEAP_START = 0x100000000;
std::size_t constexpr HEAP_SIZE = 100 * 1024;
template<typename T>
diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp
index 023327e..dd0a1d8 100644
--- a/arch/x86_64/src/kernel/main.cpp
+++ b/arch/x86_64/src/kernel/main.cpp
@@ -20,10 +20,15 @@ namespace teachos::arch::kernel
memory::heap::HEAP_START + memory::heap::HEAP_SIZE};
auto test = heap_allocator.allocate(1024);
auto test2 = new (test) memory::multiboot::memory_information{};
- auto test3 = *test2;
- test3.kernel_end = 5000;
- auto test4 = test3.kernel_end;
- if (test || test2 || test3.kernel_end || test4)
+ test = static_cast<void *>(static_cast<memory::multiboot::memory_information *>(test) + 1);
+ auto test3 = new (test) memory::multiboot::memory_information{};
+ auto test4 = *test2;
+ auto test5 = *test3;
+ test4.kernel_end = 5000;
+ test5.kernel_end = 3000;
+ auto test6 = test4.kernel_end;
+ auto test7 = test5.kernel_end;
+ if (test6 && test7)
{
video::vga::text::write("Kernel remapping successfull", video::vga::text::common_attributes::green_on_black);
}