Commit b72c2dca authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Fix some CPU information tests on ARM64.

parent 03926218
...@@ -303,68 +303,76 @@ static void test_query_basic(void) ...@@ -303,68 +303,76 @@ static void test_query_basic(void)
static void test_query_cpu(void) static void test_query_cpu(void)
{ {
DWORD status; NTSTATUS status;
ULONG ReturnLength; ULONG len;
SYSTEM_CPU_INFORMATION sci, sci2; SYSTEM_CPU_INFORMATION sci, sci2, sci3;
memset(&sci, 0xcc, sizeof(sci)); 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( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(sci) == ReturnLength, "Inconsistent length %ld\n", ReturnLength); ok( sizeof(sci) == len, "Inconsistent length %ld\n", len);
/* 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)); 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( 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) if (is_wow64)
{ {
ok( sci.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL, "ProcessorArchitecture wrong %x\n", ok( sci.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL, "ProcessorArchitecture wrong %x\n",
sci.ProcessorArchitecture ); sci.ProcessorArchitecture );
todo_wine todo_wine
ok( sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64, "ProcessorArchitecture wrong %x\n", ok( sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ||
sci2.ProcessorArchitecture ); sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64,
"ProcessorArchitecture wrong %x\n", sci2.ProcessorArchitecture );
} }
else else
ok( sci.ProcessorArchitecture == sci2.ProcessorArchitecture, ok( sci.ProcessorArchitecture == sci2.ProcessorArchitecture,
"ProcessorArchitecture differs %x / %x\n", "ProcessorArchitecture differs %x / %x\n",
sci.ProcessorArchitecture, sci2.ProcessorArchitecture ); sci.ProcessorArchitecture, sci2.ProcessorArchitecture );
ok( sci.ProcessorLevel == sci2.ProcessorLevel, "ProcessorLevel differs %x / %x\n", if (sci2.ProcessorArchitecture != PROCESSOR_ARCHITECTURE_ARM64)
sci.ProcessorLevel, sci2.ProcessorLevel ); {
ok( sci.ProcessorRevision == sci2.ProcessorRevision, "ProcessorRevision differs %x / %x\n", /* Check if we have some return values */
sci.ProcessorRevision, sci2.ProcessorRevision ); if (winetest_debug > 1) trace("Processor FeatureSet : %08lx\n", sci.ProcessorFeatureBits);
ok( sci.MaximumProcessors == sci2.MaximumProcessors, "MaximumProcessors differs %x / %x\n", ok( sci.ProcessorFeatureBits != 0, "Expected some features for this processor, got %08lx\n",
sci.MaximumProcessors, sci2.MaximumProcessors ); sci.ProcessorFeatureBits);
ok( sci.ProcessorFeatureBits == sci2.ProcessorFeatureBits, "ProcessorFeatureBits differs %lx / %lx\n",
sci.ProcessorFeatureBits, sci2.ProcessorFeatureBits );
memset(&sci2, 0xcc, sizeof(sci2)); ok( sci.ProcessorLevel == sci2.ProcessorLevel, "ProcessorLevel differs %x / %x\n",
status = pNtQuerySystemInformation(SystemEmulationProcessorInformation, &sci2, sizeof(sci2), &ReturnLength); 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( 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 #ifdef _WIN64
ok( sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL, "ProcessorArchitecture wrong %x\n", if (sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64)
sci2.ProcessorArchitecture ); 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 #else
ok( sci.ProcessorArchitecture == sci2.ProcessorArchitecture, ok( sci.ProcessorArchitecture == sci3.ProcessorArchitecture,
"ProcessorArchitecture differs %x / %x\n", "ProcessorArchitecture differs %x / %x\n",
sci.ProcessorArchitecture, sci2.ProcessorArchitecture ); sci.ProcessorArchitecture, sci3.ProcessorArchitecture );
#endif #endif
ok( sci.ProcessorLevel == sci2.ProcessorLevel, "ProcessorLevel differs %x / %x\n", ok( sci.ProcessorLevel == sci3.ProcessorLevel, "ProcessorLevel differs %x / %x\n",
sci.ProcessorLevel, sci2.ProcessorLevel ); sci.ProcessorLevel, sci3.ProcessorLevel );
ok( sci.ProcessorRevision == sci2.ProcessorRevision, "ProcessorRevision differs %x / %x\n", ok( sci.ProcessorRevision == sci3.ProcessorRevision, "ProcessorRevision differs %x / %x\n",
sci.ProcessorRevision, sci2.ProcessorRevision ); sci.ProcessorRevision, sci3.ProcessorRevision );
ok( sci.MaximumProcessors == sci2.MaximumProcessors, "MaximumProcessors differs %x / %x\n", ok( sci.MaximumProcessors == sci3.MaximumProcessors, "MaximumProcessors differs %x / %x\n",
sci.MaximumProcessors, sci2.MaximumProcessors ); sci.MaximumProcessors, sci3.MaximumProcessors );
ok( sci.ProcessorFeatureBits == sci2.ProcessorFeatureBits, "ProcessorFeatureBits differs %lx / %lx\n", ok( sci.ProcessorFeatureBits == sci3.ProcessorFeatureBits, "ProcessorFeatureBits differs %lx / %lx\n",
sci.ProcessorFeatureBits, sci2.ProcessorFeatureBits ); sci.ProcessorFeatureBits, sci3.ProcessorFeatureBits );
} }
static void test_query_performance(void) static void test_query_performance(void)
...@@ -1133,9 +1141,9 @@ static void test_query_logicalproc(void) ...@@ -1133,9 +1141,9 @@ static void test_query_logicalproc(void)
GetSystemInfo(&si); GetSystemInfo(&si);
status = pNtQuerySystemInformation(SystemLogicalProcessorInformation, NULL, 0, &len); 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; return;
} }
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status); 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) ...@@ -3308,19 +3316,29 @@ static void test_thread_start_address(void)
static void test_query_data_alignment(void) static void test_query_data_alignment(void)
{ {
ULONG ReturnLength; SYSTEM_CPU_INFORMATION sci;
ULONG len;
NTSTATUS status; NTSTATUS status;
DWORD value; DWORD value;
value = 0xdeadbeef; 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(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok(sizeof(value) == ReturnLength, "Inconsistent length %lu\n", ReturnLength); ok(sizeof(value) == len, "Inconsistent length %lu\n", len);
#ifdef __arm__
ok(value == 32, "Expected 32, got %lu\n", value); pRtlGetNativeSystemInformation(SystemCpuInformation, &sci, sizeof(sci), &len);
#else switch (sci.ProcessorArchitecture)
ok(value == 64, "Expected 64, got %lu\n", value); {
#endif 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) static void test_thread_lookup(void)
......
...@@ -2958,6 +2958,8 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, ...@@ -2958,6 +2958,8 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
{ {
#ifdef __arm__ #ifdef __arm__
*((DWORD *)info) = 32; *((DWORD *)info) = 32;
#elif defined __aarch64__
*((DWORD *)info) = 128;
#else #else
*((DWORD *)info) = 64; *((DWORD *)info) = 64;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment