blob: d68ce091a432cf9d1c4ef2671824bd6ac163f52b [file] [log] [blame]
Patrick Rudolphb14b96d2023-12-27 10:59:25 +01001/* 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
8mrc_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
Patrick Rudolph1d718de2023-12-28 19:39:11 +010028
29 /*
30 * Callback for MRC to print a character on the console.
31 * As MRC is x86_32 call into long mode and use the x86_64
32 * function do_putchar to print to console.
33 */
34
35#include <src/cpu/x86/64bit/prot2long.inc>
36
37prot2lm_wrapper do_putchar