代码拉取完成,页面将自动刷新
同步操作将从 谭玉刚/ToyBoot 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include "File.h"
#include "Log.h"
#include "Tools.h"
#define ELF_32 1
#define ELF_64 2
#define NOT_ELF -1
#define NOT_64_BIT -2
#define PT_LOAD 1
#pragma pack(1)
typedef struct
{
UINT32 Magic; //0x00
UINT8 Format;//0x04,32 or 64 bits format 1=32, 2=64
UINT8 Endianness;//0x05
UINT8 Version;//0x06
UINT8 OSAbi;//0x07
UINT8 AbiVersion;//0x08
UINT8 Rserved[7];//0x09
UINT16 Type;//0x10
UINT16 Machine;//0x12
UINT32 ElfVersion;//0x14
UINT32 Entry;//0x18
UINT32 Phoff;//0x1C
UINT32 Shoff;//0x20
UINT32 Flags;//0x24
UINT16 HeadSize;//0x28,size of elf head
UINT16 PHeadSize;//0x2A, size of a program header table entry
UINT16 PHeadCount;//0x2C, count of entries in the program header table
UINT16 SHeadSize;//0x2E, size of a section header table entry
UINT16 SHeadCount;//0x30, count of entries in the section header table
UINT16 SNameIndex;//0x32, index of entry that contains the section names
} ELF_HEADER_32;
typedef struct
{
UINT32 Magic; //0x00
UINT8 Format;//0x04,32 or 64 bits format
UINT8 Endianness;//0x05
UINT8 Version;//0x06
UINT8 OSAbi;//0x07
UINT8 AbiVersion;//0x08
UINT8 Rserved[7];//0x09
UINT16 Type;//0x10
UINT16 Machine;//0x12
UINT32 ElfVersion;//0x14
UINT64 Entry;//0x18
UINT64 Phoff;//0x20
UINT64 Shoff;//0x28
UINT32 Flags;//0x30
UINT16 HeadSize;//0x34,size of elf head
UINT16 PHeadSize;//0x36, size of a program header table entry
UINT16 PHeadCount;//0x38, count of entries in the program header table
UINT16 SHeadSize;//0x3A, size of a section header table entry
UINT16 SHeadCount;//0x3C, count of entries in the section header table
UINT16 SNameIndex;//0x3E, index of entry that contains the section names
} ELF_HEADER_64;
typedef struct
{
UINT32 Type;//0x00, type of segment
UINT32 Offset;//0x04, Offset of the segment in the file image
UINT32 VAddress;//0x08, Virtual address of the segment in memory
UINT32 PAddress;//0x0C, reserved for segment`s physical address
UINT32 SizeInFile;//0x10, size in bytes of the segment in the file image
UINT32 SizeInMemory;//0x14, size in bytes of the segment in memory
UINT32 Flags;//0x18
UINT32 Align;//0x1C, 0 and 1
} PROGRAM_HEADER_32;
typedef struct
{
UINT32 Type;//0x00, type of segment
UINT32 Flags;//0x04 Segment-dependent flags
UINT64 Offset;//0x08
UINT64 VAddress;//0x10
UINT64 PAddress;//0x18
UINT64 SizeInFile;//0x20
UINT64 SizeInMemory;//0x28
UINT64 Align;//0x30
} PROGRAM_HEADER_64;
#pragma pack()
EFI_STATUS CheckELF(
IN EFI_PHYSICAL_ADDRESS KernelBuffer
);
EFI_STATUS LoadSegments(
IN EFI_PHYSICAL_ADDRESS KernelBuffer,
OUT EFI_PHYSICAL_ADDRESS *KernelEntry
);
EFI_STATUS LoadSegs(
IN EFI_FILE_PROTOCOL *Kernel,
OUT EFI_PHYSICAL_ADDRESS *KernelEntry
);
/*EFI_STATUS LoadSegment(
IN EFI_PHYSICAL_ADDRESS KernelBuffer,
IN PROGRAM_HEADER_64 PHeader
);*/
EFI_STATUS Relocate(
IN EFI_HANDLE ImageHandle,
IN CHAR16 *FileName,
OUT EFI_PHYSICAL_ADDRESS *KernelEntry
);
EFI_STATUS GetElfInfo(
IN EFI_PHYSICAL_ADDRESS KernelAddress,
IN OUT EFI_PHYSICAL_ADDRESS *KernelEntry
);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。