about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-04-22 15:49:19 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-04-22 15:49:19 +0200
commita7ec8e7c55995dc415bd53b3d2ea4d0ae4fb71fc (patch)
tree3af7778501e6f62985205e94170c80108b1c09c4 /src
parentdfaa6896c1fed449f995feeff13998da42f4af43 (diff)
downloadbox64-a7ec8e7c55995dc415bd53b3d2ea4d0ae4fb71fc.tar.gz
box64-a7ec8e7c55995dc415bd53b3d2ea4d0ae4fb71fc.zip
[ANDROID] Try to fix test 07
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64run_private.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/emu/x64run_private.c b/src/emu/x64run_private.c
index cbeface8..d1563adc 100644
--- a/src/emu/x64run_private.c
+++ b/src/emu/x64run_private.c
@@ -40,11 +40,18 @@ void EXPORT my___libc_init(x64emu_t* emu, void* raw_args , void (*onexit)(void)
     printf_log(LOG_DEBUG, "Transfert to main(%d, %p, %p)=>%p from __libc_init\n", my_context->argc, my_context->argv, my_context->envv, main);
     // should call structors->preinit_array and structors->init_array!
     // call main and finish
+    Push64(emu, GetRBP(emu));   // set frame pointer
+    SetRBP(emu, GetRSP(emu));   // save RSP
+    SetRSP(emu, GetRSP(emu)&~0xFLL);    // Align RSP
     PushExit(emu);
     R_RIP=(uintptr_t)main;
 
     DynaRun(emu);
 
+    SetRSP(emu, GetRBP(emu));   // restore RSP
+    SetRBP(emu, Pop64(emu));    // restore RBP
+    SetRSP(emu, old_rsp);
+    SetRBP(emu, old_rbp);
     emu->quit = 1; // finished!
 }
 #else