blob: 069a66c91e96f02eda24380126adbdaafc2e1443 [file] [log] [blame]
Patrick Rudolphe5638152018-12-09 10:48:59 +01001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <arch/ram_segs.h>
Patrick Rudolphe5638152018-12-09 10:48:59 +01004#include <cpu/x86/cr.h>
5
Patrick Rudolphadcf7822020-08-27 20:50:18 +02006#if ENV_X86_64
Patrick Rudolphe5638152018-12-09 10:48:59 +01007
8 /*
9 * Functions to handle mode switches from long mode to protected
10 * mode.
11 */
12.text
13.code64
14 .section ".text.protected_mode_jump", "ax", @progbits
15 .globl protected_mode_jump
16protected_mode_jump:
17
18 push %rbp
19 mov %rsp, %rbp
20
21 /* Arguments to stack */
22 push %rdi
23 push %rsi
24
25 #include <cpu/x86/64bit/exit32.inc>
26
27 movl -8(%ebp), %eax /* Function to call */
28 movl -16(%ebp), %ebx /* Argument 0 */
29
30 /* Align the stack */
31 andl $0xFFFFFFF0, %esp
32 subl $12, %esp
33 pushl %ebx /* Argument 0 */
34
35 jmp *%eax
36#endif