Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
c88b2ed3
Commit
c88b2ed3
authored
Feb 26, 2021
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use cpu_info to check for AVX availability.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
894dbe83
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
12 deletions
+9
-12
signal_i386.c
dlls/ntdll/unix/signal_i386.c
+3
-3
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+4
-8
system.c
dlls/ntdll/unix/system.c
+1
-1
unix_private.h
dlls/ntdll/unix/unix_private.h
+1
-0
No files found.
dlls/ntdll/unix/signal_i386.c
View file @
c88b2ed3
...
...
@@ -721,7 +721,7 @@ static inline NTSTATUS save_xstate( CONTEXT *context )
xsave_area
;
XSTATE
*
xs
;
if
(
!
(
user_shared_data
->
XState
.
EnabledFeatures
&&
(
xs
=
xstate_from_context
(
context
)
)))
if
(
!
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_AVX
)
||
!
(
xs
=
xstate_from_context
(
context
)))
return
STATUS_SUCCESS
;
if
(
context_ex
->
XState
.
Length
<
offsetof
(
XSTATE
,
YmmContext
)
...
...
@@ -796,7 +796,7 @@ static inline void restore_xstate( const CONTEXT *context )
XSAVE_FORMAT
*
xrstor_base
;
XSTATE
*
xs
;
if
(
!
(
user_shared_data
->
XState
.
EnabledFeatures
&&
(
xs
=
xstate_from_context
(
context
)
)))
if
(
!
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_AVX
)
||
!
(
xs
=
xstate_from_context
(
context
)))
return
;
xrstor_base
=
(
XSAVE_FORMAT
*
)
xs
-
1
;
...
...
@@ -914,7 +914,7 @@ static inline void save_context( struct xcontext *xcontext, const ucontext_t *si
context
->
ContextFlags
|=
CONTEXT_FLOATING_POINT
|
CONTEXT_EXTENDED_REGISTERS
;
memcpy
(
context
->
ExtendedRegisters
,
fpux
,
sizeof
(
*
fpux
)
);
if
(
!
fpu
)
fpux_to_fpu
(
&
context
->
FloatSave
,
fpux
);
if
(
user_shared_data
->
XState
.
EnabledFeatures
&&
(
xs
=
XState_sig
(
fpux
)))
if
(
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_AVX
)
&&
(
xs
=
XState_sig
(
fpux
)))
{
context_init_xstate
(
context
,
xs
);
xcontext
->
host_compaction_mask
=
xs
->
CompactionMask
;
...
...
dlls/ntdll/unix/signal_x86_64.c
View file @
c88b2ed3
...
...
@@ -1528,7 +1528,7 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex
context
->
ContextFlags
|=
CONTEXT_FLOATING_POINT
;
context
->
u
.
FltSave
=
*
FPU_sig
(
sigcontext
);
context
->
MxCsr
=
context
->
u
.
FltSave
.
MxCsr
;
if
(
user_shared_data
->
XState
.
EnabledFeatures
&&
(
xs
=
XState_sig
(
FPU_sig
(
sigcontext
))))
if
(
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_AVX
)
&&
(
xs
=
XState_sig
(
FPU_sig
(
sigcontext
))))
{
/* xcontext and sigcontext are both on the signal stack, so we can
* just reference sigcontext without overflowing 32 bit XState.Offset */
...
...
@@ -1558,7 +1558,7 @@ static void restore_context( const struct xcontext *xcontext, ucontext_t *sigcon
amd64_thread_data
()
->
dr7
=
context
->
Dr7
;
set_sigcontext
(
context
,
sigcontext
);
if
(
FPU_sig
(
sigcontext
))
*
FPU_sig
(
sigcontext
)
=
context
->
u
.
FltSave
;
if
(
user_shared_data
->
XState
.
EnabledFeatures
&&
(
xs
=
XState_sig
(
FPU_sig
(
sigcontext
))))
if
(
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_AVX
)
&&
(
xs
=
XState_sig
(
FPU_sig
(
sigcontext
))))
xs
->
CompactionMask
=
xcontext
->
host_compaction_mask
;
}
...
...
@@ -1599,9 +1599,7 @@ __ASM_GLOBAL_FUNC( set_full_cpu_context,
void
signal_restore_full_cpu_context
(
void
)
{
struct
syscall_xsave
*
xsave
=
get_syscall_xsave
(
get_syscall_frame
()
);
SYSTEM_CPU_INFORMATION
cpu_info
;
NtQuerySystemInformation
(
SystemCpuInformation
,
&
cpu_info
,
sizeof
(
cpu_info
),
NULL
);
if
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_XSAVE
)
{
__asm__
volatile
(
"xrstor64 %0"
:
:
"m"
(
xsave
->
xsave
),
"a"
(
7
),
"d"
(
0
)
);
...
...
@@ -1850,7 +1848,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
xsave
->
xsave
=
context
->
u
.
FltSave
;
xsave
->
xstate
.
Mask
|=
XSTATE_MASK_LEGACY
;
}
if
(
user_shared_data
->
XState
.
EnabledFeatures
&&
(
xs
=
xstate_from_context
(
context
)))
if
(
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_AVX
)
&&
(
xs
=
xstate_from_context
(
context
)))
{
CONTEXT_EX
*
context_ex
=
(
CONTEXT_EX
*
)(
context
+
1
);
...
...
@@ -1987,7 +1985,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
amd64_thread_data
()
->
dr6
=
context
->
Dr6
;
amd64_thread_data
()
->
dr7
=
context
->
Dr7
;
}
if
(
user_shared_data
->
XState
.
EnabledFeatures
&&
(
xstate
=
xstate_from_context
(
context
)))
if
(
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_AVX
)
&&
(
xstate
=
xstate_from_context
(
context
)))
{
struct
syscall_xsave
*
xsave
=
get_syscall_xsave
(
frame
);
CONTEXT_EX
*
context_ex
=
(
CONTEXT_EX
*
)(
context
+
1
);
...
...
@@ -2831,13 +2829,11 @@ void signal_init_process(void)
*/
void
*
signal_init_syscalls
(
void
)
{
SYSTEM_CPU_INFORMATION
cpu_info
;
void
*
ptr
,
*
syscall_dispatcher
;
extern
void
__wine_syscall_dispatcher_xsave
(
void
)
DECLSPEC_HIDDEN
;
extern
void
__wine_syscall_dispatcher_xsavec
(
void
)
DECLSPEC_HIDDEN
;
NtQuerySystemInformation
(
SystemCpuInformation
,
&
cpu_info
,
sizeof
(
cpu_info
),
NULL
);
if
(
xstate_compaction_enabled
)
syscall_dispatcher
=
__wine_syscall_dispatcher_xsavec
;
else
if
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_XSAVE
)
...
...
dlls/ntdll/unix/system.c
View file @
c88b2ed3
...
...
@@ -168,7 +168,7 @@ struct smbios_boot_info
#define FIRM 0x4649524D
#define RSMB 0x52534D42
static
SYSTEM_CPU_INFORMATION
cpu_info
;
SYSTEM_CPU_INFORMATION
cpu_info
=
{
0
}
;
/*******************************************************************************
* Architecture specific feature detection for CPUs
...
...
dlls/ntdll/unix/unix_private.h
View file @
c88b2ed3
...
...
@@ -129,6 +129,7 @@ extern HANDLE keyed_event DECLSPEC_HIDDEN;
extern
timeout_t
server_start_time
DECLSPEC_HIDDEN
;
extern
sigset_t
server_block_set
DECLSPEC_HIDDEN
;
extern
struct
_KUSER_SHARED_DATA
*
user_shared_data
DECLSPEC_HIDDEN
;
extern
SYSTEM_CPU_INFORMATION
cpu_info
DECLSPEC_HIDDEN
;
#ifdef __i386__
extern
struct
ldt_copy
__wine_ldt_copy
DECLSPEC_HIDDEN
;
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment