Rudolf Mayerhofer rm@eightyfive.net wrote:
/* System Information Class 0x01 */ +typedef struct _SYSTEM_CPU_CACHE_INFORMATION {
- ULONG ProcessorMask;
- CACHE_DESCRIPTOR CacheInformation;
+} SYSTEM_CPU_CACHE_INFORMATION, *PSYSTEM_CPU_CACHE_INFORMATION;
typedef struct _SYSTEM_CPU_INFORMATION { WORD Architecture; @@ -1100,6 +1104,10 @@ typedef struct _SYSTEM_CPU_INFORMATION { WORD Revision; /* combination of CPU model and stepping */ WORD Reserved; /* always zero */ DWORD FeatureSet; /* see bit flags below */
- ULONG Cores[64]; /* Contains a Processormask for each physical core. Index is CoreID*/
- ULONG ProcessorPackages[64]; /* Contains a Processormask for each processorpackage. Index is ProcessorPackage ID*/
- ULONG NumaNodes[64]; /* Contains a Processormask for each numa node. Index is NumaNodeNumber */
- SYSTEM_CPU_CACHE_INFORMATION Caches[256]; /* Contains all cpu cache entries found */
} SYSTEM_CPU_INFORMATION, *PSYSTEM_CPU_INFORMATION;
Where does this come from? At least the processor mask is supposed to be an ULONG_PTR.
On Saturday 02 October 2010 08:15:46 Dmitry Timoshkov wrote:
Rudolf Mayerhofer rm@eightyfive.net wrote:
/* System Information Class 0x01 */
+typedef struct _SYSTEM_CPU_CACHE_INFORMATION {
- ULONG ProcessorMask;
- CACHE_DESCRIPTOR CacheInformation;
+} SYSTEM_CPU_CACHE_INFORMATION, *PSYSTEM_CPU_CACHE_INFORMATION;
typedef struct _SYSTEM_CPU_INFORMATION {
WORD Architecture;
@@ -1100,6 +1104,10 @@ typedef struct _SYSTEM_CPU_INFORMATION {
WORD Revision; /* combination of CPU model and stepping */ WORD Reserved; /* always zero */ DWORD FeatureSet; /* see bit flags below */
- ULONG Cores[64]; /* Contains a Processormask for each physical
core. Index is CoreID*/ + ULONG ProcessorPackages[64]; /* Contains a Processormask for each processorpackage. Index is ProcessorPackage ID*/
- ULONG NumaNodes[64]; /* Contains a Processormask for each numa
node. Index is NumaNodeNumber */ + SYSTEM_CPU_CACHE_INFORMATION Caches[256]; /* Contains all cpu cache entries found */
} SYSTEM_CPU_INFORMATION, *PSYSTEM_CPU_INFORMATION;
Where does this come from? At least the processor mask is supposed to be an ULONG_PTR.
You're right. Seem that i have missed that Processormask is ULONG_PTR, will update that ASAP.
This is used in NTDLL and Kernel32 to provide an Implementation for kernel32's GetLogicalProcessorInformation().
2010/10/2 Rudolf Mayerhofer rm@eightyfive.net
On Saturday 02 October 2010 08:15:46 Dmitry Timoshkov wrote:
Rudolf Mayerhofer rm@eightyfive.net wrote:
/* System Information Class 0x01 */
+typedef struct _SYSTEM_CPU_CACHE_INFORMATION {
- ULONG ProcessorMask;
- CACHE_DESCRIPTOR CacheInformation;
+} SYSTEM_CPU_CACHE_INFORMATION, *PSYSTEM_CPU_CACHE_INFORMATION;
typedef struct _SYSTEM_CPU_INFORMATION {
WORD Architecture;
@@ -1100,6 +1104,10 @@ typedef struct _SYSTEM_CPU_INFORMATION {
WORD Revision; /* combination of CPU model and stepping */ WORD Reserved; /* always zero */ DWORD FeatureSet; /* see bit flags below */
- ULONG Cores[64]; /* Contains a Processormask for each
physical
core. Index is CoreID*/ + ULONG ProcessorPackages[64]; /* Contains a Processormask for each processorpackage. Index is ProcessorPackage ID*/
- ULONG NumaNodes[64]; /* Contains a Processormask for each numa
node. Index is NumaNodeNumber */ + SYSTEM_CPU_CACHE_INFORMATION Caches[256]; /* Contains all cpu cache entries found */
} SYSTEM_CPU_INFORMATION, *PSYSTEM_CPU_INFORMATION;
Where does this come from? At least the processor mask is supposed to be an ULONG_PTR.
You're right. Seem that i have missed that Processormask is ULONG_PTR, will update that ASAP.
This is used in NTDLL and Kernel32 to provide an Implementation for kernel32's GetLogicalProcessorInformation().
You should break long lines (like the ones on patch 3/3) into lines of 100
characters max
Rudolf Mayerhofer rm@eightyfive.net wrote:
This is used in NTDLL and Kernel32 to provide an Implementation for kernel32's GetLogicalProcessorInformation().
Are the additions to the structures your own invention?
On Saturday 02 October 2010 15:15:48 Dmitry Timoshkov wrote:
Rudolf Mayerhofer rm@eightyfive.net wrote:
This is used in NTDLL and Kernel32 to provide an Implementation for kernel32's GetLogicalProcessorInformation().
Are the additions to the structures your own invention?
Yes, as SystemClass 0x01 and struct SYSTEM_CPU_INFORMATION seem to be Wine- only (I could not find anything related to that on MSDN and Googling it brings just references to Wine up). So it seems this struct was added for internal use in Wine (wineboot to be exact).
Using NtQuerySystemInfo for Class SystemCpuInformation seemed logical for use because Logical Processor Information is related to CPU Information and also because GetLogicalProcessorInformation needs to know if the processor is Hyperthreading capable (which is found in Element FeatureSet) to set a flag. As stated above the struct seems to be wine-internal anyway, so i simply added the missing elements for Cores, Processor Packages, Numa Nodes and Cache Descriptors there.
After that was done. The only things left to do were (Patches 2 and 3): - Implementing GetLogicalProcessorInformation() in kernel32/process.c with NtQuerySystemInformation. - Adding the parser for SysFS Information to fill_cpu_info() in ntdll/nt.c (which already parses /proc/cpuinfo for the data in struct SYSTEM_CPU_INFORMATION)
Rudolf Mayerhofer rm@eightyfive.net wrote:
Are the additions to the structures your own invention?
Yes, as SystemClass 0x01 and struct SYSTEM_CPU_INFORMATION seem to be Wine- only (I could not find anything related to that on MSDN and Googling it brings just references to Wine up). So it seems this struct was added for internal use in Wine (wineboot to be exact).
NtQuerySystemInfo/SystemCpuInformation is a public ntdll interface, you can't add custom extensions to it.
On Sunday 03 October 2010 09:34:02 Dmitry Timoshkov wrote:
Rudolf Mayerhofer rm@eightyfive.net wrote:
Are the additions to the structures your own invention?
Yes, as SystemClass 0x01 and struct SYSTEM_CPU_INFORMATION seem to be Wine- only (I could not find anything related to that on MSDN and Googling it brings just references to Wine up). So it seems this struct was added for internal use in Wine (wineboot to be exact).
NtQuerySystemInfo/SystemCpuInformation is a public ntdll interface, you can't add custom extensions to it.
SystemCpuInformation seems not defined anywhere outside Wine. It's not defined on MSDN, neither can it be found on any Wine-unrelated Documentations/Source-codes or Documentations. If you have any links or documentation for SystemCpuInformation, could you send them please ?
If i can't extend the struct, i think it would be easier to just move the parser into kernel32/process as well and avoid modifiying this interface as NtQuerySystemInformation is marked as deprecated on MSDN anyway.
SystemCpuInformation seems not defined anywhere outside Wine. It's not defined on MSDN, neither can it be found on any Wine-unrelated Documentations/Source-codes or Documentations. If you have any links or documentation for SystemCpuInformation, could you send them please ?
If i can't extend the struct, i think it would be easier to just move the parser into kernel32/process as well and avoid modifiying this interface as NtQuerySystemInformation is marked as deprecated on MSDN anyway.
try SystemProcessorInformation and SYSTEM_PROCESSOR_INFORMATION (instead of SystemCpuInformation and SYSTEM_CPU_INFORMATION) and you'll see that it's not Wine specific. so you cannot extend them
moreover, don't trust MSDN... they're simply saying that if there's the same API in kernel32 it should be prefered over it's ntdll counterpart...
regarding your patch, the core of the work has to be done in ntdll. you just have to find the correct API in ntdll that does the job you're not using the right one (at least for the class of the query) for example, SystemNumaProcessorMap could help you... (even I coudn't find some docs about the structures, but I didn't search a lot), and reverse engineering (using ntdll as a blackbox) may be of some help
A+
On Sunday 03 October 2010 16:22:07 Eric Pouech wrote:
SystemCpuInformation seems not defined anywhere outside Wine. It's not defined on MSDN, neither can it be found on any Wine-unrelated Documentations/Source-codes or Documentations. If you have any links or documentation for SystemCpuInformation, could you send them please ?
If i can't extend the struct, i think it would be easier to just move the parser into kernel32/process as well and avoid modifiying this interface as NtQuerySystemInformation is marked as deprecated on MSDN anyway.
try SystemProcessorInformation and SYSTEM_PROCESSOR_INFORMATION (instead of SystemCpuInformation and SYSTEM_CPU_INFORMATION) and you'll see that it's not Wine specific. so you cannot extend them
moreover, don't trust MSDN... they're simply saying that if there's the same API in kernel32 it should be prefered over it's ntdll counterpart...
regarding your patch, the core of the work has to be done in ntdll. you just have to find the correct API in ntdll that does the job you're not using the right one (at least for the class of the query) for example, SystemNumaProcessorMap could help you... (even I coudn't find some docs about the structures, but I didn't search a lot), and reverse engineering (using ntdll as a blackbox) may be of some help
A+
I just found out that SystemProcessorInformation is the same as SystemCpuInformation in Wine, both of them are SystemClass 0x01, so that class won't be of much help either. Thats also why i couldn't find anything related to SystemCpuInformation and that also means that my first set of patches was definitly the wrong approach.
Since i had some free time today, i have rewritten and submitted the patch not using the ntdll interface as i suggested before already. I'll also try to find out if there is any usable SystemClass, hopefully there is one.