提交 c2ca9ac6 编写于 作者: G Goldfish64

OpenCoreKernel: Use new function for virtual kernel

上级 f545a348
......@@ -652,13 +652,13 @@ CreateVirtualFileFileNameCopy (
FileNameCopy = AllocateCopyPool (StrSize (FileName), FileName);
if (FileNameCopy == NULL) {
DEBUG ((DEBUG_WARN, "OCVFS: Failed to allocate file name (%a) copy\n", FileName));
DEBUG ((DEBUG_WARN, "OCVFS: Failed to allocate file name (%s) copy\n", FileName));
return EFI_OUT_OF_RESOURCES;
}
Status = CreateVirtualFile (FileNameCopy, FileBuffer, FileSize, ModificationTime, File);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "OCVFS: Failed to virtualise file (%a)\n", FileName));
DEBUG ((DEBUG_WARN, "OCVFS: Failed to virtualise file (%s)\n", FileName));
FreePool (FileNameCopy);
return EFI_OUT_OF_RESOURCES;
}
......
......@@ -825,7 +825,6 @@ OcKernelFileOpen (
UINT8 *Kernel;
UINT32 KernelSize;
UINT32 AllocatedSize;
CHAR16 *FileNameCopy;
EFI_FILE_PROTOCOL *VirtualFileHandle;
EFI_STATUS PrelinkedStatus;
EFI_TIME ModificationTime;
......@@ -974,20 +973,12 @@ OcKernelFileOpen (
(*NewHandle)->Close(*NewHandle);
//
// This was our file, yet firmware is dying.
// Virtualise newly created kernel.
//
FileNameCopy = AllocateCopyPool (StrSize (FileName), FileName);
if (FileNameCopy == NULL) {
DEBUG ((DEBUG_WARN, "OC: Failed to allocate kernel name (%a) copy\n", FileName));
FreePool (Kernel);
return EFI_OUT_OF_RESOURCES;
}
Status = CreateVirtualFile (FileNameCopy, Kernel, KernelSize, &ModificationTime, &VirtualFileHandle);
Status = CreateVirtualFileFileNameCopy (FileName, Kernel, KernelSize, &ModificationTime, &VirtualFileHandle);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "OC: Failed to virtualise kernel file (%a)\n", FileName));
DEBUG ((DEBUG_WARN, "OC: Failed to virtualise kernel file (%s) - %r\n", FileName, Status));
FreePool (Kernel);
FreePool (FileNameCopy);
return EFI_OUT_OF_RESOURCES;
}
......@@ -1059,9 +1050,12 @@ OcKernelFileOpen (
(*NewHandle)->Close(*NewHandle);
//
// Virtualise newly created mkext.
//
Status = CreateVirtualFileFileNameCopy (FileName, Kernel, KernelSize, &ModificationTime, &VirtualFileHandle);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "OC: Failed to virtualise mkext file (%a) - %r\n", FileName, Status));
DEBUG ((DEBUG_WARN, "OC: Failed to virtualise mkext file (%s) - %r\n", FileName, Status));
FreePool (Kernel);
return EFI_OUT_OF_RESOURCES;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册