From 1fa524e97d36fbc473087748a27074f69c475063 Mon Sep 17 00:00:00 2001 From: klu2 Date: Fri, 24 Oct 2008 06:51:40 +0000 Subject: [PATCH] Fix ECC issue git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6214 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 60 +++++----- .../BasePeCoffLib/Ipf/PeCoffLoaderEx.c | 108 +++++++++--------- 2 files changed, 84 insertions(+), 84 deletions(-) diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c index 7df939d758..69033598e6 100644 --- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c @@ -514,9 +514,9 @@ PeCoffLoaderRelocateImage ( UINT16 *RelocEnd; CHAR8 *Fixup; CHAR8 *FixupBase; - UINT16 *F16; - UINT32 *F32; - UINT64 *F64; + UINT16 *Fixup16; + UINT32 *Fixup32; + UINT64 *Fixup64; CHAR8 *FixupData; PHYSICAL_ADDRESS BaseAddress; UINT32 NumberOfRvaAndSizes; @@ -644,39 +644,39 @@ PeCoffLoaderRelocateImage ( break; case EFI_IMAGE_REL_BASED_HIGH: - F16 = (UINT16 *) Fixup; - *F16 = (UINT16) (*F16 + ((UINT16) ((UINT32) Adjust >> 16))); + Fixup16 = (UINT16 *) Fixup; + *Fixup16 = (UINT16) (*Fixup16 + ((UINT16) ((UINT32) Adjust >> 16))); if (FixupData != NULL) { - *(UINT16 *) FixupData = *F16; + *(UINT16 *) FixupData = *Fixup16; FixupData = FixupData + sizeof (UINT16); } break; case EFI_IMAGE_REL_BASED_LOW: - F16 = (UINT16 *) Fixup; - *F16 = (UINT16) (*F16 + (UINT16) Adjust); + Fixup16 = (UINT16 *) Fixup; + *Fixup16 = (UINT16) (*Fixup16 + (UINT16) Adjust); if (FixupData != NULL) { - *(UINT16 *) FixupData = *F16; + *(UINT16 *) FixupData = *Fixup16; FixupData = FixupData + sizeof (UINT16); } break; case EFI_IMAGE_REL_BASED_HIGHLOW: - F32 = (UINT32 *) Fixup; - *F32 = *F32 + (UINT32) Adjust; + Fixup32 = (UINT32 *) Fixup; + *Fixup32 = *Fixup32 + (UINT32) Adjust; if (FixupData != NULL) { FixupData = ALIGN_POINTER (FixupData, sizeof (UINT32)); - *(UINT32 *)FixupData = *F32; + *(UINT32 *)FixupData = *Fixup32; FixupData = FixupData + sizeof (UINT32); } break; case EFI_IMAGE_REL_BASED_DIR64: - F64 = (UINT64 *) Fixup; - *F64 = *F64 + (UINT64) Adjust; + Fixup64 = (UINT64 *) Fixup; + *Fixup64 = *Fixup64 + (UINT64) Adjust; if (FixupData != NULL) { FixupData = ALIGN_POINTER (FixupData, sizeof(UINT64)); - *(UINT64 *)(FixupData) = *F64; + *(UINT64 *)(FixupData) = *Fixup64; FixupData = FixupData + sizeof(UINT64); } break; @@ -1149,9 +1149,9 @@ PeCoffLoaderRelocateImageForRuntime ( UINT16 *RelocEnd; CHAR8 *Fixup; CHAR8 *FixupBase; - UINT16 *F16; - UINT32 *F32; - UINT64 *F64; + UINT16 *Fixup16; + UINT32 *Fixup32; + UINT64 *Fixup64; CHAR8 *FixupData; UINTN Adjust; RETURN_STATUS Status; @@ -1250,38 +1250,38 @@ PeCoffLoaderRelocateImageForRuntime ( break; case EFI_IMAGE_REL_BASED_HIGH: - F16 = (UINT16 *) Fixup; - if (*(UINT16 *) FixupData == *F16) { - *F16 = (UINT16) (*F16 + ((UINT16) ((UINT32) Adjust >> 16))); + Fixup16 = (UINT16 *) Fixup; + if (*(UINT16 *) FixupData == *Fixup16) { + *Fixup16 = (UINT16) (*Fixup16 + ((UINT16) ((UINT32) Adjust >> 16))); } FixupData = FixupData + sizeof (UINT16); break; case EFI_IMAGE_REL_BASED_LOW: - F16 = (UINT16 *) Fixup; - if (*(UINT16 *) FixupData == *F16) { - *F16 = (UINT16) (*F16 + ((UINT16) Adjust & 0xffff)); + Fixup16 = (UINT16 *) Fixup; + if (*(UINT16 *) FixupData == *Fixup16) { + *Fixup16 = (UINT16) (*Fixup16 + ((UINT16) Adjust & 0xffff)); } FixupData = FixupData + sizeof (UINT16); break; case EFI_IMAGE_REL_BASED_HIGHLOW: - F32 = (UINT32 *) Fixup; + Fixup32 = (UINT32 *) Fixup; FixupData = ALIGN_POINTER (FixupData, sizeof (UINT32)); - if (*(UINT32 *) FixupData == *F32) { - *F32 = *F32 + (UINT32) Adjust; + if (*(UINT32 *) FixupData == *Fixup32) { + *Fixup32 = *Fixup32 + (UINT32) Adjust; } FixupData = FixupData + sizeof (UINT32); break; case EFI_IMAGE_REL_BASED_DIR64: - F64 = (UINT64 *)Fixup; + Fixup64 = (UINT64 *)Fixup; FixupData = ALIGN_POINTER (FixupData, sizeof (UINT64)); - if (*(UINT64 *) FixupData == *F64) { - *F64 = *F64 + (UINT64)Adjust; + if (*(UINT64 *) FixupData == *Fixup64) { + *Fixup64 = *Fixup64 + (UINT64)Adjust; } FixupData = FixupData + sizeof (UINT64); diff --git a/MdePkg/Library/BasePeCoffLib/Ipf/PeCoffLoaderEx.c b/MdePkg/Library/BasePeCoffLib/Ipf/PeCoffLoaderEx.c index 2f0b9b850c..9d86e58e3a 100644 --- a/MdePkg/Library/BasePeCoffLib/Ipf/PeCoffLoaderEx.c +++ b/MdePkg/Library/BasePeCoffLib/Ipf/PeCoffLoaderEx.c @@ -43,20 +43,20 @@ #define IMM64_IC_INST_WORD_POS_X 12 #define IMM64_IC_VAL_POS_X 21 -#define IMM64_IMM41a_INST_WORD_X 1 -#define IMM64_IMM41a_SIZE_X 10 -#define IMM64_IMM41a_INST_WORD_POS_X 14 -#define IMM64_IMM41a_VAL_POS_X 22 +#define IMM64_IMM41A_INST_WORD_X 1 +#define IMM64_IMM41A_SIZE_X 10 +#define IMM64_IMM41A_INST_WORD_POS_X 14 +#define IMM64_IMM41A_VAL_POS_X 22 -#define IMM64_IMM41b_INST_WORD_X 1 -#define IMM64_IMM41b_SIZE_X 8 -#define IMM64_IMM41b_INST_WORD_POS_X 24 -#define IMM64_IMM41b_VAL_POS_X 32 +#define IMM64_IMM41B_INST_WORD_X 1 +#define IMM64_IMM41B_SIZE_X 8 +#define IMM64_IMM41B_INST_WORD_POS_X 24 +#define IMM64_IMM41B_VAL_POS_X 32 -#define IMM64_IMM41c_INST_WORD_X 2 -#define IMM64_IMM41c_SIZE_X 23 -#define IMM64_IMM41c_INST_WORD_POS_X 0 -#define IMM64_IMM41c_VAL_POS_X 40 +#define IMM64_IMM41C_INST_WORD_X 2 +#define IMM64_IMM41C_SIZE_X 23 +#define IMM64_IMM41C_INST_WORD_POS_X 0 +#define IMM64_IMM41C_VAL_POS_X 40 #define IMM64_SIGN_INST_WORD_X 3 #define IMM64_SIGN_SIZE_X 1 @@ -83,7 +83,7 @@ PeCoffLoaderRelocateImageEx ( IN UINT64 Adjust ) { - UINT64 *F64; + UINT64 *Fixup64; UINT64 FixupVal; switch ((*Reloc) >> 12) { @@ -129,10 +129,10 @@ PeCoffLoaderRelocateImageEx ( ); EXT_IMM64(FixupVal, - (UINT32 *)Fixup + IMM64_IMM41a_INST_WORD_X, - IMM64_IMM41a_SIZE_X, - IMM64_IMM41a_INST_WORD_POS_X, - IMM64_IMM41a_VAL_POS_X + (UINT32 *)Fixup + IMM64_IMM41A_INST_WORD_X, + IMM64_IMM41A_SIZE_X, + IMM64_IMM41A_INST_WORD_POS_X, + IMM64_IMM41A_VAL_POS_X ); // @@ -172,24 +172,24 @@ PeCoffLoaderRelocateImageEx ( ); INS_IMM64(FixupVal, - ((UINT32 *)Fixup + IMM64_IMM41a_INST_WORD_X), - IMM64_IMM41a_SIZE_X, - IMM64_IMM41a_INST_WORD_POS_X, - IMM64_IMM41a_VAL_POS_X + ((UINT32 *)Fixup + IMM64_IMM41A_INST_WORD_X), + IMM64_IMM41A_SIZE_X, + IMM64_IMM41A_INST_WORD_POS_X, + IMM64_IMM41A_VAL_POS_X ); INS_IMM64(FixupVal, - ((UINT32 *)Fixup + IMM64_IMM41b_INST_WORD_X), - IMM64_IMM41b_SIZE_X, - IMM64_IMM41b_INST_WORD_POS_X, - IMM64_IMM41b_VAL_POS_X + ((UINT32 *)Fixup + IMM64_IMM41B_INST_WORD_X), + IMM64_IMM41B_SIZE_X, + IMM64_IMM41B_INST_WORD_POS_X, + IMM64_IMM41B_VAL_POS_X ); INS_IMM64(FixupVal, - ((UINT32 *)Fixup + IMM64_IMM41c_INST_WORD_X), - IMM64_IMM41c_SIZE_X, - IMM64_IMM41c_INST_WORD_POS_X, - IMM64_IMM41c_VAL_POS_X + ((UINT32 *)Fixup + IMM64_IMM41C_INST_WORD_X), + IMM64_IMM41C_SIZE_X, + IMM64_IMM41C_INST_WORD_POS_X, + IMM64_IMM41C_VAL_POS_X ); INS_IMM64(FixupVal, @@ -199,10 +199,10 @@ PeCoffLoaderRelocateImageEx ( IMM64_SIGN_VAL_POS_X ); - F64 = (UINT64 *) Fixup; + Fixup64 = (UINT64 *) Fixup; if (*FixupData != NULL) { *FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64)); - *(UINT64 *)(*FixupData) = *F64; + *(UINT64 *)(*FixupData) = *Fixup64; *FixupData = *FixupData + sizeof(UINT64); } break; @@ -267,24 +267,24 @@ PeHotRelocateImageEx ( IN UINT64 Adjust ) { - UINT64 *F64; + UINT64 *Fixup64; UINT64 FixupVal; switch ((*Reloc) >> 12) { case EFI_IMAGE_REL_BASED_DIR64: - F64 = (UINT64 *) Fixup; + Fixup64 = (UINT64 *) Fixup; *FixupData = ALIGN_POINTER (*FixupData, sizeof (UINT64)); - if (*(UINT64 *) (*FixupData) == *F64) { - *F64 = *F64 + (UINT64) Adjust; + if (*(UINT64 *) (*FixupData) == *Fixup64) { + *Fixup64 = *Fixup64 + (UINT64) Adjust; } *FixupData = *FixupData + sizeof (UINT64); break; case EFI_IMAGE_REL_BASED_IA64_IMM64: - F64 = (UINT64 *) Fixup; + Fixup64 = (UINT64 *) Fixup; *FixupData = ALIGN_POINTER (*FixupData, sizeof (UINT64)); - if (*(UINT64 *) (*FixupData) == *F64) { + if (*(UINT64 *) (*FixupData) == *Fixup64) { // // Align it to bundle address before fixing up the // 64-bit immediate value of the movl instruction. @@ -330,10 +330,10 @@ PeHotRelocateImageEx ( EXT_IMM64 ( FixupVal, - (UINT32 *) Fixup + IMM64_IMM41a_INST_WORD_X, - IMM64_IMM41a_SIZE_X, - IMM64_IMM41a_INST_WORD_POS_X, - IMM64_IMM41a_VAL_POS_X + (UINT32 *) Fixup + IMM64_IMM41A_INST_WORD_X, + IMM64_IMM41A_SIZE_X, + IMM64_IMM41A_INST_WORD_POS_X, + IMM64_IMM41A_VAL_POS_X ); // @@ -378,26 +378,26 @@ PeHotRelocateImageEx ( INS_IMM64 ( FixupVal, - ((UINT32 *) Fixup + IMM64_IMM41a_INST_WORD_X), - IMM64_IMM41a_SIZE_X, - IMM64_IMM41a_INST_WORD_POS_X, - IMM64_IMM41a_VAL_POS_X + ((UINT32 *) Fixup + IMM64_IMM41A_INST_WORD_X), + IMM64_IMM41A_SIZE_X, + IMM64_IMM41A_INST_WORD_POS_X, + IMM64_IMM41A_VAL_POS_X ); INS_IMM64 ( FixupVal, - ((UINT32 *) Fixup + IMM64_IMM41b_INST_WORD_X), - IMM64_IMM41b_SIZE_X, - IMM64_IMM41b_INST_WORD_POS_X, - IMM64_IMM41b_VAL_POS_X + ((UINT32 *) Fixup + IMM64_IMM41B_INST_WORD_X), + IMM64_IMM41B_SIZE_X, + IMM64_IMM41B_INST_WORD_POS_X, + IMM64_IMM41B_VAL_POS_X ); INS_IMM64 ( FixupVal, - ((UINT32 *) Fixup + IMM64_IMM41c_INST_WORD_X), - IMM64_IMM41c_SIZE_X, - IMM64_IMM41c_INST_WORD_POS_X, - IMM64_IMM41c_VAL_POS_X + ((UINT32 *) Fixup + IMM64_IMM41C_INST_WORD_X), + IMM64_IMM41C_SIZE_X, + IMM64_IMM41C_INST_WORD_POS_X, + IMM64_IMM41C_VAL_POS_X ); INS_IMM64 ( @@ -408,7 +408,7 @@ PeHotRelocateImageEx ( IMM64_SIGN_VAL_POS_X ); - *(UINT64 *) (*FixupData) = *F64; + *(UINT64 *) (*FixupData) = *Fixup64; } *FixupData = *FixupData + sizeof (UINT64);