mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[HAL] Implement HaliQueryProcessorBrandString
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include <hal.h>
|
||||
typedef unsigned int UINT;
|
||||
#include <x86x64/Cpuid.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
@@ -50,6 +53,47 @@ HaliHandlePCIConfigSpaceAccess(_In_ BOOLEAN IsRead,
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static
|
||||
NTSTATUS
|
||||
HaliQueryProcessorBrandString(
|
||||
_Out_writes_(BrandStringLength) PCHAR BrandString,
|
||||
_In_ ULONG BrandStringLength,
|
||||
_Out_ PULONG ReturnedLength)
|
||||
{
|
||||
CPUID_EXTENDED_FUNCTION_REGS ExtendedFunction;
|
||||
union
|
||||
{
|
||||
INT AsInt[3 * 4];
|
||||
CHAR Chars[49];
|
||||
} BrandStringUnion;
|
||||
|
||||
*ReturnedLength = sizeof(BrandStringUnion.Chars);
|
||||
if (BrandStringLength < *ReturnedLength)
|
||||
{
|
||||
DPRINT1("HaliQueryProcessorBrandString: Buffer too small (%u < %u)\n", BrandStringLength, *ReturnedLength);
|
||||
return STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
|
||||
/* Check if we can query the brand string */
|
||||
__cpuid(ExtendedFunction.AsInt32, CPUID_EXTENDED_FUNCTION);
|
||||
if (ExtendedFunction.MaxLeaf < CPUID_BRAND_STRING3)
|
||||
{
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
__cpuid(&BrandStringUnion.AsInt[0], CPUID_BRAND_STRING1);
|
||||
__cpuid(&BrandStringUnion.AsInt[4], CPUID_BRAND_STRING2);
|
||||
__cpuid(&BrandStringUnion.AsInt[8], CPUID_BRAND_STRING3);
|
||||
BrandStringUnion.Chars[48] = '\0'; // Ensure null-termination
|
||||
|
||||
/* Copy the brand string to the output buffer */
|
||||
RtlCopyMemory(BrandString,
|
||||
BrandStringUnion.Chars,
|
||||
sizeof(BrandStringUnion.Chars));
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
HaliQuerySystemInformation(IN HAL_QUERY_INFORMATION_CLASS InformationClass,
|
||||
@@ -102,7 +146,10 @@ HaliQuerySystemInformation(IN HAL_QUERY_INFORMATION_CLASS InformationClass,
|
||||
REPORT_THIS_CASE(HalQueryProfileSourceList);
|
||||
REPORT_THIS_CASE(HalInitLogInformation);
|
||||
REPORT_THIS_CASE(HalFrequencyInformation);
|
||||
REPORT_THIS_CASE(HalProcessorBrandString);
|
||||
case HalProcessorBrandString:
|
||||
{
|
||||
return HaliQueryProcessorBrandString((PCHAR)Buffer, BufferSize, ReturnedLength);
|
||||
}
|
||||
REPORT_THIS_CASE(HalHypervisorInformation);
|
||||
REPORT_THIS_CASE(HalPlatformTimerInformation);
|
||||
REPORT_THIS_CASE(HalAcpiAuditInformation);
|
||||
|
||||
Reference in New Issue
Block a user