Просмотр исходного кода

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

Isaku Yamahata 6 лет назад
Родитель
Сommit
0214a5b7ca
1 измененных файлов с 6 добавлено и 5 удалено
  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