Commit 4f6a40b1 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 9276d53e
......@@ -26,8 +26,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
......@@ -86,8 +84,8 @@ SIZE_T WINAPI GetLargePageMinimum(void)
static void fill_system_info( SYSTEM_INFO *si, const SYSTEM_BASIC_INFORMATION *basic_info,
const SYSTEM_CPU_INFORMATION *cpu_info )
{
si->u.s.wProcessorArchitecture = cpu_info->ProcessorArchitecture;
si->u.s.wReserved = 0;
si->wProcessorArchitecture = cpu_info->ProcessorArchitecture;
si->wReserved = 0;
si->dwPageSize = basic_info->PageSize;
si->lpMinimumApplicationAddress = basic_info->LowestUserAddress;
si->lpMaximumApplicationAddress = basic_info->HighestUserAddress;
......@@ -146,7 +144,7 @@ void WINAPI DECLSPEC_HOTPATCH GetNativeSystemInfo( SYSTEM_INFO *si )
if (native_machine != IMAGE_FILE_MACHINE_AMD64)
{
GetSystemInfo( si );
si->u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64;
si->wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64;
return;
}
}
......@@ -715,7 +713,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH HeapWalk( HANDLE heap, PROCESS_HEAP_ENTRY *entry )
rtl_entry.wFlags |= RTL_HEAP_ENTRY_REGION;
if (entry->wFlags & PROCESS_HEAP_UNCOMMITTED_RANGE)
rtl_entry.wFlags |= RTL_HEAP_ENTRY_UNCOMMITTED;
memcpy( &rtl_entry.Region, &entry->u.Region, sizeof(entry->u.Region) );
memcpy( &rtl_entry.Region, &entry->Region, sizeof(entry->Region) );
if (!(status = RtlWalkHeap( heap, &rtl_entry )))
{
......@@ -733,7 +731,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH HeapWalk( HANDLE heap, PROCESS_HEAP_ENTRY *entry )
else
entry->wFlags = 0;
memcpy( &entry->u.Region, &rtl_entry.Region, sizeof(entry->u.Region) );
memcpy( &entry->Region, &rtl_entry.Region, sizeof(entry->Region) );
}
return set_ntstatus( status );
......@@ -1542,13 +1540,13 @@ void * WINAPI LocateXStateFeature( CONTEXT *context, DWORD feature_id, DWORD *le
if (length)
*length = sizeof(M128A) * 16;
return &context->u.FltSave.XmmRegisters;
return &context->FltSave.XmmRegisters;
}
if (length)
*length = offsetof(XSAVE_FORMAT, XmmRegisters);
return &context->u.FltSave;
return &context->FltSave;
}
/***********************************************************************
......
......@@ -23,8 +23,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
......
......@@ -24,7 +24,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
......@@ -906,7 +905,7 @@ void WINAPI switch_fiber( CONTEXT *old, CONTEXT *new )
/* call the fiber initial function once we have switched stack */
static void CDECL start_fiber(void)
{
struct fiber_data *fiber = NtCurrentTeb()->Tib.u.FiberData;
struct fiber_data *fiber = NtCurrentTeb()->Tib.FiberData;
LPFIBER_START_ROUTINE start = fiber->start;
__TRY
......@@ -1020,12 +1019,12 @@ LPVOID WINAPI DECLSPEC_HOTPATCH CreateFiberEx( SIZE_T stack_commit, SIZE_T stack
*/
BOOL WINAPI DECLSPEC_HOTPATCH ConvertFiberToThread(void)
{
struct fiber_data *fiber = NtCurrentTeb()->Tib.u.FiberData;
struct fiber_data *fiber = NtCurrentTeb()->Tib.FiberData;
if (fiber)
{
relocate_thread_actctx_stack( &NtCurrentTeb()->ActivationContextStack );
NtCurrentTeb()->Tib.u.FiberData = NULL;
NtCurrentTeb()->Tib.FiberData = NULL;
HeapFree( GetProcessHeap(), 0, fiber );
}
return TRUE;
......@@ -1048,7 +1047,7 @@ LPVOID WINAPI DECLSPEC_HOTPATCH ConvertThreadToFiberEx( LPVOID param, DWORD flag
{
struct fiber_data *fiber;
if (NtCurrentTeb()->Tib.u.FiberData)
if (NtCurrentTeb()->Tib.FiberData)
{
SetLastError( ERROR_ALREADY_FIBER );
return NULL;
......@@ -1068,7 +1067,7 @@ LPVOID WINAPI DECLSPEC_HOTPATCH ConvertThreadToFiberEx( LPVOID param, DWORD flag
fiber->flags = flags;
fiber->fls_slots = NtCurrentTeb()->FlsSlots;
relocate_thread_actctx_stack( &fiber->actctx.stack_space );
NtCurrentTeb()->Tib.u.FiberData = fiber;
NtCurrentTeb()->Tib.FiberData = fiber;
return fiber;
}
......@@ -1081,7 +1080,7 @@ void WINAPI DECLSPEC_HOTPATCH DeleteFiber( LPVOID fiber_ptr )
struct fiber_data *fiber = fiber_ptr;
if (!fiber) return;
if (fiber == NtCurrentTeb()->Tib.u.FiberData)
if (fiber == NtCurrentTeb()->Tib.FiberData)
{
relocate_thread_actctx_stack( &NtCurrentTeb()->ActivationContextStack );
HeapFree( GetProcessHeap(), 0, fiber );
......@@ -1099,7 +1098,7 @@ void WINAPI DECLSPEC_HOTPATCH DeleteFiber( LPVOID fiber_ptr )
*/
BOOL WINAPI DECLSPEC_HOTPATCH IsThreadAFiber(void)
{
return NtCurrentTeb()->Tib.u.FiberData != NULL;
return NtCurrentTeb()->Tib.FiberData != NULL;
}
......@@ -1109,7 +1108,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsThreadAFiber(void)
void WINAPI DECLSPEC_HOTPATCH SwitchToFiber( LPVOID fiber )
{
struct fiber_data *new_fiber = fiber;
struct fiber_data *current_fiber = NtCurrentTeb()->Tib.u.FiberData;
struct fiber_data *current_fiber = NtCurrentTeb()->Tib.FiberData;
current_fiber->except = NtCurrentTeb()->Tib.ExceptionList;
current_fiber->stack_limit = NtCurrentTeb()->Tib.StackLimit;
......@@ -1118,7 +1117,7 @@ void WINAPI DECLSPEC_HOTPATCH SwitchToFiber( LPVOID fiber )
/* stack_allocation and stack_base never change */
/* FIXME: should save floating point context if requested in fiber->flags */
NtCurrentTeb()->Tib.u.FiberData = new_fiber;
NtCurrentTeb()->Tib.FiberData = new_fiber;
NtCurrentTeb()->Tib.ExceptionList = new_fiber->except;
NtCurrentTeb()->Tib.StackBase = new_fiber->stack_base;
NtCurrentTeb()->Tib.StackLimit = new_fiber->stack_limit;
......@@ -1213,7 +1212,7 @@ PTP_CLEANUP_GROUP WINAPI DECLSPEC_HOTPATCH CreateThreadpoolCleanupGroup(void)
static void WINAPI tp_io_callback( TP_CALLBACK_INSTANCE *instance, void *userdata, void *cvalue, IO_STATUS_BLOCK *iosb, TP_IO *io )
{
PTP_WIN32_IO_CALLBACK callback = *(void **)io;
callback( instance, userdata, cvalue, RtlNtStatusToDosError( iosb->u.Status ), iosb->Information, io );
callback( instance, userdata, cvalue, RtlNtStatusToDosError( iosb->Status ), iosb->Information, io );
}
......
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