Module: wine Branch: master Commit: b72c2dca0184efb732619d5dbd14b0672a7bb3e8 URL: https://gitlab.winehq.org/wine/wine/-/commit/b72c2dca0184efb732619d5dbd14b06...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Mar 14 16:39:06 2023 +0100
ntdll: Fix some CPU information tests on ARM64.
---
dlls/ntdll/tests/info.c | 112 +++++++++++++++++++++++++++-------------------- dlls/ntdll/unix/system.c | 2 + 2 files changed, 67 insertions(+), 47 deletions(-)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index cf074076c96..2cd76a8c87e 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -303,68 +303,76 @@ static void test_query_basic(void)
static void test_query_cpu(void) { - DWORD status; - ULONG ReturnLength; - SYSTEM_CPU_INFORMATION sci, sci2; + NTSTATUS status; + ULONG len; + SYSTEM_CPU_INFORMATION sci, sci2, sci3;
memset(&sci, 0xcc, sizeof(sci)); - status = pNtQuerySystemInformation(SystemCpuInformation, &sci, sizeof(sci), &ReturnLength); + status = pNtQuerySystemInformation(SystemCpuInformation, &sci, sizeof(sci), &len); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status); - ok( sizeof(sci) == ReturnLength, "Inconsistent length %ld\n", ReturnLength); - - /* Check if we have some return values */ - if (winetest_debug > 1) trace("Processor FeatureSet : %08lx\n", sci.ProcessorFeatureBits); - ok( sci.ProcessorFeatureBits != 0, "Expected some features for this processor, got %08lx\n", - sci.ProcessorFeatureBits); + ok( sizeof(sci) == len, "Inconsistent length %ld\n", len);
memset(&sci2, 0xcc, sizeof(sci2)); - status = pRtlGetNativeSystemInformation(SystemCpuInformation, &sci2, sizeof(sci2), &ReturnLength); + status = pRtlGetNativeSystemInformation(SystemCpuInformation, &sci2, sizeof(sci2), &len); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx.\n", status); - ok( sizeof(sci2) == ReturnLength, "Unexpected length %lu.\n", ReturnLength); + ok( sizeof(sci2) == len, "Unexpected length %lu.\n", len);
if (is_wow64) { ok( sci.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL, "ProcessorArchitecture wrong %x\n", sci.ProcessorArchitecture ); todo_wine - ok( sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64, "ProcessorArchitecture wrong %x\n", - sci2.ProcessorArchitecture ); + ok( sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 || + sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64, + "ProcessorArchitecture wrong %x\n", sci2.ProcessorArchitecture ); } else ok( sci.ProcessorArchitecture == sci2.ProcessorArchitecture, "ProcessorArchitecture differs %x / %x\n", sci.ProcessorArchitecture, sci2.ProcessorArchitecture );
- ok( sci.ProcessorLevel == sci2.ProcessorLevel, "ProcessorLevel differs %x / %x\n", - sci.ProcessorLevel, sci2.ProcessorLevel ); - ok( sci.ProcessorRevision == sci2.ProcessorRevision, "ProcessorRevision differs %x / %x\n", - sci.ProcessorRevision, sci2.ProcessorRevision ); - ok( sci.MaximumProcessors == sci2.MaximumProcessors, "MaximumProcessors differs %x / %x\n", - sci.MaximumProcessors, sci2.MaximumProcessors ); - ok( sci.ProcessorFeatureBits == sci2.ProcessorFeatureBits, "ProcessorFeatureBits differs %lx / %lx\n", - sci.ProcessorFeatureBits, sci2.ProcessorFeatureBits ); + if (sci2.ProcessorArchitecture != PROCESSOR_ARCHITECTURE_ARM64) + { + /* Check if we have some return values */ + if (winetest_debug > 1) trace("Processor FeatureSet : %08lx\n", sci.ProcessorFeatureBits); + ok( sci.ProcessorFeatureBits != 0, "Expected some features for this processor, got %08lx\n", + sci.ProcessorFeatureBits);
- memset(&sci2, 0xcc, sizeof(sci2)); - status = pNtQuerySystemInformation(SystemEmulationProcessorInformation, &sci2, sizeof(sci2), &ReturnLength); + ok( sci.ProcessorLevel == sci2.ProcessorLevel, "ProcessorLevel differs %x / %x\n", + sci.ProcessorLevel, sci2.ProcessorLevel ); + ok( sci.ProcessorRevision == sci2.ProcessorRevision, "ProcessorRevision differs %x / %x\n", + sci.ProcessorRevision, sci2.ProcessorRevision ); + ok( sci.MaximumProcessors == sci2.MaximumProcessors, "MaximumProcessors differs %x / %x\n", + sci.MaximumProcessors, sci2.MaximumProcessors ); + ok( sci.ProcessorFeatureBits == sci2.ProcessorFeatureBits, "ProcessorFeatureBits differs %lx / %lx\n", + sci.ProcessorFeatureBits, sci2.ProcessorFeatureBits ); + } + + memset(&sci3, 0xcc, sizeof(sci3)); + status = pNtQuerySystemInformation(SystemEmulationProcessorInformation, &sci3, sizeof(sci3), &len); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx.\n", status); - ok( sizeof(sci2) == ReturnLength, "Unexpected length %lu.\n", ReturnLength); + ok( sizeof(sci3) == len, "Unexpected length %lu.\n", len);
#ifdef _WIN64 - ok( sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL, "ProcessorArchitecture wrong %x\n", - sci2.ProcessorArchitecture ); + if (sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64) + ok( sci3.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM, "ProcessorArchitecture wrong %x\n", + sci3.ProcessorArchitecture ); + else + ok( sci3.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL, "ProcessorArchitecture wrong %x\n", + sci3.ProcessorArchitecture ); #else - ok( sci.ProcessorArchitecture == sci2.ProcessorArchitecture, + ok( sci.ProcessorArchitecture == sci3.ProcessorArchitecture, "ProcessorArchitecture differs %x / %x\n", - sci.ProcessorArchitecture, sci2.ProcessorArchitecture ); + sci.ProcessorArchitecture, sci3.ProcessorArchitecture ); #endif - ok( sci.ProcessorLevel == sci2.ProcessorLevel, "ProcessorLevel differs %x / %x\n", - sci.ProcessorLevel, sci2.ProcessorLevel ); - ok( sci.ProcessorRevision == sci2.ProcessorRevision, "ProcessorRevision differs %x / %x\n", - sci.ProcessorRevision, sci2.ProcessorRevision ); - ok( sci.MaximumProcessors == sci2.MaximumProcessors, "MaximumProcessors differs %x / %x\n", - sci.MaximumProcessors, sci2.MaximumProcessors ); - ok( sci.ProcessorFeatureBits == sci2.ProcessorFeatureBits, "ProcessorFeatureBits differs %lx / %lx\n", - sci.ProcessorFeatureBits, sci2.ProcessorFeatureBits ); + ok( sci.ProcessorLevel == sci3.ProcessorLevel, "ProcessorLevel differs %x / %x\n", + sci.ProcessorLevel, sci3.ProcessorLevel ); + ok( sci.ProcessorRevision == sci3.ProcessorRevision, "ProcessorRevision differs %x / %x\n", + sci.ProcessorRevision, sci3.ProcessorRevision ); + ok( sci.MaximumProcessors == sci3.MaximumProcessors, "MaximumProcessors differs %x / %x\n", + sci.MaximumProcessors, sci3.MaximumProcessors ); + ok( sci.ProcessorFeatureBits == sci3.ProcessorFeatureBits, "ProcessorFeatureBits differs %lx / %lx\n", + sci.ProcessorFeatureBits, sci3.ProcessorFeatureBits ); }
static void test_query_performance(void) @@ -1133,9 +1141,9 @@ static void test_query_logicalproc(void) GetSystemInfo(&si);
status = pNtQuerySystemInformation(SystemLogicalProcessorInformation, NULL, 0, &len); - if (status == STATUS_INVALID_INFO_CLASS) /* wow64 win8+ */ + if (status == STATUS_INVALID_INFO_CLASS) /* wow64 win8+, arm64 */ { - win_skip("SystemLogicalProcessorInformation is not supported\n"); + skip("SystemLogicalProcessorInformation is not supported\n"); return; } ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status); @@ -3308,19 +3316,29 @@ static void test_thread_start_address(void)
static void test_query_data_alignment(void) { - ULONG ReturnLength; + SYSTEM_CPU_INFORMATION sci; + ULONG len; NTSTATUS status; DWORD value;
value = 0xdeadbeef; - status = pNtQuerySystemInformation(SystemRecommendedSharedDataAlignment, &value, sizeof(value), &ReturnLength); + status = pNtQuerySystemInformation(SystemRecommendedSharedDataAlignment, &value, sizeof(value), &len); ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status); - ok(sizeof(value) == ReturnLength, "Inconsistent length %lu\n", ReturnLength); -#ifdef __arm__ - ok(value == 32, "Expected 32, got %lu\n", value); -#else - ok(value == 64, "Expected 64, got %lu\n", value); -#endif + ok(sizeof(value) == len, "Inconsistent length %lu\n", len); + + pRtlGetNativeSystemInformation(SystemCpuInformation, &sci, sizeof(sci), &len); + switch (sci.ProcessorArchitecture) + { + case PROCESSOR_ARCHITECTURE_ARM: + ok(value == 32, "Expected 32, got %lu\n", value); + break; + case PROCESSOR_ARCHITECTURE_ARM64: + ok(value == 128, "Expected 128, got %lu\n", value); + break; + default: + ok(value == 64, "Expected 64, got %lu\n", value); + break; + } }
static void test_thread_lookup(void) diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 33e93bbdf32..dd652a29f21 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2958,6 +2958,8 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, { #ifdef __arm__ *((DWORD *)info) = 32; +#elif defined __aarch64__ + *((DWORD *)info) = 128; #else *((DWORD *)info) = 64; #endif