提交 a27fe27f 编写于 作者: 草原企鹅's avatar 草原企鹅
......@@ -2,7 +2,10 @@ OpenCore Changelog
==================
#### v1.0.0
- Updated builtin firmware versions for SMBIOS and the rest
- Use Apple silicon GitHub runner for CI, thx @Goooler
- Switched to Apple silicon GitHub runner for CI, thx @Goooler
- Added Apple Silicon support in all provided utilities
- Utilities now require macOS 10.9+ (OpenCore itself still supports macOS 10.4+)
- Added `AllowRelocationBlock` support for 32-bit version
#### v0.9.9
- Fixed incorrect warning in ocvalidate
......
1a71d1870e336326d90153724e52def0
e8b51b8b5d7acdef262b61a3aed6bf05
......@@ -1487,8 +1487,8 @@ To view their current state, use the \texttt{pmset -g} command in Terminal.
\item KASLR (slide) is unsupported (this is Mac OS X 10.7 or older)
\end{itemize}
This quirk requires \texttt{ProvideCustomSlide} to be enabled and
typically also requires enabling \texttt{AvoidRuntimeDefrag} to function
This quirk typically requires \texttt{ProvideCustomSlide} and
\texttt{AvoidRuntimeDefrag} to be enabled to function
correctly. Hibernation is not supported when booting with a relocation
block, which will only be used if required when the quirk is enabled.
......
\documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Tue Mar 12 23:19:24 2024
%DIF ADD ../Configuration.tex Wed Mar 13 00:03:04 2024
%DIF DEL PreviousConfiguration.tex Sun Apr 7 20:10:19 2024
%DIF ADD ../Configuration.tex Mon Apr 8 11:31:07 2024
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
......@@ -1547,8 +1547,10 @@ To view their current state, use the \texttt{pmset -g} command in Terminal.
\item KASLR (slide) is unsupported (this is \DIFdelbegin \DIFdel{macOS }\DIFdelend \DIFaddbegin \DIFadd{Mac OS X }\DIFaddend 10.7 or older)
\end{itemize}
This quirk requires \texttt{ProvideCustomSlide} to be enabled and
typically also requires enabling \texttt{AvoidRuntimeDefrag} to function
This quirk \DIFaddbegin \DIFadd{typically }\DIFaddend requires \texttt{ProvideCustomSlide} \DIFaddbegin \DIFadd{and
}\texttt{\DIFadd{AvoidRuntimeDefrag}} \DIFaddend to be enabled \DIFdelbegin \DIFdel{and
typically also requires enabling }\texttt{\DIFdel{AvoidRuntimeDefrag}} %DIFAUXCMD
\DIFdelend to function
correctly. Hibernation is not supported when booting with a relocation
block, which will only be used if required when the quirk is enabled.
......
......@@ -502,6 +502,16 @@ AppleMapPrepareBooterState (
IN EFI_GET_MEMORY_MAP GetMemoryMap OPTIONAL
);
/**
Patch kernel entry point with KernelJump to later land in AppleMapPrepareKernelState.
@param[in,out] BootCompat Boot compatibility context.
**/
VOID
AppleMapPrepareKernelJump32 (
IN OUT BOOT_COMPAT_CONTEXT *BootCompat
);
/**
Patch kernel entry point with KernelJump to later land in AppleMapPrepareKernelState.
......@@ -511,12 +521,36 @@ AppleMapPrepareBooterState (
entering the kernel call gate.
**/
VOID
AppleMapPrepareKernelJump (
AppleMapPrepareKernelJump64 (
IN OUT BOOT_COMPAT_CONTEXT *BootCompat,
IN EFI_PHYSICAL_ADDRESS CallGate,
IN UINTN HookAddress
);
/**
Prepare environment for normal booting. Called when boot.efi jumps to kernel.
@param[in,out] BootCompat Boot compatibility context.
@param[in,out] BootArgs Apple kernel boot arguments.
**/
VOID
AppleMapPrepareForBooting (
IN OUT BOOT_COMPAT_CONTEXT *BootCompat,
IN OUT VOID *BootArgs
);
/**
Prepare environment for hibernate wake. Called when boot.efi jumps to kernel.
@param[in,out] BootCompat Boot compatibility context.
@param[in,out] ImageHeaderPage Apple hibernate image page number.
**/
VOID
AppleMapPrepareForHibernateWake (
IN OUT BOOT_COMPAT_CONTEXT *BootCompat,
IN UINTN ImageHeaderPage
);
/**
Prepare memory state and perform virtual address translation.
......@@ -535,6 +569,30 @@ AppleMapPrepareMemState (
IN EFI_MEMORY_DESCRIPTOR *MemoryMap
);
/**
Assembly wrapper for AppleMapPrepareKernelState32.
Used to convert calling conventions and fixup registers.
**/
VOID
AsmAppleMapPrepareKernelState32 (
VOID
);
/**
Prepare environment for Apple kernel bootloader in boot or wake cases.
This callback arrives when boot.efi jumps to kernel entry point.
Should transfer control to restored kernel entry point with the same arguments.
@param[in] Args Case-specific kernel argument handle.
@returns Case-specific value if any.
**/
UINTN
EFIAPI
AppleMapPrepareKernelState32 (
IN UINTN Args
);
/**
Prepare environment for Apple kernel bootloader in boot or wake cases.
This callback arrives when boot.efi jumps to kernel call gate.
......@@ -553,7 +611,7 @@ AppleMapPrepareMemState (
**/
EFI_STATUS
EFIAPI
AppleMapPrepareKernelStateNew (
AppleMapPrepareKernelStateNew64 (
IN UINTN SystemTable,
IN OUT APPLE_EFI_BOOT_RT_KCG_ARGS *KcgArguments,
IN KERNEL_CALL_GATE CallGate
......@@ -575,7 +633,7 @@ AppleMapPrepareKernelStateNew (
**/
UINTN
EFIAPI
AppleMapPrepareKernelStateOld (
AppleMapPrepareKernelStateOld64 (
IN UINTN Args,
IN UINTN EntryPoint,
IN KERNEL_CALL_GATE CallGate
......@@ -724,7 +782,7 @@ AppleRelocationRebase (
@param[in] KcgArg2 Second kernel call gate argument.
**/
VOID
AppleRelocationCallGate (
AppleRelocationCallGate64 (
IN OUT UINTN *Args,
IN BOOT_COMPAT_CONTEXT *BootCompat,
IN KERNEL_CALL_GATE CallGate,
......
/** @file
Copyright (C) 2019-2024, vit9696. All rights reserved.
All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "../BootCompatInternal.h"
#include <Guid/OcVariable.h>
#include <IndustryStandard/AppleHibernate.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/OcBootManagementLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/OcDeviceTreeLib.h>
#include <Library/OcMachoLib.h>
#include <Library/OcMemoryLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcStringLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
VOID
AppleMapPrepareKernelJump32 (
IN OUT BOOT_COMPAT_CONTEXT *BootCompat
)
{
UINT8 *KernelEntry;
UINT32 Offset;
BOOLEAN Found;
//
// There is no reason to patch the kernel when we do not need it.
//
if ( !BootCompat->Settings.AvoidRuntimeDefrag
&& !BootCompat->Settings.DiscardHibernateMap
&& !BootCompat->Settings.AllowRelocationBlock
&& !BootCompat->Settings.DisableSingleUser
&& !BootCompat->Settings.ForceBooterSignature)
{
return;
}
//
// TODO: Add support for 32-bit hibernation some day.
//
if (BootCompat->ServiceState.AppleHibernateWake) {
RUNTIME_DEBUG ((DEBUG_ERROR, "OCABC: Cannot patch 32-bit kernel in hibernate wake!\n"));
CpuDeadLoop ();
}
//
// There are no call gates in 32-bit mode.
//
ASSERT (BootCompat->ServiceState.OldKernelCallGate == 0);
//
// Search for kernel entry point.
// This sequence seems to be relatively stable for 10.4 ~ 10.6.
//
STATIC CONST UINT8 mEntryBytes[] = {
0x66, 0x8C, 0xDB, ///< mov bx, ds
0x8E, 0xC3, ///< mov es, ebx
0x89, 0xC5, ///< mov ebp, eax
};
Offset = 0;
if (BootCompat->KernelState.RelocationBlock != 0) {
Found = FindPattern (
mEntryBytes,
NULL,
sizeof (mEntryBytes),
(VOID *)(UINTN)BootCompat->KernelState.RelocationBlock,
BootCompat->KernelState.RelocationBlockUsed,
&Offset
);
} else {
Found = FindPattern (
mEntryBytes,
NULL,
sizeof (mEntryBytes),
(VOID *)(UINTN)KERNEL_BASE_PADDR,
BASE_2MB,
&Offset
);
}
if (!Found) {
RUNTIME_DEBUG ((DEBUG_ERROR, "OCABC: No 32-bit kernel entry!\n"));
CpuDeadLoop ();
}
KernelEntry = (VOID *)(UINTN)(KERNEL_BASE_PADDR + Offset);
KernelEntry[0] = 0xE8; ///< call
Offset = (UINTN)((UINTN)AsmAppleMapPrepareKernelState32 - (UINTN)KernelEntry - 5);
CopyMem (&KernelEntry[1], &Offset, sizeof (UINT32));
}
UINTN
EFIAPI
AppleMapPrepareKernelState32 (
IN UINTN Args
)
{
BOOT_COMPAT_CONTEXT *BootCompat;
BootCompat = GetBootCompatContext ();
if (BootCompat->ServiceState.AppleHibernateWake) {
//
// TODO: This is not really implemented.
//
AppleMapPrepareForHibernateWake (
BootCompat,
Args
);
} else {
AppleMapPrepareForBooting (
BootCompat,
(VOID *)Args
);
}
if (BootCompat->KernelState.RelocationBlock != 0) {
Args -= (UINTN)(BootCompat->KernelState.RelocationBlock - KERNEL_BASE_PADDR);
//
// FIXME: This should be done via trampoline as we may overwrite ourselves.
// See RelocationCallGate.nasm for more details.
//
CopyMem (
(VOID *)(UINTN)KERNEL_BASE_PADDR,
(VOID *)(UINTN)BootCompat->KernelState.RelocationBlock,
BootCompat->KernelState.RelocationBlockUsed
);
}
return Args;
}
;------------------------------------------------------------------------------
; @file
; Copyright (C) 2024, vit9696. All rights reserved.
;
; All rights reserved.
;
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;------------------------------------------------------------------------------
BITS 32
DEFAULT REL
SECTION .text
extern ASM_PFX(AppleMapPrepareKernelState32)
align 8
global ASM_PFX(AsmAppleMapPrepareKernelState32)
ASM_PFX(AsmAppleMapPrepareKernelState32):
; Pass kernel arguments as an argument.
; EDK II does not seem to align stack by more than 4 bytes.
push eax
; Call our C wrapper.
call ASM_PFX(AppleMapPrepareKernelState32)
; Restore stack pointer for ret function.
; We might have updated eax via return for relocation block.
add esp, 4
; Execute overwritten instructions by a jump to our asm handler.
mov bx, ds
mov es, ebx
; Return to kernel.
ret
......@@ -321,13 +321,6 @@ RestoreProtectedRtMemoryTypes (
}
}
/**
Prepare environment for normal booting. Called when boot.efi jumps to kernel.
@param[in,out] BootCompat Boot compatibility context.
@param[in,out] BootArgs Apple kernel boot arguments.
**/
STATIC
VOID
AppleMapPrepareForBooting (
IN OUT BOOT_COMPAT_CONTEXT *BootCompat,
......@@ -439,13 +432,6 @@ AppleMapPrepareForBooting (
}
}
/**
Prepare environment for hibernate wake. Called when boot.efi jumps to kernel.
@param[in,out] BootCompat Boot compatibility context.
@param[in,out] ImageHeaderPage Apple hibernate image page number.
**/
STATIC
VOID
AppleMapPrepareForHibernateWake (
IN OUT BOOT_COMPAT_CONTEXT *BootCompat,
......@@ -618,66 +604,6 @@ AppleMapPrepareBooterState (
}
}
VOID
AppleMapPrepareKernelJump (
IN OUT BOOT_COMPAT_CONTEXT *BootCompat,
IN EFI_PHYSICAL_ADDRESS CallGate,
IN UINTN HookAddress
)
{
CALL_GATE_JUMP *CallGateJump;
//
// There is no reason to patch the kernel when we do not need it.
//
if ( !BootCompat->Settings.AvoidRuntimeDefrag
&& !BootCompat->Settings.DiscardHibernateMap
&& !BootCompat->Settings.AllowRelocationBlock
&& !BootCompat->Settings.DisableSingleUser
&& !BootCompat->Settings.ForceBooterSignature)
{
return;
}
#ifndef MDE_CPU_X64
RUNTIME_DEBUG ((DEBUG_ERROR, "OCABC: Kernel trampolines are unsupported for non-X64\n"));
CpuDeadLoop ();
#endif
//
// Check whether we have address and abort if not.
//
if (CallGate == 0) {
RUNTIME_DEBUG ((DEBUG_ERROR, "OCABC: Failed to find call gate address\n"));
return;
}
CallGateJump = (VOID *)(UINTN)CallGate;
//
// Move call gate jump bytes front.
// Performing this on the EfiBootRt KCG may bork the binary, but right now
// only corrupts an unused string.
//
CopyMem (
CallGateJump + 1,
CallGateJump,
ESTIMATED_CALL_GATE_SIZE
);
//
// lea r8, [rip+XXX]
// Passes KCG as third argument to be relocatable. macOS 13 Developer Beta 1
// copies the KCG into a separately allocated buffer.
//
CallGateJump->LeaRip.Command[0] = 0x4C;
CallGateJump->LeaRip.Command[1] = 0x8D;
CallGateJump->LeaRip.Command[2] = 0x05;
CallGateJump->LeaRip.Argument = sizeof (*CallGateJump) - sizeof (CallGateJump->LeaRip);
CallGateJump->Jmp.Command = 0x25FF;
CallGateJump->Jmp.Argument = 0x0;
CallGateJump->Jmp.Address = HookAddress;
}
EFI_STATUS
AppleMapPrepareMemState (
IN OUT BOOT_COMPAT_CONTEXT *BootCompat,
......@@ -758,76 +684,3 @@ AppleMapPrepareMemState (
return Status;
}
UINTN
EFIAPI
AppleMapPrepareKernelStateWorker (
IN UINTN *Args,
IN UINTN EntryPoint,
IN KERNEL_CALL_GATE CallGate,
IN UINTN *Arg1,
IN UINTN Arg2
)
{
BOOT_COMPAT_CONTEXT *BootCompatContext;
BootCompatContext = GetBootCompatContext ();
if (BootCompatContext->ServiceState.AppleHibernateWake) {
AppleMapPrepareForHibernateWake (
BootCompatContext,
*Args
);
} else {
AppleMapPrepareForBooting (
BootCompatContext,
(VOID *)*Args
);
}
if (BootCompatContext->KernelState.RelocationBlock != 0) {
AppleRelocationCallGate (
Args,
BootCompatContext,
CallGate,
Arg1,
Arg2
);
}
return CallGate (*Arg1, Arg2);
}
EFI_STATUS
EFIAPI
AppleMapPrepareKernelStateNew (
IN UINTN SystemTable,
IN OUT APPLE_EFI_BOOT_RT_KCG_ARGS *KcgArguments,
IN KERNEL_CALL_GATE CallGate
)
{
return AppleMapPrepareKernelStateWorker (
&KcgArguments->Args,
KcgArguments->EntryPoint,
CallGate,
&SystemTable,
(UINTN)KcgArguments
);
}
UINTN
EFIAPI
AppleMapPrepareKernelStateOld (
IN UINTN Args,
IN UINTN EntryPoint,
IN KERNEL_CALL_GATE CallGate
)
{
return AppleMapPrepareKernelStateWorker (
&Args,
EntryPoint,
CallGate,
&Args,
EntryPoint
);
}
......@@ -39,6 +39,13 @@
RelocationCallGate.h
ServiceOverrides.c
[Sources.Ia32]
Ia32/KernelSupport32.c
Ia32/KernelTrampoline.nasm
[Sources.X64]
X64/KernelSupport64.c
[Packages]
MdePkg/MdePkg.dec
OpenCorePkg/OpenCorePkg.dec
......
......@@ -375,7 +375,7 @@ AppleRelocationRebase (
}
VOID
AppleRelocationCallGate (
AppleRelocationCallGate64 (
IN OUT UINTN *Args,
IN BOOT_COMPAT_CONTEXT *BootCompat,
IN KERNEL_CALL_GATE CallGate,
......
......@@ -906,6 +906,8 @@ InternalIsEfiBootRt (
return TRUE;
}
#ifdef MDE_CPU_X64
/*
Retrieves the offset of the kernel call gate in EfiBootRt.
......@@ -1016,6 +1018,8 @@ InternalEfiBootRtGetKcgOffset (
return KcgOffset;
}
#endif
/**
UEFI Boot Services LoadImage override. Called to load an efi image.
If this is bootrt.efi, then we patch its kernel call gate.
......@@ -1032,13 +1036,8 @@ OcLoadImage (
OUT EFI_HANDLE *ImageHandle
)
{
EFI_STATUS LoadImageStatus;
EFI_STATUS Status;
BOOLEAN IsEfiBootRt;
BOOT_COMPAT_CONTEXT *BootCompat;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
UINTN KcgOffset;
UINTN KcgSize;
BOOLEAN IsEfiBootRt;
BOOT_COMPAT_CONTEXT *BootCompat;
BootCompat = GetBootCompatContext ();
......@@ -1084,6 +1083,13 @@ OcLoadImage (
);
}
#if defined (MDE_CPU_X64)
EFI_STATUS LoadImageStatus;
EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
UINTN KcgOffset;
UINTN KcgSize;
LoadImageStatus = OcImageLoaderLoad (
BootPolicy,
ParentImageHandle,
......@@ -1130,10 +1136,10 @@ OcLoadImage (
//
// Patch the EfiBootRt kernel call gate.
//
AppleMapPrepareKernelJump (
AppleMapPrepareKernelJump64 (
BootCompat,
(UINTN)LoadedImage->ImageBase + KcgOffset,
(UINTN)AppleMapPrepareKernelStateNew
(UINTN)AppleMapPrepareKernelStateNew64
);
DEBUG ((
......@@ -1143,6 +1149,12 @@ OcLoadImage (
));
return LoadImageStatus;
#elif defined (MDE_CPU_IA32)
//
// Something is completely borked if we are here in 32-bit mode.
//
return EFI_INVALID_PARAMETER;
#endif
}
/**
......@@ -1430,11 +1442,15 @@ OcExitBootServices (
return Status;
}
AppleMapPrepareKernelJump (
#ifdef MDE_CPU_IA32
AppleMapPrepareKernelJump32 (BootCompat);
#elif defined (MDE_CPU_X64)
AppleMapPrepareKernelJump64 (
BootCompat,
(UINTN)BootCompat->ServiceState.OldKernelCallGate,
(UINTN)AppleMapPrepareKernelStateOld
(UINTN)AppleMapPrepareKernelStateOld64
);
#endif
return Status;
}
......
/** @file
Copyright (C) 2019-2024, vit9696. All rights reserved.
All rights reserved.
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "../BootCompatInternal.h"
#include <Guid/OcVariable.h>
#include <IndustryStandard/AppleHibernate.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/OcBootManagementLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/OcDeviceTreeLib.h>
#include <Library/OcMachoLib.h>
#include <Library/OcMemoryLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcStringLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
VOID
AppleMapPrepareKernelJump64 (
IN OUT BOOT_COMPAT_CONTEXT *BootCompat,
IN EFI_PHYSICAL_ADDRESS CallGate,
IN UINTN HookAddress
)
{
CALL_GATE_JUMP *CallGateJump;
//
// There is no reason to patch the kernel when we do not need it.
//
if ( !BootCompat->Settings.AvoidRuntimeDefrag
&& !BootCompat->Settings.DiscardHibernateMap
&& !BootCompat->Settings.AllowRelocationBlock
&& !BootCompat->Settings.DisableSingleUser
&& !BootCompat->Settings.ForceBooterSignature)
{
return;
}
//
// Check whether we have address and abort if not.
//
if (CallGate == 0) {
RUNTIME_DEBUG ((DEBUG_ERROR, "OCABC: Failed to find call gate address\n"));
return;
}
CallGateJump = (VOID *)(UINTN)CallGate;
//
// Move call gate jump bytes front.
// Performing this on the EfiBootRt KCG may bork the binary, but right now
// only corrupts an unused string.
//
CopyMem (
CallGateJump + 1,
CallGateJump,
ESTIMATED_CALL_GATE_SIZE
);
//
// lea r8, [rip+XXX]
// Passes KCG as third argument to be relocatable. macOS 13 Developer Beta 1
// copies the KCG into a separately allocated buffer.
//
CallGateJump->LeaRip.Command[0] = 0x4C;
CallGateJump->LeaRip.Command[1] = 0x8D;
CallGateJump->LeaRip.Command[2] = 0x05;
CallGateJump->LeaRip.Argument = sizeof (*CallGateJump) - sizeof (CallGateJump->LeaRip);
CallGateJump->Jmp.Command = 0x25FF;
CallGateJump->Jmp.Argument = 0x0;
CallGateJump->Jmp.Address = HookAddress;
}
STATIC
UINTN
EFIAPI
AppleMapPrepareKernelStateWorker64 (
IN UINTN *Args,
IN UINTN EntryPoint,
IN KERNEL_CALL_GATE CallGate,
IN UINTN *Arg1,
IN UINTN Arg2
)
{
BOOT_COMPAT_CONTEXT *BootCompatContext;
BootCompatContext = GetBootCompatContext ();
if (BootCompatContext->ServiceState.AppleHibernateWake) {
AppleMapPrepareForHibernateWake (
BootCompatContext,
*Args
);
} else {
AppleMapPrepareForBooting (
BootCompatContext,
(VOID *)*Args
);
}
if (BootCompatContext->KernelState.RelocationBlock != 0) {
//
// Does not return.
//
AppleRelocationCallGate64 (
Args,
BootCompatContext,
CallGate,
Arg1,
Arg2
);
}
return CallGate (*Arg1, Arg2);
}
EFI_STATUS
EFIAPI
AppleMapPrepareKernelStateNew64 (
IN UINTN SystemTable,
IN OUT APPLE_EFI_BOOT_RT_KCG_ARGS *KcgArguments,
IN KERNEL_CALL_GATE CallGate
)
{
return AppleMapPrepareKernelStateWorker64 (
&KcgArguments->Args,
KcgArguments->EntryPoint,
CallGate,
&SystemTable,
(UINTN)KcgArguments
);
}
UINTN
EFIAPI
AppleMapPrepareKernelStateOld64 (
IN UINTN Args,
IN UINTN EntryPoint,
IN KERNEL_CALL_GATE CallGate
)
{
return AppleMapPrepareKernelStateWorker64 (
&Args,
EntryPoint,
CallGate,
&Args,
EntryPoint
);
}
......@@ -80,13 +80,8 @@ endif
ifeq ($(DIST),Darwin)
ifneq ($(FUZZ),1)
ifeq ($(UDK_ARCH),Ia32)
CFLAGS += -mmacosx-version-min=10.6 --target=i386-apple-darwin
LDFLAGS += -mmacosx-version-min=10.6 --target=i386-apple-darwin
else
CFLAGS += -mmacosx-version-min=10.6 --target=x86_64-apple-darwin
LDFLAGS += -mmacosx-version-min=10.6 --target=x86_64-apple-darwin
endif
CFLAGS += -mmacosx-version-min=10.9 -arch x86_64 -arch arm64
LDFLAGS += -mmacosx-version-min=10.9 -arch x86_64 -arch arm64
endif
endif
......
......@@ -5,7 +5,7 @@ RM ?= /bin/rm
DIST ?= $(shell uname)
ifeq ($(DIST),Darwin)
CFLAGS+=-mmacosx-version-min=10.6
CFLAGS += -arch x86_64 -arch arm64 -mmacosx-version-min=10.9
endif
BINDIR=bin.$(DIST)
......
......@@ -16,6 +16,14 @@ libressl/lib/libcrypto.a:
$(OUT_DIR)/$(PROJECT).o: libressl/lib/libcrypto.a
endif
CFLAGS += -Ilibressl/include -I/usr/local/opt/openssl/include -I/opt/local/include -Wno-deprecated-declarations
LDFLAGS += -Llibressl/lib -L/usr/local/opt/openssl/lib -L/opt/local/lib
ifeq ($(DIST),Darwin)
ifeq ($(shell uname -p),arm)
OPENSSL_PATH = /opt/homebrew/opt/openssl
else
OPENSSL_PATH = /usr/local/opt/openssl
endif
endif
CFLAGS += -Ilibressl/include -I$(OPENSSL_PATH)/include -I/opt/local/include -Wno-deprecated-declarations
LDFLAGS += -Llibressl/lib -L$(OPENSSL_PATH)/lib -L/opt/local/lib
LDLIBS += -lcrypto
......@@ -11,8 +11,8 @@ cd "$SRC_DIR" || exit 1
OUTPUT_PATH="$(pwd)/libressl"
BUILD_DIR="$(pwd)/tmp/${LIBRESSL_NAME}/build"
export CFLAGS="-mmacosx-version-min=10.6 -Wno-unguarded-availability-new"
export LDFLAGS="-mmacosx-version-min=10.6"
export CFLAGS="-arch x86_64 -arch arm64 -mmacosx-version-min=10.9 -Wno-unguarded-availability-new"
export LDFLAGS="-arch x86_64 -arch arm64 -mmacosx-version-min=10.9"
abort() {
echo "ERROR: $1!"
......@@ -69,14 +69,7 @@ echo "Downloading LibreSSL ${LIBRESSL_VERSION}..."
cd "${LIBRESSL_NAME}" || abort "Failed to cd to ${LIBRESSL_NAME} with code $?"
if [ "$(${ARCH})" = "arm64" ]; then
# If we are building on arm64 (Apple Silicon), these extra options are required to ensure x86_64 builds.
EXTRA_OPTS=(--host=arm-apple-darwin --build=x86_64-apple-darwin)
CFLAGS+=" --target=x86_64-apple-darwin"
LDFLAGS+=" --target=x86_64-apple-darwin"
else
EXTRA_OPTS=()
fi
EXTRA_OPTS=()
# Monkeypatch to disable strtonum for <11.0 support
"${SED}" -i '' -E 's/strsep strtonum/strsep/g' configure || abort "Failed to monkeypatch strtonum in LibreSSL with code $?"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册