/** @file
PerfMonApp.c -- PerfMonApp
Auto-converted from IDA decompiler output.
Functions: 1
Copyright (c) HR650X BIOS Decompilation Project
**/
#include "PerfMonApp.h"
// Function: ModuleEntryPoint
EFI_STATUS
EFIAPI
ModuleEntryPoint(
EFI_HANDLE ImageHandle,
EFI_SYSTEM_TABLE *SystemTable
)
{
UINTN *PerformanceProperty;
UINTN Index;
EFI_STATUS Status;
UINTN *PerformanceInfo;
UINTN TimerFrequencyKHz;
UINTN TimerValue;
EFI_STATUS QueryStatus;
UINTN *PropertyTable;
::ImageHandle = (__int64)ImageHandle;
if ( !ImageHandle ) {
PerfMonAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 51, "gImageHandle != ((void *) 0)");
}
::SystemTable = (__int64)SystemTable;
if ( !SystemTable ) {
PerfMonAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 57, "gST != ((void *) 0)");
}
BootServices = (__int64)SystemTable->BootServices;
if ( !BootServices ) {
PerfMonAssert("e:\\hs\\MdePkg\\Library\\UefiBootServicesTableLib\\UefiBootServicesTableLib.c", 63, "gBS != ((void *) 0)");
}
RuntimeServices = (__int64)SystemTable->RuntimeServices;
if ( !RuntimeServices ) {
PerfMonAssert("e:\\hs\\MdePkg\\Library\\UefiRuntimeServicesTableLib\\UefiRuntimeServicesTableLib.c", 47, "gRT != ((void *) 0)");
}
InitializePerformanceFramework();
PropertyTable = PerformanceProperty;
n1000 = 1000;
for ( Index = 0; Index < 0xA0; Index += 40LL ) {
*(_DWORD *)((char *)&unk_9220 + Index + 32) = 0;
*(_QWORD *)((char *)&unk_9220 + Index + 8) = -1;
*(_QWORD *)((char *)&unk_9220 + Index + 16) = 0;
*(_QWORD *)((char *)&unk_9220 + Index) = 0;
}
Status = GetPerformancePropertyTable(&unk_91E0, &PropertyTable);
if ( Status >= 0 && PropertyTable != 0 ) {
PerfMonPrint(L"DP Build Version: %d.%d\n", 2, 4);
TimerFrequencyKHz = PropertyTable[1];
TimerValue = PropertyTable[3];
qword_93A0 = PropertyTable[2];
qword_93A8 = TimerValue;
dword_93B0 = TimerFrequencyKHz / 0x3E8;
byte_93B4 = TimerValue >= qword_93A0;
PerfMonPrint(L"System Performance Timer Frequency: %,8d (KHz)\n", (unsigned int)dword_93B0);
CollectPerformanceData();
InitializePerformanceData();
ConfigurePerformanceOutput();
Status = 0x8000000000000015uLL;
if ( HasPerformanceProtocol() != 0x8000000000000015uLL && HasPerformanceData() != 0x8000000000000015uLL ) {
QueryStatus = RunPerformanceQuery();
if ( QueryStatus != 0x8000000000000015uLL ) {
CleanupPerformanceState();
return QueryStatus;
}
}
} else {
PerfMonPrint(L"Performance property not found\n");
}
return Status;
}