提交 802dcdbf 编写于 作者: V vit9696

OcAppleKernelLib: Fix arg order for OcKernelLoadKextsAndReserve

上级 6aac3a2c
......@@ -67,6 +67,7 @@ PatcherInitContextFromBuffer (
//
if (!MachoInitializeContext (&Context->MachContext, Buffer, BufferSize, 0)) {
DEBUG ((DEBUG_INFO, "OCAK: Patcher init from buffer %p %u has unsupported mach-o\n", Buffer, BufferSize));
return EFI_INVALID_PARAMETER;
}
......
......@@ -212,6 +212,13 @@ InternalConnectExternalSymtab (
"__TEXT_EXEC"
);
if (Segment == NULL || Segment->VirtualAddress < Segment->FileOffset) {
DEBUG ((
DEBUG_INFO,
"OCAK: KC symtab failed locating inner %Lx %Lx (%d)\n",
Segment != NULL ? Segment->VirtualAddress : 0,
Segment != NULL ? Segment->FileOffset : 0,
Segment != NULL
));
return EFI_INVALID_PARAMETER;
}
......@@ -220,10 +227,22 @@ InternalConnectExternalSymtab (
&Buffer[Segment->FileOffset],
(UINT32) (BufferSize - Segment->FileOffset),
(UINT32) Segment->FileOffset)) {
DEBUG ((
DEBUG_INFO,
"OCAK: KC symtab failed initialising inner %Lx %x\n",
Segment->FileOffset,
BufferSize
));
return EFI_INVALID_PARAMETER;
}
if (!MachoInitialiseSymtabsExternal64 (Context, InnerContext)) {
DEBUG ((
DEBUG_INFO,
"OCAK: KC symtab failed getting symtab from inner %Lx %x\n",
Segment->FileOffset,
BufferSize
));
return EFI_INVALID_PARAMETER;
}
}
......@@ -559,7 +578,20 @@ PrelinkedInjectPrepare (
SegmentEndOffset = Context->PrelinkedInfoSegment->FileOffset + Context->PrelinkedInfoSegment->FileSize;
if (MACHO_ALIGN (SegmentEndOffset) == Context->PrelinkedSize) {
DEBUG ((
DEBUG_INFO,
"OCAK: Reducing prelink size from %X to %X via plist\n",
Context->PrelinkedSize,
(UINT32) MACHO_ALIGN (Context->PrelinkedInfoSegment->FileOffset)
));
Context->PrelinkedSize = (UINT32) MACHO_ALIGN (Context->PrelinkedInfoSegment->FileOffset);
} else {
DEBUG ((
DEBUG_INFO,
"OCAK:Leaving unchanged prelink size %X due to %LX plist\n",
Context->PrelinkedSize,
SegmentEndOffset
));
}
Context->PrelinkedInfoSegment->VirtualAddress = 0;
......
......@@ -320,8 +320,8 @@ OcKernelLoadKextsAndReserve (
DEBUG ((
DEBUG_INFO,
"OC: Kext reservation size %u\n",
*ReservedInfoSize + *ReservedExeSize
"OC: Kext reservation size info %X exe %X\n",
*ReservedInfoSize, *ReservedExeSize
));
return EFI_SUCCESS;
}
......@@ -694,6 +694,14 @@ OcKernelProcessPrelinked (
));
}
DEBUG ((
DEBUG_INFO,
"OC: Prelink size %u kext offset %u reserved %u\n",
Context.PrelinkedSize,
Context.KextsFileOffset,
ReservedExeSize
));
ASSERT (Context.PrelinkedSize - Context.KextsFileOffset <= ReservedExeSize);
Status = PrelinkedInjectComplete (&Context);
......@@ -764,8 +772,8 @@ OcKernelFileOpen (
OcKernelLoadKextsAndReserve (
mOcStorage,
mOcConfiguration,
&ReservedInfoSize,
&ReservedExeSize
&ReservedExeSize,
&ReservedInfoSize
);
LinkedExpansion = KcGetSegmentFixupChainsSize (ReservedExeSize);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册