blob: e5b9bf8d74a6f473146b7a4686298f1c43f77bd1 [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>
4#include <cpu/x86/msr.h>
5#include <cpu/x86/cr.h>
6
7
8#ifdef __x86_64__
9
10 /*
11 * Functions to handle mode switches from long mode to protected
12 * mode.
13 */
14.text
15.code64
16 .section ".text.protected_mode_jump", "ax", @progbits
17 .globl protected_mode_jump
18protected_mode_jump:
19
20 push %rbp
21 mov %rsp, %rbp
22
23 /* Arguments to stack */
24 push %rdi
25 push %rsi
26
27 #include <cpu/x86/64bit/exit32.inc>
28
29 movl -8(%ebp), %eax /* Function to call */
30 movl -16(%ebp), %ebx /* Argument 0 */
31
32 /* Align the stack */
33 andl $0xFFFFFFF0, %esp
34 subl $12, %esp
35 pushl %ebx /* Argument 0 */
36
37 jmp *%eax
38#endif