aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/context_switching
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2025-05-12 08:50:12 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2025-05-12 08:50:12 +0000
commitee4c61f7313fedd23d01c69ea5036fa38ef6248a (patch)
treecacb52db9b5233794c6284d14ef9306a045f5d72 /arch/x86_64/src/context_switching
parentef156dd6430855434b54275b22cd43ee3cedcfdc (diff)
downloadteachos-ee4c61f7313fedd23d01c69ea5036fa38ef6248a.tar.xz
teachos-ee4c61f7313fedd23d01c69ea5036fa38ef6248a.zip
Adjust user heap to lazy allocate heap
Diffstat (limited to 'arch/x86_64/src/context_switching')
-rw-r--r--arch/x86_64/src/context_switching/syscall/syscall_handler.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86_64/src/context_switching/syscall/syscall_handler.cpp b/arch/x86_64/src/context_switching/syscall/syscall_handler.cpp
index 9ca03d9..7272e9e 100644
--- a/arch/x86_64/src/context_switching/syscall/syscall_handler.cpp
+++ b/arch/x86_64/src/context_switching/syscall/syscall_handler.cpp
@@ -21,11 +21,10 @@ namespace teachos::arch::context_switching::syscall
auto expand_user_heap() -> error
{
- // TODO: use actual addresses instead of this constant!
- memory::remap_heap(memory::heap::USER_HEAP_SIZE + memory::heap::USER_HEAP_SIZE, memory::heap::USER_HEAP_SIZE,
- memory::paging::entry::USER_ACCESSIBLE);
+ static auto current_heap_end = memory::heap::USER_HEAP_START;
+ memory::remap_heap(current_heap_end, memory::heap::USER_HEAP_SIZE, memory::paging::entry::USER_ACCESSIBLE);
- arguments args{};
+ arguments args{current_heap_end, memory::heap::USER_HEAP_SIZE};
asm volatile("mov %[input], %%rdi"
: /* no output from call */
: [input] "m"(args.arg_0)
@@ -34,7 +33,8 @@ namespace teachos::arch::context_switching::syscall
: /* no output from call */
: [input] "m"(args.arg_1)
: "memory");
- return error::OUT_OF_MEMORY;
+ current_heap_end += memory::heap::USER_HEAP_SIZE;
+ return error::OK;
}
} // namespace