#------------------------------------------------------------------------------\r
#\r
-# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
#------------------------------------------------------------------------------\r
\r
ASM_GLOBAL ASM_PFX(JumpToKernel)\r
+ASM_GLOBAL ASM_PFX(JumpToUefiKernel)\r
\r
#------------------------------------------------------------------------------\r
# VOID\r
calll 0x4(%esp)\r
ret\r
\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# JumpToUefiKernel (\r
+# EFI_HANDLE ImageHandle,\r
+# EFI_SYSTEM_TABLE *SystemTable,\r
+# VOID *KernelBootParams,\r
+# VOID *KernelStart\r
+# );\r
+#------------------------------------------------------------------------------\r
+ASM_PFX(JumpToUefiKernel):\r
+ movl 0xc(%esp), %eax\r
+ movl 0x264(%eax), %eax\r
+ addl 0x10(%esp), %eax\r
+ jmp %eax\r
+\r
;------------------------------------------------------------------------------\r
;\r
-; Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
;\r
; This program and the accompanying materials\r
; are licensed and made available under the terms and conditions of the BSD License\r
\r
JumpToKernel ENDP\r
\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; JumpToUefiKernel (\r
+; EFI_HANDLE ImageHandle,\r
+; EFI_SYSTEM_TABLE *SystemTable,\r
+; VOID *KernelBootParams,\r
+; VOID *KernelStart\r
+; );\r
+;------------------------------------------------------------------------------\r
+JumpToUefiKernel PROC\r
+\r
+ mov eax, [esp + 12]\r
+ mov eax, [eax + 264h]\r
+ add eax, [esp + 16]\r
+ jmp eax\r
+\r
+JumpToUefiKernel ENDP\r
+\r
END\r
STATIC\r
EFI_STATUS\r
SetupLinuxBootParams (\r
- IN VOID *Kernel,\r
IN OUT struct boot_params *Bp\r
)\r
{\r
SetupGraphics (Bp);\r
\r
- Bp->hdr.code32_start = (UINT32)(UINTN) Kernel;\r
-\r
SetupLinuxMemmap (Bp);\r
\r
return EFI_SUCCESS;\r
\r
InitLinuxDescriptorTables ();\r
\r
- SetupLinuxBootParams (Kernel, (struct boot_params*) KernelSetup);\r
+ Bp->hdr.code32_start = (UINT32)(UINTN) Kernel;\r
+ if (Bp->hdr.version >= 0x20c && Bp->hdr.handover_offset &&\r
+ (Bp->hdr.load_flags & (sizeof (UINTN) == 4 ? BIT2 : BIT3))) {\r
+ DEBUG ((EFI_D_INFO, "Jumping to kernel EFI handover point at ofs %x\n", Bp->hdr.handover_offset));\r
+\r
+ DisableInterrupts ();\r
+ JumpToUefiKernel ((VOID*) gImageHandle, (VOID*) gST, KernelSetup, Kernel);\r
+ }\r
+\r
+ //\r
+ // Old kernels without EFI handover protocol\r
+ //\r
+ SetupLinuxBootParams (KernelSetup);\r
\r
DEBUG ((EFI_D_INFO, "Jumping to kernel\n"));\r
DisableInterrupts ();\r
/** @file\r
Boot UEFI Linux.\r
\r
- Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
VOID *KernelBootParams\r
);\r
\r
+VOID\r
+EFIAPI\r
+JumpToUefiKernel (\r
+ EFI_HANDLE ImageHandle,\r
+ EFI_SYSTEM_TABLE *SystemTable,\r
+ VOID *KernelBootParams,\r
+ VOID *KernelStart\r
+ );\r
+\r
VOID\r
InitLinuxDescriptorTables (\r
VOID\r
#------------------------------------------------------------------------------\r
\r
ASM_GLOBAL ASM_PFX(JumpToKernel)\r
+ASM_GLOBAL ASM_PFX(JumpToUefiKernel)\r
\r
#------------------------------------------------------------------------------\r
# VOID\r
ret\r
.code64\r
\r
+#------------------------------------------------------------------------------\r
+# VOID\r
+# EFIAPI\r
+# JumpToUefiKernel (\r
+# EFI_HANDLE ImageHandle, // rcx\r
+# EFI_SYSTEM_TABLE *SystemTable, // rdx\r
+# VOID *KernelBootParams, // r8\r
+# VOID *KernelStart // r9\r
+# );\r
+#------------------------------------------------------------------------------\r
+ASM_PFX(JumpToUefiKernel):\r
+ movq %rcx, %rdi\r
+ movq %rdx, %rsi\r
+ movq %r8, %rdx\r
+ xor %rax, %rax\r
+ movl 0x264(%r8), %eax\r
+ addq %rax, %r9\r
+ addq $0x200, %r9\r
+ callq %r9\r
+ ret\r
+\r
\r
JumpToKernel ENDP\r
\r
+;------------------------------------------------------------------------------\r
+; VOID\r
+; EFIAPI\r
+; JumpToUefiKernel (\r
+; EFI_HANDLE ImageHandle, // rcx\r
+; EFI_SYSTEM_TABLE *SystemTable, // rdx\r
+; VOID *KernelBootParams // r8\r
+; VOID *KernelStart, // r9\r
+; );\r
+;------------------------------------------------------------------------------\r
+JumpToUefiKernel PROC\r
+\r
+ mov rdi, rcx\r
+ mov rsi, rdx\r
+ mov rdx, r8\r
+ xor rax, rax\r
+ mov eax, [r8 + 264h]\r
+ add r9, rax\r
+ add r9, 200h\r
+ call r9\r
+ ret\r
+\r
+JumpToUefiKernel ENDP\r
+\r
END\r