30 IN OUT CHAR8 **FixupData,
36 UINT32 *RiscVHi20Fixup;
38 switch ((*Reloc) >> 12) {
40 *(UINT64 *)(*FixupData) = (UINT64)(
UINTN)Fixup;
43 case EFI_IMAGE_REL_BASED_RISCV_LOW12I:
44 RiscVHi20Fixup = (UINT32 *)(*(UINT64 *)(*FixupData));
45 if (RiscVHi20Fixup !=
NULL) {
46 Value = (UINT32)(RV_X (*RiscVHi20Fixup, 12, 20) << 12);
47 Value2 = (UINT32)(RV_X (*(UINT32 *)Fixup, 20, 12));
48 if (Value2 & (RISCV_IMM_REACH/2)) {
49 Value2 |= ~(RISCV_IMM_REACH-1);
53 Value += (UINT32)Adjust;
54 Value2 = RISCV_CONST_HIGH_PART (Value);
55 *(UINT32 *)RiscVHi20Fixup = (RV_X (Value2, 12, 20) << 12) | \
56 (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
57 *(UINT32 *)Fixup = (RV_X (Value, 0, 12) << 20) | \
58 (RV_X (*(UINT32 *)Fixup, 0, 20));
63 case EFI_IMAGE_REL_BASED_RISCV_LOW12S:
64 RiscVHi20Fixup = (UINT32 *)(*(UINT64 *)(*FixupData));
65 if (RiscVHi20Fixup !=
NULL) {
66 Value = (UINT32)(RV_X (*RiscVHi20Fixup, 12, 20) << 12);
67 Value2 = (UINT32)(RV_X (*(UINT32 *)Fixup, 7, 5) | (RV_X (*(UINT32 *)Fixup, 25, 7) << 5));
68 if (Value2 & (RISCV_IMM_REACH/2)) {
69 Value2 |= ~(RISCV_IMM_REACH-1);
73 Value += (UINT32)Adjust;
74 Value2 = RISCV_CONST_HIGH_PART (Value);
75 *(UINT32 *)RiscVHi20Fixup = (RV_X (Value2, 12, 20) << 12) | \
76 (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
77 Value2 = *(UINT32 *)Fixup & 0x01fff07f;
78 Value &= RISCV_IMM_REACH - 1;
79 *(UINT32 *)Fixup = Value2 | (UINT32)(((RV_X (Value, 0, 5) << 7) | (RV_X (Value, 5, 7) << 25)));
112 if ((Machine == IMAGE_FILE_MACHINE_RISCV64) ||
113 (Machine == IMAGE_FILE_MACHINE_ARM64) ||
114 (Machine == IMAGE_FILE_MACHINE_X64))
139 IN OUT CHAR8 **FixupData,
RETURN_STATUS PeHotRelocateImageEx(IN UINT16 *Reloc, IN OUT CHAR8 *Fixup, IN OUT CHAR8 **FixupData, IN UINT64 Adjust)
RETURN_STATUS PeCoffLoaderRelocateImageEx(IN UINT16 *Reloc, IN OUT CHAR8 *Fixup, IN OUT CHAR8 **FixupData, IN UINT64 Adjust)
BOOLEAN PeCoffLoaderImageFormatSupported(IN UINT16 Machine)
#define RETURN_UNSUPPORTED
#define EFI_IMAGE_REL_BASED_RISCV_HI20