Explorar o código

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

Isaku Yamahata %!s(int64=4) %!d(string=hai) anos
pai
achega
0214a5b7ca
Modificáronse 1 ficheiros con 6 adicións e 5 borrados
  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,
 /* 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
    envps and auxvs. Here we store rsp to rdi, so it will not be
    messed up by function calls */
    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
 #define RTLD_BOOTSTRAP