1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
5 ; SPDX-License-Identifier: BSD-2-Clause-Patent
7 ;------------------------------------------------------------------------------
12 ;------------------------------------------------------------------------------
16 ; VOID *KernelStart, // rcx
17 ; VOID *KernelBootParams // rdx
19 ;------------------------------------------------------------------------------
20 global ASM_PFX(JumpToKernel)
21 ASM_PFX(JumpToKernel):
23 ; Set up for executing kernel. BP in %esi, entry point on the stack
24 ; (64-bit when the 'ret' will use it as 32-bit, but we're little-endian)
28 ; Jump into the compatibility mode CS
35 ; Now in compatibility mode.
37 DB 0xb8, 0x18, 0x0, 0x0, 0x0 ; movl $0x18, %eax
38 DB 0x8e, 0xd8 ; movl %eax, %ds
39 DB 0x8e, 0xc0 ; movl %eax, %es
40 DB 0x8e, 0xe0 ; movl %eax, %fs
41 DB 0x8e, 0xe8 ; movl %eax, %gs
42 DB 0x8e, 0xd0 ; movl %eax, %ss
45 DB 0xf, 0x20, 0xc0 ; movl %cr0, %eax
46 DB 0xf, 0xba, 0xf8, 0x1f ; btcl $31, %eax
47 DB 0xf, 0x22, 0xc0 ; movl %eax, %cr0
49 ; Disable long mode in EFER
50 DB 0xb9, 0x80, 0x0, 0x0, 0xc0 ; movl $0x0c0000080, %ecx
52 DB 0xf, 0xba, 0xf8, 0x8 ; btcl $8, %eax
56 DB 0xf, 0x20, 0xe0 ; movl %cr4, %eax
57 DB 0xf, 0xba, 0xf8, 0x5 ; btcl $5, %eax
58 DB 0xf, 0x22, 0xe0 ; movl %eax, %cr4
60 DB 0x31, 0xed ; xor %ebp, %ebp
61 DB 0x31, 0xff ; xor %edi, %edi
62 DB 0x31, 0xdb ; xor %ebx, %ebx
65 ;------------------------------------------------------------------------------
69 ; EFI_HANDLE ImageHandle, // rcx
70 ; EFI_SYSTEM_TABLE *SystemTable, // rdx
71 ; VOID *KernelBootParams // r8
72 ; VOID *KernelStart, // r9
74 ;------------------------------------------------------------------------------
75 global ASM_PFX(JumpToUefiKernel)
76 ASM_PFX(JumpToUefiKernel):