Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
OpenCorePKG_MOD
提交
2462e02d
O
OpenCorePKG_MOD
项目概览
btwise
/
OpenCorePKG_MOD
通知
26
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OpenCorePKG_MOD
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
2462e02d
编写于
4月 16, 2024
作者:
M
Mike Beaton
提交者:
GitHub
4月 16, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OpenDuet: Add missing DxeCore ImageContext HOB (#533)
上级
e5b02f13
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
117 addition
and
98 deletion
+117
-98
Include/Duet/EfiLdrHandoff.h
Include/Duet/EfiLdrHandoff.h
+11
-9
Legacy/BootPlatform/DxeIpl/DxeInit.c
Legacy/BootPlatform/DxeIpl/DxeInit.c
+2
-1
Legacy/BootPlatform/DxeIpl/HobGeneration.c
Legacy/BootPlatform/DxeIpl/HobGeneration.c
+59
-10
Legacy/BootPlatform/DxeIpl/HobGeneration.h
Legacy/BootPlatform/DxeIpl/HobGeneration.h
+19
-3
Legacy/BootPlatform/EfiLdr/EfiLdr.h
Legacy/BootPlatform/EfiLdr/EfiLdr.h
+6
-5
Legacy/BootPlatform/EfiLdr/EfiLdr.inf
Legacy/BootPlatform/EfiLdr/EfiLdr.inf
+0
-1
Legacy/BootPlatform/EfiLdr/EfiLdrHandoff.h
Legacy/BootPlatform/EfiLdr/EfiLdrHandoff.h
+0
-56
Legacy/BootPlatform/EfiLdr/EfiLoader.c
Legacy/BootPlatform/EfiLdr/EfiLoader.c
+4
-2
Legacy/BootPlatform/EfiLdr/PeLoader.c
Legacy/BootPlatform/EfiLdr/PeLoader.c
+16
-11
未找到文件。
Include/Duet/EfiLdrHandoff.h
浏览文件 @
2462e02d
...
...
@@ -23,6 +23,7 @@ Revision History:
#include <Base.h>
#include <Uefi.h>
#include <Library/UefiImageLib.h>
#define EFILDR_BASE_SEGMENT 0x2000
#define EFILDR_LOAD_ADDRESS (EFILDR_BASE_SEGMENT << 4)
...
...
@@ -31,15 +32,16 @@ Revision History:
#define EFILDR_CB_VA 0x00
typedef
struct
_EFILDRHANDOFF
{
UINTN
MemDescCount
;
EFI_MEMORY_DESCRIPTOR
*
MemDesc
;
VOID
*
BfvBase
;
UINTN
BfvSize
;
VOID
*
DxeIplImageBase
;
UINTN
DxeIplImageSize
;
VOID
*
DxeCoreImageBase
;
UINTN
DxeCoreImageSize
;
VOID
*
DxeCoreEntryPoint
;
UINTN
MemDescCount
;
EFI_MEMORY_DESCRIPTOR
*
MemDesc
;
VOID
*
BfvBase
;
UINTN
BfvSize
;
VOID
*
DxeIplImageBase
;
UINTN
DxeIplImageSize
;
VOID
*
DxeCoreImageBase
;
UINTN
DxeCoreImageSize
;
VOID
*
DxeCoreEntryPoint
;
UEFI_IMAGE_LOADER_IMAGE_CONTEXT
DxeCoreImageContext
;
}
EFILDRHANDOFF
;
typedef
struct
{
...
...
Legacy/BootPlatform/DxeIpl/DxeInit.c
浏览文件 @
2462e02d
...
...
@@ -180,7 +180,8 @@ Returns:
PrepareHobDxeCore
(
Handoff
->
DxeCoreEntryPoint
,
(
EFI_PHYSICAL_ADDRESS
)(
UINTN
)
Handoff
->
DxeCoreImageBase
,
(
UINTN
)
Handoff
->
DxeIplImageBase
+
(
UINTN
)
Handoff
->
DxeIplImageSize
-
(
UINTN
)
Handoff
->
DxeCoreImageBase
(
UINTN
)
Handoff
->
DxeIplImageBase
+
(
UINTN
)
Handoff
->
DxeIplImageSize
-
(
UINTN
)
Handoff
->
DxeCoreImageBase
,
&
Handoff
->
DxeCoreImageContext
);
PrepareHobLegacyTable
(
gHob
);
...
...
Legacy/BootPlatform/DxeIpl/HobGeneration.c
浏览文件 @
2462e02d
...
...
@@ -207,12 +207,26 @@ HOB_TEMPLATE gHobTemplate = {
0x0
,
// PhysicalStart
0
// ResourceLength
},
{
// ImageContextDxeCore
{
{
EFI_HOB_TYPE_GUID_EXTENSION
,
// Hob type
sizeof
(
IMAGE_CONTEXT_HOB
),
// Hob size
0
,
// Reserved
},
UEFI_IMAGE_LOADER_IMAGE_CONTEXT_GUID
},
{
0
,
// FormatIndex
{
.
Ue
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
}
// Ctx.Ue
}
},
{
// Memory Map Hints to reduce fragmentation in the memory map
{
{
EFI_HOB_TYPE_GUID_EXTENSION
,
// Hob type
sizeof
(
MEMORY_TYPE_INFORMATION_HOB
),
// Hob size
0
,
//
r
eserved
0
,
//
R
eserved
},
EFI_MEMORY_TYPE_INFORMATION_GUID
},
...
...
@@ -297,7 +311,7 @@ HOB_TEMPLATE gHobTemplate = {
{
EFI_HOB_TYPE_GUID_EXTENSION
,
// Hob type
sizeof
(
TABLE_HOB
),
// Hob size
0
,
// r
eserved
0
// R
eserved
},
EFI_MPS_TABLE_GUID
},
...
...
@@ -308,35 +322,35 @@ HOB_TEMPLATE gHobTemplate = {
{ // Pointer to FlushInstructionCache
EFI_HOB_TYPE_GUID_EXTENSION, // Hob type
sizeof (PROTOCOL_HOB), // Hob size
0, //
r
eserved
0, //
R
eserved
EFI_PEI_FLUSH_INSTRUCTION_CACHE_GUID,
NULL
},
{ // Pointer to TransferControl
EFI_HOB_TYPE_GUID_EXTENSION, // Hob type
sizeof (PROTOCOL_HOB), // Hob size
0, //
r
eserved
0, //
R
eserved
EFI_PEI_TRANSFER_CONTROL_GUID,
NULL
},
{ // Pointer to PeCoffLoader
EFI_HOB_TYPE_GUID_EXTENSION, // Hob type
sizeof (PROTOCOL_HOB), // Hob size
0, //
r
eserved
0, //
R
eserved
EFI_PEI_PE_COFF_LOADER_GUID,
NULL
},
{ // Pointer to EfiDecompress
EFI_HOB_TYPE_GUID_EXTENSION, // Hob type
sizeof (PROTOCOL_HOB), // Hob size
0, //
r
eserved
0, //
R
eserved
EFI_DECOMPRESS_PROTOCOL_GUID,
NULL
},
{ // Pointer to TianoDecompress
EFI_HOB_TYPE_GUID_EXTENSION, // Hob type
sizeof (PROTOCOL_HOB), // Hob size
0, //
r
eserved
0, //
R
eserved
EFI_TIANO_DECOMPRESS_PROTOCOL_GUID,
NULL
},
...
...
@@ -754,17 +768,52 @@ PrepareHobBfv (
VOID
PrepareHobDxeCore
(
VOID
*
DxeCoreEntryPoint
,
EFI_PHYSICAL_ADDRESS
DxeCoreImageBase
,
UINT64
DxeCoreLength
VOID
*
DxeCoreEntryPoint
,
EFI_PHYSICAL_ADDRESS
DxeCoreImageBase
,
UINT64
DxeCoreLength
,
UEFI_IMAGE_LOADER_IMAGE_CONTEXT
*
ImageContext
)
{
HOB_IMAGE_CONTEXT
*
Hob
;
gHob
->
DxeCore
.
MemoryAllocationHeader
.
MemoryBaseAddress
=
DxeCoreImageBase
;
gHob
->
DxeCore
.
MemoryAllocationHeader
.
MemoryLength
=
DxeCoreLength
;
gHob
->
DxeCore
.
EntryPoint
=
(
EFI_PHYSICAL_ADDRESS
)(
UINTN
)
DxeCoreEntryPoint
;
gHob
->
MemoryDxeCore
.
PhysicalStart
=
DxeCoreImageBase
;
gHob
->
MemoryDxeCore
.
ResourceLength
=
DxeCoreLength
;
Hob
=
&
gHob
->
ImageContextDxeCore
.
ImageContext
;
Hob
->
FormatIndex
=
ImageContext
->
FormatIndex
;
if
(
Hob
->
FormatIndex
!=
UefiImageFormatUe
)
{
Hob
->
Ctx
.
Pe
.
ImageBuffer
=
(
UINT32
)(
UINTN
)
ImageContext
->
Ctx
.
Pe
.
ImageBuffer
;
Hob
->
Ctx
.
Pe
.
AddressOfEntryPoint
=
ImageContext
->
Ctx
.
Pe
.
AddressOfEntryPoint
;
Hob
->
Ctx
.
Pe
.
ImageType
=
ImageContext
->
Ctx
.
Pe
.
ImageType
;
Hob
->
Ctx
.
Pe
.
FileBuffer
=
(
UINT32
)(
UINTN
)
ImageContext
->
Ctx
.
Pe
.
FileBuffer
;
Hob
->
Ctx
.
Pe
.
ExeHdrOffset
=
ImageContext
->
Ctx
.
Pe
.
ExeHdrOffset
;
Hob
->
Ctx
.
Pe
.
SizeOfImage
=
ImageContext
->
Ctx
.
Pe
.
SizeOfImage
;
Hob
->
Ctx
.
Pe
.
FileSize
=
ImageContext
->
Ctx
.
Pe
.
FileSize
;
Hob
->
Ctx
.
Pe
.
Subsystem
=
ImageContext
->
Ctx
.
Pe
.
Subsystem
;
Hob
->
Ctx
.
Pe
.
SectionAlignment
=
ImageContext
->
Ctx
.
Pe
.
SectionAlignment
;
Hob
->
Ctx
.
Pe
.
SectionsOffset
=
ImageContext
->
Ctx
.
Pe
.
SectionsOffset
;
Hob
->
Ctx
.
Pe
.
NumberOfSections
=
ImageContext
->
Ctx
.
Pe
.
NumberOfSections
;
Hob
->
Ctx
.
Pe
.
SizeOfHeaders
=
ImageContext
->
Ctx
.
Pe
.
SizeOfHeaders
;
}
else
{
Hob
->
Ctx
.
Ue
.
ImageBuffer
=
(
UINT32
)(
UINTN
)
ImageContext
->
Ctx
.
Ue
.
ImageBuffer
;
Hob
->
Ctx
.
Ue
.
FileBuffer
=
(
UINT32
)(
UINTN
)
ImageContext
->
Ctx
.
Ue
.
FileBuffer
;
Hob
->
Ctx
.
Ue
.
EntryPointAddress
=
ImageContext
->
Ctx
.
Ue
.
EntryPointAddress
;
Hob
->
Ctx
.
Ue
.
LoadTablesFileOffset
=
ImageContext
->
Ctx
.
Ue
.
LoadTablesFileOffset
;
Hob
->
Ctx
.
Ue
.
NumLoadTables
=
ImageContext
->
Ctx
.
Ue
.
NumLoadTables
;
Hob
->
Ctx
.
Ue
.
LoadTables
=
(
UINT32
)(
UINTN
)
ImageContext
->
Ctx
.
Ue
.
LoadTables
;
Hob
->
Ctx
.
Ue
.
Segments
=
(
UINT32
)(
UINTN
)
ImageContext
->
Ctx
.
Ue
.
Segments
;
Hob
->
Ctx
.
Ue
.
LastSegmentIndex
=
ImageContext
->
Ctx
.
Ue
.
LastSegmentIndex
;
Hob
->
Ctx
.
Ue
.
SegmentAlignment
=
ImageContext
->
Ctx
.
Ue
.
SegmentAlignment
;
Hob
->
Ctx
.
Ue
.
ImageSize
=
ImageContext
->
Ctx
.
Ue
.
ImageSize
;
Hob
->
Ctx
.
Ue
.
Subsystem
=
ImageContext
->
Ctx
.
Ue
.
Subsystem
;
Hob
->
Ctx
.
Ue
.
SegmentImageInfoIterSize
=
ImageContext
->
Ctx
.
Ue
.
SegmentImageInfoIterSize
;
Hob
->
Ctx
.
Ue
.
SegmentsFileOffset
=
ImageContext
->
Ctx
.
Ue
.
SegmentsFileOffset
;
}
}
VOID
*
...
...
Legacy/BootPlatform/DxeIpl/HobGeneration.h
浏览文件 @
2462e02d
...
...
@@ -36,6 +36,20 @@ Revision History:
#pragma pack(1)
// FIXME: Move to audk
///
/// Identifies DxeCore ImageContext HOB
///
#define UEFI_IMAGE_LOADER_IMAGE_CONTEXT_GUID \
{ 0x05cc29cc, 0xfbdf, 0x4cc8, { 0x98, 0x25, 0x71, 0x76, 0x08, 0x5b, 0x05, 0x01 } }
////extern EFI_GUID gUefiImageLoaderImageContextGuid;
typedef
struct
{
EFI_HOB_GUID_TYPE
Hob
;
HOB_IMAGE_CONTEXT
ImageContext
;
}
IMAGE_CONTEXT_HOB
;
typedef
struct
{
EFI_HOB_GUID_TYPE
Hob
;
EFI_MEMORY_TYPE_INFORMATION
Info
[
10
];
...
...
@@ -79,6 +93,7 @@ typedef struct {
EFI_HOB_RESOURCE_DESCRIPTOR
MemoryAbove4GB
;
EFI_HOB_MEMORY_ALLOCATION_MODULE
DxeCore
;
EFI_HOB_RESOURCE_DESCRIPTOR
MemoryDxeCore
;
IMAGE_CONTEXT_HOB
ImageContextDxeCore
;
MEMORY_TYPE_INFORMATION_HOB
MemoryTypeInfo
;
TABLE_HOB
Acpi
;
TABLE_HOB
Acpi20
;
...
...
@@ -133,9 +148,10 @@ PrepareHobMemory (
VOID
PrepareHobDxeCore
(
VOID
*
DxeCoreEntryPoint
,
EFI_PHYSICAL_ADDRESS
DxeCoreImageBase
,
UINT64
DxeCoreLength
VOID
*
DxeCoreEntryPoint
,
EFI_PHYSICAL_ADDRESS
DxeCoreImageBase
,
UINT64
DxeCoreLength
,
UEFI_IMAGE_LOADER_IMAGE_CONTEXT
*
ImageContext
);
VOID
*
...
...
Legacy/BootPlatform/EfiLdr/EfiLdr.h
浏览文件 @
2462e02d
...
...
@@ -88,11 +88,12 @@ VOID
EFI_STATUS
EfiLdrLoadImage
(
IN
VOID
*
FHand
,
IN
UINT32
BufferSize
,
IN
EFILDR_LOADED_IMAGE
*
Image
,
IN
UINTN
*
NumberOfMemoryMapEntries
,
IN
EFI_MEMORY_DESCRIPTOR
*
EfiMemoryDescriptor
IN
VOID
*
FHand
,
IN
UINT32
BufferSize
,
IN
EFILDR_LOADED_IMAGE
*
Image
,
IN
UINTN
*
NumberOfMemoryMapEntries
,
IN
EFI_MEMORY_DESCRIPTOR
*
EfiMemoryDescriptor
,
OUT
UEFI_IMAGE_LOADER_IMAGE_CONTEXT
*
ImageContext
);
#endif //_DUET_EFI_LOADER_H_
Legacy/BootPlatform/EfiLdr/EfiLdr.inf
浏览文件 @
2462e02d
...
...
@@ -39,7 +39,6 @@
[Sources]
Support.h
EfiLdrHandoff.h
EfiLdr.h
EfiLoader.c
PeLoader.c
...
...
Legacy/BootPlatform/EfiLdr/EfiLdrHandoff.h
已删除
100644 → 0
浏览文件 @
e5b02f13
/*++
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
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.
Module Name:
EfiLdrHandoff.h
Abstract:
Revision History:
--*/
#ifndef _EFILDR_HANDOFF_H_
#define _EFILDR_HANDOFF_H_
#define EFILDR_BASE_SEGMENT 0x2000
#define EFILDR_LOAD_ADDRESS (EFILDR_BASE_SEGMENT << 4)
#define EFILDR_HEADER_ADDRESS (EFILDR_LOAD_ADDRESS+0x2000)
#define EFILDR_CB_VA 0x00
typedef
struct
_EFILDRHANDOFF
{
UINTN
MemDescCount
;
EFI_MEMORY_DESCRIPTOR
*
MemDesc
;
VOID
*
BfvBase
;
UINTN
BfvSize
;
VOID
*
DxeIplImageBase
;
UINTN
DxeIplImageSize
;
VOID
*
DxeCoreImageBase
;
UINTN
DxeCoreImageSize
;
VOID
*
DxeCoreEntryPoint
;
}
EFILDRHANDOFF
;
typedef
struct
{
UINT32
CheckSum
;
UINT32
Offset
;
UINT32
Length
;
UINT8
FileName
[
52
];
}
EFILDR_IMAGE
;
typedef
struct
{
UINT32
Signature
;
UINT32
HeaderCheckSum
;
UINT32
FileLength
;
UINT32
NumberOfImages
;
}
EFILDR_HEADER
;
#endif
Legacy/BootPlatform/EfiLdr/EfiLoader.c
浏览文件 @
2462e02d
...
...
@@ -142,7 +142,8 @@ EfiLoader (
DestinationSize
,
&
DxeIplImage
,
&
NumberOfMemoryMapEntries
,
EfiMemoryDescriptor
EfiMemoryDescriptor
,
NULL
);
if
(
EFI_ERROR
(
Status
))
{
SystemHang
(
"Failed to load and relocate DxeIpl PE image!
\n
"
);
...
...
@@ -184,7 +185,8 @@ EfiLoader (
DestinationSize
,
&
DxeCoreImage
,
&
NumberOfMemoryMapEntries
,
EfiMemoryDescriptor
EfiMemoryDescriptor
,
&
Handoff
.
DxeCoreImageContext
);
if
(
EFI_ERROR
(
Status
))
{
SystemHang
(
"Failed to load/relocate DxeMain!
\n
"
);
...
...
Legacy/BootPlatform/EfiLdr/PeLoader.c
浏览文件 @
2462e02d
...
...
@@ -26,18 +26,23 @@ Revision History:
EFI_STATUS
EfiLdrLoadImage
(
IN
VOID
*
FHand
,
IN
UINT32
BufferSize
,
IN
EFILDR_LOADED_IMAGE
*
Image
,
IN
UINTN
*
NumberOfMemoryMapEntries
,
IN
EFI_MEMORY_DESCRIPTOR
*
EfiMemoryDescriptor
IN
VOID
*
FHand
,
IN
UINT32
BufferSize
,
IN
EFILDR_LOADED_IMAGE
*
Image
,
IN
UINTN
*
NumberOfMemoryMapEntries
,
IN
EFI_MEMORY_DESCRIPTOR
*
EfiMemoryDescriptor
,
OUT
UEFI_IMAGE_LOADER_IMAGE_CONTEXT
*
ImageContext
)
{
EFI_STATUS
Status
;
UEFI_IMAGE_LOADER_IMAGE_CONTEXT
ImageContext
;
UEFI_IMAGE_LOADER_IMAGE_CONTEXT
TempImageContext
;
if
(
ImageContext
==
NULL
)
{
ImageContext
=
&
TempImageContext
;
}
Status
=
UefiImageInitializeContext
(
&
ImageContext
,
ImageContext
,
FHand
,
BufferSize
,
UEFI_IMAGE_SOURCE_FV
,
...
...
@@ -50,7 +55,7 @@ EfiLdrLoadImage (
//
// Set the image subsystem type
//
Image
->
Type
=
UefiImageGetSubsystem
(
&
ImageContext
);
Image
->
Type
=
UefiImageGetSubsystem
(
ImageContext
);
switch
(
Image
->
Type
)
{
case
EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION
:
...
...
@@ -72,7 +77,7 @@ EfiLdrLoadImage (
return
EFI_INVALID_PARAMETER
;
}
Image
->
NoPages
=
EFI_SIZE_TO_PAGES
(
UefiImageGetImageSize
(
&
ImageContext
));
Image
->
NoPages
=
EFI_SIZE_TO_PAGES
(
UefiImageGetImageSize
(
ImageContext
));
//
// Compute the amount of memory needed to load the image and
...
...
@@ -99,7 +104,7 @@ EfiLdrLoadImage (
// Load and relocate image
//
Status
=
UefiImageLoadImageForExecution
(
&
ImageContext
,
ImageContext
,
Image
->
ImageBase
,
(
UINT32
)
EFI_PAGES_TO_SIZE
(
Image
->
NoPages
),
NULL
,
...
...
@@ -109,7 +114,7 @@ EfiLdrLoadImage (
return
Status
;
}
Image
->
EntryPoint
=
(
EFI_IMAGE_ENTRY_POINT
)
UefiImageLoaderGetImageEntryPoint
(
&
ImageContext
);
Image
->
EntryPoint
=
(
EFI_IMAGE_ENTRY_POINT
)
UefiImageLoaderGetImageEntryPoint
(
ImageContext
);
return
Status
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录