@@ -103,7 +103,7 @@ typedef struct {
103
103
} std_coff_t ;
104
104
105
105
typedef struct {
106
- UINT32 image_base ;
106
+ unsigned long image_base ;
107
107
UINT32 section_alignment ;
108
108
UINT32 file_alignment ;
109
109
UINT16 major_operating_system_version ;
@@ -118,10 +118,10 @@ typedef struct {
118
118
UINT32 checksum ;
119
119
UINT16 subsystem ;
120
120
UINT16 dll_characteristics ;
121
- UINT32 size_of_stack_reserve ;
122
- UINT32 size_of_stack_commit ;
123
- UINT32 size_of_heap_reserve ;
124
- UINT32 size_of_heap_commit ;
121
+ unsigned long size_of_stack_reserve ;
122
+ unsigned long size_of_stack_commit ;
123
+ unsigned long size_of_heap_reserve ;
124
+ unsigned long size_of_heap_commit ;
125
125
UINT32 loader_flags ;
126
126
UINT32 number_of_rva_and_sizes ;
127
127
} win_t ;
@@ -257,8 +257,8 @@ static EFI_STATUS load_sections(section_header_t *section, UINT16 nb,
257
257
return EFI_SUCCESS ;
258
258
}
259
259
260
- static void relocate (loaded_section_t * data , UINT32 base , relocation_t * table ,
261
- UINT32 size )
260
+ static void relocate (loaded_section_t * data , unsigned long base ,
261
+ relocation_t * table , UINT32 size )
262
262
{
263
263
relocation_t * table_end = (relocation_t * )((UINT8 * )table + size );
264
264
unsigned long diff = (unsigned long )data -> addr - base - data -> start ;
@@ -272,9 +272,17 @@ static void relocate(loaded_section_t *data, UINT32 base, relocation_t *table,
272
272
for (; fixup < fixup_end ; fixup ++ ) {
273
273
if (* (UINT16 * )fixup == 0 )
274
274
break ;
275
- if (fixup -> type != HIGHLOW )
276
- continue ;
277
- * (UINT32 * )& mem [fixup -> offset ] += diff ;
275
+ switch (fixup -> type ) {
276
+ case HIGHLOW :
277
+ * (UINT32 * )& mem [fixup -> offset ] += diff ;
278
+ break ;
279
+ case DIR64 :
280
+ * (UINT64 * )& mem [fixup -> offset ] += diff ;
281
+ break ;
282
+ default :
283
+ ewerr ("Unsupported relocation type %d" ,
284
+ fixup -> type );
285
+ }
278
286
}
279
287
table = (relocation_t * )fixup_end ;
280
288
}
0 commit comments