Patrick Rudolph | e563815 | 2018-12-09 10:48:59 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <arch/ram_segs.h> |
Patrick Rudolph | e563815 | 2018-12-09 10:48:59 +0100 | [diff] [blame] | 4 | #include <cpu/x86/cr.h> |
| 5 | |
Patrick Rudolph | adcf782 | 2020-08-27 20:50:18 +0200 | [diff] [blame] | 6 | #if ENV_X86_64 |
Patrick Rudolph | e563815 | 2018-12-09 10:48:59 +0100 | [diff] [blame] | 7 | |
| 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 |
| 16 | protected_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 |