提交 18a231ee 编写于 作者: J John Davis

OcAppleKernelLib: Inject only current arch during cacheless boot

上级 e7ad34e1
......@@ -11,6 +11,7 @@ OpenCore Changelog
- Removed default codec connection delay from AudioDxe
- Added optional `--codec-setup-delay` argument to AudioDxe
- Changed units of `Audio` -> `SetupDelay` from microseconds to milliseconds (divide previous value by 1000 if using this setting)
- Fixed incorrect FAT binary slice being selected under macOS 10.4.11 when performing a cacheless boot
#### v0.8.2
- Fixed `AppleCpuPmCfgLock` on macOS 13
......
......@@ -1307,7 +1307,7 @@ CachelessContextAddKext (
IN OUT CACHELESS_CONTEXT *Context,
IN CONST CHAR8 *InfoPlist,
IN UINT32 InfoPlistSize,
IN CONST UINT8 *Executable OPTIONAL,
IN UINT8 *Executable OPTIONAL,
IN UINT32 ExecutableSize OPTIONAL,
OUT CHAR8 BundleVersion[MAX_INFO_BUNDLE_VERSION_KEY_SIZE] OPTIONAL
);
......
......@@ -27,6 +27,7 @@
#include <Library/OcVirtualFsLib.h>
#include "CachelessInternal.h"
#include "MkextInternal.h"
#include "PrelinkedInternal.h"
STATIC
......@@ -807,7 +808,7 @@ CachelessContextAddKext (
IN OUT CACHELESS_CONTEXT *Context,
IN CONST CHAR8 *InfoPlist,
IN UINT32 InfoPlistSize,
IN CONST UINT8 *Executable OPTIONAL,
IN UINT8 *Executable OPTIONAL,
IN UINT32 ExecutableSize OPTIONAL,
OUT CHAR8 BundleVersion[MAX_INFO_BUNDLE_VERSION_KEY_SIZE] OPTIONAL
)
......@@ -1031,6 +1032,17 @@ CachelessContextAddKext (
//
ASSERT (NewKext->BinaryFileName != NULL);
//
// Use only the binary for the current arch.
// Some versions of macOS 10.4 may incorrectly chose the 64-bit slice
// despite 32-bit being the only supported Intel architecture.
//
if (!InternalParseKextBinary (&Executable, &ExecutableSize, Context->Is32Bit)) {
FreePool (NewKext->PlistData);
FreePool (NewKext);
return EFI_INVALID_PARAMETER;
}
NewKext->BinaryData = AllocateCopyPool (ExecutableSize, Executable);
if (NewKext->BinaryData == NULL) {
if (NewKext->BinaryFileName != NULL) {
......
......@@ -32,9 +32,8 @@
//
#define MKEXT_ALIGN(a) (ALIGN_VALUE (a, sizeof (UINT64)))
STATIC
BOOLEAN
ParseKextBinary (
InternalParseKextBinary (
IN OUT UINT8 **Buffer,
IN OUT UINT32 *BufferSize,
IN BOOLEAN Is32Bit
......@@ -1363,7 +1362,7 @@ MkextInjectKext (
ASSERT (ExecutableSize > 0);
BinOffset = MkextNewSize;
if (!ParseKextBinary (&Executable, &ExecutableSize, Context->Is32Bit)) {
if (!InternalParseKextBinary (&Executable, &ExecutableSize, Context->Is32Bit)) {
return EFI_INVALID_PARAMETER;
}
......@@ -1412,7 +1411,7 @@ MkextInjectKext (
ASSERT (ExecutableSize > 0);
BinOffset = PlistOffset;
if (!ParseKextBinary (&Executable, &ExecutableSize, Context->Is32Bit)) {
if (!InternalParseKextBinary (&Executable, &ExecutableSize, Context->Is32Bit)) {
XmlDocumentFree (PlistXml);
FreePool (PlistBuffer);
return EFI_INVALID_PARAMETER;
......
......@@ -68,4 +68,11 @@ InternalCachedMkextKext (
IN CONST CHAR8 *BundleId
);
BOOLEAN
InternalParseKextBinary (
IN OUT UINT8 **Buffer,
IN OUT UINT32 *BufferSize,
IN BOOLEAN Is32Bit
);
#endif // MKEXT_INTERNAL_H
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册