1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Calls a x86_64 function from x86_32 context.
4 * Must not be directly invoked from C code!
7 #include <cpu/x86/64bit/entry64.inc>
11 .section ".text.long_mode_call_3arg", "ax", @progbits
12 .global long_mode_call_3arg
15 /* Function to call is passed in EAX. */
17 /* Backup registers */
20 /* Backup stack pointer */
23 /* Enter long mode, preserves ebx */
27 movabs $0xfffffffffffffff0, %rax
30 movl 28(%rbp), %ebx /* Function to call */
31 movl 36(%rbp), %edi /* 1st arg */
32 movl 40(%rbp), %esi /* 2nd arg */
33 movl 44(%rbp), %edx /* 3rd arg */
37 /* Store return value on stack. popal will fetch it. */
42 #include <cpu/x86/64bit/exit32.inc>
44 /* Restore stack pointer */
47 /* Restore registers */