ntdll: Check ContextFlags before restoring registers on x86_64.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2016-01-02 04:40:46 +01:00 committed by Alexandre Julliard
parent 367b30d827
commit 897ac569c8
1 changed files with 22 additions and 2 deletions

View File

@ -1800,11 +1800,12 @@ __ASM_GLOBAL_FUNC( RtlCaptureContext,
"ret" ); "ret" );
/*********************************************************************** /***********************************************************************
* set_cpu_context * set_full_cpu_context
* *
* Set the new CPU context. * Set the new CPU context.
*/ */
__ASM_GLOBAL_FUNC( set_cpu_context, extern void set_full_cpu_context( const CONTEXT *context );
__ASM_GLOBAL_FUNC( set_full_cpu_context,
"subq $40,%rsp\n\t" "subq $40,%rsp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 40\n\t") __ASM_CFI(".cfi_adjust_cfa_offset 40\n\t")
"ldmxcsr 0x34(%rdi)\n\t" /* context->MxCsr */ "ldmxcsr 0x34(%rdi)\n\t" /* context->MxCsr */
@ -1852,6 +1853,25 @@ __ASM_GLOBAL_FUNC( set_cpu_context,
"movq 0xb0(%rdi),%rdi\n\t" /* context->Rdi */ "movq 0xb0(%rdi),%rdi\n\t" /* context->Rdi */
"iretq" ); "iretq" );
/***********************************************************************
* set_cpu_context
*
* Set the new CPU context. Used by NtSetContextThread.
*/
void set_cpu_context( const CONTEXT *context )
{
DWORD flags = context->ContextFlags & ~CONTEXT_AMD64;
if (flags & CONTEXT_FULL)
{
if (!(flags & CONTEXT_CONTROL))
FIXME( "setting partial context (%x) not supported\n", flags );
else
set_full_cpu_context( context );
}
}
/*********************************************************************** /***********************************************************************
* copy_context * copy_context
* *