Browse Source

[Pal/Linux] 16-align stack before calling pal_linux_main

Isaku Yamahata 4 years ago
parent
commit
0214a5b7ca
1 changed files with 6 additions and 5 deletions
  1. 6 5
      Pal/src/host/Linux/db_main.c

+ 6 - 5
Pal/src/host/Linux/db_main.c

@@ -40,11 +40,12 @@
 /* At the begining of entry point, rsp starts at argc, then argvs,
    envps and auxvs. Here we store rsp to rdi, so it will not be
    messed up by function calls */
-__asm__ (".global pal_start \n"
-     "  .type pal_start,@function \n"
-     "pal_start: \n"
-     "  movq %rsp, %rdi \n"
-     "  call pal_linux_main \n");
+__asm__ (".global pal_start\n"
+     "  .type pal_start,@function\n"
+     "pal_start:\n"
+     "  movq %rsp, %rdi\n"
+     "  andq $~15, %rsp\n"
+     "  call pal_linux_main\n");
 
 #define RTLD_BOOTSTRAP