Skip to content

Commit

Permalink
Align "esp" Stack. Misc Formating.
Browse files Browse the repository at this point in the history
  • Loading branch information
CuriousTommy committed Sep 4, 2023
1 parent 9f284c9 commit 0549204
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/startup/mldr/elfcalls/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ static void* darling_thread_entry(void* p)
"xorl %%ebp, %%ebp\n"
// Switch to the new stack.
"movl %[stack_ptr], %%esp\n"
// Make sure stack is 16 aligned (before we push the fake return address)
"sub $8, %%esp\n"
// Unlike x86_64, all function arguments must be stored in the stack
"pushl 16(%[args])\n" // 6th argument | args.arg3
"pushl 12(%[args])\n" // 5th argument | args.arg2
Expand All @@ -326,7 +328,8 @@ static void* darling_thread_entry(void* p)
[stack_ptr] "r"(stack_ptr)
);
#else
#error Not implemented
#error Not implemented
// args.entry_point(args.pth, args.port, args.real_entry_point, args.arg1, args.arg2, args.arg3);
#endif
__builtin_unreachable();
}
Expand Down

0 comments on commit 0549204

Please sign in to comment.