Commit c3352feb authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Use nameless unions/structs for CPU-related data.

parent 65edf192
......@@ -24,8 +24,6 @@
#include <signal.h>
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
......@@ -312,7 +310,7 @@ static ULONG_PTR get_runtime_function_end( RUNTIME_FUNCTION *func, ULONG_PTR add
#ifdef __x86_64__
return func->EndAddress;
#elif defined(__arm__)
if (func->u.s.Flag) return func->BeginAddress + func->u.s.FunctionLength * 2;
if (func->Flag) return func->BeginAddress + func->FunctionLength * 2;
else
{
struct unwind_info
......@@ -324,11 +322,11 @@ static ULONG_PTR get_runtime_function_end( RUNTIME_FUNCTION *func, ULONG_PTR add
DWORD f : 1;
DWORD count : 5;
DWORD words : 4;
} *info = (struct unwind_info *)(addr + func->u.UnwindData);
} *info = (struct unwind_info *)(addr + func->UnwindData);
return func->BeginAddress + info->function_length * 2;
}
#else /* __aarch64__ */
if (func->u.s.Flag) return func->BeginAddress + func->u.s.FunctionLength * 4;
if (func->Flag) return func->BeginAddress + func->FunctionLength * 4;
else
{
struct unwind_info
......@@ -339,7 +337,7 @@ static ULONG_PTR get_runtime_function_end( RUNTIME_FUNCTION *func, ULONG_PTR add
DWORD e : 1;
DWORD epilog : 5;
DWORD codes : 5;
} *info = (struct unwind_info *)(addr + func->u.UnwindData);
} *info = (struct unwind_info *)(addr + func->UnwindData);
return func->BeginAddress + info->function_length * 4;
}
#endif
......
......@@ -29,7 +29,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "winnt.h"
#include "winternl.h"
......
......@@ -26,8 +26,6 @@
#include <stdarg.h>
#include "ntstatus.h"
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define WIN32_NO_STATUS
#include "winsock2.h"
#include "windef.h"
......@@ -1567,7 +1565,7 @@ PVOID WINAPI RtlDecodePointer( PVOID ptr )
VOID WINAPI RtlInitializeSListHead(PSLIST_HEADER list)
{
#ifdef _WIN64
list->s.Alignment = list->s.Region = 0;
list->Alignment = list->Region = 0;
list->Header16.HeaderType = 1; /* we use the 16-byte header */
#else
list->Alignment = 0;
......@@ -1582,7 +1580,7 @@ WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER list)
#ifdef _WIN64
return list->Header16.Depth;
#else
return list->s.Depth;
return list->Depth;
#endif
}
......@@ -1594,7 +1592,7 @@ PSLIST_ENTRY WINAPI RtlFirstEntrySList(const SLIST_HEADER* list)
#ifdef _WIN64
return (SLIST_ENTRY *)((ULONG_PTR)list->Header16.NextEntry << 4);
#else
return list->s.Next.Next;
return list->Next.Next;
#endif
}
......@@ -1607,24 +1605,24 @@ PSLIST_ENTRY WINAPI RtlInterlockedFlushSList(PSLIST_HEADER list)
#ifdef _WIN64
if (!list->Header16.NextEntry) return NULL;
new.s.Alignment = new.s.Region = 0;
new.Alignment = new.Region = 0;
new.Header16.HeaderType = 1; /* we use the 16-byte header */
do
{
old = *list;
new.Header16.Sequence = old.Header16.Sequence + 1;
} while (!InterlockedCompareExchange128((__int64 *)list, new.s.Region, new.s.Alignment, (__int64 *)&old));
} while (!InterlockedCompareExchange128((__int64 *)list, new.Region, new.Alignment, (__int64 *)&old));
return (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4);
#else
if (!list->s.Next.Next) return NULL;
if (!list->Next.Next) return NULL;
new.Alignment = 0;
do
{
old = *list;
new.s.Sequence = old.s.Sequence + 1;
new.Sequence = old.Sequence + 1;
} while (InterlockedCompareExchange64((__int64 *)&list->Alignment, new.Alignment,
old.Alignment) != old.Alignment);
return old.s.Next.Next;
return old.Next.Next;
#endif
}
......@@ -1643,19 +1641,19 @@ PSLIST_ENTRY WINAPI RtlInterlockedPushEntrySList(PSLIST_HEADER list, PSLIST_ENTR
entry->Next = (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4);
new.Header16.Depth = old.Header16.Depth + 1;
new.Header16.Sequence = old.Header16.Sequence + 1;
} while (!InterlockedCompareExchange128((__int64 *)list, new.s.Region, new.s.Alignment, (__int64 *)&old));
} while (!InterlockedCompareExchange128((__int64 *)list, new.Region, new.Alignment, (__int64 *)&old));
return (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4);
#else
new.s.Next.Next = entry;
new.Next.Next = entry;
do
{
old = *list;
entry->Next = old.s.Next.Next;
new.s.Depth = old.s.Depth + 1;
new.s.Sequence = old.s.Sequence + 1;
entry->Next = old.Next.Next;
new.Depth = old.Depth + 1;
new.Sequence = old.Sequence + 1;
} while (InterlockedCompareExchange64((__int64 *)&list->Alignment, new.Alignment,
old.Alignment) != old.Alignment);
return old.s.Next.Next;
return old.Next.Next;
#endif
}
......@@ -1683,18 +1681,18 @@ PSLIST_ENTRY WINAPI RtlInterlockedPopEntrySList(PSLIST_HEADER list)
{
}
__ENDTRY
} while (!InterlockedCompareExchange128((__int64 *)list, new.s.Region, new.s.Alignment, (__int64 *)&old));
} while (!InterlockedCompareExchange128((__int64 *)list, new.Region, new.Alignment, (__int64 *)&old));
#else
do
{
old = *list;
if (!(entry = old.s.Next.Next)) return NULL;
if (!(entry = old.Next.Next)) return NULL;
/* entry could be deleted by another thread */
__TRY
{
new.s.Next.Next = entry->Next;
new.s.Depth = old.s.Depth - 1;
new.s.Sequence = old.s.Sequence + 1;
new.Next.Next = entry->Next;
new.Depth = old.Depth - 1;
new.Sequence = old.Sequence + 1;
}
__EXCEPT_PAGE_FAULT
{
......@@ -1722,19 +1720,19 @@ PSLIST_ENTRY WINAPI RtlInterlockedPushListSListEx(PSLIST_HEADER list, PSLIST_ENT
new.Header16.Depth = old.Header16.Depth + count;
new.Header16.Sequence = old.Header16.Sequence + 1;
last->Next = (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4);
} while (!InterlockedCompareExchange128((__int64 *)list, new.s.Region, new.s.Alignment, (__int64 *)&old));
} while (!InterlockedCompareExchange128((__int64 *)list, new.Region, new.Alignment, (__int64 *)&old));
return (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4);
#else
new.s.Next.Next = first;
new.Next.Next = first;
do
{
old = *list;
new.s.Depth = old.s.Depth + count;
new.s.Sequence = old.s.Sequence + 1;
last->Next = old.s.Next.Next;
new.Depth = old.Depth + count;
new.Sequence = old.Sequence + 1;
last->Next = old.Next.Next;
} while (InterlockedCompareExchange64((__int64 *)&list->Alignment, new.Alignment,
old.Alignment) != old.Alignment);
return old.s.Next.Next;
return old.Next.Next;
#endif
}
......
......@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntdll_test.h"
#include "ddk/wdm.h"
#include "intrin.h"
......@@ -160,18 +158,18 @@ static void test_RtlQueryPerformanceCounter(void)
return;
}
if (!(usd->u3.s.QpcBypassEnabled & SHARED_GLOBAL_FLAGS_QPC_BYPASS_ENABLED))
if (!(usd->QpcBypassEnabled & SHARED_GLOBAL_FLAGS_QPC_BYPASS_ENABLED))
{
todo_wine win_skip("QpcBypassEnabled is not set, skipping tests\n");
return;
}
if ((usd->u3.s.QpcBypassEnabled & SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_HV_PAGE))
if ((usd->QpcBypassEnabled & SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_HV_PAGE))
{
ok( usd->u3.s.QpcBypassEnabled == (SHARED_GLOBAL_FLAGS_QPC_BYPASS_ENABLED|SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_HV_PAGE|SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_RDTSCP),
"unexpected QpcBypassEnabled %x, expected 0x83\n", usd->u3.s.QpcBypassEnabled );
ok( usd->QpcBypassEnabled == (SHARED_GLOBAL_FLAGS_QPC_BYPASS_ENABLED|SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_HV_PAGE|SHARED_GLOBAL_FLAGS_QPC_BYPASS_USE_RDTSCP),
"unexpected QpcBypassEnabled %x, expected 0x83\n", usd->QpcBypassEnabled );
ok( usd->QpcFrequency == 10000000, "unexpected QpcFrequency %I64d, expected 10000000\n", usd->QpcFrequency );
ok( !usd->u3.s.QpcShift, "unexpected QpcShift %d, expected 0\n", usd->u3.s.QpcShift );
ok( !usd->QpcShift, "unexpected QpcShift %d, expected 0\n", usd->QpcShift );
hsd = NULL;
status = pNtQuerySystemInformation( SystemHypervisorSharedPageInformation, &hsd, sizeof(void *), &len );
......@@ -192,7 +190,7 @@ static void test_RtlQueryPerformanceCounter(void)
}
else
{
ok( usd->u3.s.QpcShift == 10, "unexpected QpcShift %d, expected 10\n", usd->u3.s.QpcShift );
ok( usd->QpcShift == 10, "unexpected QpcShift %d, expected 10\n", usd->QpcShift );
tsc0 = __rdtsc();
ret = pRtlQueryPerformanceCounter( &counter );
......@@ -200,9 +198,9 @@ static void test_RtlQueryPerformanceCounter(void)
ok( ret, "RtlQueryPerformanceCounter failed\n" );
tsc0 += usd->QpcBias;
tsc0 >>= usd->u3.s.QpcShift;
tsc0 >>= usd->QpcShift;
tsc1 += usd->QpcBias;
tsc1 >>= usd->u3.s.QpcShift;
tsc1 >>= usd->QpcShift;
ok( tsc0 <= counter.QuadPart, "rdtscp %I64d and RtlQueryPerformanceCounter %I64d are out of order\n", tsc0, counter.QuadPart );
ok( counter.QuadPart <= tsc1, "RtlQueryPerformanceCounter %I64d and rdtscp %I64d are out of order\n", counter.QuadPart, tsc1 );
......@@ -422,7 +420,7 @@ static void test_user_shared_data_time(void)
if (user_shared_data->NtMajorVersion <= 5 && user_shared_data->NtMinorVersion <= 1)
t2 = (DWORD)((*(volatile ULONG*)&user_shared_data->TickCountLowDeprecated * (ULONG64)user_shared_data->TickCountMultiplier) >> 24);
else
t2 = (DWORD)((read_ksystem_time(&user_shared_data->u.TickCount) * user_shared_data->TickCountMultiplier) >> 24);
t2 = (DWORD)((read_ksystem_time(&user_shared_data->TickCount) * user_shared_data->TickCountMultiplier) >> 24);
t3 = GetTickCount();
} while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
......
......@@ -32,7 +32,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "winternl.h"
#include "ddk/wdm.h"
......@@ -403,7 +402,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH RtlQueryPerformanceFrequency( LARGE_INTEGER *frequ
ULONG WINAPI DECLSPEC_HOTPATCH NtGetTickCount(void)
{
/* note: we ignore TickCountMultiplier */
return user_shared_data->u.TickCount.LowPart;
return user_shared_data->TickCount.LowPart;
}
/***********************************************************************
......
......@@ -67,7 +67,6 @@
# include <mach/vm_map.h>
#endif
#define NONAMELESSUNION
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
......@@ -619,12 +618,12 @@ static BOOL logical_proc_info_ex_add_by_id( LOGICAL_PROCESSOR_RELATIONSHIP rel,
while (ofs < logical_proc_info_ex_size)
{
dataex = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *)((char *)logical_proc_info_ex + ofs);
if (rel == RelationProcessorPackage && dataex->Relationship == rel && dataex->u.Processor.Reserved[1] == id)
if (rel == RelationProcessorPackage && dataex->Relationship == rel && dataex->Processor.Reserved[1] == id)
{
dataex->u.Processor.GroupMask[0].Mask |= mask;
dataex->Processor.GroupMask[0].Mask |= mask;
return TRUE;
}
else if (rel == RelationProcessorCore && dataex->Relationship == rel && dataex->u.Processor.Reserved[1] == id)
else if (rel == RelationProcessorCore && dataex->Relationship == rel && dataex->Processor.Reserved[1] == id)
{
return TRUE;
}
......@@ -640,16 +639,16 @@ static BOOL logical_proc_info_ex_add_by_id( LOGICAL_PROCESSOR_RELATIONSHIP rel,
dataex->Relationship = rel;
dataex->Size = log_proc_ex_size_plus( sizeof(PROCESSOR_RELATIONSHIP) );
if (rel == RelationProcessorCore)
dataex->u.Processor.Flags = count_bits( mask ) > 1 ? LTP_PC_SMT : 0;
dataex->Processor.Flags = count_bits( mask ) > 1 ? LTP_PC_SMT : 0;
else
dataex->u.Processor.Flags = 0;
dataex->u.Processor.EfficiencyClass = 0;
dataex->u.Processor.GroupCount = 1;
dataex->u.Processor.GroupMask[0].Mask = mask;
dataex->u.Processor.GroupMask[0].Group = 0;
dataex->Processor.Flags = 0;
dataex->Processor.EfficiencyClass = 0;
dataex->Processor.GroupCount = 1;
dataex->Processor.GroupMask[0].Mask = mask;
dataex->Processor.GroupMask[0].Group = 0;
/* mark for future lookup */
dataex->u.Processor.Reserved[0] = 0;
dataex->u.Processor.Reserved[1] = id;
dataex->Processor.Reserved[0] = 0;
dataex->Processor.Reserved[1] = id;
logical_proc_info_ex_size += dataex->Size;
return TRUE;
......@@ -668,13 +667,13 @@ static BOOL logical_proc_info_add_by_id( LOGICAL_PROCESSOR_RELATIONSHIP rel, DWO
for (i = 0; i < logical_proc_info_len; i++)
{
if (rel == RelationProcessorPackage && logical_proc_info[i].Relationship == rel
&& logical_proc_info[i].u.Reserved[1] == id)
&& logical_proc_info[i].Reserved[1] == id)
{
logical_proc_info[i].ProcessorMask |= mask;
return logical_proc_info_ex_add_by_id( rel, id, mask );
}
else if (rel == RelationProcessorCore && logical_proc_info[i].Relationship == rel
&& logical_proc_info[i].u.Reserved[1] == id)
&& logical_proc_info[i].Reserved[1] == id)
return logical_proc_info_ex_add_by_id( rel, id, mask );
}
......@@ -683,9 +682,9 @@ static BOOL logical_proc_info_add_by_id( LOGICAL_PROCESSOR_RELATIONSHIP rel, DWO
logical_proc_info[i].Relationship = rel;
logical_proc_info[i].ProcessorMask = mask;
if (rel == RelationProcessorCore)
logical_proc_info[i].u.ProcessorCore.Flags = count_bits( mask ) > 1 ? LTP_PC_SMT : 0;
logical_proc_info[i].u.Reserved[0] = 0;
logical_proc_info[i].u.Reserved[1] = id;
logical_proc_info[i].ProcessorCore.Flags = count_bits( mask ) > 1 ? LTP_PC_SMT : 0;
logical_proc_info[i].Reserved[0] = 0;
logical_proc_info[i].Reserved[1] = id;
logical_proc_info_len = i + 1;
return logical_proc_info_ex_add_by_id( rel, id, mask );
......@@ -699,7 +698,7 @@ static BOOL logical_proc_info_add_cache( ULONG_PTR mask, CACHE_DESCRIPTOR *cache
for (i = 0; i < logical_proc_info_len; i++)
{
if (logical_proc_info[i].Relationship==RelationCache && logical_proc_info[i].ProcessorMask==mask
&& logical_proc_info[i].u.Cache.Level==cache->Level && logical_proc_info[i].u.Cache.Type==cache->Type)
&& logical_proc_info[i].Cache.Level==cache->Level && logical_proc_info[i].Cache.Type==cache->Type)
return TRUE;
}
......@@ -707,14 +706,14 @@ static BOOL logical_proc_info_add_cache( ULONG_PTR mask, CACHE_DESCRIPTOR *cache
logical_proc_info[i].Relationship = RelationCache;
logical_proc_info[i].ProcessorMask = mask;
logical_proc_info[i].u.Cache = *cache;
logical_proc_info[i].Cache = *cache;
logical_proc_info_len = i + 1;
for (ofs = 0; ofs < logical_proc_info_ex_size; )
{
dataex = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *)((char *)logical_proc_info_ex + ofs);
if (dataex->Relationship == RelationCache && dataex->u.Cache.GroupMask.Mask == mask
&& dataex->u.Cache.Level == cache->Level && dataex->u.Cache.Type == cache->Type)
if (dataex->Relationship == RelationCache && dataex->Cache.GroupMask.Mask == mask
&& dataex->Cache.Level == cache->Level && dataex->Cache.Type == cache->Type)
return TRUE;
ofs += dataex->Size;
}
......@@ -725,13 +724,13 @@ static BOOL logical_proc_info_add_cache( ULONG_PTR mask, CACHE_DESCRIPTOR *cache
dataex->Relationship = RelationCache;
dataex->Size = log_proc_ex_size_plus( sizeof(CACHE_RELATIONSHIP) );
dataex->u.Cache.Level = cache->Level;
dataex->u.Cache.Associativity = cache->Associativity;
dataex->u.Cache.LineSize = cache->LineSize;
dataex->u.Cache.CacheSize = cache->Size;
dataex->u.Cache.Type = cache->Type;
dataex->u.Cache.GroupMask.Mask = mask;
dataex->u.Cache.GroupMask.Group = 0;
dataex->Cache.Level = cache->Level;
dataex->Cache.Associativity = cache->Associativity;
dataex->Cache.LineSize = cache->LineSize;
dataex->Cache.CacheSize = cache->Size;
dataex->Cache.Type = cache->Type;
dataex->Cache.GroupMask.Mask = mask;
dataex->Cache.GroupMask.Group = 0;
logical_proc_info_ex_size += dataex->Size;
......@@ -746,7 +745,7 @@ static BOOL logical_proc_info_add_numa_node( ULONG_PTR mask, DWORD node_id )
logical_proc_info[logical_proc_info_len].Relationship = RelationNumaNode;
logical_proc_info[logical_proc_info_len].ProcessorMask = mask;
logical_proc_info[logical_proc_info_len].u.NumaNode.NodeNumber = node_id;
logical_proc_info[logical_proc_info_len].NumaNode.NodeNumber = node_id;
++logical_proc_info_len;
if (!grow_logical_proc_ex_buf( log_proc_ex_size_plus( sizeof(NUMA_NODE_RELATIONSHIP) ))) return FALSE;
......@@ -755,9 +754,9 @@ static BOOL logical_proc_info_add_numa_node( ULONG_PTR mask, DWORD node_id )
dataex->Relationship = RelationNumaNode;
dataex->Size = log_proc_ex_size_plus( sizeof(NUMA_NODE_RELATIONSHIP) );
dataex->u.NumaNode.NodeNumber = node_id;
dataex->u.NumaNode.GroupMask.Mask = mask;
dataex->u.NumaNode.GroupMask.Group = 0;
dataex->NumaNode.NodeNumber = node_id;
dataex->NumaNode.GroupMask.Mask = mask;
dataex->NumaNode.GroupMask.Group = 0;
logical_proc_info_ex_size += dataex->Size;
......@@ -774,11 +773,11 @@ static BOOL logical_proc_info_add_group( DWORD num_cpus, ULONG_PTR mask )
dataex->Relationship = RelationGroup;
dataex->Size = log_proc_ex_size_plus( sizeof(GROUP_RELATIONSHIP) );
dataex->u.Group.MaximumGroupCount = 1;
dataex->u.Group.ActiveGroupCount = 1;
dataex->u.Group.GroupInfo[0].MaximumProcessorCount = num_cpus;
dataex->u.Group.GroupInfo[0].ActiveProcessorCount = num_cpus;
dataex->u.Group.GroupInfo[0].ActiveProcessorMask = mask;
dataex->Group.MaximumGroupCount = 1;
dataex->Group.ActiveGroupCount = 1;
dataex->Group.GroupInfo[0].MaximumProcessorCount = num_cpus;
dataex->Group.GroupInfo[0].ActiveProcessorCount = num_cpus;
dataex->Group.GroupInfo[0].ActiveProcessorMask = mask;
logical_proc_info_ex_size += dataex->Size;
return TRUE;
......@@ -1259,8 +1258,8 @@ static NTSTATUS create_cpuset_info(SYSTEM_CPU_SET_INFORMATION *info)
{
if (proc_info->Relationship == RelationCache)
{
if (max_cache_level < proc_info->u.Cache.Level)
max_cache_level = proc_info->u.Cache.Level;
if (max_cache_level < proc_info->Cache.Level)
max_cache_level = proc_info->Cache.Level;
}
proc_info = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *)((BYTE *)proc_info + proc_info->Size);
}
......@@ -1274,45 +1273,45 @@ static NTSTATUS create_cpuset_info(SYSTEM_CPU_SET_INFORMATION *info)
{
info[i].Size = sizeof(*info);
info[i].Type = CpuSetInformation;
info[i].u.CpuSet.Id = 0x100 + i;
info[i].u.CpuSet.LogicalProcessorIndex = i;
info[i].CpuSet.Id = 0x100 + i;
info[i].CpuSet.LogicalProcessorIndex = i;
}
for (i = 0; (char *)proc_info != (char *)logical_proc_info_ex + cpu_info_size; ++i)
{
if (proc_info->Relationship == RelationProcessorCore)
{
if (proc_info->u.Processor.GroupCount != 1)
if (proc_info->Processor.GroupCount != 1)
{
FIXME("Unsupported group count %u.\n", proc_info->u.Processor.GroupCount);
FIXME("Unsupported group count %u.\n", proc_info->Processor.GroupCount);
continue;
}
cpu_mask = proc_info->u.Processor.GroupMask[0].Mask;
cpu_mask = proc_info->Processor.GroupMask[0].Mask;
for (j = 0; j < count; ++j)
if (((ULONG64)1 << j) & cpu_mask)
{
info[j].u.CpuSet.CoreIndex = core_index;
info[j].u.CpuSet.EfficiencyClass = proc_info->u.Processor.EfficiencyClass;
info[j].CpuSet.CoreIndex = core_index;
info[j].CpuSet.EfficiencyClass = proc_info->Processor.EfficiencyClass;
}
++core_index;
}
else if (proc_info->Relationship == RelationCache)
{
if (proc_info->u.Cache.Level == max_cache_level)
if (proc_info->Cache.Level == max_cache_level)
{
cpu_mask = proc_info->u.Cache.GroupMask.Mask;
cpu_mask = proc_info->Cache.GroupMask.Mask;
for (j = 0; j < count; ++j)
if (((ULONG64)1 << j) & cpu_mask)
info[j].u.CpuSet.LastLevelCacheIndex = cache_index;
info[j].CpuSet.LastLevelCacheIndex = cache_index;
}
++cache_index;
}
else if (proc_info->Relationship == RelationNumaNode)
{
cpu_mask = proc_info->u.NumaNode.GroupMask.Mask;
cpu_mask = proc_info->NumaNode.GroupMask.Mask;
for (j = 0; j < count; ++j)
if (((ULONG64)1 << j) & cpu_mask)
info[j].u.CpuSet.NumaNodeIndex = proc_info->u.NumaNode.NodeNumber;
info[j].CpuSet.NumaNodeIndex = proc_info->NumaNode.NodeNumber;
}
proc_info = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *)((char *)proc_info + proc_info->Size);
}
......
......@@ -63,8 +63,6 @@
#include <mach/mach.h>
#endif
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "winternl.h"
......@@ -420,7 +418,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void
if (flags & CONTEXT_AMD64_FLOATING_POINT)
{
to->flags |= SERVER_CTX_FLOATING_POINT;
memcpy( to->fp.x86_64_regs.fpregs, &from->u.FltSave, sizeof(to->fp.x86_64_regs.fpregs) );
memcpy( to->fp.x86_64_regs.fpregs, &from->FltSave, sizeof(to->fp.x86_64_regs.fpregs) );
}
if (flags & CONTEXT_AMD64_DEBUG_REGISTERS)
{
......@@ -481,8 +479,8 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void
I386_FLOATING_SAVE_AREA fpu;
to->flags |= SERVER_CTX_EXTENDED_REGISTERS | SERVER_CTX_FLOATING_POINT;
memcpy( to->ext.i386_regs, &from->u.FltSave, sizeof(to->ext.i386_regs) );
fpux_to_fpu( &fpu, &from->u.FltSave );
memcpy( to->ext.i386_regs, &from->FltSave, sizeof(to->ext.i386_regs) );
fpux_to_fpu( &fpu, &from->FltSave );
to->fp.i386_regs.ctrl = fpu.ControlWord;
to->fp.i386_regs.status = fpu.StatusWord;
to->fp.i386_regs.tag = fpu.TagWord;
......@@ -547,7 +545,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void
if (flags & CONTEXT_ARM_FLOATING_POINT)
{
to->flags |= SERVER_CTX_FLOATING_POINT;
for (i = 0; i < 32; i++) to->fp.arm_regs.d[i] = from->u.D[i];
for (i = 0; i < 32; i++) to->fp.arm_regs.d[i] = from->D[i];
to->fp.arm_regs.fpscr = from->Fpscr;
}
if (flags & CONTEXT_ARM_DEBUG_REGISTERS)
......@@ -569,8 +567,8 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void
if (flags & CONTEXT_ARM64_CONTROL)
{
to->flags |= SERVER_CTX_CONTROL;
to->integer.arm64_regs.x[29] = from->u.s.Fp;
to->integer.arm64_regs.x[30] = from->u.s.Lr;
to->integer.arm64_regs.x[29] = from->Fp;
to->integer.arm64_regs.x[30] = from->Lr;
to->ctl.arm64_regs.sp = from->Sp;
to->ctl.arm64_regs.pc = from->Pc;
to->ctl.arm64_regs.pstate = from->Cpsr;
......@@ -578,15 +576,15 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void
if (flags & CONTEXT_ARM64_INTEGER)
{
to->flags |= SERVER_CTX_INTEGER;
for (i = 0; i <= 28; i++) to->integer.arm64_regs.x[i] = from->u.X[i];
for (i = 0; i <= 28; i++) to->integer.arm64_regs.x[i] = from->X[i];
}
if (flags & CONTEXT_ARM64_FLOATING_POINT)
{
to->flags |= SERVER_CTX_FLOATING_POINT;
for (i = 0; i < 32; i++)
{
to->fp.arm64_regs.q[i].low = from->V[i].s.Low;
to->fp.arm64_regs.q[i].high = from->V[i].s.High;
to->fp.arm64_regs.q[i].low = from->V[i].Low;
to->fp.arm64_regs.q[i].high = from->V[i].High;
}
to->fp.arm64_regs.fpcr = from->Fpcr;
to->fp.arm64_regs.fpsr = from->Fpsr;
......@@ -820,8 +818,8 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
if ((from->flags & SERVER_CTX_FLOATING_POINT) && (to_flags & CONTEXT_AMD64_FLOATING_POINT))
{
to->ContextFlags |= CONTEXT_AMD64_FLOATING_POINT;
memcpy( &to->u.FltSave, from->fp.x86_64_regs.fpregs, sizeof(from->fp.x86_64_regs.fpregs) );
to->MxCsr = to->u.FltSave.MxCsr;
memcpy( &to->FltSave, from->fp.x86_64_regs.fpregs, sizeof(from->fp.x86_64_regs.fpregs) );
to->MxCsr = to->FltSave.MxCsr;
}
if ((from->flags & SERVER_CTX_DEBUG_REGISTERS) && (to_flags & CONTEXT_AMD64_DEBUG_REGISTERS))
{
......@@ -887,7 +885,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
if ((from->flags & SERVER_CTX_EXTENDED_REGISTERS) && (to_flags & CONTEXT_AMD64_FLOATING_POINT))
{
to->ContextFlags |= CONTEXT_AMD64_FLOATING_POINT;
memcpy( &to->u.FltSave, from->ext.i386_regs, sizeof(to->u.FltSave) );
memcpy( &to->FltSave, from->ext.i386_regs, sizeof(to->FltSave) );
}
else if ((from->flags & SERVER_CTX_FLOATING_POINT) && (to_flags & CONTEXT_AMD64_FLOATING_POINT))
{
......@@ -903,7 +901,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
fpu.DataSelector = from->fp.i386_regs.data_sel;
fpu.Cr0NpxState = from->fp.i386_regs.cr0npx;
memcpy( fpu.RegisterArea, from->fp.i386_regs.regs, sizeof(fpu.RegisterArea) );
fpu_to_fpux( &to->u.FltSave, &fpu );
fpu_to_fpux( &to->FltSave, &fpu );
}
if ((from->flags & SERVER_CTX_DEBUG_REGISTERS) && (to_flags & CONTEXT_AMD64_DEBUG_REGISTERS))
{
......@@ -966,7 +964,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
if ((from->flags & SERVER_CTX_FLOATING_POINT) && (to_flags & CONTEXT_ARM_FLOATING_POINT))
{
to->ContextFlags |= CONTEXT_ARM_FLOATING_POINT;
for (i = 0; i < 32; i++) to->u.D[i] = from->fp.arm_regs.d[i];
for (i = 0; i < 32; i++) to->D[i] = from->fp.arm_regs.d[i];
to->Fpscr = from->fp.arm_regs.fpscr;
}
if ((from->flags & SERVER_CTX_DEBUG_REGISTERS) && (to_flags & CONTEXT_ARM_DEBUG_REGISTERS))
......@@ -988,24 +986,24 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
if ((from->flags & SERVER_CTX_CONTROL) && (to_flags & CONTEXT_ARM64_CONTROL))
{
to->ContextFlags |= CONTEXT_ARM64_CONTROL;
to->u.s.Fp = from->integer.arm64_regs.x[29];
to->u.s.Lr = from->integer.arm64_regs.x[30];
to->Sp = from->ctl.arm64_regs.sp;
to->Pc = from->ctl.arm64_regs.pc;
to->Cpsr = from->ctl.arm64_regs.pstate;
to->Fp = from->integer.arm64_regs.x[29];
to->Lr = from->integer.arm64_regs.x[30];
to->Sp = from->ctl.arm64_regs.sp;
to->Pc = from->ctl.arm64_regs.pc;
to->Cpsr = from->ctl.arm64_regs.pstate;
}
if ((from->flags & SERVER_CTX_INTEGER) && (to_flags & CONTEXT_ARM64_INTEGER))
{
to->ContextFlags |= CONTEXT_ARM64_INTEGER;
for (i = 0; i <= 28; i++) to->u.X[i] = from->integer.arm64_regs.x[i];
for (i = 0; i <= 28; i++) to->X[i] = from->integer.arm64_regs.x[i];
}
if ((from->flags & SERVER_CTX_FLOATING_POINT) && (to_flags & CONTEXT_ARM64_FLOATING_POINT))
{
to->ContextFlags |= CONTEXT_ARM64_FLOATING_POINT;
for (i = 0; i < 32; i++)
{
to->V[i].s.Low = from->fp.arm64_regs.q[i].low;
to->V[i].s.High = from->fp.arm64_regs.q[i].high;
to->V[i].Low = from->fp.arm64_regs.q[i].low;
to->V[i].High = from->fp.arm64_regs.q[i].high;
}
to->Fpcr = from->fp.arm64_regs.fpcr;
to->Fpsr = from->fp.arm64_regs.fpsr;
......
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