Please still review the series for overall. I just realized though the code can be slightly simplified if I still submit 'core_id' to logical_proc_info_add_by_id. The lookup code within that function doesn't have to parse the masks (ProcessorMask or GroupMask[0]) and it is cleaner and more future proof that way.
Thanks, Roderick
On Wed, Jun 13, 2018 at 10:48 PM, Roderick Colenbrander thunderbird2k@gmail.com wrote:
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
dlls/ntdll/nt.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index e6458b98f2..0b69f7de44 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -1325,8 +1325,16 @@ static inline BOOL logical_proc_info_add_by_id(SYSTEM_LOGICAL_PROCESSOR_INFORMAT (*pdata)[i].ProcessorMask |= mask; return TRUE; }
}else
i = *len;
}
else
{
for(i=0; i<*len; i++)
{
if ((*pdata)[i].Relationship==rel && (*pdata)[i].ProcessorMask==mask &&
(*pdata)[i].u.Reserved[1]==id)
return TRUE;
}
} while(*len == *pmax_len) {
@@ -1352,6 +1360,11 @@ static inline BOOL logical_proc_info_add_by_id(SYSTEM_LOGICAL_PROCESSOR_INFORMAT dataex->u.Processor.GroupMask[0].Mask |= mask; return TRUE; }
else if (rel == RelationProcessorCore && dataex->Relationship == rel &&
dataex->u.Processor.GroupMask[0].Mask == mask && dataex->u.Processor.Reserved[1] == id)
{
return TRUE;
} ofs += dataex->Size; }
@@ -1548,6 +1561,8 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **
for(i=beg; i<=end; i++) {
ULONG_PTR thread_mask = 0;
if(i > 8*sizeof(ULONG_PTR)) { FIXME("skipping logical processor %d\n", i);
@@ -1568,15 +1583,16 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION ** return STATUS_NO_MEMORY; }
sprintf(name, core_info, i, "core_id");
/* Mask of logical threads sharing same physical core. */
sprintf(name, core_info, i, "thread_siblings"); f = fopen(name, "r"); if(f) {
fscanf(f, "%u", &r);
fscanf(f, "%lx", &thread_mask); fclose(f); }
else r = i;
if(!logical_proc_info_add_by_id(data, dataex, &len, max_len, RelationProcessorCore, r, (ULONG_PTR)1 << i))
else thread_mask = 1<<i;
if(!logical_proc_info_add_by_id(data, dataex, &len, max_len, RelationProcessorCore, r, thread_mask)) { fclose(fcpu_list); return STATUS_NO_MEMORY;
-- 2.14.4