Patrick Rudolph | b14b96d | 2023-12-27 10:59:25 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* Functions to call MRC.bin from x86_64 */ |
| 3 | |
| 4 | .text |
| 5 | .code32 |
| 6 | .section ".text.mrc_wrapper", "ax", @progbits |
| 7 | .globl mrc_wrapper |
| 8 | mrc_wrapper: |
| 9 | /* Set up new stack frame */ |
| 10 | pushal |
| 11 | mov %esp, %ebp |
| 12 | |
| 13 | /* Align stack */ |
| 14 | andl $0xfffffff0, %esp |
| 15 | |
| 16 | movl 36(%ebp), %ebx /* Get function pointer */ |
| 17 | movl 40(%ebp), %eax /* Get argument */ |
| 18 | |
| 19 | call *%ebx |
| 20 | |
| 21 | /* Place return value on stack so that popal fetches it */ |
| 22 | movl %eax, 28(%ebp) |
| 23 | |
| 24 | /* Restore stack pointer */ |
| 25 | mov %ebp, %esp |
| 26 | popal |
| 27 | ret |