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
edbdec44
Commit
edbdec44
authored
Feb 14, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Store extended FPU context in NtGetContextThread().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5ecea501
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
5 deletions
+32
-5
signal_i386.c
dlls/ntdll/signal_i386.c
+32
-5
No files found.
dlls/ntdll/signal_i386.c
View file @
edbdec44
...
...
@@ -427,8 +427,6 @@ static size_t signal_stack_size;
static
wine_signal_handler
handlers
[
256
];
static
BOOL
fpux_support
;
/* whether the CPU supports extended fpu context */
enum
i386_trap_code
{
TRAP_x86_UNKNOWN
=
-
1
,
/* Unknown fault (TRAP_sig not defined) */
...
...
@@ -559,6 +557,15 @@ static inline void *get_signal_stack(void)
/***********************************************************************
* has_fpux
*/
static
inline
int
has_fpux
(
void
)
{
return
(
cpu_info
.
FeatureSet
&
CPU_FEATURE_FXSR
);
}
/***********************************************************************
* get_current_teb
*
* Get the current teb based on the stack pointer.
...
...
@@ -860,6 +867,26 @@ static inline void save_fpu( CONTEXT *context )
/***********************************************************************
* save_fpux
*
* Save the thread FPU extended context.
*/
static
inline
void
save_fpux
(
CONTEXT
*
context
)
{
#ifdef __GNUC__
/* we have to enforce alignment by hand */
char
buffer
[
sizeof
(
XMM_SAVE_AREA32
)
+
16
];
XMM_SAVE_AREA32
*
state
=
(
XMM_SAVE_AREA32
*
)(((
ULONG_PTR
)
buffer
+
15
)
&
~
15
);
if
(
!
has_fpux
())
return
;
context
->
ContextFlags
|=
CONTEXT_EXTENDED_REGISTERS
;
__asm__
__volatile__
(
"fxsave %0"
:
"=m"
(
*
state
)
);
memcpy
(
context
->
ExtendedRegisters
,
state
,
sizeof
(
*
state
)
);
#endif
}
/***********************************************************************
* restore_fpu
*
* Restore the FPU context to a sigcontext.
...
...
@@ -985,7 +1012,6 @@ static inline void save_context( CONTEXT *context, const ucontext_t *sigcontext,
{
context
->
ContextFlags
|=
CONTEXT_FLOATING_POINT
|
CONTEXT_EXTENDED_REGISTERS
;
memcpy
(
context
->
ExtendedRegisters
,
fpux
,
sizeof
(
*
fpux
)
);
fpux_support
=
TRUE
;
if
(
!
fpu
)
fpux_to_fpu
(
&
context
->
FloatSave
,
fpux
);
}
if
(
!
fpu
&&
!
fpux
)
save_fpu
(
context
);
...
...
@@ -1137,7 +1163,7 @@ void DECLSPEC_HIDDEN set_cpu_context( const CONTEXT *context )
{
DWORD
flags
=
context
->
ContextFlags
&
~
CONTEXT_i386
;
if
((
flags
&
CONTEXT_EXTENDED_REGISTERS
)
&&
fpux_support
)
restore_fpux
(
context
);
if
((
flags
&
CONTEXT_EXTENDED_REGISTERS
)
&&
has_fpux
()
)
restore_fpux
(
context
);
else
if
(
flags
&
CONTEXT_FLOATING_POINT
)
restore_fpu
(
context
);
if
(
flags
&
CONTEXT_DEBUG_REGISTERS
)
...
...
@@ -1419,7 +1445,8 @@ NTSTATUS CDECL DECLSPEC_HIDDEN __regs_NtGetContextThread( DWORD edi, DWORD esi,
context
->
ContextFlags
|=
CONTEXT_SEGMENTS
;
}
if
(
needed_flags
&
CONTEXT_FLOATING_POINT
)
save_fpu
(
context
);
/* FIXME: extended floating point */
if
(
needed_flags
&
CONTEXT_EXTENDED_REGISTERS
)
save_fpux
(
context
);
/* FIXME: xstate */
/* update the cached version of the debug registers */
if
(
context
->
ContextFlags
&
(
CONTEXT_DEBUG_REGISTERS
&
~
CONTEXT_i386
))
{
...
...
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