| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
.text |
| 4 |
.code32 |
| 5 |
/* |
| 6 |
* Macro to wrap a x86_64 function to be called from x86_32 code. |
| 7 |
* This assumes that 0-3 32bit arguments are passed to the |
| 8 |
* calling function. |
| 9 |
* |
| 10 |
* In order to preserve ESP without setting up a stack frame |
| 11 |
* pass the function to call in EAX. The macro prepends "__prot2lm_" |
| 12 |
* to the wrapped function name. |
| 13 |
*/ |
| 14 |
.macro prot2lm_wrapper func2call:req |
| 15 |
.global __prot2lm_\func2call |
| 16 |
__prot2lm_\func2call : |
| 17 |
/* Get function to call */ |
| 18 |
mov $\func2call, %eax |
| 19 |
|
| 20 |
/* |
| 21 |
* Jump to function instead of call. |
| 22 |
* It will return directly to caller. |
| 23 |
*/ |
| 24 |
jmp long_mode_call_3arg |
| 25 |
|
| 26 |
/* Not reachable */ |
| 27 |
.endm |