From 263e7305cf174d1e7f8ad11a7f7020e791f0f405 Mon Sep 17 00:00:00 2001 From: antifallobst Date: Thu, 1 Jun 2023 11:40:12 +0200 Subject: [PATCH] feature (memory management): implemented a function to read the caller from the stack --- inc/mm/stack.h | 2 ++ src/platform/x86/stack.asm | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 src/platform/x86/stack.asm diff --git a/inc/mm/stack.h b/inc/mm/stack.h index 0542460..de6f57b 100644 --- a/inc/mm/stack.h +++ b/inc/mm/stack.h @@ -11,4 +11,6 @@ void stack_dump_call_info (uint64_t rip, symbol_T* symbol); void stack_trace_call_stack (uint64_t rbp); +extern uint64_t stack_get_caller(); + #endif //NOX_STACK_H diff --git a/src/platform/x86/stack.asm b/src/platform/x86/stack.asm new file mode 100644 index 0000000..927f63c --- /dev/null +++ b/src/platform/x86/stack.asm @@ -0,0 +1,7 @@ +; This file is part of noxos and licensed under the MIT open source license + +stack_get_caller: + mov rax, [rbp + 0x8] + ret + +GLOBAL stack_get_caller \ No newline at end of file