-
Notifications
You must be signed in to change notification settings - Fork 28
/
UefiImageLib.h
722 lines (601 loc) · 25 KB
/
UefiImageLib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
// FIXME: Docs
#ifndef UEFI_IMAGE_LIB_H_
#define UEFI_IMAGE_LIB_H_
#include <Library/UeImageLib.h>
#include <Library/PeCoffLib2.h>
typedef enum {
UefiImageFormatPe = 0,
UefiImageFormatUe = 1,
UefiImageFormatMax
} UEFI_IMAGE_FORMAT;
#define UEFI_IMAGE_SOURCE_NON_FV 0U
#define UEFI_IMAGE_SOURCE_FV 1U
#define UEFI_IMAGE_SOURCE_ALL 2U
#define UEFI_IMAGE_SOURCE_MAX 3U
// FIXME: Get rid of pointers.
typedef struct {
UINT32 ImageBuffer;
UINT32 AddressOfEntryPoint;
UINT8 ImageType;
UINT32 FileBuffer;
UINT32 ExeHdrOffset;
UINT32 SizeOfImage;
UINT32 FileSize;
UINT16 Subsystem;
UINT32 SectionAlignment;
UINT32 SectionsOffset;
UINT16 NumberOfSections;
UINT32 SizeOfHeaders;
} PE_HOB_IMAGE_CONTEXT;
typedef struct {
UINT32 ImageBuffer;
UINT32 FileBuffer;
UINT32 EntryPointAddress;
UINT32 LoadTablesFileOffset;
UINT8 NumLoadTables;
UINT32 LoadTables;
UINT32 Segments;
UINT8 LastSegmentIndex;
UINT32 SegmentAlignment;
UINT32 ImageSize;
UINT8 Subsystem;
UINT8 SegmentImageInfoIterSize;
UINT32 SegmentsFileOffset;
} UE_HOB_IMAGE_CONTEXT;
typedef struct {
UINT8 FormatIndex;
union {
UE_HOB_IMAGE_CONTEXT Ue;
PE_HOB_IMAGE_CONTEXT Pe;
} Ctx;
} HOB_IMAGE_CONTEXT;
typedef UINT8 UEFI_IMAGE_SOURCE;
typedef struct {
UINT8 FormatIndex;
union {
UE_LOADER_IMAGE_CONTEXT Ue;
PE_COFF_LOADER_IMAGE_CONTEXT Pe;
} Ctx;
} UEFI_IMAGE_LOADER_IMAGE_CONTEXT;
typedef struct UEFI_IMAGE_LOADER_RUNTIME_CONTEXT_ UEFI_IMAGE_LOADER_RUNTIME_CONTEXT;
///
/// Image record segment that desribes the UEFI memory permission configuration
/// for one segment of the Image.
///
typedef struct {
///
/// The size, in Bytes, of the Image record segment.
///
UINT32 Size;
///
/// The UEFI memory permission attributes corresponding to this Image record
/// segment.
///
UINT32 Attributes;
} UEFI_IMAGE_RECORD_SEGMENT;
///
/// The 32-bit signature that identifies a UEFI_IMAGE_RECORD structure.
///
#define UEFI_IMAGE_RECORD_SIGNATURE SIGNATURE_32 ('U','I','I','R')
///
/// Image record that describes the UEFI memory permission configuration for
/// every segment of the Image.
///
typedef struct {
///
/// The signature of the Image record structure. Must be set to
/// UEFI_IMAGE_RECORD_SIGNATURE.
///
UINT32 Signature;
///
/// The number of Image records. Must be at least 1.
///
UINT32 NumSegments;
///
/// A link to allow insertion of the Image record into a doubly-linked list.
///
LIST_ENTRY Link;
///
/// The start address of the Image memory space.
///
UINTN StartAddress;
///
/// The end address of the Image memory space. Must be equal to StartAddress
/// plus the sum of Segments[i].Size for 0 <= i < NumSegments.
///
UINTN EndAddress;
///
/// The Image record segments with their corresponding memory permission
/// attributes. All Image record segments are contiguous and cover the entire
/// Image memory space. The address of an Image record segment can be
/// determined by adding the sum of all previous sizes to StartAddress.
///
UEFI_IMAGE_RECORD_SEGMENT Segments[];
} UEFI_IMAGE_RECORD;
/**
Adds the digest of Data to HashContext. This function can be called multiple
times to compute the digest of discontinuous data.
@param[in,out] HashContext The context of the current hash.
@param[in] Data The data to be hashed.
@param[in] DataSize The size, in Bytes, of Data.
@returns Whether hashing has been successful.
**/
typedef
BOOLEAN
(EFIAPI *UEFI_IMAGE_LOADER_HASH_UPDATE)(
IN OUT VOID *HashContext,
IN CONST VOID *Data,
IN UINTN DataSize
);
// FIXME: Docs
RETURN_STATUS
UefiImageInitializeContextPreHash (
OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
IN CONST VOID *FileBuffer,
IN UINT32 FileSize,
IN UEFI_IMAGE_SOURCE Source,
IN UINT8 ImageOrigin
);
RETURN_STATUS
UefiImageInitializeContextPostHash (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Verify the UEFI Image and initialise Context.
Used offsets and ranges must be aligned and in the bounds of the raw file.
Image headers and basic Relocation information must be well-formed.
FileBuffer must remain valid for the entire lifetime of Context.
@param[out] Context The context describing the Image.
@param[in] FileBuffer The file data to parse as UEFI Image.
@param[in] FileSize The size, in Bytes, of FileBuffer.
@param[in] Source Determines supported loaders (PE/UE).
@param[in] ImageOrigin Determines image protection policy.
@retval RETURN_SUCCESS The Image context has been initialised successfully.
@retval other The file data is malformed.
**/
RETURN_STATUS
UefiImageInitializeContext (
OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
IN CONST VOID *FileBuffer,
IN UINT32 FileSize,
IN UEFI_IMAGE_SOURCE Source,
IN UINT8 ImageOrigin
);
/**
Retrieves the UefiImageLib Image format identifier.
@param[out] Context The context describing the Image.
@returns The UefiImageLib format identifier.
**/
UINT8
UefiImageGetFormat (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Hashes the Image using the format's default hashing algorithm.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@param[in,out] HashContext The context of the current hash. Must have been
initialised for usage with the HashUpdate
function.
@param[in] HashUpdate The data hashing function.
@returns Whether hashing has been successful.
**/
BOOLEAN
UefiImageHashImageDefault (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
IN OUT VOID *HashContext,
IN UEFI_IMAGE_LOADER_HASH_UPDATE HashUpdate
);
/**
Load the Image into the destination memory space.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@param[out] Destination The Image destination memory. Must be allocated
from page memory.
@param[in] DestinationSize The size, in Bytes, of Destination. Must be at
least as large as the size returned by
UefiImageGetImageSize().
@retval RETURN_SUCCESS The Image was loaded successfully.
@retval other The Image could not be loaded successfully.
**/
RETURN_STATUS
UefiImageLoadImage (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
OUT VOID *Destination,
IN UINT32 DestinationSize
);
// FIXME: Docs
BOOLEAN
UefiImageImageIsInplace (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Equivalent to the UefiImageLoadImage() function for inplace-loading. Ensures that
all important raw file offsets match the respective RVAs.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@retval RETURN_SUCCESS The Image has been inplace-loaded successfully.
@retval other The Image is not suitable for inplace-loading.
**/
RETURN_STATUS
UefiImageLoadImageInplace (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
// FIXME: Docs
RETURN_STATUS
UefiImageRelocateImageInplace (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
// FIXME:
RETURN_STATUS
UefiImageRelocateImageInplaceForExecution (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Retrieves the size required to bookkeep Image runtime relocation information.
May only be called when UefiImageGetRelocsStripped() returns FALSE.
@param[in,out] Context The context describing the Image. Must have been
loaded by UefiImageLoadImage().
@param[out] Size On output, the size, in Bytes, required for the
bookkeeping buffer.
@retval RETURN_SUCCESS The Image runtime context size for the Image was
retrieved successfully.
@retval other The Image runtime context size for the Image could not
be retrieved successfully.
**/
RETURN_STATUS
UefiImageLoaderGetRuntimeContextSize (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
OUT UINT32 *Size
);
/**
Relocate the Image for boot-time usage.
May only be called when UefiImageGetRelocsStripped() returns FALSE, or with
BaseAddress == UefiImageGetBaseAddress().
@param[in,out] Context The context describing the Image. Must have
been loaded by UefiImageLoadImage().
@param[in] BaseAddress The address to relocate the Image to.
@param[out] RuntimeContext If not NULL, on output, a bookkeeping data
required for Image runtime relocation.
@param[in] RuntimeContextSize The size, in Bytes, of RuntimeContext. Must
be at least as big as the size returned by
UefiImageLoaderGetRuntimeContextSize().
@retval RETURN_SUCCESS The Image has been relocated successfully.
@retval other The Image Relocation Directory is malformed.
**/
RETURN_STATUS
UefiImageRelocateImage (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
IN UINT64 BaseAddress,
OUT UEFI_IMAGE_LOADER_RUNTIME_CONTEXT *RuntimeContext OPTIONAL,
IN UINT32 RuntimeContextSize
);
/**
Load the Image into the destination memory space, relocate Image for boot-time
usage, and perform environment-specific actions required to execute code from
the Image.
May only be called when UefiImageGetRelocsStripped() returns FALSE, or with
BaseAddress == UefiImageGetBaseAddress().
@param[in,out] Context The context describing the Image. Must have
been initialised by
UefiImageInitializeContext().
@param[out] Destination The Image destination memory. Must be
allocated from page memory.
@param[in] DestinationSize The size, in Bytes, of Destination. Must be
at least as large as the size returned by
UefiImageGetImageSize().
@param[out] RuntimeContext If not NULL, on output, a buffer
bookkeeping data required for Image runtime
relocation.
@param[in] RuntimeContextSize The size, in Bytes, of RuntimeContext. Must
be at least as big as the size returned by
UefiImageLoaderGetRuntimeContextSize().
@retval RETURN_SUCCESS The Image was loaded successfully.
@retval other The Image could not be loaded successfully.
**/
RETURN_STATUS
UefiImageLoadImageForExecution (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
OUT VOID *Destination,
IN UINT32 DestinationSize,
OUT UEFI_IMAGE_LOADER_RUNTIME_CONTEXT *RuntimeContext OPTIONAL,
IN UINT32 RuntimeContextSize
);
/**
Relocate Image for Runtime usage.
May only be called when UefiImageGetRelocsStripped() returns FALSE, or with
BaseAddress == UefiImageGetBaseAddress().
@param[in,out] Image The Image destination memory. Must have been
relocated by UefiImageRelocateImage().
@param[in] ImageSize The size, in Bytes, of Image.
@param[in] BaseAddress The address to relocate the Image to.
@param[in] RuntimeContext The Relocation context obtained by
UefiImageRelocateImage().
@retval RETURN_SUCCESS The Image has been relocated successfully.
@retval other The Image could not be relocated successfully.
**/
RETURN_STATUS
UefiImageRuntimeRelocateImage (
IN OUT VOID *Image,
IN UINT32 ImageSize,
IN UINT64 BaseAddress,
IN CONST UEFI_IMAGE_LOADER_RUNTIME_CONTEXT *RuntimeContext
);
/**
Relocate Image for Runtime usage, and perform environment-specific actions
required to execute code from the Image.
May only be called when UefiImageGetRelocsStripped() returns FALSE, or with
BaseAddress == UefiImageGetBaseAddress().
@param[in,out] Image The Image destination memory. Must have been
relocated by UefiImageRelocateImage().
@param[in] ImageSize The size, in Bytes, of Image.
@param[in] BaseAddress The address to relocate the Image to.
@param[in] RuntimeContext The Relocation context obtained by
UefiImageRelocateImage().
@retval RETURN_SUCCESS The Image has been relocated successfully.
@retval other The Image could not be relocated successfully.
**/
RETURN_STATUS
UefiImageRuntimeRelocateImageForExecution (
IN OUT VOID *Image,
IN UINT32 ImageSize,
IN UINT64 BaseAddress,
IN CONST UEFI_IMAGE_LOADER_RUNTIME_CONTEXT *RuntimeContext
);
/**
Discards optional Image segments to disguise sensitive data.
This may destruct the Image Relocation Directory and as such, no function that
performs Image relocation may be called after this function has been invoked.
@param[in,out] Context The context describing the Image. Must have been
loaded by UefiImageLoadImage().
**/
VOID
UefiImageDiscardSegments (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Retrieves the Image symbols path.
@param[in,out] Context The context describing the Image. Must have
been initialised by
UefiImageInitializeContext().
@param[out] SymbolsPath On output, a pointer to the Image symbols
path.
@param[out] SymbolsPathSize On output, the size, in Bytes, of *
SymbolsPath.
@retval RETURN_SUCCESS The Image symbols path was retrieved successfully.
@retval other The Image symbols path could not be retrieved
successfully.
**/
RETURN_STATUS
UefiImageGetSymbolsPath (
IN CONST UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
OUT CONST CHAR8 **SymbolsPath,
OUT UINT32 *SymbolsPathSize
);
/**
Retrieves the Image module name from the Image symbols path.
@param[in,out] Context The context describing the Image. Must have
been initialised by
UefiImageInitializeContext().
@param[out] ModuleName Buffer the Image module name is written into.
If the name exceeds ModuleNameSize, it will be
truncated.
@param[out] ModuleNameSize The size, in Bytes, of ModuleName.
@retval RETURN_SUCCESS The Image module name was retrieved successfully.
@retval other The Image module name could not be retrieved
successfully.
**/
RETURN_STATUS
UefiImageGetModuleNameFromSymbolsPath (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
OUT CHAR8 *ModuleName,
IN UINT32 ModuleNameSize
);
// FIXME: Abstract certificates somehow?
/**
Retrieves the first certificate from the Image Certificate Directory.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@param[out] Certificate On output, the first certificate of the Image.
@retval RETURN_SUCCESS The certificate has been retrieved successfully.
@retval RETURN_NOT_FOUND There is no such certificate.
@retval other The Image Certificate Directory is malformed.
**/
RETURN_STATUS
UefiImageGetFirstCertificate (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
OUT CONST WIN_CERTIFICATE **Certificate
);
/**
Retrieves the next certificate from the Image Certificate Directory.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@param[out] Certificate On input, the current certificate of the Image.
Must have been retrieved by
UefiImageGetFirstCertificate().
On output, the next certificate of the Image.
@retval RETURN_SUCCESS The certificate has been retrieved successfully.
@retval RETURN_NOT_FOUND There is no such certificate.
@retval other The Image Certificate Directory is malformed.
**/
RETURN_STATUS
UefiImageGetNextCertificate (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
IN OUT CONST WIN_CERTIFICATE **Certificate
);
/**
Retrieves the Image HII data RVA.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@param[out] HiiRva On output, the RVA of the HII resource data.
@param[out] HiiSize On output, the size, in Bytes, of HiiRva.
@retval RETURN_SUCCESS The Image HII data has been retrieved successfully.
@retval RETURN_NOT_FOUND The Image HII data could not be found.
@retval other The Image Resource Directory is malformed.
**/
RETURN_STATUS
UefiImageGetHiiDataRva (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
OUT UINT32 *HiiRva,
OUT UINT32 *HiiSize
);
/**
Retrieve the Image entry point RVA.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@returns The Image entry point RVA.
**/
UINT32
UefiImageGetEntryPointAddress (
IN CONST UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Retrieves the Image machine type.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@returns The Image machine type.
**/
UINT16
UefiImageGetMachine (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Retrieves the Image subsystem type.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@returns The Image subsystem type.
**/
UINT16
UefiImageGetSubsystem (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Retrieves the Image segment alignment.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@returns The Image segment alignment.
**/
UINT32
UefiImageGetSegmentAlignment (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Retrieves the size, in Bytes, of the Image memory space.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@returns The size of the Image memory space.
**/
UINT32
UefiImageGetImageSize (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Retrieves the Image preferred load address.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@returns The Image preferred load address.
**/
UINT64
UefiImageGetBaseAddress (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Returns whether the Image relocations have been stripped.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@returns Whether the Image relocations have been stripped.
**/
BOOLEAN
UefiImageGetRelocsStripped (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Retrieves the Image load address UefiImageLoadImage() has loaded the Image to.
May be called only after UefiImageLoadImage() has succeeded.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@returns The Image load address.
**/
UINTN
UefiImageLoaderGetImageAddress (
IN CONST UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Retrieves the Image debug address. Due to post-processing, the debug address
may deviate from the load address. Symbolication must use this address.
May be called only after UefiImageLoadImage() has succeeded.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@returns The Image debug address.
**/
UINTN
UefiImageLoaderGetDebugAddress (
IN CONST UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Retrieve the Image entry point address.
May be called only after UefiImageLoadImage() has succeeded.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@returns The Image entry point addres.
**/
UINTN
UefiImageLoaderGetImageEntryPoint (
IN CONST UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
/**
Constructs an Image record from the Image. Any headers, gaps, or trailers are
described as read-only data.
May be called only after UefiImageLoadImage() has succeeded.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@retval NULL The Image record could not constructed successfully.
@retval other The Image record was constructed successfully and is returned.
It is allocated using the AllocatePool() API and is
caller-owned as soon as this function returns.
**/
UEFI_IMAGE_RECORD *
UefiImageLoaderGetImageRecord (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
// FIXME: Docs
RETURN_STATUS
UefiImageDebugLocateImage (
OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
IN UINTN Address,
IN UINT8 ImageOrigin
);
/**
Retrieve the Image fixed loading address.
This function is only guaranteed to function correctly if the Image was built
by a tool with this feature enabled.
@param[in,out] Context The context describing the Image. Must have been
initialised by UefiImageInitializeContext().
@param[out] Address On output, the fixed loading address of the Image.
*Address is guaranteed to by aligned by the Image
segment alignment, and thus the size returned by
UefiImageGetImageSize is sufficient to hold the
Image.
@retval RETURN_SUCCESS The Image has a fixed loading address.
@retval RETURN_NOT_FOUND The Image does not have a fixed loading address.
@retval RETURN_UNSUPPORTED The Image fixed loading address is unaligned.
**/
RETURN_STATUS
UefiImageGetFixedAddress (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context,
OUT UINT64 *Address
);
// FIXME: Docs
VOID
UefiImageDebugPrintSegments (
IN OUT UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
VOID
UefiImageDebugPrintImageRecord (
IN CONST UEFI_IMAGE_RECORD *ImageRecord
);
UINTN
UefiImageLoaderGetDebugAddress (
IN CONST UEFI_IMAGE_LOADER_IMAGE_CONTEXT *Context
);
#endif // UEFI_IMAGE_LIB_H_