xref: /aosp_15_r20/external/coreboot/src/northbridge/intel/sandybridge/mrc_wrapper.S (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
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
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
28
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
38