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

OcAppleKernelLib: Fix arg order for OcKernelLoadKextsAndReserve

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