Correct ECC Error for MdePkg/Include/Protocol and Correct PeCofferLib bug to set ImageContext->EntryPoint after relocate when the destination address is specified.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5514 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2008-07-17 08:45:10 +00:00
parent 2a958a00c6
commit 19bee90c32
7 changed files with 42 additions and 76 deletions

View File

@ -135,28 +135,28 @@ EFI_STATUS
**/ **/
typedef struct { typedef struct {
UINT32 MediaId; ///< The curent media Id. If the media changes, this value is changed. UINT32 MediaId; /**< The curent media Id. If the media changes, this value is changed.**/
BOOLEAN RemovableMedia; ///< TRUE if the media is removable; otherwise, FALSE. BOOLEAN RemovableMedia; /**< TRUE if the media is removable; otherwise, FALSE.**/
BOOLEAN MediaPresent; /**< TRUE if there is a media currently present in the device; BOOLEAN MediaPresent; /**< TRUE if there is a media currently present in the device;
othersise, FALSE. THis field shows the media present status othersise, FALSE. THis field shows the media present status
as of the most recent ReadBlocks() or WriteBlocks() call. as of the most recent ReadBlocks() or WriteBlocks() call.
**/ **/
BOOLEAN LogicalPartition; /**< TRUE if LBA 0 is the first block of a partition; otherwise BOOLEAN LogicalPartition; /**< TRUE if LBA 0 is the first block of a partition; otherwise
FALSE. For media with only one partition this would be TRUE. FALSE. For media with only one partition this would be TRUE.
**/ **/
BOOLEAN ReadOnly; /**< TRUE if the media is marked read-only otherwise, FALSE. BOOLEAN ReadOnly; /**< TRUE if the media is marked read-only otherwise, FALSE.
This field shows the read-only status as of the most recent WriteBlocks () call. This field shows the read-only status as of the most recent WriteBlocks () call.
**/ **/
BOOLEAN WriteCaching; ///< TRUE if the WriteBlock () function caches write data. BOOLEAN WriteCaching; /**< TRUE if the WriteBlock () function caches write data.**/
UINT32 BlockSize; /**< The intrinsic block size of the device. If the media changes, then UINT32 BlockSize; /**< The intrinsic block size of the device. If the media changes, then
this field is updated. this field is updated.
**/ **/
UINT32 IoAlign; ///< Supplies the alignment requirement for any buffer to read or write block(s). UINT32 IoAlign; /**< Supplies the alignment requirement for any buffer to read or write block(s).**/
EFI_LBA LastBlock; /**< The last logical block address on the device. EFI_LBA LastBlock; /**< The last logical block address on the device.
If the media changes, then this field is updated. If the media changes, then this field is updated.
**/ **/
} EFI_BLOCK_IO_MEDIA; } EFI_BLOCK_IO_MEDIA;
#define EFI_BLOCK_IO_PROTOCOL_REVISION 0x00010000 #define EFI_BLOCK_IO_PROTOCOL_REVISION 0x00010000

View File

