aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/user
diff options
context:
space:
mode:
authorFabian Imhof <fabian.imhof@ost.ch>2025-05-07 14:06:25 +0000
committerFabian Imhof <fabian.imhof@ost.ch>2025-05-07 14:06:25 +0000
commitbe32189323ba8c46091d6deaf091cf41147426b4 (patch)
tree499d4626c82dcae9fac683983e6605d88a0d6f95 /arch/x86_64/src/user
parentc9f46f3773e7943ce114af888a44f50061c2ac1d (diff)
downloadteachos-be32189323ba8c46091d6deaf091cf41147426b4.tar.xz
teachos-be32189323ba8c46091d6deaf091cf41147426b4.zip
wip custom heap allocation functions for user mode
Diffstat (limited to 'arch/x86_64/src/user')
-rw-r--r--arch/x86_64/src/user/main.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/arch/x86_64/src/user/main.cpp b/arch/x86_64/src/user/main.cpp
index 3e7b0ec..4f6e688 100644
--- a/arch/x86_64/src/user/main.cpp
+++ b/arch/x86_64/src/user/main.cpp
@@ -1,8 +1,9 @@
#include "arch/user/main.hpp"
#include "arch/context_switching/syscall/main.hpp"
+#include "arch/memory/heap/global_heap_allocator.hpp"
-// TODO: Disallow this import
+// TODO: Disallow these imports
#include "arch/kernel/cpu/if.hpp"
#include "arch/video/vga/text.hpp"
@@ -11,20 +12,23 @@ namespace teachos::arch::user
auto main() -> void
{
char constexpr syscall_message[] = "Successfully entered user mode and wrote to VGA buffer via syscall!";
- auto const error = context_switching::syscall::syscall(context_switching::syscall::type::WRITE,
- {reinterpret_cast<uint64_t>(&syscall_message)});
+ context_switching::syscall::syscall(context_switching::syscall::type::WRITE,
+ {reinterpret_cast<uint64_t>(&syscall_message)});
- kernel::cpu::clear_interrupt_flag(); // Causes crash Kernel Code (.text) is not mapped in User mMde
+ // kernel::cpu::clear_interrupt_flag(); // Causes crash Kernel Code (.text) is not mapped in User mMde
- auto test = new int{20}; // Causes crash Heap is not mapped in User Mode
+ auto test = memory::heap::global_heap_allocator::malloc(20U);
(void)test;
- if (!error)
- {
- // Causes crash vga is not mapped in User Mode
- video::vga::text::write("Successfully made a SYSCALL and returned with SYSRETQ!",
- video::vga::text::common_attributes::green_on_black);
- }
+ // auto test = new int{20}; // Causes crash Heap is not mapped in User Mode
+ // (void)test;
+
+ // if (!error)
+ // {
+ // // Causes crash vga is not mapped in User Mode
+ // video::vga::text::write("Successfully made a SYSCALL and returned with SYSRETQ!",
+ // video::vga::text::common_attributes::green_on_black);
+ // }
for (;;)
{