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 @@ ...@@ -24,8 +24,6 @@
#include <signal.h> #include <signal.h>
#include <stdarg.h> #include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "windef.h" #include "windef.h"
...@@ -312,7 +310,7 @@ static ULONG_PTR get_runtime_function_end( RUNTIME_FUNCTION *func, ULONG_PTR add ...@@ -312,7 +310,7 @@ static ULONG_PTR get_runtime_function_end( RUNTIME_FUNCTION *func, ULONG_PTR add
#ifdef __x86_64__ #ifdef __x86_64__
return func->EndAddress; return func->EndAddress;
#elif defined(__arm__) #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 else
{ {
struct unwind_info struct unwind_info
...@@ -324,11 +322,11 @@ static ULONG_PTR get_runtime_function_end( RUNTIME_FUNCTION *func, ULONG_PTR add ...@@ -324,11 +322,11 @@ static ULONG_PTR get_runtime_function_end( RUNTIME_FUNCTION *func, ULONG_PTR add
DWORD f : 1; DWORD f : 1;
DWORD count : 5; DWORD count : 5;
DWORD words : 4; 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; return func->BeginAddress + info->function_length * 2;
} }
#else /* __aarch64__ */ #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 else
{ {
struct unwind_info struct unwind_info
...@@ -339,7 +337,7 @@ static ULONG_PTR get_runtime_function_end( RUNTIME_FUNCTION *func, ULONG_PTR add ...@@ -339,7 +337,7 @@ static ULONG_PTR get_runtime_function_end( RUNTIME_FUNCTION *func, ULONG_PTR add
DWORD e : 1; DWORD e : 1;
DWORD epilog : 5; DWORD epilog : 5;
DWORD codes : 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; return func->BeginAddress + info->function_length * 4;
} }
#endif #endif
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winnt.h" #include "winnt.h"
#include "winternl.h" #include "winternl.h"
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <stdarg.h> #include <stdarg.h>
#include "ntstatus.h" #include "ntstatus.h"
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "winsock2.h" #include "winsock2.h"
#include "windef.h" #include "windef.h"
...@@ -1567,7 +1565,7 @@ PVOID WINAPI RtlDecodePointer( PVOID ptr ) ...@@ -1567,7 +1565,7 @@ PVOID WINAPI RtlDecodePointer( PVOID ptr )
VOID WINAPI RtlInitializeSListHead(PSLIST_HEADER list) VOID WINAPI RtlInitializeSListHead(PSLIST_HEADER list)
{ {
#ifdef _WIN64 #ifdef _WIN64
list->s.Alignment = list->s.Region = 0; list->Alignment = list->Region = 0;
list->Header16.HeaderType = 1; /* we use the 16-byte header */ list->Header16.HeaderType = 1; /* we use the 16-byte header */
#else #else
list->Alignment = 0; list->Alignment = 0;
...@@ -1582,7 +1580,7 @@ WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER list) ...@@ -1582,7 +1580,7 @@ WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER list)
#ifdef _WIN64 #ifdef _WIN64
return list->Header16.Depth; return list->Header16.Depth;
#else #else
return list->s.Depth; return list->Depth;
#endif #endif
} }
...@@ -1594,7 +1592,7 @@ PSLIST_ENTRY WINAPI RtlFirstEntrySList(const SLIST_HEADER* list) ...@@ -1594,7 +1592,7 @@ PSLIST_ENTRY WINAPI RtlFirstEntrySList(const SLIST_HEADER* list)
#ifdef _WIN64 #ifdef _WIN64
return (SLIST_ENTRY *)((ULONG_PTR)list->Header16.NextEntry << 4); return (SLIST_ENTRY *)((ULONG_PTR)list->Header16.NextEntry << 4);
#else #else
return list->s.Next.Next; return list->Next.Next;
#endif #endif
} }
...@@ -1607,24 +1605,24 @@ PSLIST_ENTRY WINAPI RtlInterlockedFlushSList(PSLIST_HEADER list) ...@@ -1607,24 +1605,24 @@ PSLIST_ENTRY WINAPI RtlInterlockedFlushSList(PSLIST_HEADER list)
#ifdef _WIN64 #ifdef _WIN64
if (!list->Header16.NextEntry) return NULL; 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 */ new.Header16.HeaderType = 1; /* we use the 16-byte header */
do do
{ {
old = *list; old = *list;
new.Header16.Sequence = old.Header16.Sequence + 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); return (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4);
#else #else
if (!list->s.Next.Next) return NULL; if (!list->Next.Next) return NULL;
new.Alignment = 0; new.Alignment = 0;
do do
{ {
old = *list; old = *list;
new.s.Sequence = old.s.Sequence + 1; new.Sequence = old.Sequence + 1;
} while (InterlockedCompareExchange64((__int64 *)&list->Alignment, new.Alignment, } while (InterlockedCompareExchange64((__int64 *)&list->Alignment, new.Alignment,
old.Alignment) != old.Alignment); old.Alignment) != old.Alignment);
return old.s.Next.Next; return old.Next.Next;
#endif #endif
} }
...@@ -1643,19 +1641,19 @@ PSLIST_ENTRY WINAPI RtlInterlockedPushEntrySList(PSLIST_HEADER list, PSLIST_ENTR ...@@ -1643,19 +1641,19 @@ PSLIST_ENTRY WINAPI RtlInterlockedPushEntrySList(PSLIST_HEADER list, PSLIST_ENTR
entry->Next = (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4); entry->Next = (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4);
new.Header16.Depth = old.Header16.Depth + 1; new.Header16.Depth = old.Header16.Depth + 1;
new.Header16.Sequence = old.Header16.Sequence + 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); return (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4);
#else #else
new.s.Next.Next = entry; new.Next.Next = entry;
do do
{ {
old = *list; old = *list;
entry->Next = old.s.Next.Next; entry->Next = old.Next.Next;
new.s.Depth = old.s.Depth + 1; new.Depth = old.Depth + 1;
new.s.Sequence = old.s.Sequence + 1; new.Sequence = old.Sequence + 1;
} while (InterlockedCompareExchange64((__int64 *)&list->Alignment, new.Alignment, } while (InterlockedCompareExchange64((__int64 *)&list->Alignment, new.Alignment,
old.Alignment) != old.Alignment); old.Alignment) != old.Alignment);
return old.s.Next.Next; return old.Next.Next;
#endif #endif
} }
...@@ -1683,18 +1681,18 @@ PSLIST_ENTRY WINAPI RtlInterlockedPopEntrySList(PSLIST_HEADER list) ...@@ -1683,18 +1681,18 @@ PSLIST_ENTRY WINAPI RtlInterlockedPopEntrySList(PSLIST_HEADER list)
{ {
} }
__ENDTRY __ENDTRY
} while (!InterlockedCompareExchange128((__int64 *)list, new.s.Region, new.s.Alignment, (__int64 *)&old)); } while (!InterlockedCompareExchange128((__int64 *)list, new.Region, new.Alignment, (__int64 *)&old));
#else #else
do do
{ {
old = *list; old = *list;
if (!(entry = old.s.Next.Next)) return NULL; if (!(entry = old.Next.Next)) return NULL;
/* entry could be deleted by another thread */ /* entry could be deleted by another thread */
__TRY __TRY
{ {
new.s.Next.Next = entry->Next; new.Next.Next = entry->Next;
new.s.Depth = old.s.Depth - 1; new.Depth = old.Depth - 1;
new.s.Sequence = old.s.Sequence + 1; new.Sequence = old.Sequence + 1;
} }
__EXCEPT_PAGE_FAULT __EXCEPT_PAGE_FAULT
{ {
...@@ -1722,19 +1720,19 @@ PSLIST_ENTRY WINAPI RtlInterlockedPushListSListEx(PSLIST_HEADER list, PSLIST_ENT ...@@ -1722,19 +1720,19 @@ PSLIST_ENTRY WINAPI RtlInterlockedPushListSListEx(PSLIST_HEADER list, PSLIST_ENT
new.Header16.Depth = old.Header16.Depth + count; new.Header16.Depth = old.Header16.Depth + count;
new.Header16.Sequence = old.Header16.Sequence + 1; new.Header16.Sequence = old.Header16.Sequence + 1;
last->Next = (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4); 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); return (SLIST_ENTRY *)((ULONG_PTR)old.Header16.NextEntry << 4);
#else #else
new.s.Next.Next = first; new.Next.Next = first;
do do
{ {
old = *list; old = *list;
new.s.Depth = old.s.Depth + count; new.Depth = old.Depth + count;
new.s.Sequence = old.s.Sequence + 1; new.Sequence = old.Sequence + 1;
last->Next = old.s.Next.Next; last->Next = old.Next.Next;
} while (InterlockedCompareExchange64((__int64 *)&list->Alignment, new.Alignment, } while (InterlockedCompareExchange64((__int64 *)&list->Alignment, new.Alignment,
old.Alignment) != old.Alignment); old.Alignment) != old.Alignment);
return old.s.Next.Next; return old.Next.Next;
#endif #endif
} }
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntdll_test.h" #include "ntdll_test.h"
#include "ddk/wdm.h" #include "ddk/wdm.h"
#include "intrin.h" #include "intrin.h"
...@@ -160,18 +158,18 @@ static void test_RtlQueryPerformanceCounter(void) ...@@ -160,18 +158,18 @@ static void test_RtlQueryPerformanceCounter(void)
return; 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"); todo_wine win_skip("QpcBypassEnabled is not set, skipping tests\n");
return; 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), 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->u3.s.QpcBypassEnabled ); "unexpected QpcBypassEnabled %x, expected 0x83\n", usd->QpcBypassEnabled );
ok( usd->QpcFrequency == 10000000, "unexpected QpcFrequency %I64d, expected 10000000\n", usd->QpcFrequency ); 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; hsd = NULL;
status = pNtQuerySystemInformation( SystemHypervisorSharedPageInformation, &hsd, sizeof(void *), &len ); status = pNtQuerySystemInformation( SystemHypervisorSharedPageInformation, &hsd, sizeof(void *), &len );
...@@ -192,7 +190,7 @@ static void test_RtlQueryPerformanceCounter(void) ...@@ -192,7 +190,7 @@ static void test_RtlQueryPerformanceCounter(void)
} }
else 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(); tsc0 = __rdtsc();
ret = pRtlQueryPerformanceCounter( &counter ); ret = pRtlQueryPerformanceCounter( &counter );
...@@ -200,9 +198,9 @@ static void test_RtlQueryPerformanceCounter(void) ...@@ -200,9 +198,9 @@ static void test_RtlQueryPerformanceCounter(void)
ok( ret, "RtlQueryPerformanceCounter failed\n" ); ok( ret, "RtlQueryPerformanceCounter failed\n" );
tsc0 += usd->QpcBias; tsc0 += usd->QpcBias;
tsc0 >>= usd->u3.s.QpcShift; tsc0 >>= usd->QpcShift;
tsc1 += usd->QpcBias; 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( 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 ); 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) ...@@ -422,7 +420,7 @@ static void test_user_shared_data_time(void)
if (user_shared_data->NtMajorVersion <= 5 && user_shared_data->NtMinorVersion <= 1) 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); t2 = (DWORD)((*(volatile ULONG*)&user_shared_data->TickCountLowDeprecated * (ULONG64)user_shared_data->TickCountMultiplier) >> 24);
else 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(); t3 = GetTickCount();
} while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */ } while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winternl.h" #include "winternl.h"
#include "ddk/wdm.h" #include "ddk/wdm.h"
...@@ -403,7 +402,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH RtlQueryPerformanceFrequency( LARGE_INTEGER *frequ ...@@ -403,7 +402,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH RtlQueryPerformanceFrequency( LARGE_INTEGER *frequ
ULONG WINAPI DECLSPEC_HOTPATCH NtGetTickCount(void) ULONG WINAPI DECLSPEC_HOTPATCH NtGetTickCount(void)
{ {
/* note: we ignore TickCountMultiplier */ /* note: we ignore TickCountMultiplier */
return user_shared_data->u.TickCount.LowPart; return user_shared_data->TickCount.LowPart;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -63,8 +63,6 @@ ...@@ -63,8 +63,6 @@
#include <mach/mach.h> #include <mach/mach.h>
#endif #endif
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "winternl.h" #include "winternl.h"
...@@ -420,7 +418,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void ...@@ -420,7 +418,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void
if (flags & CONTEXT_AMD64_FLOATING_POINT) if (flags & CONTEXT_AMD64_FLOATING_POINT)
{ {
to->flags |= SERVER_CTX_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) if (flags & CONTEXT_AMD64_DEBUG_REGISTERS)
{ {
...@@ -481,8 +479,8 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void ...@@ -481,8 +479,8 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void
I386_FLOATING_SAVE_AREA fpu; I386_FLOATING_SAVE_AREA fpu;
to->flags |= SERVER_CTX_EXTENDED_REGISTERS | SERVER_CTX_FLOATING_POINT; to->flags |= SERVER_CTX_EXTENDED_REGISTERS | SERVER_CTX_FLOATING_POINT;
memcpy( to->ext.i386_regs, &from->u.FltSave, sizeof(to->ext.i386_regs) ); memcpy( to->ext.i386_regs, &from->FltSave, sizeof(to->ext.i386_regs) );
fpux_to_fpu( &fpu, &from->u.FltSave ); fpux_to_fpu( &fpu, &from->FltSave );
to->fp.i386_regs.ctrl = fpu.ControlWord; to->fp.i386_regs.ctrl = fpu.ControlWord;
to->fp.i386_regs.status = fpu.StatusWord; to->fp.i386_regs.status = fpu.StatusWord;
to->fp.i386_regs.tag = fpu.TagWord; to->fp.i386_regs.tag = fpu.TagWord;
...@@ -547,7 +545,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void ...@@ -547,7 +545,7 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void
if (flags & CONTEXT_ARM_FLOATING_POINT) if (flags & CONTEXT_ARM_FLOATING_POINT)
{ {
to->flags |= SERVER_CTX_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; to->fp.arm_regs.fpscr = from->Fpscr;
} }
if (flags & CONTEXT_ARM_DEBUG_REGISTERS) if (flags & CONTEXT_ARM_DEBUG_REGISTERS)
...@@ -569,8 +567,8 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void ...@@ -569,8 +567,8 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void
if (flags & CONTEXT_ARM64_CONTROL) if (flags & CONTEXT_ARM64_CONTROL)
{ {
to->flags |= SERVER_CTX_CONTROL; to->flags |= SERVER_CTX_CONTROL;
to->integer.arm64_regs.x[29] = from->u.s.Fp; to->integer.arm64_regs.x[29] = from->Fp;
to->integer.arm64_regs.x[30] = from->u.s.Lr; to->integer.arm64_regs.x[30] = from->Lr;
to->ctl.arm64_regs.sp = from->Sp; to->ctl.arm64_regs.sp = from->Sp;
to->ctl.arm64_regs.pc = from->Pc; to->ctl.arm64_regs.pc = from->Pc;
to->ctl.arm64_regs.pstate = from->Cpsr; to->ctl.arm64_regs.pstate = from->Cpsr;
...@@ -578,15 +576,15 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void ...@@ -578,15 +576,15 @@ static NTSTATUS context_to_server( context_t *to, USHORT to_machine, const void
if (flags & CONTEXT_ARM64_INTEGER) if (flags & CONTEXT_ARM64_INTEGER)
{ {
to->flags |= SERVER_CTX_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) if (flags & CONTEXT_ARM64_FLOATING_POINT)
{ {
to->flags |= SERVER_CTX_FLOATING_POINT; to->flags |= SERVER_CTX_FLOATING_POINT;
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
{ {
to->fp.arm64_regs.q[i].low = from->V[i].s.Low; to->fp.arm64_regs.q[i].low = from->V[i].Low;
to->fp.arm64_regs.q[i].high = from->V[i].s.High; to->fp.arm64_regs.q[i].high = from->V[i].High;
} }
to->fp.arm64_regs.fpcr = from->Fpcr; to->fp.arm64_regs.fpcr = from->Fpcr;
to->fp.arm64_regs.fpsr = from->Fpsr; to->fp.arm64_regs.fpsr = from->Fpsr;
...@@ -820,8 +818,8 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma ...@@ -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)) if ((from->flags & SERVER_CTX_FLOATING_POINT) && (to_flags & CONTEXT_AMD64_FLOATING_POINT))
{ {
to->ContextFlags |= 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) ); memcpy( &to->FltSave, from->fp.x86_64_regs.fpregs, sizeof(from->fp.x86_64_regs.fpregs) );
to->MxCsr = to->u.FltSave.MxCsr; to->MxCsr = to->FltSave.MxCsr;
} }
if ((from->flags & SERVER_CTX_DEBUG_REGISTERS) && (to_flags & CONTEXT_AMD64_DEBUG_REGISTERS)) 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 ...@@ -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)) if ((from->flags & SERVER_CTX_EXTENDED_REGISTERS) && (to_flags & CONTEXT_AMD64_FLOATING_POINT))
{ {
to->ContextFlags |= 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)) 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 ...@@ -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.DataSelector = from->fp.i386_regs.data_sel;
fpu.Cr0NpxState = from->fp.i386_regs.cr0npx; fpu.Cr0NpxState = from->fp.i386_regs.cr0npx;
memcpy( fpu.RegisterArea, from->fp.i386_regs.regs, sizeof(fpu.RegisterArea) ); 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)) 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 ...@@ -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)) if ((from->flags & SERVER_CTX_FLOATING_POINT) && (to_flags & CONTEXT_ARM_FLOATING_POINT))
{ {
to->ContextFlags |= 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; to->Fpscr = from->fp.arm_regs.fpscr;
} }
if ((from->flags & SERVER_CTX_DEBUG_REGISTERS) && (to_flags & CONTEXT_ARM_DEBUG_REGISTERS)) if ((from->flags & SERVER_CTX_DEBUG_REGISTERS) && (to_flags & CONTEXT_ARM_DEBUG_REGISTERS))
...@@ -988,8 +986,8 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma ...@@ -988,8 +986,8 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
if ((from->flags & SERVER_CTX_CONTROL) && (to_flags & CONTEXT_ARM64_CONTROL)) if ((from->flags & SERVER_CTX_CONTROL) && (to_flags & CONTEXT_ARM64_CONTROL))
{ {
to->ContextFlags |= CONTEXT_ARM64_CONTROL; to->ContextFlags |= CONTEXT_ARM64_CONTROL;
to->u.s.Fp = from->integer.arm64_regs.x[29]; to->Fp = from->integer.arm64_regs.x[29];
to->u.s.Lr = from->integer.arm64_regs.x[30]; to->Lr = from->integer.arm64_regs.x[30];
to->Sp = from->ctl.arm64_regs.sp; to->Sp = from->ctl.arm64_regs.sp;
to->Pc = from->ctl.arm64_regs.pc; to->Pc = from->ctl.arm64_regs.pc;
to->Cpsr = from->ctl.arm64_regs.pstate; to->Cpsr = from->ctl.arm64_regs.pstate;
...@@ -997,15 +995,15 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma ...@@ -997,15 +995,15 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
if ((from->flags & SERVER_CTX_INTEGER) && (to_flags & CONTEXT_ARM64_INTEGER)) if ((from->flags & SERVER_CTX_INTEGER) && (to_flags & CONTEXT_ARM64_INTEGER))
{ {
to->ContextFlags |= 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)) if ((from->flags & SERVER_CTX_FLOATING_POINT) && (to_flags & CONTEXT_ARM64_FLOATING_POINT))
{ {
to->ContextFlags |= CONTEXT_ARM64_FLOATING_POINT; to->ContextFlags |= CONTEXT_ARM64_FLOATING_POINT;
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
{ {
to->V[i].s.Low = from->fp.arm64_regs.q[i].low; to->V[i].Low = from->fp.arm64_regs.q[i].low;
to->V[i].s.High = from->fp.arm64_regs.q[i].high; to->V[i].High = from->fp.arm64_regs.q[i].high;
} }
to->Fpcr = from->fp.arm64_regs.fpcr; to->Fpcr = from->fp.arm64_regs.fpcr;
to->Fpsr = from->fp.arm64_regs.fpsr; 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