Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
c44e58c8
Commit
c44e58c8
authored
Mar 14, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement the SystemProcessorFeaturesInformation query.
parent
72422be6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
31 deletions
+59
-31
info.c
dlls/ntdll/tests/info.c
+12
-0
system.c
dlls/ntdll/unix/system.c
+40
-31
system.c
dlls/wow64/system.c
+1
-0
winternl.h
include/winternl.h
+6
-0
No files found.
dlls/ntdll/tests/info.c
View file @
c44e58c8
...
...
@@ -305,6 +305,7 @@ static void test_query_cpu(void)
{
NTSTATUS
status
;
ULONG
len
,
buffer
[
16
];
SYSTEM_PROCESSOR_FEATURES_INFORMATION
features
;
SYSTEM_CPU_INFORMATION
sci
,
sci2
,
sci3
;
memset
(
&
sci
,
0xcc
,
sizeof
(
sci
));
...
...
@@ -375,6 +376,17 @@ static void test_query_cpu(void)
sci
.
ProcessorFeatureBits
,
sci3
.
ProcessorFeatureBits
);
len
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemProcessorFeaturesInformation
,
&
features
,
sizeof
(
features
),
&
len
);
if
(
status
!=
STATUS_NOT_SUPPORTED
)
{
ok
(
!
status
,
"SystemProcessorFeaturesInformation failed %lx
\n
"
,
status
);
ok
(
len
==
sizeof
(
features
),
"wrong len %lu
\n
"
,
len
);
ok
(
(
ULONG
)
features
.
ProcessorFeatureBits
==
sci
.
ProcessorFeatureBits
,
"wrong bits %I64x / %lx
\n
"
,
features
.
ProcessorFeatureBits
,
sci
.
ProcessorFeatureBits
);
}
else
skip
(
"SystemProcessorFeaturesInformation is not supported
\n
"
);
len
=
0xdeadbeef
;
status
=
pNtQuerySystemInformation
(
SystemProcessorBrandString
,
buffer
,
sizeof
(
buffer
),
&
len
);
if
(
status
!=
STATUS_NOT_SUPPORTED
)
{
...
...
dlls/ntdll/unix/system.c
View file @
c44e58c8
...
...
@@ -229,6 +229,7 @@ struct smbios_chassis_args
#define RSMB 0x52534D42
SYSTEM_CPU_INFORMATION
cpu_info
=
{
0
};
static
SYSTEM_PROCESSOR_FEATURES_INFORMATION
cpu_features
;
static
char
cpu_name
[
49
];
static
SYSTEM_LOGICAL_PROCESSOR_INFORMATION
*
logical_proc_info
;
static
unsigned
int
logical_proc_info_len
,
logical_proc_info_alloc_len
;
...
...
@@ -345,6 +346,7 @@ static void get_cpuid_name( char *buffer )
static
void
get_cpuinfo
(
SYSTEM_CPU_INFORMATION
*
info
)
{
unsigned
int
regs
[
4
],
regs2
[
4
],
regs3
[
4
];
ULONGLONG
features
;
#if defined(__i386__)
info
->
ProcessorArchitecture
=
PROCESSOR_ARCHITECTURE_INTEL
;
...
...
@@ -353,7 +355,7 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info )
#endif
/* We're at least a 386 */
info
->
ProcessorFeatureBit
s
=
CPU_FEATURE_VME
|
CPU_FEATURE_X86
|
CPU_FEATURE_PGE
;
feature
s
=
CPU_FEATURE_VME
|
CPU_FEATURE_X86
|
CPU_FEATURE_PGE
;
info
->
ProcessorLevel
=
3
;
if
(
!
have_cpuid
())
return
;
...
...
@@ -362,35 +364,35 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info )
if
(
regs
[
0
]
>=
0x00000001
)
/* Check for supported cpuid version */
{
do_cpuid
(
0x00000001
,
0
,
regs2
);
/* get cpu features */
if
(
regs2
[
3
]
&
(
1
<<
3
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_PSE
;
if
(
regs2
[
3
]
&
(
1
<<
4
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_TSC
;
if
(
regs2
[
3
]
&
(
1
<<
6
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_PAE
;
if
(
regs2
[
3
]
&
(
1
<<
8
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_CX8
;
if
(
regs2
[
3
]
&
(
1
<<
11
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_SEP
;
if
(
regs2
[
3
]
&
(
1
<<
12
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_MTRR
;
if
(
regs2
[
3
]
&
(
1
<<
15
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_CMOV
;
if
(
regs2
[
3
]
&
(
1
<<
16
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_PAT
;
if
(
regs2
[
3
]
&
(
1
<<
23
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_MMX
;
if
(
regs2
[
3
]
&
(
1
<<
24
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_FXSR
;
if
(
regs2
[
3
]
&
(
1
<<
25
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_SSE
;
if
(
regs2
[
3
]
&
(
1
<<
26
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_SSE2
;
if
(
regs2
[
2
]
&
(
1
<<
0
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_SSE3
;
if
(
regs2
[
2
]
&
(
1
<<
9
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_SSSE3
;
if
(
regs2
[
2
]
&
(
1
<<
13
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_CX128
;
if
(
regs2
[
2
]
&
(
1
<<
19
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_SSE41
;
if
(
regs2
[
2
]
&
(
1
<<
20
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_SSE42
;
if
(
regs2
[
2
]
&
(
1
<<
27
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_XSAVE
;
if
(
regs2
[
2
]
&
(
1
<<
28
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_AVX
;
if
(
regs2
[
3
]
&
(
1
<<
3
))
feature
s
|=
CPU_FEATURE_PSE
;
if
(
regs2
[
3
]
&
(
1
<<
4
))
feature
s
|=
CPU_FEATURE_TSC
;
if
(
regs2
[
3
]
&
(
1
<<
6
))
feature
s
|=
CPU_FEATURE_PAE
;
if
(
regs2
[
3
]
&
(
1
<<
8
))
feature
s
|=
CPU_FEATURE_CX8
;
if
(
regs2
[
3
]
&
(
1
<<
11
))
feature
s
|=
CPU_FEATURE_SEP
;
if
(
regs2
[
3
]
&
(
1
<<
12
))
feature
s
|=
CPU_FEATURE_MTRR
;
if
(
regs2
[
3
]
&
(
1
<<
15
))
feature
s
|=
CPU_FEATURE_CMOV
;
if
(
regs2
[
3
]
&
(
1
<<
16
))
feature
s
|=
CPU_FEATURE_PAT
;
if
(
regs2
[
3
]
&
(
1
<<
23
))
feature
s
|=
CPU_FEATURE_MMX
;
if
(
regs2
[
3
]
&
(
1
<<
24
))
feature
s
|=
CPU_FEATURE_FXSR
;
if
(
regs2
[
3
]
&
(
1
<<
25
))
feature
s
|=
CPU_FEATURE_SSE
;
if
(
regs2
[
3
]
&
(
1
<<
26
))
feature
s
|=
CPU_FEATURE_SSE2
;
if
(
regs2
[
2
]
&
(
1
<<
0
))
feature
s
|=
CPU_FEATURE_SSE3
;
if
(
regs2
[
2
]
&
(
1
<<
9
))
feature
s
|=
CPU_FEATURE_SSSE3
;
if
(
regs2
[
2
]
&
(
1
<<
13
))
feature
s
|=
CPU_FEATURE_CX128
;
if
(
regs2
[
2
]
&
(
1
<<
19
))
feature
s
|=
CPU_FEATURE_SSE41
;
if
(
regs2
[
2
]
&
(
1
<<
20
))
feature
s
|=
CPU_FEATURE_SSE42
;
if
(
regs2
[
2
]
&
(
1
<<
27
))
feature
s
|=
CPU_FEATURE_XSAVE
;
if
(
regs2
[
2
]
&
(
1
<<
28
))
feature
s
|=
CPU_FEATURE_AVX
;
if
((
regs2
[
3
]
&
(
1
<<
26
))
&&
(
regs2
[
3
]
&
(
1
<<
24
))
&&
have_sse_daz_mode
())
/* has SSE2 and FXSAVE/FXRSTOR */
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_DAZ
;
feature
s
|=
CPU_FEATURE_DAZ
;
if
(
regs
[
0
]
>=
0x00000007
)
{
do_cpuid
(
0x00000007
,
0
,
regs3
);
/* get extended features */
if
(
regs3
[
1
]
&
(
1
<<
5
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_AVX2
;
if
(
regs3
[
1
]
&
(
1
<<
5
))
feature
s
|=
CPU_FEATURE_AVX2
;
}
if
(
info
->
ProcessorFeatureBit
s
&
CPU_FEATURE_XSAVE
)
if
(
feature
s
&
CPU_FEATURE_XSAVE
)
{
do_cpuid
(
0x0000000d
,
1
,
regs3
);
/* get XSAVE details */
if
(
regs3
[
0
]
&
2
)
xstate_compaction_enabled
=
TRUE
;
...
...
@@ -411,10 +413,10 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info )
if
(
regs
[
0
]
>=
0x80000001
)
{
do_cpuid
(
0x80000001
,
0
,
regs2
);
/* get vendor features */
if
(
regs2
[
2
]
&
(
1
<<
2
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_VIRT
;
if
(
regs2
[
3
]
&
(
1
<<
20
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_NX
;
if
(
regs2
[
3
]
&
(
1
<<
27
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_TSC
;
if
(
regs2
[
3
]
&
(
1u
<<
31
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_3DNOW
;
if
(
regs2
[
2
]
&
(
1
<<
2
))
feature
s
|=
CPU_FEATURE_VIRT
;
if
(
regs2
[
3
]
&
(
1
<<
20
))
feature
s
|=
CPU_FEATURE_NX
;
if
(
regs2
[
3
]
&
(
1
<<
27
))
feature
s
|=
CPU_FEATURE_TSC
;
if
(
regs2
[
3
]
&
(
1u
<<
31
))
feature
s
|=
CPU_FEATURE_3DNOW
;
}
if
(
regs
[
0
]
>=
0x80000004
)
get_cpuid_name
(
cpu_name
);
}
...
...
@@ -428,15 +430,15 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info )
info
->
ProcessorRevision
|=
((
regs2
[
0
]
>>
4
)
&
0xf
)
<<
8
;
/* model */
info
->
ProcessorRevision
|=
regs2
[
0
]
&
0xf
;
/* stepping */
if
(
regs2
[
2
]
&
(
1
<<
5
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_VIRT
;
if
(
regs2
[
3
]
&
(
1
<<
21
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_DS
;
if
(
regs2
[
2
]
&
(
1
<<
5
))
feature
s
|=
CPU_FEATURE_VIRT
;
if
(
regs2
[
3
]
&
(
1
<<
21
))
feature
s
|=
CPU_FEATURE_DS
;
do_cpuid
(
0x80000000
,
0
,
regs
);
/* get vendor cpuid level */
if
(
regs
[
0
]
>=
0x80000001
)
{
do_cpuid
(
0x80000001
,
0
,
regs2
);
/* get vendor features */
if
(
regs2
[
3
]
&
(
1
<<
20
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_NX
;
if
(
regs2
[
3
]
&
(
1
<<
27
))
info
->
ProcessorFeatureBit
s
|=
CPU_FEATURE_TSC
;
if
(
regs2
[
3
]
&
(
1
<<
20
))
feature
s
|=
CPU_FEATURE_NX
;
if
(
regs2
[
3
]
&
(
1
<<
27
))
feature
s
|=
CPU_FEATURE_TSC
;
}
if
(
regs
[
0
]
>=
0x80000004
)
get_cpuid_name
(
cpu_name
);
}
...
...
@@ -449,6 +451,7 @@ static void get_cpuinfo( SYSTEM_CPU_INFORMATION *info )
info
->
ProcessorRevision
|=
regs2
[
0
]
&
0xf
;
/* stepping */
}
}
info
->
ProcessorFeatureBits
=
cpu_features
.
ProcessorFeatureBits
=
features
;
}
#elif defined(__arm__)
...
...
@@ -3204,6 +3207,12 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
break
;
}
case
SystemProcessorFeaturesInformation
:
/* 154 */
len
=
sizeof
(
cpu_features
);
if
(
size
>=
len
)
memcpy
(
info
,
&
cpu_features
,
len
);
else
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
break
;
case
SystemCpuSetInformation
:
/* 175 */
return
NtQuerySystemInformationEx
(
class
,
NULL
,
0
,
info
,
size
,
ret_size
);
...
...
dlls/wow64/system.c
View file @
c44e58c8
...
...
@@ -331,6 +331,7 @@ NTSTATUS WINAPI wow64_NtQuerySystemInformation( UINT *args )
case
SystemKernelDebuggerInformationEx
:
/* SYSTEM_KERNEL_DEBUGGER_INFORMATION_EX */
case
SystemCpuSetInformation
:
/* SYSTEM_CPU_SET_INFORMATION */
case
SystemProcessorBrandString
:
/* char[] */
case
SystemProcessorFeaturesInformation
:
/* SYSTEM_PROCESSOR_FEATURES_INFORMATION */
case
SystemWineVersionInformation
:
/* char[] */
return
NtQuerySystemInformation
(
class
,
ptr
,
len
,
retlen
);
...
...
include/winternl.h
View file @
c44e58c8
...
...
@@ -2389,6 +2389,12 @@ typedef struct _SYSTEM_CPU_INFORMATION {
#define CPU_FEATURE_ARM_V8_CRC32 0x00000004
#define CPU_FEATURE_ARM_V8_CRYPTO 0x00000008
typedef
struct
_SYSTEM_PROCESSOR_FEATURES_INFORMATION
{
ULONGLONG
ProcessorFeatureBits
;
ULONGLONG
Reserved
[
3
];
}
SYSTEM_PROCESSOR_FEATURES_INFORMATION
,
*
PSYSTEM_PROCESSOR_FEATURES_INFORMATION
;
/* System Information Class 0x02 */
/* Documented in "Windows NT/2000 Native API Reference" by Gary Nebbett. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment