ReactOS 0.4.15-dev-7907-g95bf896
util.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING.ARM in the top level directory
3 * PROJECT: ReactOS UEFI Boot Library
4 * FILE: boot/environ/lib/misc/util.c
5 * PURPOSE: Boot Library Utility Functions
6 * PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include "bl.h"
12
13/* DATA VARIABLES ************************************************************/
14
17
21
30
31/* FUNCTIONS *****************************************************************/
32
35 _Out_ PVOID* TableAddress,
37 )
38{
39 ULONG i, TableCount, HeaderLength;
41 PRSDT Rsdt;
42 PXSDT Xsdt;
45
46 Header = 0;
47
48 /* Make sure there's an output parameter */
49 if (!TableAddress)
50 {
52 }
53
54 /* Get the currently known RSDT and XSDT */
55 Rsdt = (PRSDT)UtlRsdt;
56 Xsdt = (PXSDT)UtlXsdt;
57
58 /* Is there an RSDT? */
59 if (!Rsdt)
60 {
61 /* No -- is there an XSDT? */
62 if (!Xsdt)
63 {
64 /* No. Look up the RSDT */
66 if (!NT_SUCCESS(Status))
67 {
68 EfiPrintf(L"no rsdp found\r\n");
69 return Status;
70 }
71
72 /* Map the header */
74 0,
75 sizeof(*Header),
77 if (!NT_SUCCESS(Status))
78 {
79 return Status;
80 }
81
82 /* Unmap the header */
84
85 /* Map the whole table */
87 0,
88 Header->Length,
90 if (!NT_SUCCESS(Status))
91 {
92 return Status;
93 }
94
95 /* Check if its an XSDT or an RSDT */
96 if (Header->Signature == XSDT_SIGNATURE)
97 {
98 /* It's an XSDT */
99 Xsdt = (PXSDT)Header;
100 UtlXsdt = Xsdt;
101 }
102 else
103 {
104 /* It's an RSDT */
105 Rsdt = (PRSDT)Header;
106 UtlRsdt = Rsdt;
107 }
108 }
109 }
110
111 /* OK, so do we have an XSDT after all? */
112 if (Xsdt)
113 {
114 /* Yes... how big is it? */
115 HeaderLength = Xsdt->Header.Length;
116 if (HeaderLength >= sizeof(*Header))
117 {
118 HeaderLength = sizeof(*Header);
119 }
120
121 /* Based on that, how many tables are there? */
122 TableCount = (Xsdt->Header.Length - HeaderLength) / sizeof(PHYSICAL_ADDRESS);
123 }
124 else
125 {
126 /* Nope, we have an RSDT. How big is it? */
127 HeaderLength = Rsdt->Header.Length;
128 if (HeaderLength >= sizeof(*Header))
129 {
130 HeaderLength = sizeof(*Header);
131 }
132
133 /* Based on that, how many tables are there? */
134 TableCount = (Rsdt->Header.Length - HeaderLength) / sizeof(ULONG);
135 }
136
137 /* Loop through the ACPI tables */
138 for (i = 0; i < TableCount; i++)
139 {
140 /* For an XSDT, read the 64-bit address directly */
141 if (Xsdt)
142 {
143 PhysicalAddress = Xsdt->Tables[i];
144 }
145 else
146 {
147 /* For RSDT, cast it */
149 }
150
151 /* Map the header */
153 0,
154 sizeof(*Header),
156 if (!NT_SUCCESS(Status))
157 {
158 return Status;
159 }
160
161 /* Is it the right one? */
162 if (Header->Signature == Signature)
163 {
164 /* Unmap the header */
166
167 /* Map the whole table */
168 return BlMmMapPhysicalAddressEx(TableAddress,
169 0,
170 Header->Length,
172 }
173 }
174
175 /* Requested table does not exist */
176 return STATUS_NOT_FOUND;
177}
178
179
180VOID
182 _In_ ULONG Percentage,
183 _Out_opt_ PBOOLEAN Completed
184 )
185{
187 {
188 EfiPrintf(L"Unimplemented\r\n");
189 }
190 else if (*Completed)
191 {
192 *Completed = TRUE;
193 }
194}
195
198 VOID
199 )
200{
201 UtlRsdt = 0;
202 UtlXsdt = 0;
203
204 UtlMcContext = 0;
207
215 UtlProgressInfo = 0;
216
217 return STATUS_SUCCESS;
218}
219
220VOID
223 _In_ PWCHAR ProgressInfo
224 )
225{
226 EfiPrintf(L"Progress Info: %s\r\n", ProgressInfo);
227}
228
229VOID
232 _In_ ULONG Percent,
233 _Out_ PBOOLEAN Completed
234 )
235{
236 EfiPrintf(L"Progress: %d\r\n", Percent);
237 if (Completed)
238 {
239 *Completed = TRUE;
240 }
241}
242
245 VOID
246 )
247{
248 /* One shouldn't already exist */
250 {
251 return STATUS_UNSUCCESSFUL;
252 }
253
254 /* Set the routine, and no context */
257
258 /* Progress increases by one */
260
261 /* Set progress to zero for now */
264
265 /* Set the info routine if there is one */
267
268 /* All good */
269 return STATUS_SUCCESS;
270}
271
272PVOID
276 _Out_ PULONG EntryIndex,
280 _In_ PVOID Argument3,
282 )
283{
284 PVOID Entry = NULL;
285 ULONG Index;
287
288 /* Check for invalid parameters */
289 if (!(Table) || !(EntryIndex))
290 {
291 return Entry;
292 }
293
294 /* Loop each entry in the table */
295 for (Index = 0; Index < Count; Index++)
296 {
297 /* Check if this entry is filled out */
298 if (Table[Index])
299 {
300 /* Call the comparison function */
302 Argument1,
303 Argument2,
304 Argument3,
305 Argument4);
306 if (Result)
307 {
308 /* Entry found return it */
309 *EntryIndex = Index;
310 Entry = Table[Index];
311 break;
312 }
313 }
314 }
315
316 /* Return the entry that was (or wasn't) found */
317 return Entry;
318}
319
325 _Out_ PULONG EntryIndex,
327 )
328{
329 ULONG NewCount;
331 ULONG Index = 0;
332 PVOID* NewTable;
333
334 /* Make sure all the parameters were specified */
335 if (!(Table) || !(*Table) || !(Count) || !(Callback))
336 {
338 }
339
340 /* Read the current table */
341 NewTable = *Table;
342 NewCount = *Count;
343
344 /* Iterate over it */
345 while (Index < NewCount)
346 {
347 /* Look for a free index */
348 if (!NewTable[Index])
349 {
350 goto SetIndex;
351 }
352
353 /* No free index yet, keep going */
354 ++Index;
355 }
356
357 /* No free index was found, try to purge some entries */
358 Index = 0;
359 while (Index < NewCount)
360 {
361 /* Call each purge callback, trying to make space */
362 Status = Callback(NewTable[Index]);
363 if (NT_SUCCESS(Status))
364 {
365 /* We should have this slot available now */
366 goto SetIndex;
367 }
368
369 /* Keep trying to purge more */
370 ++Index;
371 }
372
373 /* Double the table */
374 NewTable = BlMmAllocateHeap(2 * sizeof(PVOID) * NewCount);
375 if (!NewTable)
376 {
377 return STATUS_NO_MEMORY;
378 }
379
380 /* Clear the new table, and copy the old entries */
381 RtlZeroMemory(&NewTable[NewCount], sizeof(PVOID) * NewCount);
382 RtlCopyMemory(NewTable, *Table, sizeof(PVOID) * NewCount);
383
384 /* Free the old table */
386
387 /* Return the new table and count */
388 *Count = 2 * NewCount;
389 *Table = NewTable;
390
391SetIndex:
392 /* Set the index and return */
393 NewTable[Index] = Entry;
394 *EntryIndex = Index;
395 return Status;
396}
397
402 _In_ PBL_TBL_MAP_ROUTINE MapCallback
403 )
404{
405 NTSTATUS Status, LocalStatus;
406 PVOID Entry;
407 ULONG Index;
408
409 /* Bail out if there's no table */
410 if (!Table)
411 {
413 }
414
415 /* Assume success and loop each index */
417 for (Index = 0; Index < Count; Index++)
418 {
419 /* See if an entry exists at this index */
420 Entry = Table[Index];
421 if (Entry)
422 {
423 /* Call the map routine for this entry */
424 LocalStatus = MapCallback(Entry, Index);
425 if (!NT_SUCCESS(LocalStatus))
426 {
427 /* Propagate failure only */
428 Status = LocalStatus;
429 }
430 }
431 }
432
433 /* Return status to caller */
434 return Status;
435}
436
440
441ULONG
445 )
446{
448 ULONG KeyHash, i;
449
450 /* Check if the value is a pointer, or embedded inline */
451 Value = (Entry->Flags & BL_HT_VALUE_IS_INLINE) ? Entry->Value : (PUCHAR)&Entry->Value;
452
453 /* Iterate over each byte, and sum it */
454 for (i = 0, KeyHash = 0; i < Entry->Size; i++)
455 {
456 KeyHash += Value[i++];
457 }
458
459 /* Modulo the number of buckets */
460 return KeyHash % TableSize;
461}
462
465 _In_ PBL_HASH_ENTRY Entry1,
466 _In_ PBL_HASH_ENTRY Entry2
467 )
468{
469 ULONG Flags;
470 BOOLEAN ValueMatch;
471
472 /* Check if the flags or sizes are not matching */
473 Flags = Entry1->Flags;
474 if ((Entry1->Size != Entry2->Size) || (Flags != Entry2->Flags))
475 {
476 ValueMatch = FALSE;
477 }
478 else if (Flags & BL_HT_VALUE_IS_INLINE)
479 {
480 /* Check if this is an in-line value, compare it */
481 ValueMatch = Entry1->Value == Entry2->Value;
482 }
483 else
484 {
485 /* This is a pointer value, compare it */
486 ValueMatch = (RtlCompareMemory(Entry1->Value, Entry2->Value, Entry1->Size) ==
487 Entry1->Size);
488 }
489
490 /* Return if it matched */
491 return ValueMatch;
492}
493
497 )
498{
499 /* Never purge this entry */
500 return STATUS_UNSUCCESSFUL;
501}
502
509 )
510{
513 ULONG i;
514
515 /* Assume failure */
516 HashTable = NULL;
517
518 /* Can't create a table with no ID */
519 if (!Id)
520 {
522 }
523
524 /* Check if we don't already have a hash table table */
525 if (!HtTableSize)
526 {
527 /* Allocate it and zero it out */
528 HtTableSize = 4;
530 if (!HtTableArray)
531 {
533 goto Quickie;
534 }
536 HtTableEntries = 0;
537 }
538
539 /* Allocate the hash table */
541 if (!HashTable)
542 {
544 goto Quickie;
545 }
546
547 /* Fill it out */
548 HashTable->HashFunction = HashFunction ? HashFunction : DefaultHashFunction;
549 HashTable->CompareFunction = CompareFunction ? CompareFunction : HtpCompareKeys;
550 HashTable->Size = Size ? Size : 13;
551
552 /* Allocate the hash links, one for each bucket */
553 HashTable->HashLinks = BlMmAllocateHeap(sizeof(LIST_ENTRY) * HashTable->Size);
554 if (!HashTable->HashLinks)
555 {
557 goto Quickie;
558 }
559
560 /* Initialize the hash links */
561 for (i = 0; i < HashTable->Size; i++)
562 {
563 InitializeListHead(&HashTable->HashLinks[i]);
564 }
565
566 /* Save us in the table of hash tables */
568 &Size,
569 HashTable,
570 Id,
572 if (NT_SUCCESS(Status))
573 {
574 /* One more -- we're done */
576 return Status;
577 }
578
579Quickie:
580 /* Check if we just allocated the table array now */
581 if (!(HtTableEntries) && (HtTableArray))
582 {
583 /* Free it */
586 HtTableSize = 0;
587 }
588
589 /* Check if we allocated a hash table*/
590 if (HashTable)
591 {
592 /* With links? */
593 if (HashTable->HashLinks)
594 {
595 /* Free them */
596 BlMmFreeHeap(HashTable->HashLinks);
597 }
598
599 /* Free the table*/
601 }
602
603 /* We're done */
604 return Status;
605}
606
609 _In_ ULONG TableId,
612 )
613{
617 PLIST_ENTRY HashLinkHead, HashLink;
618 PBL_HASH_NODE HashNode;
619
620 /* Check if the table ID is invalid, or we have no entry, or it's malformed */
621 if ((HtTableSize <= TableId) ||
622 !(Entry) ||
623 ((Entry->Flags & BL_HT_VALUE_IS_INLINE) && (Entry->Size != sizeof(ULONG))))
624 {
625 /* Fail */
627 }
628 else
629 {
630 /* Otherwise, get the hash table for this index */
631 HashTable = HtTableArray[TableId];
632
633 /* Get the hash bucket */
634 HashValue = HashTable->HashFunction(Entry, HashTable->Size);
635
636 /* Start iterating each entry in the bucket, assuming failure */
638 HashLinkHead = &HashTable->HashLinks[HashValue];
639 HashLink = HashLinkHead->Flink;
640 while (HashLink != HashLinkHead)
641 {
642 /* Get a node in this bucket, and compare the value */
643 HashNode = CONTAINING_RECORD(HashLink, BL_HASH_NODE, ListEntry);
644 if (HashTable->CompareFunction(&HashNode->Entry, Entry))
645 {
646 /* Does the caller want the value? */
647 if (Value)
648 {
649 /* Return it */
650 *Value = &HashNode->Value;
651 }
652
653 /* Return success and stop scanning */
655 break;
656 }
657
658 /* Try the next node */
659 HashLink = HashLink->Flink;
660 }
661 }
662
663 /* Return back to the caller */
664 return Status;
665}
666
669 _In_ ULONG TableId,
673 )
674{
675 PBL_HASH_NODE HashNode;
677 PLIST_ENTRY HashLinkHead;
679
680 /* Check for invalid table ID, missing arguments, or malformed entry */
681 if ((HtTableSize <= TableId) ||
682 !(Entry) ||
683 !(Data) ||
684 !(Entry->Size) ||
685 !(Entry->Value) ||
686 !(DataSize) ||
687 ((Entry->Flags & BL_HT_VALUE_IS_INLINE) && (Entry->Size != sizeof(ULONG))))
688 {
689 /* Fail the call */
691 goto Quickie;
692 }
693
694 /* Get the hash table for this ID */
695 HashTable = HtTableArray[TableId];
696
697 /* Allocate a hash node */
698 HashNode = BlMmAllocateHeap(sizeof(*HashNode));
699 if (!HashNode)
700 {
702 goto Quickie;
703 }
704
705 /* Capture all the data*/
706 HashNode->Entry.Size = Entry->Size;
707 HashNode->Entry.Flags = Entry->Flags;
708 HashNode->Entry.Value = Entry->Value;
709 HashNode->Value.DataSize = DataSize;
710 HashNode->Value.Data = Data;
711
712 /* Insert it into the bucket list and return success */
713 HashLinkHead = &HashTable->HashLinks[HashTable->HashFunction(Entry, HashTable->Size)];
714 InsertTailList(HashLinkHead, &HashNode->ListEntry);
716
717Quickie:
718 return Status;
719}
720
723 _In_ ULONG TableId,
725 )
726{
730 PLIST_ENTRY HashLinkHead, HashLink;
731 PBL_HASH_NODE HashNode;
732
733 /* Check if the table ID is invalid, or we have no entry, or it's malformed */
734 if ((HtTableSize <= TableId) ||
735 !(Entry) ||
736 !(Entry->Size) ||
737 !(Entry->Value) ||
738 ((Entry->Flags & BL_HT_VALUE_IS_INLINE) && (Entry->Size != sizeof(ULONG))))
739 {
740 /* Fail */
742 }
743 else
744 {
745 /* Otherwise, get the hash table for this index */
746 HashTable = HtTableArray[TableId];
747
748 /* Get the hash bucket */
749 HashValue = HashTable->HashFunction(Entry, HashTable->Size);
750
751 /* Start iterating each entry in the bucket, assuming failure */
753 HashLinkHead = &HashTable->HashLinks[HashValue];
754 HashLink = HashLinkHead->Flink;
755 while (HashLink != HashLinkHead)
756 {
757 /* Get a node in this bucket, and compare the value */
758 HashNode = CONTAINING_RECORD(HashLink, BL_HASH_NODE, ListEntry);
759 if (HashTable->CompareFunction(&HashNode->Entry, Entry))
760 {
761 /* Remove it from the list and free it */
762 RemoveEntryList(&HashNode->ListEntry);
763 BlMmFreeHeap(HashNode);
764 return STATUS_SUCCESS;
765 }
766
767 /* Try the next node */
768 HashLink = HashLink->Flink;
769 }
770 }
771
772 /* Return back to the caller */
773 return Status;
774}
775
776ULONG
778 _In_ ULONG PartialSum,
782 )
783{
784 ULONG i;
785
787 {
788 EfiPrintf(L"Not supported\r\n");
789 return 0;
790 }
792 {
793 PartialSum = (unsigned __int16)PartialSum;
794 Length &= ~1;
795
796 for (i = 0; i < Length; i += 2)
797 {
798 PartialSum += *(unsigned __int16 *)&Buffer[i];
800 {
801 PartialSum = (unsigned __int16)((PartialSum >> 16) + PartialSum);
802 }
803 }
804
805 if (i != Length)
806 {
807 PartialSum += (unsigned __int8)Buffer[Length];
809 {
810 PartialSum = (unsigned __int16)((PartialSum >> 16) + PartialSum);
811 }
812 }
813
815 {
816 return ~PartialSum;
817 }
818
819 PartialSum = (unsigned __int16)PartialSum;
820 }
821 else
822 {
823 /* Invalid mode */
824 return 0;
825 }
826
828 {
829 return ~PartialSum;
830 }
831
832 return PartialSum;
833}
834
835#if defined(_M_IX86) || defined(_M_X64)
837Archx86IsCpuidSupported (
838 VOID
839 )
840{
841 ULONG CallerFlags, Flags;
842
843 /* Read the original flags, and add the CPUID bit */
844 CallerFlags = __readeflags() ^ 0x200000;
845 __writeeflags(CallerFlags);
846
847 /* Read our flags now */
849
850 /* Check if the bit stuck */
851 return (((CallerFlags ^ Flags) >> 21) & 1) ^ 1;
852}
853#endif
854
858 )
859{
860#if defined(_M_IX86) || defined(_M_X64)
862 INT CpuInfo[4];
863
864 /* Check if the CPU supports this instruction */
865 Supported = Archx86IsCpuidSupported();
866 if (!Supported)
867 {
868 return FALSE;
869 }
870
871 /* Check if it's the extended function */
872 if (Function >= 0x80000000)
873 {
874 /* Check if extended functions are supported */
875 __cpuid(CpuInfo, 0x80000000);
876 if ((CpuInfo[0] & 0xFFFFFF00) != 0x80000000)
877 {
878 /* Nope */
879 return FALSE;
880 }
881 }
882 else
883 {
884 /* It's a regular function, get the maximum one supported */
885 __cpuid(CpuInfo, 0);
886 }
887
888 /* Check if our function is within bounds */
889 if (Function <= CpuInfo[0])
890 {
891 return TRUE;
892 }
893#else
894 EfiPrintf(L"BlArchIsCpuIdFunctionSupported not implemented for this platform.\r\n");
895#endif
896
897 /* Nope */
898 return FALSE;
899}
900
903 VOID
904 )
905{
906#if defined(_M_IX86) || defined(_M_X64)
907 CPU_INFO CpuInfo;
908
909 /* Serialize with CPUID, if it exists */
910 if (Archx86IsCpuidSupported())
911 {
912 BlArchCpuId(0, 0, &CpuInfo);
913 }
914
915 /* Read the TSC */
916 return __rdtsc();
917#else
918 EfiPrintf(L"BlArchGetPerformanceCounter not implemented for this platform.\r\n");
919 return 0;
920#endif
921}
922
923VOID
926 _In_ ULONG SubFunction,
928 )
929{
930#if defined(_M_IX86) || defined(_M_X64)
931 /* Use the intrinsic */
932 __cpuidex((INT*)Result->AsUINT32, Function, SubFunction);
933#endif
934}
935
938 VOID
939 )
940{
941 CPU_INFO CpuInfo;
942 INT Temp;
943
944 /* Get the CPU Vendor */
945 BlArchCpuId(0, 0, &CpuInfo);
946#if defined(_M_IX86) || defined(_M_X64)
947 Temp = CpuInfo.Ecx;
948 CpuInfo.Ecx = CpuInfo.Edx;
949 CpuInfo.Edx = Temp;
950
951 /* Check against supported values */
952 if (!strncmp((PCHAR)&CpuInfo.Ebx, "GenuineIntel", 12))
953 {
954 return CPU_INTEL;
955 }
956 if (!strncmp((PCHAR)&CpuInfo.Ebx, "AuthenticAMD", 12))
957 {
958 return CPU_AMD;
959 }
960 if (!strncmp((PCHAR)&CpuInfo.Ebx, "CentaurHauls", 12))
961 {
962 return CPU_VIA;
963 }
964#ifdef _M_IX86
965 if (!strncmp((PCHAR)&CpuInfo.Ebx, "CyrixInstead", 12))
966 {
967 return CPU_CYRIX;
968 }
969 if (!strncmp((PCHAR)&CpuInfo.Ebx, "GenuineTMx86", 12))
970 {
971 return CPU_TRANSMETA;
972 }
973 if (!strncmp((PCHAR)&CpuInfo.Ebx, "RiseRiseRise", 12))
974 {
975 return CPU_RISE;
976 }
977#endif // _M_IX86
978#else // defined(_M_IX86) || defined(_M_X64)
979 EfiPrintf(L"BlArchGetCpuVendor not implemented for this platform.\r\n");
980#endif
981 /* Other */
982 return CPU_UNKNOWN;
983}
DWORD Id
unsigned char BOOLEAN
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
LONG NTSTATUS
Definition: precomp.h:26
#define __int8
Definition: basetyps.h:25
#define __int16
Definition: basetyps.h:22
VOID EfiPrintf(_In_ PWCHAR Format,...)
Definition: firmware.c:126
#define BL_UTL_CHECKSUM_USHORT_BUFFER
Definition: bl.h:191
#define BL_UTL_CHECKSUM_COMPLEMENT
Definition: bl.h:187
#define BL_UTL_CHECKSUM_UCHAR_BUFFER
Definition: bl.h:190
PVOID BlMmAllocateHeap(_In_ SIZE_T Size)
Definition: heapalloc.c:569
NTSTATUS BlMmUnmapVirtualAddressEx(_In_ PVOID VirtualAddress, _In_ ULONGLONG Size)
Definition: mm.c:487
BOOLEAN(* PBL_HASH_TABLE_COMPARE_FUNCTION)(_In_ struct _BL_HASH_ENTRY *Entry1, _In_ struct _BL_HASH_ENTRY *Entry2)
Definition: bl.h:595
BOOLEAN(* PBL_TBL_LOOKUP_ROUTINE)(_In_ PVOID Entry, _In_ PVOID Argument1, _In_ PVOID Argument2, _In_ PVOID Argument3, _In_ PVOID Argument4)
Definition: bl.h:565
NTSTATUS(* PBL_TBL_MAP_ROUTINE)(_In_ PVOID Entry, _In_ ULONG EntryIndex)
Definition: bl.h:575
#define BL_HT_VALUE_IS_INLINE
Definition: bl.h:137
NTSTATUS BlMmMapPhysicalAddressEx(_In_ PVOID *VirtualAddress, _In_ ULONG Attributes, _In_ ULONGLONG Size, _In_ PHYSICAL_ADDRESS PhysicalAddress)
Definition: mm.c:192
#define BL_UTL_CHECKSUM_NEGATE
Definition: bl.h:189
ULONG(* PBL_HASH_TABLE_HASH_FUNCTION)(_In_ struct _BL_HASH_ENTRY *Entry, _In_ ULONG TableSize)
Definition: bl.h:602
NTSTATUS BlMmFreeHeap(_In_ PVOID Buffer)
Definition: heapalloc.c:663
NTSTATUS(* PBL_TBL_SET_ROUTINE)(_In_ PVOID Entry)
Definition: bl.h:582
NTSTATUS EfipGetRsdt(_Out_ PPHYSICAL_ADDRESS FoundRsdt)
Definition: firmware.c:1635
ULONG UtlProgressGranularity
Definition: util.c:25
PVOID UtlMcContext
Definition: util.c:18
PVOID UtlProgressInfo
Definition: util.c:29
VOID BlArchCpuId(_In_ ULONG Function, _In_ ULONG SubFunction, _Out_ PCPU_INFO Result)
Definition: util.c:924
ULONG HtTableEntries
Definition: util.c:439
NTSTATUS BlUtlRegisterProgressRoutine(VOID)
Definition: util.c:244
NTSTATUS BlHtStore(_In_ ULONG TableId, _In_ PBL_HASH_ENTRY Entry, _In_ PVOID Data, _In_ ULONG DataSize)
Definition: util.c:668
ULONG DefaultHashFunction(_In_ PBL_HASH_ENTRY Entry, _In_ ULONG TableSize)
Definition: util.c:442
ULONG UtlNextUpdatePercentage
Definition: util.c:27
NTSTATUS BlHtCreate(_In_ ULONG Size, _In_ PBL_HASH_TABLE_HASH_FUNCTION HashFunction, _In_ PBL_HASH_TABLE_COMPARE_FUNCTION CompareFunction, _Out_ PULONG Id)
Definition: util.c:504
PVOID BlTblFindEntry(_In_ PVOID *Table, _In_ ULONG Count, _Out_ PULONG EntryIndex, _In_ PBL_TBL_LOOKUP_ROUTINE Callback, _In_ PVOID Argument1, _In_ PVOID Argument2, _In_ PVOID Argument3, _In_ PVOID Argument4)
Definition: util.c:273
PBL_HASH_TABLE * HtTableArray
Definition: util.c:438
PVOID UtlProgressInfoRoutine
Definition: util.c:24
BOOLEAN BlArchIsCpuIdFunctionSupported(_In_ ULONG Function)
Definition: util.c:856
ULONG BlUtlCheckSum(_In_ ULONG PartialSum, _In_ PUCHAR Buffer, _In_ ULONG Length, _In_ ULONG Flags)
Definition: util.c:777
ULONG UtlCurrentPercentComplete
Definition: util.c:26
BOOLEAN HtpCompareKeys(_In_ PBL_HASH_ENTRY Entry1, _In_ PBL_HASH_ENTRY Entry2)
Definition: util.c:464
PVOID UtlMcUpdateMessageRoutine
Definition: util.c:20
ULONG HtTableSize
Definition: util.c:437
NTSTATUS BlUtlInitialize(VOID)
Definition: util.c:197
CPU_VENDORS BlArchGetCpuVendor(VOID)
Definition: util.c:937
NTSTATUS BlHtLookup(_In_ ULONG TableId, _In_ PBL_HASH_ENTRY Entry, _Out_opt_ PBL_HASH_VALUE *Value)
Definition: util.c:608
NTSTATUS BlUtlGetAcpiTable(_Out_ PVOID *TableAddress, _In_ ULONG Signature)
Definition: util.c:34
NTSTATUS TblDoNotPurgeEntry(_In_ PVOID Entry)
Definition: util.c:495
VOID BmUpdateProgress(_In_ PVOID Unknown, _In_ ULONG Percent, _Out_ PBOOLEAN Completed)
Definition: util.c:230
PVOID UtlMcDisplayMessageRoutine
Definition: util.c:19
NTSTATUS BlHtDelete(_In_ ULONG TableId, _In_ PBL_HASH_ENTRY Entry)
Definition: util.c:722
ULONGLONG BlArchGetPerformanceCounter(VOID)
Definition: util.c:902
NTSTATUS BlTblSetEntry(_Inout_ PVOID **Table, _Inout_ PULONG Count, _In_ PVOID Entry, _Out_ PULONG EntryIndex, _In_ PBL_TBL_SET_ROUTINE Callback)
Definition: util.c:321
NTSTATUS BlTblMap(_In_ PVOID *Table, _In_ ULONG Count, _In_ PBL_TBL_MAP_ROUTINE MapCallback)
Definition: util.c:399
PRSDT UtlRsdt
Definition: util.c:15
VOID BmUpdateProgressInfo(_In_ PVOID Unknown, _In_ PWCHAR ProgressInfo)
Definition: util.c:221
BOOLEAN UtlProgressNeedsInfoUpdate
Definition: util.c:28
VOID BlUtlUpdateProgress(_In_ ULONG Percentage, _Out_opt_ PBOOLEAN Completed)
Definition: util.c:181
PVOID UtlProgressRoutine
Definition: util.c:22
PVOID UtlProgressContext
Definition: util.c:23
PXSDT UtlXsdt
Definition: util.c:16
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
Definition: cdrom.h:1156
Definition: bufpool.h:45
Definition: Header.h:9
_In_ PVOID Argument2
Definition: classpnp.h:721
@ Supported
Definition: classpnp.h:733
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR Signature[]
Definition: parser.c:141
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
InternalIoctlParams Argument4
Status
Definition: gdiplustypes.h:25
ASMGENDATA Table[]
Definition: genincdata.c:61
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
@ Unknown
Definition: i8042prt.h:114
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
PPC_QUAL unsigned long long __rdtsc(void)
Definition: intrin_ppc.h:688
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
Definition: intrin_x86.h:1669
__INTRIN_INLINE void __cpuidex(int CPUInfo[4], int InfoType, int ECXValue)
Definition: intrin_x86.h:1649
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1674
#define _Out_opt_
Definition: ms_sal.h:346
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
CPU_VENDORS
Definition: ketypes.h:103
@ CPU_VIA
Definition: ketypes.h:107
@ CPU_INTEL
Definition: ketypes.h:106
@ CPU_UNKNOWN
Definition: ketypes.h:104
@ CPU_AMD
Definition: ketypes.h:105
@ CPU_RISE
Definition: ketypes.h:96
@ CPU_CYRIX
Definition: ketypes.h:92
@ CPU_TRANSMETA
Definition: ketypes.h:93
int Count
Definition: noreturn.cpp:7
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define L(x)
Definition: ntvdm.h:50
RSDT * PRSDT
Definition: acpi.h:191
#define XSDT_SIGNATURE
Definition: acpi.h:39
XSDT * PXSDT
Definition: acpi.h:198
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_NOT_FOUND
Definition: shellext.h:72
base of all file and directory entries
Definition: entries.h:83
Definition: hash.c:67
Definition: bl.h:1177
ULONG Flags
Definition: bl.h:1179
ULONG Size
Definition: bl.h:1178
PVOID Value
Definition: bl.h:1180
LIST_ENTRY ListEntry
Definition: bl.h:1191
BL_HASH_ENTRY Entry
Definition: bl.h:1192
BL_HASH_VALUE Value
Definition: bl.h:1193
PVOID Data
Definition: bl.h:1186
ULONG DataSize
Definition: bl.h:1185
ULONG Length
Definition: acpi.h:97
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: acpi.h:187
ULONG Tables[ANYSIZE_ARRAY]
Definition: acpi.h:189
DESCRIPTION_HEADER Header
Definition: acpi.h:188
Definition: acpi.h:194
PHYSICAL_ADDRESS Tables[ANYSIZE_ARRAY]
Definition: acpi.h:196
DESCRIPTION_HEADER Header
Definition: acpi.h:195
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PBOOLEAN
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
ULONG Ebx
Definition: ketypes.h:367
ULONG Ecx
Definition: ketypes.h:368
ULONG Edx
Definition: ketypes.h:369
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_IRQL_requires_same_ _In_opt_ PVOID Argument1
Definition: cmtypes.h:696
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:4327
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
_In_ BOOLEAN _In_ ULONG _Out_ PULONG HashValue
Definition: rtlfuncs.h:2039