@ -76,7 +76,6 @@ typedef struct {
UINT32 DataOffset; UINT32 DataOffset;
UINT16 Ds; UINT16 Ds;
UINT8 Reserved2[10]; UINT8 Reserved2[10];
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
UINT8 St0Mm0[10], Reserved3[6]; UINT8 St0Mm0[10], Reserved3[6];
UINT8 St1Mm1[10], Reserved4[6]; UINT8 St1Mm1[10], Reserved4[6];
UINT8 St2Mm2[10], Reserved5[6]; UINT8 St2Mm2[10], Reserved5[6];
@ -95,26 +94,10 @@ typedef struct {
UINT8 Xmm7[16]; UINT8 Xmm7[16];
UINT8 Reserved11[14 * 16]; UINT8 Reserved11[14 * 16];
} EFI_FX_SAVE_STATE_IA32; } EFI_FX_SAVE_STATE_IA32;
#else
UINT8 St0Mm0[10], Reserved3[6];
UINT8 St0Mm1[10], Reserved4[6];
UINT8 St0Mm2[10], Reserved5[6];
UINT8 St0Mm3[10], Reserved6[6];
UINT8 St0Mm4[10], Reserved7[6];
UINT8 St0Mm5[10], Reserved8[6];
UINT8 St0Mm6[10], Reserved9[6];
UINT8 St0Mm7[10], Reserved10[6];
UINT8 Reserved11[22 * 16];
} EFI_FX_SAVE_STATE;
#endif
typedef struct { typedef struct {
UINT32 ExceptionData; UINT32 ExceptionData;
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
EFI_FX_SAVE_STATE_IA32 FxSaveState; EFI_FX_SAVE_STATE_IA32 FxSaveState;
#else
EFI_FX_SAVE_STATE FxSaveState;
#endif
UINT32 Dr0; UINT32 Dr0;
UINT32 Dr1; UINT32 Dr1;
UINT32 Dr2; UINT32 Dr2;
@ -199,23 +182,10 @@ typedef struct {
UINT8 Xmm5[16]; UINT8 Xmm5[16];
UINT8 Xmm6[16]; UINT8 Xmm6[16];
UINT8 Xmm7[16]; UINT8 Xmm7[16];
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
// //
// NOTE: UEFI 2.0 spec definition as follows. It should be updated // NOTE: UEFI 2.0 spec definition as follows.
// after spec update.
// //
UINT8 Reserved11[14 * 16]; UINT8 Reserved11[14 * 16];
#else
UINT8 Xmm8[16];
UINT8 Xmm9[16];
UINT8 Xmm10[16];
UINT8 Xmm11[16];
UINT8 Xmm12[16];
UINT8 Xmm13[16];
UINT8 Xmm14[16];
UINT8 Xmm15[16];
UINT8 Reserved10[6 * 16];
#endif
} EFI_FX_SAVE_STATE_X64; } EFI_FX_SAVE_STATE_X64;
typedef struct { typedef struct {

View File

@ -32,7 +32,7 @@
@param DevicePath Points to the start of the EFI device path. @param DevicePath Points to the start of the EFI device path.
@revtal Size Size of the specified device path, in bytes, including the end-of-path tag. @retval Size Size of the specified device path, in bytes, including the end-of-path tag.
**/ **/
typedef typedef

View File

@ -291,7 +291,7 @@ EFI_STATUS
@retval EFI_OUT_OF_RESOURCES An allocation failure occurred. @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.
@retavl EFI_NOT_FOUND Name was not found in the firmware @retval EFI_NOT_FOUND Name was not found in the firmware
volume. volume.
@retval EFI_DEVICE_ERROR A hardware error occurred when @retval EFI_DEVICE_ERROR A hardware error occurred when

View File

@ -13,8 +13,8 @@
**/ **/
#ifndef _EFI_MANAGED_NETWORK_PROTOCOL_H #ifndef __EFI_MANAGED_NETWORK_PROTOCOL_H__
#define _EFI_MANAGED_NETWORK_PROTOCOL_H #define __EFI_MANAGED_NETWORK_PROTOCOL_H__
#include <Protocol/SimpleNetwork.h> #include <Protocol/SimpleNetwork.h>

View File

@ -54,10 +54,6 @@ typedef struct _UGA_DEVICE {
} }
UGA_DEVICE, *PUGA_DEVICE; UGA_DEVICE, *PUGA_DEVICE;
#ifndef UGA_IO_REQUEST_CODE
//
// Prevent conflicts with UGA typedefs.
//
typedef enum { typedef enum {
UgaIoGetVersion = 1, UgaIoGetVersion = 1,
UgaIoGetChildDevice, UgaIoGetChildDevice,
@ -85,8 +81,6 @@ typedef enum {
} }
UGA_IO_REQUEST_CODE, *PUGA_IO_REQUEST_CODE; UGA_IO_REQUEST_CODE, *PUGA_IO_REQUEST_CODE;
#endif
typedef struct { typedef struct {
IN UGA_IO_REQUEST_CODE ioRequestCode; IN UGA_IO_REQUEST_CODE ioRequestCode;
IN VOID *pvInBuffer; IN VOID *pvInBuffer;
@ -146,32 +140,30 @@ EFI_STATUS
IN UGA_DEVICE * Device IN UGA_DEVICE * Device
); );
typedef UGA_STATUS (EFIAPI *PUGA_FW_SERVICE_DISPATCH)(IN PUGA_DEVICE pDevice, IN OUT PUGA_IO_REQUEST pIoRequest);
/** /**
This is the main UGA service dispatch routine for all UGA_IO_REQUEST s.
Routine Description: @param pDevice pDevice specifies a pointer to a device object associated with a
This is the main UGA service dispatch routine for all UGA_IO_REQUEST s.
Arguments:
pDevice - pDevice specifies a pointer to a device object associated with a
device enumerated by a pIoRequest->ioRequestCode of type device enumerated by a pIoRequest->ioRequestCode of type
UgaIoGetChildDevice. The root device for the EFI_UGA_IO_PROTOCOL UgaIoGetChildDevice. The root device for the EFI_UGA_IO_PROTOCOL
is represented by pDevice being set to NULL. is represented by pDevice being set to NULL.
pIoRequest - pIoRequest points to a caller allocated buffer that contains data @param pIoRequest
pIoRequest points to a caller allocated buffer that contains data
defined by pIoRequest->ioRequestCode. See Related Definitions for defined by pIoRequest->ioRequestCode. See Related Definitions for
a definition of UGA_IO_REQUEST_CODE s and their associated data a definition of UGA_IO_REQUEST_CODE s and their associated data
structures. structures.
Returns: @return UGA_STATUS
Varies depending on pIoRequest.
**/ **/
typedef UGA_STATUS
(EFIAPI *PUGA_FW_SERVICE_DISPATCH)(
IN PUGA_DEVICE pDevice,
IN OUT PUGA_IO_REQUEST pIoRequest
);
struct _EFI_UGA_IO_PROTOCOL { struct _EFI_UGA_IO_PROTOCOL {
EFI_UGA_IO_PROTOCOL_CREATE_DEVICE CreateDevice; EFI_UGA_IO_PROTOCOL_CREATE_DEVICE CreateDevice;
EFI_UGA_IO_PROTOCOL_DELETE_DEVICE DeleteDevice; EFI_UGA_IO_PROTOCOL_DELETE_DEVICE DeleteDevice;

View File

@ -544,11 +544,8 @@ PeCoffLoaderRelocateImage (
// //
if (ImageContext->DestinationAddress != 0) { if (ImageContext->DestinationAddress != 0) {
BaseAddress = ImageContext->DestinationAddress; BaseAddress = ImageContext->DestinationAddress;
} else if (!(ImageContext->IsTeImage)) {
BaseAddress = ImageContext->ImageAddress;
} else { } else {
Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress); BaseAddress = ImageContext->ImageAddress;
BaseAddress = ImageContext->ImageAddress + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;
} }
if (!(ImageContext->IsTeImage)) { if (!(ImageContext->IsTeImage)) {
@ -597,8 +594,8 @@ PeCoffLoaderRelocateImage (
} }
} else { } else {
Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress); Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
Adjust = (UINT64) (BaseAddress - Hdr.Te->ImageBase); Adjust = (UINT64) (BaseAddress - Hdr.Te->StrippedSize + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->ImageBase);
Hdr.Te->ImageBase = (UINT64) (BaseAddress); Hdr.Te->ImageBase = (UINT64) (BaseAddress - Hdr.Te->StrippedSize + sizeof (EFI_TE_IMAGE_HEADER));
// //
// Find the relocation block // Find the relocation block
@ -711,6 +708,13 @@ PeCoffLoaderRelocateImage (
RelocBase = (EFI_IMAGE_BASE_RELOCATION *) RelocEnd; RelocBase = (EFI_IMAGE_BASE_RELOCATION *) RelocEnd;
} }
//
// Adjust the EntryPoint to match the linked-to address
//
if (ImageContext->DestinationAddress != 0) {
ImageContext->EntryPoint -= (UINT64) ImageContext->ImageAddress;
ImageContext->EntryPoint += (UINT64) ImageContext->DestinationAddress;
}
return RETURN_SUCCESS; return RETURN_SUCCESS;
} }