mirror of https://github.com/acidanthera/audk.git
1. cleanup functions header in PeCoffLoaderEx.c
2. fixed link error in EnablePaging64.asm git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1175 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
af1dd46d37
commit
4a78c00aac
|
@ -36,7 +36,10 @@
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
InternalX86EnablePaging64 PROC
|
InternalX86EnablePaging64 PROC
|
||||||
cli
|
cli
|
||||||
mov dword ptr [rsp], @F ; offset for far retf, seg is the 1st arg
|
pop rax
|
||||||
|
call @Base
|
||||||
|
@Base:
|
||||||
|
add dword ptr [rsp], @F - @Base ; offset for far retf, seg is the 1st arg
|
||||||
mov rax, cr4 ; mov eax, cr4
|
mov rax, cr4 ; mov eax, cr4
|
||||||
or al, (1 SHL 5)
|
or al, (1 SHL 5)
|
||||||
mov cr4, rax ; enable PAE
|
mov cr4, rax ; enable PAE
|
||||||
|
|
|
@ -25,45 +25,45 @@
|
||||||
*(UINT32*)Address = (*(UINT32*)Address & ~(((1 << Size) - 1) << InstPos)) | \
|
*(UINT32*)Address = (*(UINT32*)Address & ~(((1 << Size) - 1) << InstPos)) | \
|
||||||
((UINT32)((((UINT64)Value >> ValPos) & (((UINT64)1 << Size) - 1))) << InstPos)
|
((UINT32)((((UINT64)Value >> ValPos) & (((UINT64)1 << Size) - 1))) << InstPos)
|
||||||
|
|
||||||
#define IMM64_IMM7B_INST_WORD_X 3
|
#define IMM64_IMM7B_INST_WORD_X 3
|
||||||
#define IMM64_IMM7B_SIZE_X 7
|
#define IMM64_IMM7B_SIZE_X 7
|
||||||
#define IMM64_IMM7B_INST_WORD_POS_X 4
|
#define IMM64_IMM7B_INST_WORD_POS_X 4
|
||||||
#define IMM64_IMM7B_VAL_POS_X 0
|
#define IMM64_IMM7B_VAL_POS_X 0
|
||||||
|
|
||||||
#define IMM64_IMM9D_INST_WORD_X 3
|
#define IMM64_IMM9D_INST_WORD_X 3
|
||||||
#define IMM64_IMM9D_SIZE_X 9
|
#define IMM64_IMM9D_SIZE_X 9
|
||||||
#define IMM64_IMM9D_INST_WORD_POS_X 18
|
#define IMM64_IMM9D_INST_WORD_POS_X 18
|
||||||
#define IMM64_IMM9D_VAL_POS_X 7
|
#define IMM64_IMM9D_VAL_POS_X 7
|
||||||
|
|
||||||
#define IMM64_IMM5C_INST_WORD_X 3
|
#define IMM64_IMM5C_INST_WORD_X 3
|
||||||
#define IMM64_IMM5C_SIZE_X 5
|
#define IMM64_IMM5C_SIZE_X 5
|
||||||
#define IMM64_IMM5C_INST_WORD_POS_X 13
|
#define IMM64_IMM5C_INST_WORD_POS_X 13
|
||||||
#define IMM64_IMM5C_VAL_POS_X 16
|
#define IMM64_IMM5C_VAL_POS_X 16
|
||||||
|
|
||||||
#define IMM64_IC_INST_WORD_X 3
|
#define IMM64_IC_INST_WORD_X 3
|
||||||
#define IMM64_IC_SIZE_X 1
|
#define IMM64_IC_SIZE_X 1
|
||||||
#define IMM64_IC_INST_WORD_POS_X 12
|
#define IMM64_IC_INST_WORD_POS_X 12
|
||||||
#define IMM64_IC_VAL_POS_X 21
|
#define IMM64_IC_VAL_POS_X 21
|
||||||
|
|
||||||
#define IMM64_IMM41a_INST_WORD_X 1
|
#define IMM64_IMM41a_INST_WORD_X 1
|
||||||
#define IMM64_IMM41a_SIZE_X 10
|
#define IMM64_IMM41a_SIZE_X 10
|
||||||
#define IMM64_IMM41a_INST_WORD_POS_X 14
|
#define IMM64_IMM41a_INST_WORD_POS_X 14
|
||||||
#define IMM64_IMM41a_VAL_POS_X 22
|
#define IMM64_IMM41a_VAL_POS_X 22
|
||||||
|
|
||||||
#define IMM64_IMM41b_INST_WORD_X 1
|
#define IMM64_IMM41b_INST_WORD_X 1
|
||||||
#define IMM64_IMM41b_SIZE_X 8
|
#define IMM64_IMM41b_SIZE_X 8
|
||||||
#define IMM64_IMM41b_INST_WORD_POS_X 24
|
#define IMM64_IMM41b_INST_WORD_POS_X 24
|
||||||
#define IMM64_IMM41b_VAL_POS_X 32
|
#define IMM64_IMM41b_VAL_POS_X 32
|
||||||
|
|
||||||
#define IMM64_IMM41c_INST_WORD_X 2
|
#define IMM64_IMM41c_INST_WORD_X 2
|
||||||
#define IMM64_IMM41c_SIZE_X 23
|
#define IMM64_IMM41c_SIZE_X 23
|
||||||
#define IMM64_IMM41c_INST_WORD_POS_X 0
|
#define IMM64_IMM41c_INST_WORD_POS_X 0
|
||||||
#define IMM64_IMM41c_VAL_POS_X 40
|
#define IMM64_IMM41c_VAL_POS_X 40
|
||||||
|
|
||||||
#define IMM64_SIGN_INST_WORD_X 3
|
#define IMM64_SIGN_INST_WORD_X 3
|
||||||
#define IMM64_SIGN_SIZE_X 1
|
#define IMM64_SIGN_SIZE_X 1
|
||||||
#define IMM64_SIGN_INST_WORD_POS_X 27
|
#define IMM64_SIGN_INST_WORD_POS_X 27
|
||||||
#define IMM64_SIGN_VAL_POS_X 63
|
#define IMM64_SIGN_VAL_POS_X 63
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an Itanium-based specific relocation fixup.
|
Performs an Itanium-based specific relocation fixup.
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
PeCoffLoaderRelocateImageEx (
|
PeCoffLoaderRelocateImageEx (
|
||||||
IN UINT16 *Reloc,
|
IN UINT16 *Reloc,
|
||||||
IN OUT CHAR8 *Fixup,
|
IN OUT CHAR8 *Fixup,
|
||||||
IN OUT CHAR8 **FixupData,
|
IN OUT CHAR8 **FixupData,
|
||||||
IN UINT64 Adjust
|
IN UINT64 Adjust
|
||||||
)
|
)
|
||||||
|
@ -97,8 +97,8 @@ PeCoffLoaderRelocateImageEx (
|
||||||
|
|
||||||
Fixup = (CHAR8 *)((UINTN) Fixup & (UINTN) ~(15));
|
Fixup = (CHAR8 *)((UINTN) Fixup & (UINTN) ~(15));
|
||||||
FixupVal = (UINT64)0;
|
FixupVal = (UINT64)0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract the lower 32 bits of IMM64 from bundle
|
// Extract the lower 32 bits of IMM64 from bundle
|
||||||
//
|
//
|
||||||
EXT_IMM64(FixupVal,
|
EXT_IMM64(FixupVal,
|
||||||
|
@ -135,13 +135,13 @@ PeCoffLoaderRelocateImageEx (
|
||||||
IMM64_IMM41a_INST_WORD_POS_X,
|
IMM64_IMM41a_INST_WORD_POS_X,
|
||||||
IMM64_IMM41a_VAL_POS_X
|
IMM64_IMM41a_VAL_POS_X
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update 64-bit address
|
// Update 64-bit address
|
||||||
//
|
//
|
||||||
FixupVal += Adjust;
|
FixupVal += Adjust;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Insert IMM64 into bundle
|
// Insert IMM64 into bundle
|
||||||
//
|
//
|
||||||
INS_IMM64(FixupVal,
|
INS_IMM64(FixupVal,
|
||||||
|
@ -216,15 +216,15 @@ PeCoffLoaderRelocateImageEx (
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns TRUE if the machine type of PE/COFF image is supported. Supported
|
Returns TRUE if the machine type of PE/COFF image is supported. Supported
|
||||||
does not mean the image can be executed it means the PE/COFF loader supports
|
does not mean the image can be executed it means the PE/COFF loader supports
|
||||||
loading and relocating of the image type. It's up to the caller to support
|
loading and relocating of the image type. It's up to the caller to support
|
||||||
the entry point.
|
the entry point.
|
||||||
|
|
||||||
This function implies the basic PE/COFF loader/relocator supports IA32, EBC,
|
This function implies the basic PE/COFF loader/relocator supports IA32, EBC,
|
||||||
& X64 images. Calling the entry point in a correct mannor is up to the
|
& X64 images. Calling the entry point in a correct mannor is up to the
|
||||||
consumer of this library. This version also supports the special relocations
|
consumer of this library. This version also supports the special relocations
|
||||||
for Itanium.
|
for Itanium.
|
||||||
|
|
||||||
@param Machine Machine type from the PE Header.
|
@param Machine Machine type from the PE Header.
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ PeCoffLoaderImageFormatSupported (
|
||||||
{
|
{
|
||||||
if ((Machine == EFI_IMAGE_MACHINE_IPF) || (Machine == EFI_IMAGE_MACHINE_IA32) ||
|
if ((Machine == EFI_IMAGE_MACHINE_IPF) || (Machine == EFI_IMAGE_MACHINE_IA32) ||
|
||||||
(Machine == EFI_IMAGE_MACHINE_EBC) || (Machine == EFI_IMAGE_MACHINE_X64)) {
|
(Machine == EFI_IMAGE_MACHINE_EBC) || (Machine == EFI_IMAGE_MACHINE_X64)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -247,14 +247,14 @@ PeCoffLoaderImageFormatSupported (
|
||||||
|
|
||||||
/**
|
/**
|
||||||
ImageRead function that operates on a memory buffer whos base is passed into
|
ImageRead function that operates on a memory buffer whos base is passed into
|
||||||
FileHandle.
|
FileHandle.
|
||||||
|
|
||||||
@param Reloc Ponter to baes of the input stream
|
@param Reloc Ponter to baes of the input stream
|
||||||
@param Fixup Offset to the start of the buffer
|
@param Fixup Offset to the start of the buffer
|
||||||
@param FixupData Number of bytes to copy into the buffer
|
@param FixupData Number of bytes to copy into the buffer
|
||||||
@param Adjust Location to place results of read
|
@param Adjust Location to place results of read
|
||||||
|
|
||||||
@retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
|
@retval RETURN_SUCCESS Data is read from FileOffset from the Handle into
|
||||||
the buffer.
|
the buffer.
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
|
@ -264,27 +264,6 @@ PeHotRelocateImageEx (
|
||||||
IN OUT CHAR8 **FixupData,
|
IN OUT CHAR8 **FixupData,
|
||||||
IN UINT64 Adjust
|
IN UINT64 Adjust
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Performs an IPF specific relocation fixup
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Reloc - Pointer to the relocation record
|
|
||||||
|
|
||||||
Fixup - Pointer to the address to fix up
|
|
||||||
|
|
||||||
FixupData - Pointer to a buffer to log the fixups
|
|
||||||
|
|
||||||
Adjust - The offset to adjust the fixup
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
UINT64 *F64;
|
UINT64 *F64;
|
||||||
UINT64 FixupVal;
|
UINT64 FixupVal;
|
||||||
|
|
Loading…
Reference in New Issue