summaryrefslogtreecommitdiff
path: root/src/northbridge/intel/sandybridge/mrc_wrapper.S
blob: d68ce091a432cf9d1c4ef2671824bd6ac163f52b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* SPDX-License-Identifier: GPL-2.0-only */
/* Functions to call MRC.bin from x86_64 */

.text
.code32
	.section ".text.mrc_wrapper", "ax", @progbits
	.globl mrc_wrapper
mrc_wrapper:
	/* Set up new stack frame */
	pushal
	mov	%esp, %ebp

	/* Align stack */
	andl	$0xfffffff0, %esp

	movl	36(%ebp), %ebx	/* Get function pointer */
	movl	40(%ebp), %eax	/* Get argument */

	call	*%ebx

	/* Place return value on stack so that popal fetches it */
	movl	%eax, 28(%ebp)

	/* Restore stack pointer */
	mov	%ebp, %esp
	popal
	ret

	/*
	 * Callback for MRC to print a character on the console.
	 * As MRC is x86_32 call into long mode and use the x86_64
	 * function do_putchar to print to console.
	 */

#include <src/cpu/x86/64bit/prot2long.inc>

prot2lm_wrapper do_putchar