The id parameter can be used for core / package lookup. On Linux we pass package or core values. On Mac, we use package for both. Use a core identifier on Mac as well.
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com --- dlls/ntdll/nt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index e6458b98f2..14e18dc6af 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -1309,6 +1309,12 @@ static DWORD log_proc_ex_size_plus(DWORD size) return sizeof(LOGICAL_PROCESSOR_RELATIONSHIP) + sizeof(DWORD) + size; }
+/* Store package and core information for a logical processor. Parsing of processor + * data may happen in multiple passes; the 'id' parameter is then used to locate + * previously stored data. The type of data stored in 'id' depends on 'rel': + * - RelationProcessorPackage: package id ('CPU socket'). + * - RelationProcessorCore: physical core number. + */ static inline BOOL logical_proc_info_add_by_id(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **pdata, SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX **pdataex, DWORD *len, DWORD *pmax_len, LOGICAL_PROCESSOR_RELATIONSHIP rel, DWORD id, ULONG_PTR mask) @@ -1805,6 +1811,7 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION ** for(p = 0; p < pkgs_no; ++p){ for(j = 0; j < cores_per_package && p * cores_per_package + j < cores_no; ++j){ ULONG_PTR mask = 0; + DWORD phys_core;
for(k = 0; k < lcpu_per_core; ++k) mask |= (ULONG_PTR)1 << (j * lcpu_per_core + k); @@ -1816,7 +1823,8 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION ** return STATUS_NO_MEMORY;
/* add new core */ - if(!logical_proc_info_add_by_id(data, dataex, &len, max_len, RelationProcessorCore, p, mask)) + phys_core = p * cores_per_package + j; + if(!logical_proc_info_add_by_id(data, dataex, &len, max_len, RelationProcessorCore, phys_core, mask)) return STATUS_NO_MEMORY;
for(i = 1; i < 5; ++i){