[ROSLOAD] Initial support for launching OS Loader Entrypoint and returning from it
[reactos.git] / boot / environ / include / bl.h
1 /*
2 * COPYRIGHT: See COPYING.ARM in the top level directory
3 * PROJECT: ReactOS UEFI Boot Library
4 * FILE: boot/environ/include/bl.h
5 * PURPOSE: Main Boot Library Header
6 * PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9 #ifndef _BL_H
10 #define _BL_H
11
12 /* INCLUDES ******************************************************************/
13
14 /* C Headers */
15 #include <stdlib.h>
16 #include <stdio.h>
17 #include <wchar.h>
18
19 /* NT Base Headers */
20 #include <ntifs.h>
21
22 /* NDK Headers */
23 #include <ntndk.h>
24
25 /* NT SafeInt Header */
26 #include <ntintsafe.h>
27
28 /* PE Headers */
29 #include <ntimage.h>
30
31 /* ACPI Headers */
32 #include <drivers/acpi/acpi.h>
33
34 /* UEFI Headers */
35 #include <Uefi.h>
36 #include <DevicePath.h>
37 #include <LoadedImage.h>
38 #include <GraphicsOutput.h>
39 #include <UgaDraw.h>
40 #include <BlockIo.h>
41 #include <Acpi.h>
42 #include <GlobalVariable.h>
43
44 /* Registry Headers */
45 #define __FREELDR_H
46 #include <cmlib.h>
47
48 /* DEFINES *******************************************************************/
49
50 DEFINE_GUID(BadMemoryGuid, 0x54B8275B, 0xD431, 0x473F, 0xAC, 0xFB, 0xE5, 0x36, 0xA0, 0x84, 0x94, 0xA3);
51
52 #define BL_APPLICATION_FLAG_CONVERTED_FROM_EFI 0x01
53
54 #define BL_APP_ENTRY_SIGNATURE "BTAPENT"
55
56 #define BOOT_APPLICATION_SIGNATURE_1 'TOOB'
57 #define BOOT_APPLICATION_SIGNATURE_2 ' PPA'
58
59 #define BOOT_MEMORY_TRANSLATION_TYPE_PHYSICAL 0
60 #define BOOT_MEMORY_TRANSLATION_TYPE_VIRTUAL 1
61
62 #define BOOT_APPLICATION_VERSION 2
63 #define BL_MEMORY_DATA_VERSION 1
64 #define BL_RETURN_ARGUMENTS_VERSION 1
65 #define BL_FIRMWARE_DESCRIPTOR_VERSION 2
66
67 #define BL_RETURN_ARGUMENTS_NO_PAE_FLAG 0x40
68
69 #define BL_APPLICATION_ENTRY_FLAG_NO_GUID 0x01
70 #define BL_APPLICATION_ENTRY_BCD_OPTIONS_INTERNAL 0x02
71 #define BL_APPLICATION_ENTRY_WINLOAD 0x04
72 #define BL_APPLICATION_ENTRY_STARTUP 0x08
73 #define BL_APPLICATION_ENTRY_REBOOT_ON_ERROR 0x20
74 #define BL_APPLICATION_ENTRY_NTLDR 0x40
75 #define BL_APPLICATION_ENTRY_BCD_OPTIONS_EXTERNAL 0x80
76 #define BL_APPLICATION_ENTRY_WINRESUME 0x100
77 #define BL_APPLICATION_ENTRY_SETUPLDR 0x200
78 #define BL_APPLICATION_ENTRY_BOOTSECTOR 0x400
79 #define BL_APPLICATION_ENTRY_BOOTMGR 0x1000
80 #define BL_APPLICATION_ENTRY_DISPLAY_ORDER 0x800000
81 #define BL_APPLICATION_ENTRY_FIXED_SEQUENCE 0x20000000
82 #define BL_APPLICATION_ENTRY_RECOVERY 0x40000000
83
84 #define BL_CONTEXT_PAGING_ON 1
85 #define BL_CONTEXT_INTERRUPTS_ON 2
86
87 #define BL_MM_FLAG_USE_FIRMWARE_FOR_MEMORY_MAP_BUFFERS 0x01
88 #define BL_MM_FLAG_REQUEST_COALESCING 0x02
89
90 #define BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG 0x01
91 #define BL_MM_ADD_DESCRIPTOR_TRUNCATE_FLAG 0x02
92 #define BL_MM_ADD_DESCRIPTOR_NEVER_COALESCE_FLAG 0x10
93 #define BL_MM_ADD_DESCRIPTOR_NEVER_TRUNCATE_FLAG 0x20
94 #define BL_MM_ADD_DESCRIPTOR_ALLOCATE_FLAG 0x1000
95 #define BL_MM_ADD_DESCRIPTOR_UPDATE_LIST_POINTER_FLAG 0x2000
96
97 #define BL_MM_INCLUDE_MAPPED_ALLOCATED 0x01
98 #define BL_MM_INCLUDE_MAPPED_UNALLOCATED 0x02
99 #define BL_MM_INCLUDE_UNMAPPED_ALLOCATED 0x04
100 #define BL_MM_INCLUDE_UNMAPPED_UNALLOCATED 0x08
101 #define BL_MM_INCLUDE_RESERVED_ALLOCATED 0x10
102 #define BL_MM_INCLUDE_BAD_MEMORY 0x20
103 #define BL_MM_INCLUDE_FIRMWARE_MEMORY 0x40
104 #define BL_MM_INCLUDE_TRUNCATED_MEMORY 0x80
105 #define BL_MM_INCLUDE_PERSISTENT_MEMORY 0x100
106 #define BL_MM_INCLUDE_FIRMWARE_MEMORY_2 0x200
107
108 #define BL_MM_INCLUDE_NO_FIRMWARE_MEMORY (BL_MM_INCLUDE_PERSISTENT_MEMORY | \
109 BL_MM_INCLUDE_TRUNCATED_MEMORY | \
110 BL_MM_INCLUDE_BAD_MEMORY | \
111 BL_MM_INCLUDE_RESERVED_ALLOCATED | \
112 BL_MM_INCLUDE_UNMAPPED_UNALLOCATED | \
113 BL_MM_INCLUDE_UNMAPPED_ALLOCATED | \
114 BL_MM_INCLUDE_MAPPED_UNALLOCATED | \
115 BL_MM_INCLUDE_MAPPED_ALLOCATED)
116 C_ASSERT(BL_MM_INCLUDE_NO_FIRMWARE_MEMORY == 0x1BF);
117
118 #define BL_MM_INCLUDE_ONLY_FIRMWARE_MEMORY (BL_MM_INCLUDE_FIRMWARE_MEMORY_2 | \
119 BL_MM_INCLUDE_FIRMWARE_MEMORY)
120 C_ASSERT(BL_MM_INCLUDE_ONLY_FIRMWARE_MEMORY == 0x240);
121
122 #define BL_MM_REQUEST_DEFAULT_TYPE 1
123 #define BL_MM_REQUEST_TOP_DOWN_TYPE 2
124
125 #define BL_MM_REMOVE_PHYSICAL_REGION_FLAG 0x40000000
126 #define BL_MM_REMOVE_VIRTUAL_REGION_FLAG 0x80000000
127
128 #define BL_LIBRARY_FLAG_NO_DISPLAY 0x01
129 #define BL_LIBRARY_FLAG_REINITIALIZE 0x02
130 #define BL_LIBRARY_FLAG_REINITIALIZE_ALL 0x04
131 #define BL_LIBRARY_FLAG_ZERO_HEAP_ALLOCATIONS_ON_FREE 0x10
132 #define BL_LIBRARY_FLAG_INITIALIZATION_COMPLETED 0x20
133 #define BL_LIBRARY_FLAG_NO_GRAPHICS_CONSOLE 0x800
134
135 #define BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG 0x01
136 #define BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG 0x02
137
138 #define BL_HT_VALUE_IS_INLINE 0x01
139
140 #define BL_FS_REGISTER_AT_HEAD_FLAG 1
141
142 #define BL_BLOCK_DEVICE_REMOVABLE_FLAG 0x01
143 #define BL_BLOCK_DEVICE_PRESENT_FLAG 0x02
144 #define BL_BLOCK_DEVICE_VIRTUAL_FLAG 0x04
145
146 #define BL_MEMORY_CLASS_SHIFT 28
147
148 #define BL_FILE_READ_ACCESS 0x01
149 #define BL_FILE_WRITE_ACCESS 0x02
150 #define BL_DIRECTORY_ACCESS 0x04
151 #define BL_UNKNOWN_ACCESS 0x10
152
153 #define BL_DEVICE_READ_ACCESS 0x01
154 #define BL_DEVICE_WRITE_ACCESS 0x02
155
156 #define BL_DEVICE_ENTRY_OPENED 0x01
157 #define BL_DEVICE_ENTRY_READ_ACCESS 0x02
158 #define BL_DEVICE_ENTRY_WRITE_ACCESS 0x04
159
160 #define BL_FILE_ENTRY_OPENED 0x01
161 #define BL_FILE_ENTRY_READ_ACCESS 0x02
162 #define BL_FILE_ENTRY_WRITE_ACCESS 0x04
163 #define BL_FILE_ENTRY_UNKNOWN_ACCESS 0x10
164 #define BL_FILE_ENTRY_DIRECTORY 0x10000
165
166 #define BL_ETFS_FILE_ENTRY_DIRECTORY 0x01
167
168 #define BL_IMG_VALID_FILE 0x01
169 #define BL_IMG_MEMORY_FILE 0x02
170 #define BL_IMG_REMOTE_FILE 0x04
171
172 #define BL_LOAD_IMG_VIRTUAL_BUFFER 0x01
173 #define BL_LOAD_IMG_EXISTING_BUFFER 0x04
174 #define BL_LOAD_IMG_UNKNOWN_BUFFER_FLAG 0x08
175 #define BL_LOAD_IMG_COMPUTE_SIGNATURE 0x10
176 #define BL_LOAD_IMG_COMPUTE_HASH 0x40000
177
178 #define BL_LOAD_PE_IMG_VIRTUAL_BUFFER BL_LOAD_IMG_VIRTUAL_BUFFER
179 #define BL_LOAD_PE_IMG_CHECK_MACHINE 0x02
180 #define BL_LOAD_PE_IMG_EXISTING_BUFFER BL_LOAD_IMG_EXISTING_BUFFER
181 #define BL_LOAD_PE_IMG_COMPUTE_HASH 0x10
182 #define BL_LOAD_PE_IMG_CHECK_SUBSYSTEM 0x80
183 #define BL_LOAD_PE_IMG_SKIP_RELOCATIONS 0x100
184 #define BL_LOAD_PE_IMG_CHECK_FORCED_INTEGRITY 0x200
185 #define BL_LOAD_PE_IMG_IGNORE_CHECKSUM_MISMATCH 0x10000
186 #define BL_LOAD_PE_IMG_VALIDATE_ORIGINAL_FILENAME 0x400000
187
188 #define BL_UTL_CHECKSUM_COMPLEMENT 0x10000
189 #define BL_UTL_CHECKSUM_ROTATE 0x20000
190 #define BL_UTL_CHECKSUM_NEGATE 0x40000
191 #define BL_UTL_CHECKSUM_UCHAR_BUFFER 0x01
192 #define BL_UTL_CHECKSUM_USHORT_BUFFER 0x02
193
194 /* ENUMERATIONS **************************************************************/
195
196 typedef enum _BL_COLOR
197 {
198 Black,
199 Blue,
200 Green,
201 Cyan,
202 Red,
203 Magenta,
204 Brown,
205 LtGray,
206 Gray,
207 LtBlue,
208 LtGreen,
209 LtCyan,
210 LtRed,
211 LtMagenta,
212 Yellow,
213 White
214 } BL_COLOR, *PBL_COLOR;
215
216 typedef enum _BL_MENU_POLICY
217 {
218 MenuPolicyLegacy = 0,
219 MenuPolicyStandard = 1
220 } BL_MENU_POLICY;
221
222 typedef enum _BL_MEMORY_DESCRIPTOR_TYPE
223 {
224 BlMdPhysical,
225 BlMdVirtual,
226 BlMdTracker
227 } BL_MEMORY_DESCRIPTOR_TYPE;
228
229 typedef enum _BL_TRANSLATION_TYPE
230 {
231 BlNone,
232 BlVirtual,
233 BlPae,
234 BlMax
235 } BL_TRANSLATION_TYPE;
236
237 typedef enum _BL_ARCH_MODE
238 {
239 BlProtectedMode,
240 BlRealMode
241 } BL_ARCH_MODE;
242
243 //
244 // Boot Device Types
245 //
246 typedef enum _BL_DEVICE_TYPE
247 {
248 DiskDevice = 0,
249 LegacyPartitionDevice = 2,
250 SerialDevice = 3,
251 UdpDevice = 4,
252 BootDevice = 5,
253 PartitionDevice = 6,
254 LocateDevice = 8,
255 } BL_DEVICE_TYPE;
256
257 //
258 // Local Device Types
259 //
260 typedef enum _BL_LOCAL_DEVICE_TYPE
261 {
262 LocalDevice = 0,
263 FloppyDevice = 1,
264 CdRomDevice = 2,
265 RamDiskDevice = 3,
266 FileDevice = 5,
267 VirtualDiskDevice = 6
268 } BL_LOCAL_DEVICE_TYPE;
269
270 //
271 // Partition types
272 //
273 typedef enum _BL_PARTITION_TYPE
274 {
275 GptPartition,
276 MbrPartition,
277 RawPartition,
278 } BL_PARTITION_TYPE;
279
280 //
281 // File Path Types
282 //
283 typedef enum _BL_PATH_TYPE
284 {
285 InternalPath = 3,
286 EfiPath = 4
287 } BL_PATH_TYPE;
288
289 //
290 // Classes of Memory
291 //
292 typedef enum _BL_MEMORY_CLASS
293 {
294 BlLoaderClass = 0xD,
295 BlApplicationClass,
296 BlSystemClass
297 } BL_MEMORY_CLASS;
298
299 //
300 // Types of Memory
301 //
302 typedef enum _BL_MEMORY_TYPE
303 {
304 //
305 // Loader Memory
306 //
307 BlLoaderMemory = 0xD0000002,
308 BlLoaderDeviceMemory = 0xD0000004,
309 BlLoaderHeap = 0xD0000005,
310 BlLoaderPageDirectory = 0xD0000006,
311 BlLoaderReferencePage = 0xD0000007,
312 BlLoaderRamDisk = 0xD0000008,
313 BlLoaderArchData = 0xD0000009,
314 BlLoaderData = 0xD000000A,
315 BlLoaderRegistry = 0xD000000B,
316 BlLoaderBlockMemory = 0xD000000C,
317 BlLoaderSelfMap = 0xD000000F,
318
319 //
320 // Application Memory
321 //
322 BlApplicationReserved = 0xE0000001,
323 BlApplicationData = 0xE0000004,
324
325 //
326 // System Memory
327 //
328 BlConventionalMemory = 0xF0000001,
329 BlUnusableMemory = 0xF0000002,
330 BlReservedMemory = 0xF0000003,
331 BlEfiBootMemory = 0xF0000004,
332 BlConventionalZeroedMemory = 0xF000005,
333 BlEfiRuntimeCodeMemory = 0xF0000006,
334 BlAcpiReclaimMemory = 0xF0000008,
335 BlAcpiNvsMemory = 0xF0000009,
336 BlDeviceIoMemory = 0xF000000A,
337 BlDevicePortMemory = 0xF000000B,
338 BlPalMemory = 0xF000000C,
339 BlEfiRuntimeDataMemory = 0xF000000E,
340 } BL_MEMORY_TYPE;
341
342 typedef enum _BL_MEMORY_ATTR
343 {
344 //
345 // Memory Caching Attributes
346 //
347 BlMemoryUncached = 0x00000001,
348 BlMemoryWriteCombined = 0x00000002,
349 BlMemoryWriteThrough = 0x00000004,
350 BlMemoryWriteBack = 0x00000008,
351 BlMemoryUncachedExported = 0x00000010,
352 BlMemoryValidCacheAttributes = BlMemoryUncached | BlMemoryWriteCombined | BlMemoryWriteThrough | BlMemoryWriteBack | BlMemoryUncachedExported,
353 BlMemoryValidCacheAttributeMask = 0x000000FF,
354
355 //
356 // Memory Protection Attributes
357 //
358 BlMemoryWriteProtected = 0x00000100,
359 BlMemoryReadProtected = 0x00000200,
360 BlMemoryExecuteProtected = 0x00000400,
361 BlMemoryValidProtectionAttributes = BlMemoryWriteProtected | BlMemoryReadProtected | BlMemoryExecuteProtected,
362 BlMemoryValidProtectionAttributeMask = 0x0000FF00,
363
364 //
365 // Memory Allocation Attributes
366 //
367 BlMemoryLargePages = 0x00010000,
368 BlMemoryKernelRange = 0x00020000,
369 BlMemoryFixed = 0x00040000,
370 BlMemoryBelow1MB = 0x00080000,
371 BlMemoryValidAllocationAttributes = BlMemoryKernelRange | BlMemoryFixed | BlMemoryBelow1MB | BlMemoryLargePages,
372 BlMemoryValidAllocationAttributeMask = 0x00FF0000,
373
374 //
375 // Memory Type Attributes
376 //
377 BlMemoryRuntime = 0x01000000,
378 BlMemoryCoalesced = 0x02000000,
379 BlMemoryUpdate = 0x04000000,
380 BlMemoryNonFirmware = 0x08000000,
381 BlMemoryPersistent = 0x10000000,
382 BlMemorySpecial = 0x20000000,
383 BlMemoryFirmware = 0x80000000,
384 BlMemoryValidTypeAttributes = BlMemoryRuntime | BlMemoryCoalesced | BlMemoryUpdate | BlMemoryNonFirmware | BlMemoryPersistent | BlMemorySpecial | BlMemoryFirmware,
385 BlMemoryValidTypeAttributeMask = 0xFF000000,
386 } BL_MEMORY_ATTR;
387
388 /* CALLBACKS *****************************************************************/
389
390 struct _BL_FILE_ENTRY;
391 struct _BL_FILE_INFORMATION;
392 typedef
393 NTSTATUS
394 (*PBL_FILE_OPEN) (
395 _In_ struct _BL_FILE_ENTRY* Directory,
396 _In_ PWCHAR FileName,
397 _In_ ULONG Flags,
398 _Out_ struct _BL_FILE_ENTRY** FileEntry
399 );
400
401 typedef
402 NTSTATUS
403 (*PBL_FILE_CLOSE) (
404 _In_ struct _BL_FILE_ENTRY* FileEntry
405 );
406
407 typedef
408 NTSTATUS
409 (*PBL_FILE_READ) (
410 _In_ struct _BL_FILE_ENTRY* FileEntry,
411 _In_ PVOID Buffer,
412 _In_ ULONG Size,
413 _Out_opt_ PULONG BytesRead
414 );
415
416 typedef
417 NTSTATUS
418 (*PBL_FILE_WRITE) (
419 VOID
420 );
421
422 typedef
423 NTSTATUS
424 (*PBL_FILE_GET_NEXT) (
425 VOID
426 );
427
428 typedef
429 NTSTATUS
430 (*PBL_FILE_GET_INFO) (
431 _In_ struct _BL_FILE_ENTRY* FileEntry,
432 _Out_ struct _BL_FILE_INFORMATION* FileInfo
433 );
434
435 typedef
436 NTSTATUS
437 (*PBL_FILE_SET_INFO) (
438 _In_ struct _BL_FILE_ENTRY* FileEntry,
439 _In_ struct _BL_FILE_INFORMATION* FileInfo
440 );
441
442 typedef
443 NTSTATUS
444 (*PBL_FS_INIT_CALLBACK) (
445 VOID
446 );
447
448 typedef
449 NTSTATUS
450 (*PBL_FS_DESTROY_CALLBACK) (
451 VOID
452 );
453
454 typedef
455 NTSTATUS
456 (*PBL_FS_MOUNT_CALLBACK) (
457 _In_ ULONG DeviceId,
458 _In_ ULONG Unknown,
459 _Out_ struct _BL_FILE_ENTRY** FileEntry
460 );
461
462 typedef
463 NTSTATUS
464 (*PBL_FS_PURGE_CALLBACK) (
465 VOID
466 );
467
468 typedef
469 NTSTATUS
470 (*PBL_FILE_DESTROY_CALLBACK) (
471 _In_ PVOID Entry
472 );
473
474 struct _BL_TEXT_CONSOLE;
475 struct _BL_DISPLAY_STATE;
476 struct _BL_DISPLAY_MODE;
477 struct _BL_INPUT_CONSOLE;
478 struct _BL_REMOTE_CONSOLE;
479 struct _BL_GRAPHICS_CONSOLE;
480 typedef
481 VOID
482 (*PCONSOLE_DESTRUCT) (
483 _In_ struct _BL_TEXT_CONSOLE* Console
484 );
485
486 typedef
487 NTSTATUS
488 (*PCONSOLE_REINITIALIZE) (
489 _In_ struct _BL_TEXT_CONSOLE* Console
490 );
491
492 typedef
493 NTSTATUS
494 (*PCONSOLE_GET_TEXT_STATE) (
495 _In_ struct _BL_TEXT_CONSOLE* Console,
496 _Out_ struct _BL_DISPLAY_STATE* TextState
497 );
498
499 typedef
500 NTSTATUS
501 (*PCONSOLE_SET_TEXT_STATE) (
502 _In_ struct _BL_TEXT_CONSOLE* Console,
503 _In_ ULONG Flags,
504 _In_ struct _BL_DISPLAY_STATE* TextState
505 );
506
507 typedef
508 NTSTATUS
509 (*PCONSOLE_GET_TEXT_RESOLUTION) (
510 _In_ struct _BL_TEXT_CONSOLE* Console,
511 _Out_ PULONG TextResolution
512 );
513
514 typedef
515 NTSTATUS
516 (*PCONSOLE_SET_TEXT_RESOLUTION) (
517 _In_ struct _BL_TEXT_CONSOLE* Console,
518 _In_ ULONG NewTextResolution,
519 _Out_ PULONG OldTextResolution
520 );
521
522 typedef
523 NTSTATUS
524 (*PCONSOLE_CLEAR_TEXT) (
525 _In_ struct _BL_TEXT_CONSOLE* Console,
526 _In_ BOOLEAN LineOnly
527 );
528
529 typedef
530 BOOLEAN
531 (*PCONSOLE_IS_ENABLED) (
532 _In_ struct _BL_GRAPHICS_CONSOLE* Console
533 );
534
535 typedef
536 NTSTATUS
537 (*PCONSOLE_GET_GRAPHICAL_RESOLUTION) (
538 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
539 _Out_ struct _BL_DISPLAY_MODE* DisplayMode
540 );
541
542 typedef
543 NTSTATUS
544 (*PCONSOLE_SET_GRAPHICAL_RESOLUTION) (
545 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
546 _In_ struct _BL_DISPLAY_MODE DisplayMode
547 );
548
549 typedef
550 NTSTATUS
551 (*PCONSOLE_ENABLE) (
552 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
553 _In_ BOOLEAN Enable
554 );
555
556 typedef
557 NTSTATUS
558 (*PCONSOLE_WRITE_TEXT) (
559 _In_ struct _BL_TEXT_CONSOLE* Console,
560 _In_ PCHAR Text,
561 _In_ ULONG Attribute
562 );
563
564 typedef
565 BOOLEAN
566 (*PBL_TBL_LOOKUP_ROUTINE) (
567 _In_ PVOID Entry,
568 _In_ PVOID Argument1,
569 _In_ PVOID Argument2,
570 _In_ PVOID Argument3,
571 _In_ PVOID Argument4
572 );
573
574 typedef
575 NTSTATUS
576 (*PBL_TBL_MAP_ROUTINE) (
577 _In_ PVOID Entry,
578 _In_ ULONG EntryIndex
579 );
580
581 typedef
582 NTSTATUS
583 (*PBL_TBL_SET_ROUTINE) (
584 _In_ PVOID Entry
585 );
586
587 typedef
588 NTSTATUS
589 (*PBL_IO_DESTROY_ROUTINE) (
590 VOID
591 );
592
593 struct _BL_HASH_ENTRY;
594 typedef
595 BOOLEAN
596 (*PBL_HASH_TABLE_COMPARE_FUNCTION) (
597 _In_ struct _BL_HASH_ENTRY* Entry1,
598 _In_ struct _BL_HASH_ENTRY* Entry2
599 );
600
601 typedef
602 ULONG
603 (*PBL_HASH_TABLE_HASH_FUNCTION) (
604 _In_ struct _BL_HASH_ENTRY* Entry,
605 _In_ ULONG TableSize
606 );
607
608 struct _BL_DEVICE_ENTRY;
609 struct _BL_DEVICE_DESCRIPTOR;
610 struct _BL_DEVICE_INFORMATION;
611
612 typedef
613 NTSTATUS
614 (*PBL_DEVICE_ENUMERATE_DEVICE_CLASS) (
615 VOID
616 );
617
618 typedef
619 NTSTATUS
620 (*PBL_DEVICE_OPEN) (
621 _In_ struct _BL_DEVICE_DESCRIPTOR* Device,
622 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry
623 );
624
625 typedef
626 NTSTATUS
627 (*PBL_DEVICE_CLOSE) (
628 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry
629 );
630
631 typedef
632 NTSTATUS
633 (*PBL_DEVICE_READ) (
634 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry,
635 _In_ PVOID Buffer,
636 _In_ ULONG Size,
637 _Out_ PULONG BytesRead
638 );
639
640 typedef
641 NTSTATUS
642 (*PBL_DEVICE_WRITE) (
643 VOID
644 );
645
646 typedef
647 NTSTATUS
648 (*PBL_DEVICE_GET_INFORMATION) (
649 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry,
650 _Out_ struct _BL_DEVICE_INFORMATION* DeviceInformation
651 );
652
653 typedef
654 NTSTATUS
655 (*PBL_DEVICE_SET_INFORMATION) (
656 _In_ struct _BL_DEVICE_ENTRY* DeviceEntry,
657 _In_ struct _BL_DEVICE_INFORMATION* DeviceInformation
658 );
659
660 typedef
661 NTSTATUS
662 (*PBL_DEVICE_RESET) (
663 VOID
664 );
665
666 typedef
667 NTSTATUS
668 (*PBL_DEVICE_FLUSH) (
669 VOID
670 );
671
672 typedef
673 NTSTATUS
674 (*PBL_DEVICE_CREATE) (
675 VOID
676 );
677
678 /* DATA STRUCTURES ***********************************************************/
679
680 typedef struct _BL_LIBRARY_PARAMETERS
681 {
682 ULONG LibraryFlags;
683 ULONG TranslationType;
684 ULONG MinimumAllocationCount;
685 ULONG MinimumHeapSize;
686 ULONG HeapAllocationAttributes;
687 PWCHAR ApplicationBaseDirectory;
688 ULONG DescriptorCount;
689 PWCHAR FontBaseDirectory;
690 } BL_LIBRARY_PARAMETERS, *PBL_LIBRARY_PARAMETERS;
691
692 /* This should eventually go into a more public header */
693 typedef struct _BOOT_APPLICATION_PARAMETER_BLOCK
694 {
695 /* This header tells the library what image we're dealing with */
696 ULONG Signature[2];
697 ULONG Version;
698 ULONG Size;
699 ULONG ImageType;
700 ULONG MemoryTranslationType;
701
702 /* Where is the image located */
703 ULONGLONG ImageBase;
704 ULONG ImageSize;
705
706 /* Offset to BL_MEMORY_DATA */
707 ULONG MemoryDataOffset;
708
709 /* Offset to BL_APPLICATION_ENTRY */
710 ULONG AppEntryOffset;
711
712 /* Offset to BL_DEVICE_DESCRPIPTOR */
713 ULONG BootDeviceOffset;
714
715 /* Offset to BL_FIRMWARE_PARAMETERS */
716 ULONG FirmwareParametersOffset;
717
718 /* Offset to BL_RETURN_ARGUMENTS */
719 ULONG ReturnArgumentsOffset;
720 } BOOT_APPLICATION_PARAMETER_BLOCK, *PBOOT_APPLICATION_PARAMETER_BLOCK;
721
722 typedef struct _BL_MEMORY_DATA
723 {
724 ULONG Version;
725 ULONG MdListOffset;
726 ULONG DescriptorCount;
727 ULONG DescriptorSize;
728 ULONG DescriptorOffset;
729 } BL_MEMORY_DATA, *PBL_MEMORY_DATA;
730
731 typedef struct _BL_FIRMWARE_DESCRIPTOR
732 {
733 ULONG Version;
734 ULONG Unknown;
735 EFI_HANDLE ImageHandle;
736 EFI_SYSTEM_TABLE *SystemTable;
737 } BL_FIRMWARE_DESCRIPTOR, *PBL_FIRMWARE_DESCRIPTOR;
738
739 typedef struct _BL_RETURN_ARGUMENTS
740 {
741 ULONG Version;
742 NTSTATUS Status;
743 ULONG Flags;
744 ULONGLONG DataSize;
745 ULONGLONG DataPage;
746 } BL_RETURN_ARGUMENTS, *PBL_RETURN_ARGUMENTS;
747
748 typedef struct _BL_MEMORY_DESCRIPTOR
749 {
750 LIST_ENTRY ListEntry;
751 union
752 {
753 struct
754 {
755 ULONGLONG BasePage;
756 ULONGLONG VirtualPage;
757 };
758 struct
759 {
760 ULONGLONG BaseAddress;
761 ULONGLONG VirtualAddress;
762 };
763 };
764 ULONGLONG PageCount;
765 ULONG Flags;
766 BL_MEMORY_TYPE Type;
767 } BL_MEMORY_DESCRIPTOR, *PBL_MEMORY_DESCRIPTOR;
768
769 typedef struct _BL_BCD_OPTION
770 {
771 ULONG Type;
772 ULONG DataOffset;
773 ULONG DataSize;
774 ULONG ListOffset;
775 ULONG NextEntryOffset;
776 ULONG Empty;
777 } BL_BCD_OPTION, *PBL_BCD_OPTION;
778
779 typedef struct _BL_APPLICATION_ENTRY
780 {
781 CHAR Signature[8];
782 ULONG Flags;
783 GUID Guid;
784 ULONG Unknown[4];
785 BL_BCD_OPTION BcdData;
786 } BL_APPLICATION_ENTRY, *PBL_APPLICATION_ENTRY;
787
788 typedef struct _BL_LOADED_APPLICATION_ENTRY
789 {
790 ULONG Flags;
791 GUID Guid;
792 PBL_BCD_OPTION BcdData;
793 } BL_LOADED_APPLICATION_ENTRY, *PBL_LOADED_APPLICATION_ENTRY;
794
795 typedef struct _BL_MENU_STATUS
796 {
797 union
798 {
799 struct
800 {
801 ULONG AnyKey : 1;
802 ULONG AdvancedOptions : 1;
803 ULONG BootOptions : 1;
804 ULONG OemKey : 1;
805 ULONG Exit : 1;
806 ULONG Reserved : 27;
807 };
808 ULONG AsULong;
809 };
810 ULONG BootIndex;
811 WCHAR KeyValue;
812 } BL_MENU_STATUS, *PL_MENU_STATUS;
813
814 typedef enum _BL_BOOT_ERROR_STATUS
815 {
816 Reboot = 1,
817 Recover = 2,
818 RecoverOem = 3,
819 OsSelection = 4,
820 NextOs = 5,
821 TryAgain = 6,
822 AdvancedOptions = 7,
823 BootOptions = 8
824 } BL_BOOT_ERROR_STATUS;
825
826 typedef struct _BL_HARDDISK_DEVICE
827 {
828 ULONG PartitionType;
829 union
830 {
831 struct
832 {
833 ULONG PartitionSignature;
834 } Mbr;
835
836 struct
837 {
838 GUID PartitionSignature;
839 } Gpt;
840
841 struct
842 {
843 ULONG DiskNumber;
844 } Raw;
845 };
846 } BL_HARDDISK_DEVICE;
847
848 typedef struct _BL_LOCAL_DEVICE
849 {
850 ULONG Type;
851 union
852 {
853 struct
854 {
855 ULONG DriveNumber;
856 } FloppyDisk;
857
858 BL_HARDDISK_DEVICE HardDisk;
859
860 struct
861 {
862 PHYSICAL_ADDRESS ImageBase;
863 LARGE_INTEGER ImageSize;
864 ULONG ImageOffset;
865 } RamDisk;
866
867 ULONG File; // unknown for now
868 };
869 } BL_LOCAL_DEVICE, *PBL_LOCAL_DEVICE;
870
871 typedef struct _BL_DEVICE_DESCRIPTOR
872 {
873 DEVICE_TYPE DeviceType;
874 ULONG Flags;
875 ULONG Size;
876 ULONG Unknown;
877 union
878 {
879 BL_LOCAL_DEVICE Local;
880
881 struct
882 {
883 ULONG Unknown;
884 } Remote;
885
886 struct
887 {
888 union
889 {
890 ULONG PartitionNumber;
891 } Mbr;
892
893 union
894 {
895 GUID PartitionGuid;
896 } Gpt;
897
898 BL_LOCAL_DEVICE Disk;
899 } Partition;
900 };
901 } BL_DEVICE_DESCRIPTOR, *PBL_DEVICE_DESCRIPTOR;
902
903 typedef struct _BL_FILE_PATH_DESCRIPTOR
904 {
905 ULONG Version;
906 ULONG Length;
907 ULONG PathType;
908 UCHAR Path[ANYSIZE_ARRAY];
909 } BL_FILE_PATH_DESCRIPTOR, *PBL_FILE_PATH_DESCRIPTOR;
910
911 typedef struct _BL_WINDOWS_LOAD_OPTIONS
912 {
913 CHAR Signature[8];
914 ULONG Version;
915 ULONG Length;
916 ULONG OsPathOffset;
917 WCHAR LoadOptions[ANYSIZE_ARRAY];
918 } BL_WINDOWS_LOAD_OPTIONS, *PBL_WINDOWS_LOAD_OPTIONS;
919
920 typedef struct _BL_ARCH_CONTEXT
921 {
922 BL_ARCH_MODE Mode;
923 BL_TRANSLATION_TYPE TranslationType;
924 ULONG ContextFlags;
925 } BL_ARCH_CONTEXT, *PBL_ARCH_CONTEXT;
926
927 typedef struct _BL_MEMORY_DESCRIPTOR_LIST
928 {
929 LIST_ENTRY ListHead;
930 PLIST_ENTRY First;
931 PLIST_ENTRY This;
932 ULONG Type;
933 } BL_MEMORY_DESCRIPTOR_LIST, *PBL_MEMORY_DESCRIPTOR_LIST;
934
935 typedef struct _BL_ADDRESS_RANGE
936 {
937 ULONGLONG Minimum;
938 ULONGLONG Maximum;
939 } BL_ADDRESS_RANGE, *PBL_ADDRESS_RANGE;
940
941 typedef struct _BL_FILE_INFORMATION
942 {
943 ULONGLONG Size;
944 ULONGLONG Offset;
945 PWCHAR FsName;
946 ULONG Flags;
947 } BL_FILE_INFORMATION, *PBL_FILE_INFORMATION;
948
949 typedef struct _BL_FILE_CALLBACKS
950 {
951 PBL_FILE_OPEN Open;
952 PBL_FILE_CLOSE Close;
953 PBL_FILE_READ Read;
954 PBL_FILE_WRITE Write;
955 PBL_FILE_GET_NEXT GetNext;
956 PBL_FILE_GET_INFO GetInfo;
957 PBL_FILE_SET_INFO SetInfo;
958 } BL_FILE_CALLBACKS, *PBL_FILE_CALLBACKS;
959
960 typedef struct _BL_FILE_ENTRY
961 {
962 PWCHAR FilePath;
963 ULONG DeviceId;
964 ULONG FileId;
965 ULONG Flags;
966 ULONG ReferenceCount;
967 ULONG Unknown;
968 ULONGLONG TotalBytesRead;
969 ULONGLONG Unknown2;
970 BL_FILE_CALLBACKS Callbacks;
971 PVOID FsSpecificData;
972 } BL_FILE_ENTRY, *PBL_FILE_ENTRY;
973
974 typedef struct _BL_FILE_SYSTEM_ENTRY
975 {
976 LIST_ENTRY ListEntry;
977 PBL_FS_INIT_CALLBACK InitCallback;
978 PBL_FS_DESTROY_CALLBACK DestroyCallback;
979 PBL_FS_MOUNT_CALLBACK MountCallback;
980 PBL_FS_PURGE_CALLBACK PurgeCallback;
981 } BL_FILE_SYSTEM_ENTRY, *PBL_FILE_SYSTEM_ENTRY;
982
983 typedef struct _BL_FILE_SYSTEM_REGISTRATION_TABLE
984 {
985 PBL_FS_INIT_CALLBACK Init;
986 PBL_FS_DESTROY_CALLBACK Destroy;
987 PBL_FS_MOUNT_CALLBACK Mount;
988 PBL_FS_PURGE_CALLBACK Purge;
989 } BL_FILE_SYSTEM_REGISTRATION_TABLE;
990
991 typedef struct _BL_DISPLAY_STATE
992 {
993 ULONG BgColor;
994 ULONG FgColor;
995 ULONG XPos;
996 ULONG YPos;
997 ULONG CursorVisible;
998 } BL_DISPLAY_STATE, *PBL_DISPLAY_STATE;
999
1000 typedef struct _BL_DISPLAY_MODE
1001 {
1002 ULONG HRes;
1003 ULONG VRes;
1004 ULONG HRes2;
1005 } BL_DISPLAY_MODE, *PBL_DISPLAY_MODE;
1006
1007 typedef struct _BL_TEXT_CONSOLE_VTABLE
1008 {
1009 PCONSOLE_DESTRUCT Destruct;
1010 PCONSOLE_REINITIALIZE Reinitialize;
1011 PCONSOLE_GET_TEXT_STATE GetTextState;
1012 PCONSOLE_SET_TEXT_STATE SetTextState;
1013 PCONSOLE_GET_TEXT_RESOLUTION GetTextResolution;
1014 PCONSOLE_SET_TEXT_RESOLUTION SetTextResolution;
1015 PCONSOLE_CLEAR_TEXT ClearText;
1016 PCONSOLE_WRITE_TEXT WriteText;
1017 } BL_TEXT_CONSOLE_VTABLE, *PBL_TEXT_CONSOLE_VTABLE;
1018
1019 typedef struct _BL_GRAPHICS_CONSOLE_VTABLE
1020 {
1021 BL_TEXT_CONSOLE_VTABLE Text;
1022 PCONSOLE_IS_ENABLED IsEnabled;
1023 PCONSOLE_ENABLE Enable;
1024 PVOID GetConsoleResolution;
1025 PCONSOLE_GET_GRAPHICAL_RESOLUTION GetGraphicalResolution;
1026 PCONSOLE_GET_GRAPHICAL_RESOLUTION GetOriginalResolution;
1027 PCONSOLE_SET_GRAPHICAL_RESOLUTION SetOriginalResolution;
1028 /// more for graphics ///
1029 } BL_GRAPHICS_CONSOLE_VTABLE, *PBL_GRAPHICS_CONSOLE_VTABLE;
1030
1031 typedef struct _BL_TEXT_CONSOLE
1032 {
1033 PBL_TEXT_CONSOLE_VTABLE Callbacks;
1034 BL_DISPLAY_STATE State;
1035 BL_DISPLAY_MODE DisplayMode;
1036 BOOLEAN Active;
1037 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* Protocol;
1038 ULONG Mode;
1039 EFI_SIMPLE_TEXT_OUTPUT_MODE OldMode;
1040 } BL_TEXT_CONSOLE, *PBL_TEXT_CONSOLE;
1041
1042 typedef struct _BL_INPUT_CONSOLE_VTABLE
1043 {
1044 PCONSOLE_DESTRUCT Destruct;
1045 PCONSOLE_REINITIALIZE Reinitialize;
1046 //PCONSOLE_IS_KEY_PENDING IsKeyPending;
1047 //PCONSOLE_READ_INPUT ReadInput;
1048 //PCONSOLE_ERASE_BUFFER EraseBuffer;
1049 //PCONSOLE_FILL_BUFFER FillBuffer;
1050 } BL_INPUT_CONSOLE_VTABLE, *PBL_INPUT_CONSOLE_VTABLE;
1051
1052 typedef struct _BL_INPUT_CONSOLE
1053 {
1054 PBL_INPUT_CONSOLE_VTABLE Callbacks;
1055 PULONG Buffer;
1056 PULONG DataStart;
1057 PULONG DataEnd;
1058 PULONG EndBuffer;
1059 } BL_INPUT_CONSOLE, *PBL_INPUT_CONSOLE;
1060
1061 typedef enum _BL_GRAPHICS_CONSOLE_TYPE
1062 {
1063 BlGopConsole,
1064 BlUgaConsole
1065 } BL_GRAPHICS_CONSOLE_TYPE;
1066
1067 typedef struct _BL_GRAPHICS_CONSOLE
1068 {
1069 BL_TEXT_CONSOLE TextConsole;
1070 BL_DISPLAY_MODE DisplayMode;
1071 ULONG PixelDepth;
1072 ULONG FgColor;
1073 ULONG BgColor;
1074 BL_DISPLAY_MODE OldDisplayMode;
1075 ULONG OldPixelDepth;
1076 EFI_HANDLE Handle;
1077 BL_GRAPHICS_CONSOLE_TYPE Type;
1078 EFI_GRAPHICS_OUTPUT_PROTOCOL* Protocol;
1079 PVOID FrameBuffer;
1080 ULONG FrameBufferSize;
1081 ULONG PixelsPerScanLine;
1082 ULONG Mode;
1083 ULONG OldMode;
1084 } BL_GRAPHICS_CONSOLE, *PBL_GRAPHICS_CONSOLE;
1085
1086 typedef struct _BL_REMOTE_CONSOLE
1087 {
1088 BL_TEXT_CONSOLE TextConsole;
1089 } BL_REMOTE_CONSOLE, *PBL_REMOTE_CONSOLE;
1090
1091 typedef struct _BL_HASH_TABLE
1092 {
1093 PLIST_ENTRY HashLinks;
1094 ULONG Size;
1095 PBL_HASH_TABLE_COMPARE_FUNCTION CompareFunction;
1096 PBL_HASH_TABLE_HASH_FUNCTION HashFunction;
1097 } BL_HASH_TABLE, *PBL_HASH_TABLE;
1098
1099 typedef struct _BL_HASH_ENTRY
1100 {
1101 ULONG Size;
1102 ULONG Flags;
1103 PVOID Value;
1104 } BL_HASH_ENTRY, *PBL_HASH_ENTRY;
1105
1106 typedef struct _BL_HASH_VALUE
1107 {
1108 ULONG DataSize;
1109 PVOID Data;
1110 } BL_HASH_VALUE, *PBL_HASH_VALUE;
1111
1112 typedef struct _BL_HASH_NODE
1113 {
1114 LIST_ENTRY ListEntry;
1115 BL_HASH_ENTRY Entry;
1116 BL_HASH_VALUE Value;
1117 } BL_HASH_NODE, *PBL_HASH_NODE;
1118
1119 typedef struct _BL_BLOCK_DEVICE_INFORMATION
1120 {
1121 BL_LOCAL_DEVICE_TYPE Type;
1122 ULONG DeviceFlags;
1123 ULONG Unknown;
1124 BL_PARTITION_TYPE PartitionType;
1125 ULONG BlockSize;
1126 ULONG Alignment;
1127 ULONGLONG LastBlock;
1128 ULONGLONG Offset;
1129 ULONG Block;
1130 struct
1131 {
1132 union
1133 {
1134 struct
1135 {
1136 ULONG Signature;
1137 } Mbr;
1138 struct
1139 {
1140 GUID Signature;
1141 } Gpt;
1142 };
1143 } Disk;
1144 } BL_BLOCK_DEVICE_INFORMATION, *PBL_BLOCK_DEVICE_INFORMATION;
1145
1146 typedef struct _BL_DEVICE_INFORMATION
1147 {
1148 BL_DEVICE_TYPE DeviceType;
1149 union
1150 {
1151 BL_BLOCK_DEVICE_INFORMATION BlockDeviceInfo;
1152 };
1153 } BL_DEVICE_INFORMATION, *PBL_DEVICE_INFORMATION;
1154
1155 typedef struct _BL_BLOCK_DEVICE
1156 {
1157 BL_BLOCK_DEVICE_INFORMATION;
1158 ULONGLONG StartOffset;
1159 EFI_BLOCK_IO* Protocol;
1160 EFI_HANDLE Handle;
1161 } BL_BLOCK_DEVICE, *PBL_BLOCK_DEVICE;
1162
1163 typedef struct _BL_PROTOCOL_HANDLE
1164 {
1165 EFI_HANDLE Handle;
1166 PVOID Interface;
1167 } BL_PROTOCOL_HANDLE, *PBL_PROTOCOL_HANDLE;
1168
1169 typedef struct _BL_DEVICE_CALLBACKS
1170 {
1171 PBL_DEVICE_ENUMERATE_DEVICE_CLASS EnumerateDeviceClass;
1172 PBL_DEVICE_OPEN Open;
1173 PBL_DEVICE_CLOSE Close;
1174 PBL_DEVICE_READ Read;
1175 PBL_DEVICE_WRITE Write;
1176 PBL_DEVICE_GET_INFORMATION GetInformation;
1177 PBL_DEVICE_SET_INFORMATION SetInformation;
1178 PBL_DEVICE_RESET Reset;
1179 PBL_DEVICE_FLUSH Flush;
1180 PBL_DEVICE_CREATE Create;
1181 } BL_DEVICE_CALLBACKS, *PBL_DEVICE_CALLBACKS;
1182
1183 typedef struct _BL_DEVICE_ENTRY
1184 {
1185 ULONG DeviceId;
1186 ULONG Flags;
1187 ULONG Unknown;
1188 ULONG ReferenceCount;
1189 BL_DEVICE_CALLBACKS Callbacks;
1190 PVOID DeviceSpecificData;
1191 PBL_DEVICE_DESCRIPTOR DeviceDescriptor;
1192 } BL_DEVICE_ENTRY, *PBL_DEVICE_ENTRY;
1193
1194 typedef struct _BL_IMG_FILE
1195 {
1196 UCHAR Flags;
1197 union
1198 {
1199 PVOID BaseAddress;
1200 ULONG FileId;
1201 };
1202 ULONG FileSize;
1203 PWCHAR FileName;
1204 } BL_IMG_FILE, *PBL_IMG_FILE;
1205
1206 typedef struct _BL_IMAGE_APPLICATION_ENTRY
1207 {
1208 PBL_APPLICATION_ENTRY AppEntry;
1209 PVOID ImageBase;
1210 ULONG ImageSize;
1211 } BL_IMAGE_APPLICATION_ENTRY, *PBL_IMAGE_APPLICATION_ENTRY;
1212
1213 typedef struct _BL_IMAGE_PARAMETERS
1214 {
1215 PVOID Buffer;
1216 ULONG ActualSize;
1217 ULONG BufferSize;
1218 } BL_IMAGE_PARAMETERS, *PBL_IMAGE_PARAMETERS;
1219
1220 typedef struct _BL_DEFERRED_FONT_FILE
1221 {
1222 LIST_ENTRY ListEntry;
1223 ULONG Flags;
1224 PBL_DEVICE_DESCRIPTOR Device;
1225 PWCHAR FontPath;
1226 } BL_DEFERRED_FONT_FILE, *PBL_DEFERRED_FONT_FILE;
1227
1228 #pragma pack(push)
1229 #pragma pack(1)
1230 typedef struct _BMP_HEADER
1231 {
1232 USHORT Signature;
1233 ULONG Size;
1234 USHORT Reserved[2];
1235 ULONG Offset;
1236 } BMP_HEADER, *PBMP_HEADER;
1237
1238 typedef struct _DIB_HEADER
1239 {
1240 ULONG Size;
1241 ULONG Width;
1242 ULONG Height;
1243 USHORT Planes;
1244 USHORT BitCount;
1245 ULONG Compression;
1246 ULONG SizeImage;
1247 ULONG XPelsPerMeter;
1248 ULONG YPelsPerMEter;
1249 ULONG ClrUsed;
1250 ULONG ClrImportant;
1251 } DIB_HEADER, *PDIB_HEADER;
1252
1253 typedef struct _BITMAP
1254 {
1255 BMP_HEADER BmpHeader;
1256 DIB_HEADER DibHeader;
1257 } BITMAP, *PBITMAP;
1258 #pragma pack(pop)
1259
1260 typedef struct _COORD
1261 {
1262 ULONG X;
1263 ULONG Y;
1264 } COORD, *PCOORD;
1265
1266 typedef struct _BL_PD_DATA_BLOB
1267 {
1268 PVOID Data;
1269 ULONG DataSize;
1270 ULONG BlobSize;
1271 } BL_PD_DATA_BLOB, *PBL_PD_DATA_BLOB;
1272
1273 /* INLINE ROUTINES ***********************************************************/
1274
1275 FORCEINLINE
1276 VOID
1277 BlSetupDefaultParameters (
1278 _Out_ PBL_LIBRARY_PARAMETERS LibraryParameters
1279 )
1280 {
1281 BL_LIBRARY_PARAMETERS DefaultParameters =
1282 {
1283 0x20,
1284 BlVirtual,
1285 1024,
1286 2 * 1024 * 1024,
1287 0,
1288 NULL,
1289 0,
1290 NULL
1291 };
1292
1293 /* Copy the defaults */
1294 RtlCopyMemory(LibraryParameters, &DefaultParameters, sizeof(*LibraryParameters));
1295 }
1296
1297 FORCEINLINE
1298 VOID
1299 MmMdInitializeListHead (
1300 _In_ PBL_MEMORY_DESCRIPTOR_LIST List
1301 )
1302 {
1303 /* Initialize the list */
1304 InitializeListHead(&List->ListHead);
1305 List->First = &List->ListHead;
1306 List->This = NULL;
1307 List->Type = 0;
1308 }
1309
1310 /* INITIALIZATION ROUTINES ***************************************************/
1311
1312 NTSTATUS
1313 BlInitializeLibrary(
1314 _In_ PBOOT_APPLICATION_PARAMETER_BLOCK BootAppParameters,
1315 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
1316 );
1317
1318 NTSTATUS
1319 BlpArchInitialize (
1320 _In_ ULONG Phase
1321 );
1322
1323 NTSTATUS
1324 BlpFwInitialize (
1325 _In_ ULONG Phase,
1326 _In_ PBL_FIRMWARE_DESCRIPTOR FirmwareParameters
1327 );
1328
1329 NTSTATUS
1330 BlpMmInitialize (
1331 _In_ PBL_MEMORY_DATA MemoryData,
1332 _In_ BL_TRANSLATION_TYPE TranslationType,
1333 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
1334 );
1335
1336 NTSTATUS
1337 MmBaInitialize (
1338 VOID
1339 );
1340
1341 NTSTATUS
1342 MmPaInitialize (
1343 _In_ PBL_MEMORY_DATA MemoryData,
1344 _In_ ULONG MinimumPages
1345 );
1346
1347 NTSTATUS
1348 MmArchInitialize (
1349 _In_ ULONG Phase,
1350 _In_ PBL_MEMORY_DATA MemoryData,
1351 _In_ BL_TRANSLATION_TYPE TranslationType,
1352 _In_ BL_TRANSLATION_TYPE LibraryTranslationType
1353 );
1354
1355 NTSTATUS
1356 MmHaInitialize (
1357 _In_ ULONG HeapSize,
1358 _In_ ULONG HeapAttributes
1359 );
1360
1361 VOID
1362 MmMdInitialize (
1363 _In_ ULONG Phase,
1364 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
1365 );
1366
1367 NTSTATUS
1368 BlpDeviceInitialize (
1369 VOID
1370 );
1371
1372 NTSTATUS
1373 BlpIoInitialize (
1374 VOID
1375 );
1376
1377 NTSTATUS
1378 BlpFileInitialize (
1379 VOID
1380 );
1381
1382 NTSTATUS
1383 BlpDisplayInitialize (
1384 _In_ ULONG Flags
1385 );
1386
1387 NTSTATUS
1388 BlpDisplayReinitialize (
1389 VOID
1390 );
1391
1392 VOID
1393 BlDestroyLibrary (
1394 VOID
1395 );
1396
1397 NTSTATUS
1398 BcInitialize (
1399 VOID
1400 );
1401
1402 /* FIRMWARE ROUTINES *********************************************************/
1403
1404 VOID
1405 EfiPrintf (
1406 _In_ PWCHAR Format,
1407 ...
1408 );
1409
1410 NTSTATUS
1411 BlFwGetParameters(
1412 _In_ PBL_FIRMWARE_DESCRIPTOR Parameters
1413 );
1414
1415 NTSTATUS
1416 BlFwEnumerateDevice (
1417 _In_ PBL_DEVICE_DESCRIPTOR Device
1418 );
1419
1420 NTSTATUS
1421 EfiAllocatePages (
1422 _In_ ULONG Type,
1423 _In_ ULONG Pages,
1424 _Inout_ EFI_PHYSICAL_ADDRESS* Memory
1425 );
1426
1427 NTSTATUS
1428 EfiStall (
1429 _In_ ULONG StallTime
1430 );
1431
1432 NTSTATUS
1433 EfiConInExReset (
1434 VOID
1435 );
1436
1437 NTSTATUS
1438 EfiConInReset (
1439 VOID
1440 );
1441
1442 NTSTATUS
1443 EfiConOutOutputString (
1444 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1445 _In_ PWCHAR String
1446 );
1447
1448 NTSTATUS
1449 EfiConOutQueryMode (
1450 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1451 _In_ ULONG Mode,
1452 _In_ UINTN* Columns,
1453 _In_ UINTN* Rows
1454 );
1455
1456 NTSTATUS
1457 EfiConOutSetMode (
1458 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1459 _In_ ULONG Mode
1460 );
1461
1462 VOID
1463 EfiConOutReadCurrentMode (
1464 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1465 _Out_ EFI_SIMPLE_TEXT_OUTPUT_MODE* Mode
1466 );
1467
1468 NTSTATUS
1469 EfiConOutSetAttribute (
1470 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1471 _In_ ULONG Attribute
1472 );
1473
1474 NTSTATUS
1475 EfiConOutSetCursorPosition (
1476 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1477 _In_ ULONG Column,
1478 _In_ ULONG Row
1479 );
1480
1481 NTSTATUS
1482 EfiConOutEnableCursor (
1483 _In_ SIMPLE_TEXT_OUTPUT_INTERFACE *TextInterface,
1484 _In_ BOOLEAN Visible
1485 );
1486
1487 NTSTATUS
1488 EfiLocateHandleBuffer (
1489 _In_ EFI_LOCATE_SEARCH_TYPE SearchType,
1490 _In_ EFI_GUID *Protocol,
1491 _Inout_ PULONG HandleCount,
1492 _Inout_ EFI_HANDLE** Buffer
1493 );
1494
1495 NTSTATUS
1496 EfiOpenProtocol (
1497 _In_ EFI_HANDLE Handle,
1498 _In_ EFI_GUID *Protocol,
1499 _Out_ PVOID* Interface
1500 );
1501
1502 NTSTATUS
1503 EfiCloseProtocol (
1504 _In_ EFI_HANDLE Handle,
1505 _In_ EFI_GUID *Protocol
1506 );
1507
1508 NTSTATUS
1509 EfiGopGetCurrentMode (
1510 _In_ EFI_GRAPHICS_OUTPUT_PROTOCOL *GopInterface,
1511 _Out_ UINTN* Mode,
1512 _Out_ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Information
1513 );
1514
1515 NTSTATUS
1516 EfiGopSetMode (
1517 _In_ EFI_GRAPHICS_OUTPUT_PROTOCOL *GopInterface,
1518 _In_ ULONG Mode
1519 );
1520
1521 VOID
1522 EfiGopGetFrameBuffer (
1523 _In_ EFI_GRAPHICS_OUTPUT_PROTOCOL *GopInterface,
1524 _Out_ PHYSICAL_ADDRESS* FrameBuffer,
1525 _Out_ UINTN *FrameBufferSize
1526 );
1527
1528 VOID
1529 EfiResetSystem (
1530 _In_ EFI_RESET_TYPE ResetType
1531 );
1532
1533 EFI_DEVICE_PATH*
1534 EfiGetLeafNode (
1535 _In_ EFI_DEVICE_PATH *DevicePath
1536 );
1537
1538 EFI_DEVICE_PATH *
1539 EfiIsDevicePathParent (
1540 _In_ EFI_DEVICE_PATH *DevicePath1,
1541 _In_ EFI_DEVICE_PATH *DevicePath2
1542 );
1543
1544 NTSTATUS
1545 EfipGetRsdt (
1546 _Out_ PPHYSICAL_ADDRESS FoundRsdt
1547 );
1548
1549 NTSTATUS
1550 EfiFreePages (
1551 _In_ ULONG Pages,
1552 _In_ EFI_PHYSICAL_ADDRESS PhysicalAddress
1553 );
1554
1555 /* PLATFORM TIMER ROUTINES ***************************************************/
1556
1557 NTSTATUS
1558 BlpTimeCalibratePerformanceCounter (
1559 VOID
1560 );
1561
1562 ULONGLONG
1563 BlTimeQueryPerformanceCounter (
1564 _Out_opt_ PLARGE_INTEGER Frequency
1565 );
1566
1567 ULONGLONG
1568 BlArchGetPerformanceCounter (
1569 VOID
1570 );
1571
1572 /* RESOURCE LOCALE INTERNATIONALIZATION ROUTINES *****************************/
1573
1574 NTSTATUS
1575 BlpDisplayRegisterLocale (
1576 _In_ PWCHAR Locale
1577 );
1578
1579 /* FONT ROUTINES *************************************************************/
1580
1581 VOID
1582 BfiFreeDeferredFontFile (
1583 _In_ PBL_DEFERRED_FONT_FILE DeferredFontFile
1584 );
1585
1586 NTSTATUS
1587 BfLoadFontFile (
1588 _In_ PBL_DEVICE_DESCRIPTOR Device,
1589 _In_ PWCHAR FontPath
1590 );
1591
1592 NTSTATUS
1593 BfLoadDeferredFontFiles (
1594 VOID
1595 );
1596
1597 NTSTATUS
1598 BfClearScreen (
1599 _In_ PBL_GRAPHICS_CONSOLE Console
1600 );
1601
1602 NTSTATUS
1603 BfClearToEndOfLine (
1604 _In_ PBL_GRAPHICS_CONSOLE Console
1605 );
1606
1607 /* FILESYSTEM ROUTINES *******************************************************/
1608
1609 NTSTATUS
1610 FatInitialize (
1611 VOID
1612 );
1613
1614 NTSTATUS
1615 FatMount (
1616 _In_ ULONG DeviceId,
1617 _In_ ULONG Unknown,
1618 _Out_ PBL_FILE_ENTRY* FileEntry
1619 );
1620
1621 NTSTATUS
1622 EtfsInitialize (
1623 VOID
1624 );
1625
1626 NTSTATUS
1627 EtfsMount (
1628 _In_ ULONG DeviceId,
1629 _In_ ULONG Unknown,
1630 _Out_ PBL_FILE_ENTRY* FileEntry
1631 );
1632
1633 /* DEBUG ROUTINES ************************************************************/
1634
1635
1636 BOOLEAN
1637 BlBdDebuggerEnabled (
1638 VOID
1639 );
1640
1641 NTSTATUS
1642 BlBdPullRemoteFile (
1643 _In_ PWCHAR FilePath,
1644 _Out_ PVOID BaseAddress,
1645 _Out_ PULONGLONG FileSize
1646 );
1647
1648 VOID
1649 BlStatusPrint (
1650 _In_ PCWCH Format,
1651 ...
1652 );
1653
1654 VOID
1655 BlStatusError (
1656 _In_ ULONG ErrorCode,
1657 _In_ ULONG Parameter1,
1658 _In_ ULONG_PTR Parameter2,
1659 _In_ ULONG_PTR Parameter3,
1660 _In_ ULONG_PTR Parameter4
1661 );
1662
1663 /* UTILITY ROUTINES **********************************************************/
1664
1665 VOID
1666 BlArchCpuId (
1667 _In_ ULONG Function,
1668 _In_ ULONG SubFunction,
1669 _Out_ INT* Result
1670 );
1671
1672 CPU_VENDORS
1673 BlArchGetCpuVendor (
1674 VOID
1675 );
1676
1677 BOOLEAN
1678 BlArchIsCpuIdFunctionSupported (
1679 _In_ ULONG Function
1680 );
1681
1682 VOID
1683 BlUtlUpdateProgress (
1684 _In_ ULONG Percentage,
1685 _Out_opt_ PBOOLEAN Completed
1686 );
1687
1688 NTSTATUS
1689 BlUtlGetAcpiTable (
1690 _Out_ PVOID* TableAddress,
1691 _In_ ULONG Signature
1692 );
1693
1694 NTSTATUS
1695 BlUtlInitialize (
1696 VOID
1697 );
1698
1699 NTSTATUS
1700 BlUtlRegisterProgressRoutine (
1701 VOID
1702 );
1703
1704 ULONG
1705 BlUtlCheckSum (
1706 _In_ ULONG PartialSum,
1707 _In_ PUCHAR Buffer,
1708 _In_ ULONG Length,
1709 _In_ ULONG Flags
1710 );
1711
1712 NTSTATUS
1713 BlGetApplicationBaseAndSize (
1714 _Out_ PVOID* ImageBase,
1715 _Out_ PULONG ImageSize
1716 );
1717
1718 VOID
1719 BlDestroyBootEntry (
1720 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry
1721 );
1722
1723 NTSTATUS
1724 BlPdQueryData (
1725 _In_ const GUID* DataGuid,
1726 _In_ PVOID Unknown,
1727 _Inout_ PBL_PD_DATA_BLOB DataBlob
1728 );
1729
1730 /* FIRMWARE UTILITY ROUTINES *************************************************/
1731
1732 EFI_STATUS
1733 EfiGetEfiStatusCode(
1734 _In_ NTSTATUS Status
1735 );
1736
1737 NTSTATUS
1738 EfiGetNtStatusCode (
1739 _In_ EFI_STATUS EfiStatus
1740 );
1741
1742 VOID
1743 BlFwReboot (
1744 VOID
1745 );
1746
1747 NTSTATUS
1748 MmFwFreePages (
1749 _In_ ULONG BasePage,
1750 _In_ ULONG PageCount
1751 );
1752
1753 PGUID
1754 BlGetApplicationIdentifier (
1755 VOID
1756 );
1757
1758 NTSTATUS
1759 BlpSecureBootEFIIsEnabled (
1760 VOID
1761 );
1762
1763 NTSTATUS
1764 BlSecureBootIsEnabled (
1765 _Out_ PBOOLEAN SecureBootEnabled
1766 );
1767
1768 NTSTATUS
1769 BlSecureBootCheckForFactoryReset (
1770 VOID
1771 );
1772
1773 /* RESOURCE ROUTINES *********************************************************/
1774
1775 PWCHAR
1776 BlResourceFindMessage (
1777 _In_ ULONG MsgId
1778 );
1779
1780 PWCHAR
1781 BlResourceFindHtml (
1782 VOID
1783 );
1784
1785 NTSTATUS
1786 BlpResourceInitialize (
1787 VOID
1788 );
1789
1790 /* TABLE ROUTINES ************************************************************/
1791
1792 NTSTATUS
1793 BlTblMap (
1794 _In_ PVOID *Table,
1795 _In_ ULONG Count,
1796 _In_ PBL_TBL_MAP_ROUTINE MapCallback
1797 );
1798
1799 PVOID
1800 BlTblFindEntry (
1801 _In_ PVOID *Table,
1802 _In_ ULONG Count,
1803 _Out_ PULONG EntryIndex,
1804 _In_ PBL_TBL_LOOKUP_ROUTINE Callback,
1805 _In_ PVOID Argument1,
1806 _In_ PVOID Argument2,
1807 _In_ PVOID Argument3,
1808 _In_ PVOID Argument4
1809 );
1810
1811 NTSTATUS
1812 BlTblSetEntry (
1813 _Inout_ PVOID** Table,
1814 _Inout_ PULONG Count,
1815 _In_ PVOID Entry,
1816 _Out_ PULONG EntryIndex,
1817 _In_ PBL_TBL_SET_ROUTINE Callback
1818 );
1819
1820 NTSTATUS
1821 TblDoNotPurgeEntry (
1822 _In_ PVOID Entry
1823 );
1824
1825 /* HASH TABLE ROUTINES *******************************************************/
1826
1827 NTSTATUS
1828 BlHtStore (
1829 _In_ ULONG TableId,
1830 _In_ PBL_HASH_ENTRY Entry,
1831 _In_ PVOID Data,
1832 _In_ ULONG DataSize
1833 );
1834
1835 NTSTATUS
1836 BlHtDelete (
1837 _In_ ULONG TableId,
1838 _In_ PBL_HASH_ENTRY Entry
1839 );
1840
1841 NTSTATUS
1842 BlHtLookup (
1843 _In_ ULONG TableId,
1844 _In_ PBL_HASH_ENTRY Entry,
1845 _Out_ PBL_HASH_VALUE *Value
1846 );
1847
1848 NTSTATUS
1849 BlHtCreate (
1850 _In_ ULONG Size,
1851 _In_ PBL_HASH_TABLE_HASH_FUNCTION HashFunction,
1852 _In_ PBL_HASH_TABLE_COMPARE_FUNCTION CompareFunction,
1853 _Out_ PULONG Id
1854 );
1855
1856 /* BCD OPTION ROUTINES *******************************************************/
1857
1858 PBL_BCD_OPTION
1859 MiscGetBootOption (
1860 _In_ PBL_BCD_OPTION List,
1861 _In_ ULONG Type
1862 );
1863
1864 ULONG
1865 BlGetBootOptionListSize (
1866 _In_ PBL_BCD_OPTION BcdOption
1867 );
1868
1869 ULONG
1870 BlGetBootOptionSize (
1871 _In_ PBL_BCD_OPTION BcdOption
1872 );
1873
1874 NTSTATUS
1875 BlGetBootOptionString (
1876 _In_ PBL_BCD_OPTION List,
1877 _In_ ULONG Type,
1878 _Out_ PWCHAR* Value
1879 );
1880
1881 NTSTATUS
1882 BlGetBootOptionInteger (
1883 _In_ PBL_BCD_OPTION List,
1884 _In_ ULONG Type,
1885 _Out_ PULONGLONG Value
1886 );
1887
1888 NTSTATUS
1889 BlGetBootOptionBoolean (
1890 _In_ PBL_BCD_OPTION List,
1891 _In_ ULONG Type,
1892 _Out_ PBOOLEAN Value
1893 );
1894
1895 NTSTATUS
1896 BlpGetBootOptionIntegerList (
1897 _In_ PBL_BCD_OPTION List,
1898 _In_ ULONG Type,
1899 _Out_ PULONGLONG* Value,
1900 _Out_ PULONGLONG Count,
1901 _In_ BOOLEAN NoCopy
1902 );
1903
1904 NTSTATUS
1905 BlGetBootOptionDevice (
1906 _In_ PBL_BCD_OPTION List,
1907 _In_ ULONG Type,
1908 _Out_ PBL_DEVICE_DESCRIPTOR* Value,
1909 _In_opt_ PBL_BCD_OPTION* ExtraOptions
1910 );
1911
1912 NTSTATUS
1913 BlGetBootOptionGuid (
1914 _In_ PBL_BCD_OPTION List,
1915 _In_ ULONG Type,
1916 _Out_ PGUID Value
1917 );
1918
1919 NTSTATUS
1920 BlGetBootOptionGuidList (
1921 _In_ PBL_BCD_OPTION List,
1922 _In_ ULONG Type,
1923 _Out_ PGUID *Value,
1924 _In_ PULONG Count
1925 );
1926
1927 NTSTATUS
1928 BlCopyBootOptions (
1929 _In_ PBL_BCD_OPTION OptionList,
1930 _Out_ PBL_BCD_OPTION *CopiedOptions
1931 );
1932
1933 NTSTATUS
1934 BlAppendBootOptionBoolean (
1935 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
1936 _In_ ULONG OptionId
1937 );
1938
1939 NTSTATUS
1940 BlAppendBootOptionInteger (
1941 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
1942 _In_ ULONG OptionId,
1943 _In_ ULONGLONG Value
1944 );
1945
1946 NTSTATUS
1947 BlAppendBootOptionString (
1948 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
1949 _In_ PWCHAR OptionString
1950 );
1951
1952 NTSTATUS
1953 BlAppendBootOptions (
1954 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
1955 _In_ PBL_BCD_OPTION Options
1956 );
1957
1958 VOID
1959 BlRemoveBootOption (
1960 _In_ PBL_BCD_OPTION List,
1961 _In_ ULONG Type
1962 );
1963
1964 NTSTATUS
1965 BlReplaceBootOptions (
1966 _In_ PBL_LOADED_APPLICATION_ENTRY AppEntry,
1967 _In_ PBL_BCD_OPTION NewOptions
1968 );
1969
1970 /* BOOT REGISTRY ROUTINES ****************************************************/
1971
1972 VOID
1973 BiCloseKey (
1974 _In_ HANDLE KeyHandle
1975 );
1976
1977 NTSTATUS
1978 BiOpenKey(
1979 _In_ HANDLE ParentHandle,
1980 _In_ PWCHAR KeyName,
1981 _Out_ PHANDLE Handle
1982 );
1983
1984 NTSTATUS
1985 BiLoadHive (
1986 _In_ PBL_FILE_PATH_DESCRIPTOR FilePath,
1987 _Out_ PHANDLE HiveHandle
1988 );
1989
1990 NTSTATUS
1991 BiGetRegistryValue (
1992 _In_ HANDLE KeyHandle,
1993 _In_ PWCHAR ValueName,
1994 _In_ ULONG Type,
1995 _Out_ PVOID* Buffer,
1996 _Out_ PULONG ValueLength
1997 );
1998
1999 NTSTATUS
2000 BiEnumerateSubKeys (
2001 _In_ HANDLE KeyHandle,
2002 _Out_ PWCHAR** SubKeyList,
2003 _Out_ PULONG SubKeyCount
2004 );
2005
2006 NTSTATUS
2007 BiDeleteKey (
2008 _In_ HANDLE KeyHandle
2009 );
2010
2011 VOID
2012 BiDereferenceHive (
2013 _In_ HANDLE KeyHandle
2014 );
2015
2016 /* CONTEXT ROUTINES **********************************************************/
2017
2018 VOID
2019 BlpArchSwitchContext (
2020 _In_ BL_ARCH_MODE NewMode
2021 );
2022
2023 VOID
2024 BlpArchEnableTranslation (
2025 VOID
2026 );
2027
2028 VOID
2029 Archx86TransferTo32BitApplicationAsm (
2030 VOID
2031 );
2032
2033 /* MEMORY DESCRIPTOR ROUTINES ************************************************/
2034
2035 VOID
2036 MmMdDbgDumpList (
2037 _In_ PBL_MEMORY_DESCRIPTOR_LIST DescriptorList,
2038 _In_opt_ ULONG MaxCount
2039 );
2040
2041 VOID
2042 MmMdInitializeList (
2043 _In_ PBL_MEMORY_DESCRIPTOR_LIST DescriptorList,
2044 _In_ ULONG Type,
2045 _In_ PLIST_ENTRY ListHead
2046 );
2047
2048 PBL_MEMORY_DESCRIPTOR
2049 MmMdFindDescriptor (
2050 _In_ ULONG WhichList,
2051 _In_ ULONG Flags,
2052 _In_ ULONGLONG Page
2053 );
2054
2055 PBL_MEMORY_DESCRIPTOR
2056 MmMdFindDescriptorFromMdl (
2057 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
2058 _In_ ULONG Flags,
2059 _In_ ULONGLONG Page
2060 );
2061
2062 NTSTATUS
2063 MmMdCopyList (
2064 _In_ PBL_MEMORY_DESCRIPTOR_LIST DestinationList,
2065 _In_ PBL_MEMORY_DESCRIPTOR_LIST SourceList,
2066 _In_opt_ PBL_MEMORY_DESCRIPTOR ListDescriptor,
2067 _Out_ PULONG ActualCount,
2068 _In_ ULONG Count,
2069 _In_ ULONG Flags
2070 );
2071
2072 ULONG
2073 MmMdCountList (
2074 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList
2075 );
2076
2077 VOID
2078 MmMdFreeList(
2079 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList
2080 );
2081
2082 PBL_MEMORY_DESCRIPTOR
2083 MmMdInitByteGranularDescriptor (
2084 _In_ ULONG Flags,
2085 _In_ BL_MEMORY_TYPE Type,
2086 _In_ ULONGLONG BasePage,
2087 _In_ ULONGLONG VirtualPage,
2088 _In_ ULONGLONG PageCount
2089 );
2090
2091 VOID
2092 MmMdFreeGlobalDescriptors (
2093 VOID
2094 );
2095
2096 NTSTATUS
2097 MmMdAddDescriptorToList (
2098 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
2099 _In_ PBL_MEMORY_DESCRIPTOR MemoryDescriptor,
2100 _In_ ULONG Flags
2101 );
2102
2103 NTSTATUS
2104 MmMdTruncateDescriptors (
2105 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
2106 _In_ PBL_MEMORY_DESCRIPTOR_LIST NewList,
2107 _In_ ULONGLONG BasePage
2108 );
2109
2110 VOID
2111 MmMdRemoveDescriptorFromList (
2112 _In_ PBL_MEMORY_DESCRIPTOR_LIST MdList,
2113 _In_ PBL_MEMORY_DESCRIPTOR Entry
2114 );
2115
2116 BOOLEAN
2117 MmMdFindSatisfyingRegion (
2118 _In_ PBL_MEMORY_DESCRIPTOR Descriptor,
2119 _Out_ PBL_MEMORY_DESCRIPTOR NewDescriptor,
2120 _In_ ULONGLONG Pages,
2121 _In_ PBL_ADDRESS_RANGE BaseRange,
2122 _In_ PBL_ADDRESS_RANGE VirtualRange,
2123 _In_ BOOLEAN TopDown,
2124 _In_ BL_MEMORY_TYPE MemoryType,
2125 _In_ ULONG Flags,
2126 _In_ ULONG Alignment
2127 );
2128
2129 NTSTATUS
2130 MmMdRemoveRegionFromMdlEx (
2131 __in PBL_MEMORY_DESCRIPTOR_LIST MdList,
2132 __in ULONG Flags,
2133 __in ULONGLONG BasePage,
2134 __in ULONGLONG PageCount,
2135 __in PBL_MEMORY_DESCRIPTOR_LIST NewMdList
2136 );
2137
2138 NTSTATUS
2139 MmMdFreeDescriptor (
2140 _In_ PBL_MEMORY_DESCRIPTOR MemoryDescriptor
2141 );
2142
2143 /* PAGE ALLOCATOR ROUTINES ***************************************************/
2144
2145 NTSTATUS
2146 MmPaTruncateMemory (
2147 _In_ ULONGLONG BasePage
2148 );
2149
2150 NTSTATUS
2151 BlMmAllocatePhysicalPages(
2152 _Inout_ PPHYSICAL_ADDRESS Address,
2153 _In_ BL_MEMORY_TYPE MemoryType,
2154 _In_ ULONGLONG PageCount,
2155 _In_ ULONG Attributes,
2156 _In_ ULONG Alignment
2157 );
2158
2159 NTSTATUS
2160 MmPapAllocatePhysicalPagesInRange (
2161 _Inout_ PPHYSICAL_ADDRESS BaseAddress,
2162 _In_ BL_MEMORY_TYPE MemoryType,
2163 _In_ ULONGLONG Pages,
2164 _In_ ULONG Attributes,
2165 _In_ ULONG Alignment,
2166 _In_ PBL_MEMORY_DESCRIPTOR_LIST NewList,
2167 _In_opt_ PBL_ADDRESS_RANGE Range,
2168 _In_ ULONG RangeType
2169 );
2170
2171 NTSTATUS
2172 MmPaReleaseSelfMapPages (
2173 _In_ PHYSICAL_ADDRESS Address
2174 );
2175
2176 NTSTATUS
2177 MmPaReserveSelfMapPages (
2178 _Inout_ PPHYSICAL_ADDRESS PhysicalAddress,
2179 _In_ ULONG Alignment,
2180 _In_ ULONG PageCount
2181 );
2182 NTSTATUS
2183 BlMmFreePhysicalPages (
2184 _In_ PHYSICAL_ADDRESS Address
2185 );
2186
2187 NTSTATUS
2188 MmPapFreePages (
2189 _In_ PVOID Address,
2190 _In_ ULONG WhichList
2191 );
2192
2193 NTSTATUS
2194 MmPapAllocatePagesInRange (
2195 _Inout_ PVOID* PhysicalAddress,
2196 _In_ BL_MEMORY_TYPE MemoryType,
2197 _In_ ULONGLONG Pages,
2198 _In_ ULONG Attributes,
2199 _In_ ULONG Alignment,
2200 _In_opt_ PBL_ADDRESS_RANGE Range,
2201 _In_ ULONG Type
2202 );
2203
2204 NTSTATUS
2205 MmFwGetMemoryMap (
2206 _Out_ PBL_MEMORY_DESCRIPTOR_LIST MemoryMap,
2207 _In_ ULONG Flags
2208 );
2209
2210 NTSTATUS
2211 BlpMmInitializeConstraints (
2212 VOID
2213 );
2214
2215 NTSTATUS
2216 BlMmRemoveBadMemory (
2217 VOID
2218 );
2219
2220 NTSTATUS
2221 BlMmGetMemoryMap (
2222 _In_ PLIST_ENTRY MemoryMap,
2223 _In_ PBL_IMAGE_PARAMETERS MemoryParameters,
2224 _In_ ULONG WhichTypes,
2225 _In_ ULONG Flags
2226 );
2227
2228 /* VIRTUAL MEMORY ROUTINES ***************************************************/
2229
2230 NTSTATUS
2231 MmSelectMappingAddress (
2232 _Out_ PVOID* MappingAddress,
2233 _In_ PVOID PreferredAddress,
2234 _In_ ULONGLONG Size,
2235 _In_ ULONG AllocationAttributes,
2236 _In_ ULONG Flags,
2237 _In_ PHYSICAL_ADDRESS PhysicalAddress
2238 );
2239
2240 NTSTATUS
2241 MmMapPhysicalAddress (
2242 _Inout_ PPHYSICAL_ADDRESS PhysicalAddress,
2243 _Out_ PVOID* VirtualAddress,
2244 _Inout_ PULONGLONG Size,
2245 _In_ ULONG CacheAttributes
2246 );
2247
2248 NTSTATUS
2249 MmUnmapVirtualAddress (
2250 _Inout_ PVOID* VirtualAddress,
2251 _Inout_ PULONGLONG Size
2252 );
2253
2254 NTSTATUS
2255 BlMmMapPhysicalAddressEx (
2256 _In_ PVOID* VirtualAddress,
2257 _In_ ULONG Attributes,
2258 _In_ ULONGLONG Size,
2259 _In_ PHYSICAL_ADDRESS PhysicalAddress
2260 );
2261
2262 NTSTATUS
2263 BlMmUnmapVirtualAddressEx (
2264 _In_ PVOID VirtualAddress,
2265 _In_ ULONGLONG Size
2266 );
2267
2268 BOOLEAN
2269 BlMmTranslateVirtualAddress (
2270 _In_ PVOID VirtualAddress,
2271 _Out_ PPHYSICAL_ADDRESS PhysicalAddress
2272 );
2273
2274 BOOLEAN
2275 MmArchTranslateVirtualAddress (
2276 _In_ PVOID VirtualAddress,
2277 _Out_opt_ PPHYSICAL_ADDRESS PhysicalAddress,
2278 _Out_opt_ PULONG CachingFlags
2279 );
2280
2281 /* BLOCK ALLOCATOR ROUTINES **************************************************/
2282
2283 NTSTATUS
2284 BlpMmCreateBlockAllocator (
2285 VOID
2286 );
2287
2288 /* HEAP ALLOCATOR ROUTINES ***************************************************/
2289
2290 PVOID
2291 BlMmAllocateHeap (
2292 _In_ ULONG Size
2293 );
2294
2295 NTSTATUS
2296 BlMmFreeHeap (
2297 _In_ PVOID Buffer
2298 );
2299
2300 /* DISPLAY ROUTINES **********************************************************/
2301
2302 VOID
2303 BlDisplayGetTextCellResolution (
2304 _Out_ PULONG TextWidth,
2305 _Out_ PULONG TextHeight
2306 );
2307
2308 NTSTATUS
2309 BlDisplaySetScreenResolution (
2310 VOID
2311 );
2312
2313 NTSTATUS
2314 BlDisplayGetScreenResolution (
2315 _Out_ PULONG HRes,
2316 _Out_ PULONG Vres
2317 );
2318
2319 VOID
2320 BlDisplayInvalidateOemBitmap (
2321 VOID
2322 );
2323
2324 PBITMAP
2325 BlDisplayGetOemBitmap (
2326 _Out_ PCOORD Offset,
2327 _Out_opt_ PULONG Flags
2328 );
2329
2330 BOOLEAN
2331 BlDisplayValidOemBitmap (
2332 VOID
2333 );
2334
2335 NTSTATUS
2336 BlDisplayClearScreen (
2337 VOID
2338 );
2339
2340 NTSTATUS
2341 BlDisplaySetCursorType (
2342 _In_ ULONG Type
2343 );
2344
2345 /* I/O ROUTINES **************************************************************/
2346
2347 NTSTATUS
2348 BlpIoRegisterDestroyRoutine (
2349 _In_ PBL_IO_DESTROY_ROUTINE DestroyRoutine
2350 );
2351
2352 NTSTATUS
2353 BlDeviceClose (
2354 _In_ ULONG DeviceId
2355 );
2356
2357 NTSTATUS
2358 BlpDeviceOpen (
2359 _In_ PBL_DEVICE_DESCRIPTOR Device,
2360 _In_ ULONG Flags,
2361 _In_ ULONG Unknown,
2362 _Out_ PULONG DeviceId
2363 );
2364
2365 NTSTATUS
2366 BlDeviceGetInformation (
2367 _In_ ULONG DeviceId,
2368 _Out_ PBL_DEVICE_INFORMATION DeviceInformation
2369 );
2370
2371 NTSTATUS
2372 BlDeviceSetInformation (
2373 _In_ ULONG DeviceId,
2374 _In_ PBL_DEVICE_INFORMATION DeviceInformation
2375 );
2376
2377 NTSTATUS
2378 BlDeviceReadAtOffset (
2379 _In_ ULONG DeviceId,
2380 _In_ ULONG Size,
2381 _In_ ULONGLONG Offset,
2382 _In_ PVOID Buffer,
2383 _Out_ PULONG BytesRead
2384 );
2385
2386 /* IMAGE ROUTINES ************************************************************/
2387
2388 NTSTATUS
2389 BlImgLoadImageWithProgress2 (
2390 _In_ ULONG DeviceId,
2391 _In_ BL_MEMORY_TYPE MemoryType,
2392 _In_ PWCHAR FileName,
2393 _Inout_ PVOID* MappedBase,
2394 _Inout_ PULONG MappedSize,
2395 _In_ ULONG ImageFlags,
2396 _In_ BOOLEAN ShowProgress,
2397 _Out_opt_ PUCHAR* HashBuffer,
2398 _Out_opt_ PULONG HashSize
2399 );
2400
2401 PIMAGE_SECTION_HEADER
2402 BlImgFindSection (
2403 _In_ PVOID ImageBase,
2404 _In_ ULONG ImageSize
2405 );
2406
2407 NTSTATUS
2408 BlImgLoadBootApplication (
2409 _In_ PBL_LOADED_APPLICATION_ENTRY BootEntry,
2410 _Out_ PULONG AppHandle
2411 );
2412
2413 NTSTATUS
2414 BlImgStartBootApplication (
2415 _In_ ULONG AppHandle,
2416 _Inout_ PBL_RETURN_ARGUMENTS ReturnArguments
2417 );
2418
2419 NTSTATUS
2420 BlImgUnloadBootApplication (
2421 _In_ ULONG AppHandle
2422 );
2423
2424 VOID
2425 BlImgQueryCodeIntegrityBootOptions (
2426 _In_ PBL_LOADED_APPLICATION_ENTRY ApplicationEntry,
2427 _Out_ PBOOLEAN IntegrityChecksDisabled,
2428 _Out_ PBOOLEAN TestSigning
2429 );
2430
2431 /* FILE I/O ROUTINES *********************************************************/
2432
2433 NTSTATUS
2434 BlFileClose (
2435 _In_ ULONG FileId
2436 );
2437
2438 NTSTATUS
2439 BlFileReadAtOffsetEx (
2440 _In_ ULONG FileId,
2441 _In_ ULONG Size,
2442 _In_ ULONGLONG ByteOffset,
2443 _In_ PVOID Buffer,
2444 _Out_ PULONG BytesReturned,
2445 _In_ ULONG Flags
2446 );
2447
2448 NTSTATUS
2449 BlFileGetInformation (
2450 _In_ ULONG FileId,
2451 _In_ PBL_FILE_INFORMATION FileInfo
2452 );
2453
2454 NTSTATUS
2455 BlFileOpen (
2456 _In_ ULONG DeviceId,
2457 _In_ PWCHAR FileName,
2458 _In_ ULONG Flags,
2459 _Out_ PULONG FileId
2460 );
2461
2462 /* BLOCK I/O ROUTINES *******************************************************/
2463
2464 NTSTATUS
2465 BlockIoEfiCompareDevice (
2466 _In_ PBL_DEVICE_DESCRIPTOR Device,
2467 _In_ EFI_HANDLE Handle
2468 );
2469
2470 /* INPUT CONSOLE ROUTINES ****************************************************/
2471
2472 VOID
2473 ConsoleInputLocalDestruct (
2474 _In_ struct _BL_INPUT_CONSOLE* Console
2475 );
2476
2477 NTSTATUS
2478 ConsoleInputBaseReinitialize (
2479 _In_ struct _BL_INPUT_CONSOLE* Console
2480 );
2481
2482 NTSTATUS
2483 ConsoleCreateLocalInputCnsole (
2484 VOID
2485 );
2486
2487 /* TEXT CONSOLE ROUTINES *****************************************************/
2488
2489 VOID
2490 ConsoleGraphicalDestruct (
2491 _In_ struct _BL_GRAPHICS_CONSOLE* Console
2492 );
2493
2494 NTSTATUS
2495 ConsoleGraphicalClearText (
2496 _In_ PBL_GRAPHICS_CONSOLE Console,
2497 _In_ BOOLEAN LineOnly
2498 );
2499
2500 NTSTATUS
2501 ConsoleGraphicalClearPixels (
2502 _In_ PBL_GRAPHICS_CONSOLE Console,
2503 _In_ ULONG Color
2504 );
2505
2506 NTSTATUS
2507 ConsoleGraphicalReinitialize (
2508 _In_ struct _BL_GRAPHICS_CONSOLE* Console
2509 );
2510
2511 NTSTATUS
2512 ConsoleGraphicalSetTextState (
2513 _In_ PBL_GRAPHICS_CONSOLE Console,
2514 _In_ ULONG Mask,
2515 _In_ PBL_DISPLAY_STATE TextState
2516 );
2517
2518 BOOLEAN
2519 ConsoleGraphicalIsEnabled (
2520 _In_ struct _BL_GRAPHICS_CONSOLE* Console
2521 );
2522
2523 NTSTATUS
2524 ConsoleGraphicalGetGraphicalResolution (
2525 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
2526 _In_ PBL_DISPLAY_MODE DisplayMode
2527 );
2528
2529 NTSTATUS
2530 ConsoleGraphicalGetOriginalResolution (
2531 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
2532 _In_ PBL_DISPLAY_MODE DisplayMode
2533 );
2534
2535 NTSTATUS
2536 ConsoleGraphicalEnable (
2537 _In_ struct _BL_GRAPHICS_CONSOLE* Console,
2538 _In_ BOOLEAN Enable
2539 );
2540
2541 VOID
2542 ConsoleTextLocalDestruct (
2543 _In_ struct _BL_TEXT_CONSOLE* Console
2544 );
2545
2546 NTSTATUS
2547 ConsoleTextLocalReinitialize (
2548 _In_ struct _BL_TEXT_CONSOLE* Console
2549 );
2550
2551 NTSTATUS
2552 ConsoleTextBaseGetTextState (
2553 _In_ struct _BL_TEXT_CONSOLE* Console,
2554 _Out_ PBL_DISPLAY_STATE TextState
2555 );
2556
2557 NTSTATUS
2558 ConsoleTextLocalSetTextState (
2559 _In_ struct _BL_TEXT_CONSOLE* Console,
2560 _In_ ULONG Flags,
2561 _In_ PBL_DISPLAY_STATE TextState
2562 );
2563
2564 NTSTATUS
2565 ConsoleTextBaseGetTextResolution (
2566 _In_ struct _BL_TEXT_CONSOLE* Console,
2567 _Out_ PULONG TextResolution
2568 );
2569
2570 NTSTATUS
2571 ConsoleTextLocalSetTextResolution (
2572 _In_ struct _BL_TEXT_CONSOLE* Console,
2573 _In_ ULONG NewTextResolution,
2574 _Out_ PULONG OldTextResolution
2575 );
2576
2577 NTSTATUS
2578 ConsoleTextLocalClearText (
2579 _In_ struct _BL_TEXT_CONSOLE* Console,
2580 _In_ BOOLEAN LineOnly
2581 );
2582
2583 NTSTATUS
2584 ConsoleTextLocalWriteText (
2585 _In_ struct _BL_TEXT_CONSOLE* Console,
2586 _In_ PCHAR Text,
2587 _In_ ULONG Attribute
2588 );
2589
2590 NTSTATUS
2591 ConsoleTextLocalConstruct (
2592 _In_ PBL_TEXT_CONSOLE TextConsole,
2593 _In_ BOOLEAN Activate
2594 );
2595
2596 BOOLEAN
2597 ConsolepFindResolution (
2598 _In_ PBL_DISPLAY_MODE Mode,
2599 _In_ PBL_DISPLAY_MODE List,
2600 _In_ ULONG MaxIndex
2601 );
2602
2603 NTSTATUS
2604 ConsoleFirmwareTextClear (
2605 _In_ PBL_TEXT_CONSOLE Console,
2606 _In_ BOOLEAN LineOnly
2607 );
2608
2609 VOID
2610 ConsoleFirmwareTextClose (
2611 _In_ PBL_TEXT_CONSOLE TextConsole
2612 );
2613
2614 NTSTATUS
2615 ConsoleFirmwareTextOpen (
2616 _In_ PBL_TEXT_CONSOLE TextConsole
2617 );
2618
2619 NTSTATUS
2620 ConsoleFirmwareTextSetState (
2621 _In_ PBL_TEXT_CONSOLE TextConsole,
2622 _In_ UCHAR Mask,
2623 _In_ PBL_DISPLAY_STATE State
2624 );
2625
2626 NTSTATUS
2627 ConsoleGraphicalConstruct (
2628 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2629 );
2630
2631 NTSTATUS
2632 ConsoleCreateRemoteConsole (
2633 _In_ PBL_TEXT_CONSOLE* TextConsole
2634 );
2635
2636 NTSTATUS
2637 ConsoleEfiGraphicalOpenProtocol (
2638 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole,
2639 _In_ BL_GRAPHICS_CONSOLE_TYPE Type
2640 );
2641
2642 VOID
2643 ConsoleFirmwareGraphicalClose (
2644 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2645 );
2646
2647 VOID
2648 ConsoleFirmwareGraphicalDisable (
2649 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2650 );
2651
2652 NTSTATUS
2653 ConsoleFirmwareGraphicalClear (
2654 _In_ PBL_GRAPHICS_CONSOLE Console,
2655 _In_ ULONG Color
2656 );
2657
2658 NTSTATUS
2659 ConsoleFirmwareGraphicalEnable (
2660 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2661 );
2662
2663 NTSTATUS
2664 ConsoleEfiUgaOpen (
2665 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2666 );
2667
2668 VOID
2669 ConsoleEfiUgaClose (
2670 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2671 );
2672
2673 VOID
2674 ConsoleEfiGopClose (
2675 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2676 );
2677
2678 NTSTATUS
2679 ConsoleEfiGopOpen (
2680 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2681 );
2682
2683 NTSTATUS
2684 ConsoleEfiGopEnable (
2685 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole
2686 );
2687
2688 NTSTATUS
2689 ConsoleEfiUgaSetResolution (
2690 _In_ PBL_GRAPHICS_CONSOLE GraphicsConsole,
2691 _In_ PBL_DISPLAY_MODE DisplayMode,
2692 _In_ ULONG DisplayModeCount
2693 );
2694
2695 NTSTATUS
2696 ConsoleCreateLocalInputConsole (
2697 VOID
2698 );
2699
2700 NTSTATUS
2701 ConsoleInputLocalEraseBuffer (
2702 _In_ PBL_INPUT_CONSOLE Console,
2703 _In_opt_ PULONG ValueToFill
2704 );
2705
2706 VOID
2707 ConsolepClearBuffer (
2708 _In_ PUCHAR FrameBuffer,
2709 _In_ ULONG Width,
2710 _In_ PUCHAR FillColor,
2711 _In_ ULONG Height,
2712 _In_ ULONG ScanlineWidth,
2713 _In_ ULONG PixelDepth
2714 );
2715
2716 NTSTATUS
2717 ConsolepConvertColorToPixel (
2718 _In_ BL_COLOR Color,
2719 _Out_ PUCHAR Pixel
2720 );
2721
2722 extern ULONG MmDescriptorCallTreeCount;
2723 extern ULONG BlpApplicationFlags;
2724 extern BL_LIBRARY_PARAMETERS BlpLibraryParameters;
2725 extern BL_TRANSLATION_TYPE MmTranslationType;
2726 extern PBL_ARCH_CONTEXT CurrentExecutionContext;
2727 extern PBL_DEVICE_DESCRIPTOR BlpBootDevice;
2728 extern BL_LOADED_APPLICATION_ENTRY BlpApplicationEntry;
2729 extern EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *EfiConOut;
2730 extern EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *EfiConInEx;
2731 extern EFI_GUID EfiGraphicsOutputProtocol;
2732 extern EFI_GUID EfiUgaDrawProtocol;
2733 extern EFI_GUID EfiLoadedImageProtocol;
2734 extern EFI_GUID EfiDevicePathProtocol;
2735 extern EFI_GUID EfiBlockIoProtocol;
2736 extern EFI_GUID EfiSimpleTextInputExProtocol;
2737 extern EFI_GUID EfiRootAcpiTableGuid;
2738 extern EFI_GUID EfiRootAcpiTable10Guid;
2739 extern EFI_GUID EfiGlobalVariable;
2740 extern ULONG ConsoleGraphicalResolutionListFlags;
2741 extern BL_DISPLAY_MODE ConsoleGraphicalResolutionList[];
2742 extern BL_DISPLAY_MODE ConsoleTextResolutionList[];
2743 extern ULONG ConsoleGraphicalResolutionListSize;
2744 extern PVOID DspRemoteInputConsole;
2745 extern PVOID DspLocalInputConsole;
2746 extern WCHAR BlScratchBuffer[8192];
2747 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlMappedAllocated;
2748 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlMappedUnallocated;
2749 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlFwAllocationTracker;
2750 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedAllocated;
2751 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlUnmappedUnallocated;
2752 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlReservedAllocated;
2753 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlBadMemory;
2754 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlTruncatedMemory;
2755 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlPersistentMemory;
2756 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlCompleteBadMemory;
2757 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlFreeVirtual;
2758 extern BL_MEMORY_DESCRIPTOR_LIST MmMdlMappingTrackers;
2759 extern ULONGLONG BlpTimePerformanceFrequency;
2760 extern LIST_ENTRY RegisteredFileSystems;
2761 extern BL_ADDRESS_RANGE MmArchKsegAddressRange;
2762 extern ULONG_PTR MmArchTopOfApplicationAddressSpace;
2763
2764 #endif