mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-16 07:27:35 +00:00
lx_kit: update 'arch_execute()' functions based on libc
This ensures proper stack alignment for FPU instructions on x86_64. Fixes #3356
This commit is contained in:
parent
c2c33d6808
commit
c7d9df6350
@ -34,6 +34,7 @@ void arch_execute(void *sp, void *func, void *arg)
|
||||
{
|
||||
asm volatile ("mov r0, %2;" /* set arg */
|
||||
"mov sp, %0;" /* set stack */
|
||||
"mov fp, #0;" /* clear frame pointer */
|
||||
"mov pc, %1;" /* call func */
|
||||
""
|
||||
: : "r"(sp), "r"(func), "r"(arg) : "r0");
|
||||
|
@ -35,6 +35,7 @@ void arch_execute(void *sp, void *func, void *arg)
|
||||
asm volatile ("movl %2, 0(%0);"
|
||||
"movl %1, -0x4(%0);"
|
||||
"movl %0, %%esp;"
|
||||
"xorl %%ebp, %%ebp;" /* clear frame pointer */
|
||||
"call *-4(%%esp);"
|
||||
: : "r" (sp), "r" (func), "r" (arg));
|
||||
}
|
||||
|
@ -33,11 +33,15 @@ extern "C" {
|
||||
static inline
|
||||
void arch_execute(void *sp, void *func, void *arg)
|
||||
{
|
||||
asm volatile ("movq %2, %%rdi;"
|
||||
"movq %1, 0(%0);"
|
||||
"movq %0, %%rsp;"
|
||||
"call *0(%%rsp);"
|
||||
: "+r" (sp), "+r" (func), "+r" (arg) : : "memory");
|
||||
asm volatile ("movq %0, %%rsp;" /* load stack pointer */
|
||||
"movq %%rsp, %%rbp;" /* caller stack frame (for GDB debugging) */
|
||||
"movq %0, -8(%%rbp);"
|
||||
"movq %1, -16(%%rbp);"
|
||||
"movq %2, -24(%%rbp);"
|
||||
"sub $24, %%rsp;" /* adjust to next stack frame */
|
||||
"movq %2, %%rdi;" /* 1st argument */
|
||||
"call *-16(%%rbp);" /* call func */
|
||||
: : "r" (sp), "r" (func), "r" (arg));
|
||||
}
|
||||
|
||||
#endif /* _ARCH_EXECUTE_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user