about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedldlinux.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wrapped/wrappedldlinux.c')
-rwxr-xr-xsrc/wrapped/wrappedldlinux.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wrapped/wrappedldlinux.c b/src/wrapped/wrappedldlinux.c
index b5dc0da6..83245e93 100755
--- a/src/wrapped/wrappedldlinux.c
+++ b/src/wrapped/wrappedldlinux.c
@@ -28,6 +28,12 @@ EXPORT void* my___tls_get_addr(void* p)
     return ptr->data+GetTLSBase(my_context->elfs[t->i])+t->o;
 }
 
+EXPORT void* my___libc_stack_end;
+void stSetup(box64context_t* context)
+{
+    my___libc_stack_end = context->stack;   // is this the end, or should I add stasz?
+}
+
 // don't try to load the actual ld-linux (because name is variable), just use box64 itself, as it's linked to ld-linux
 const char* ldlinuxName = "ld-linux.so.2";
 #define LIBNAME ldlinux
@@ -37,6 +43,9 @@ const char* ldlinuxName = "ld-linux.so.2";
         lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);    \
     else
 
+#define CUSTOM_INIT         \
+    stSetup(box64);         \
+
 // define all standard library functions
 #include "wrappedlib_init.h"