]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/LoadLinuxLib/X64/JumpToKernel.nasm
OvmfPkg/TlsAuthConfigLib: configure trusted cipher suites for HTTPS boot
[mirror_edk2.git] / OvmfPkg / Library / LoadLinuxLib / X64 / JumpToKernel.nasm
CommitLineData
3c0a051f 1;------------------------------------------------------------------------------\r
2;\r
a205121e 3; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
3c0a051f 4;\r
5; This program and the accompanying materials\r
6; are licensed and made available under the terms and conditions of the BSD License\r
7; which accompanies this distribution. The full text of the license may be found at\r
8; http://opensource.org/licenses/bsd-license.php.\r
9;\r
10; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12;\r
13;------------------------------------------------------------------------------\r
14\r
ad8ae98d
JJ
15 DEFAULT REL\r
16 SECTION .text\r
3c0a051f 17\r
18;------------------------------------------------------------------------------\r
19; VOID\r
20; EFIAPI\r
21; JumpToKernel (\r
22; VOID *KernelStart, // rcx\r
23; VOID *KernelBootParams // rdx\r
24; );\r
25;------------------------------------------------------------------------------\r
ad8ae98d
JJ
26global ASM_PFX(JumpToKernel)\r
27ASM_PFX(JumpToKernel):\r
3c0a051f 28\r
61a114ba 29 ; Set up for executing kernel. BP in %esi, entry point on the stack\r
30 ; (64-bit when the 'ret' will use it as 32-bit, but we're little-endian)\r
31 mov rsi, rdx\r
32 push rcx\r
33\r
34 ; Jump into the compatibility mode CS\r
ad8ae98d
JJ
35 push 0x10\r
36 lea rax, [.0]\r
61a114ba 37 push rax\r
ad8ae98d 38 DB 0x48, 0xcb ; retfq\r
61a114ba 39\r
ad8ae98d 40.0:\r
61a114ba 41 ; Now in compatibility mode.\r
42\r
ad8ae98d
JJ
43 DB 0xb8, 0x18, 0x0, 0x0, 0x0 ; movl $0x18, %eax\r
44 DB 0x8e, 0xd8 ; movl %eax, %ds\r
45 DB 0x8e, 0xc0 ; movl %eax, %es\r
46 DB 0x8e, 0xe0 ; movl %eax, %fs\r
47 DB 0x8e, 0xe8 ; movl %eax, %gs\r
48 DB 0x8e, 0xd0 ; movl %eax, %ss\r
61a114ba 49\r
50 ; Disable paging\r
ad8ae98d
JJ
51 DB 0xf, 0x20, 0xc0 ; movl %cr0, %eax\r
52 DB 0xf, 0xba, 0xf8, 0x1f ; btcl $31, %eax\r
53 DB 0xf, 0x22, 0xc0 ; movl %eax, %cr0\r
61a114ba 54\r
55 ; Disable long mode in EFER\r
ad8ae98d
JJ
56 DB 0xb9, 0x80, 0x0, 0x0, 0xc0 ; movl $0x0c0000080, %ecx\r
57 DB 0xf, 0x32 ; rdmsr\r
58 DB 0xf, 0xba, 0xf8, 0x8 ; btcl $8, %eax\r
59 DB 0xf, 0x30 ; wrmsr\r
61a114ba 60\r
61 ; Disable PAE\r
ad8ae98d
JJ
62 DB 0xf, 0x20, 0xe0 ; movl %cr4, %eax\r
63 DB 0xf, 0xba, 0xf8, 0x5 ; btcl $5, %eax\r
64 DB 0xf, 0x22, 0xe0 ; movl %eax, %cr4\r
61a114ba 65\r
ad8ae98d
JJ
66 DB 0x31, 0xed ; xor %ebp, %ebp\r
67 DB 0x31, 0xff ; xor %edi, %edi\r
68 DB 0x31, 0xdb ; xor %ebx, %ebx\r
69 DB 0xc3 ; ret\r
3c0a051f 70\r
dd71f6e2 71;------------------------------------------------------------------------------\r
72; VOID\r
73; EFIAPI\r
74; JumpToUefiKernel (\r
75; EFI_HANDLE ImageHandle, // rcx\r
76; EFI_SYSTEM_TABLE *SystemTable, // rdx\r
77; VOID *KernelBootParams // r8\r
78; VOID *KernelStart, // r9\r
79; );\r
80;------------------------------------------------------------------------------\r
ad8ae98d
JJ
81global ASM_PFX(JumpToUefiKernel)\r
82ASM_PFX(JumpToUefiKernel):\r
dd71f6e2 83\r
84 mov rdi, rcx\r
85 mov rsi, rdx\r
86 mov rdx, r8\r
87 xor rax, rax\r
ad8ae98d 88 mov eax, [r8 + 0x264]\r
dd71f6e2 89 add r9, rax\r
ad8ae98d 90 add r9, 0x200\r
dd71f6e2 91 call r9\r
92 ret\r
93\r