Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
675e8218
Commit
675e8218
authored
Jul 18, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move NtSetContextThread implementation to the platform-specific files.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1e484175
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
43 deletions
+93
-43
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-1
signal_arm.c
dlls/ntdll/signal_arm.c
+16
-0
signal_arm64.c
dlls/ntdll/signal_arm64.c
+16
-1
signal_i386.c
dlls/ntdll/signal_i386.c
+26
-1
signal_powerpc.c
dlls/ntdll/signal_powerpc.c
+16
-1
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+17
-2
thread.c
dlls/ntdll/thread.c
+1
-37
No files found.
dlls/ntdll/ntdll_misc.h
View file @
675e8218
...
@@ -53,10 +53,10 @@ extern void wait_suspend( CONTEXT *context ) DECLSPEC_HIDDEN;
...
@@ -53,10 +53,10 @@ extern void wait_suspend( CONTEXT *context ) DECLSPEC_HIDDEN;
extern
NTSTATUS
send_debug_event
(
EXCEPTION_RECORD
*
rec
,
int
first_chance
,
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
send_debug_event
(
EXCEPTION_RECORD
*
rec
,
int
first_chance
,
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
extern
LONG
call_vectored_handlers
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
extern
LONG
call_vectored_handlers
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
extern
void
raise_status
(
NTSTATUS
status
,
EXCEPTION_RECORD
*
rec
)
DECLSPEC_NORETURN
DECLSPEC_HIDDEN
;
extern
void
raise_status
(
NTSTATUS
status
,
EXCEPTION_RECORD
*
rec
)
DECLSPEC_NORETURN
DECLSPEC_HIDDEN
;
extern
void
set_cpu_context
(
const
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
extern
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
DECLSPEC_HIDDEN
;
extern
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
context_to_server
(
context_t
*
to
,
const
CONTEXT
*
from
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
context_to_server
(
context_t
*
to
,
const
CONTEXT
*
from
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
context_from_server
(
CONTEXT
*
to
,
const
context_t
*
from
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
context_from_server
(
CONTEXT
*
to
,
const
context_t
*
from
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
set_thread_context
(
HANDLE
handle
,
const
CONTEXT
*
context
,
BOOL
*
self
)
DECLSPEC_HIDDEN
;
extern
void
call_thread_entry_point
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
)
DECLSPEC_NORETURN
DECLSPEC_HIDDEN
;
extern
void
call_thread_entry_point
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
)
DECLSPEC_NORETURN
DECLSPEC_HIDDEN
;
/* debug helpers */
/* debug helpers */
...
...
dlls/ntdll/signal_arm.c
View file @
675e8218
...
@@ -294,6 +294,7 @@ __ASM_STDCALL_FUNC( RtlCaptureContext, 4,
...
@@ -294,6 +294,7 @@ __ASM_STDCALL_FUNC( RtlCaptureContext, 4,
* Set the new CPU context.
* Set the new CPU context.
*/
*/
/* FIXME: What about the CPSR? */
/* FIXME: What about the CPSR? */
void
set_cpu_context
(
const
CONTEXT
*
context
);
__ASM_GLOBAL_FUNC
(
set_cpu_context
,
__ASM_GLOBAL_FUNC
(
set_cpu_context
,
"mov IP, r0
\n\t
"
"mov IP, r0
\n\t
"
"ldr r0, [IP, #0x4]
\n\t
"
/* context->R0 */
"ldr r0, [IP, #0x4]
\n\t
"
/* context->R0 */
...
@@ -427,6 +428,21 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
...
@@ -427,6 +428,21 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
/***********************************************************************
* NtSetContextThread (NTDLL.@)
* ZwSetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtSetContextThread
(
HANDLE
handle
,
const
CONTEXT
*
context
)
{
NTSTATUS
ret
;
BOOL
self
;
ret
=
set_thread_context
(
handle
,
context
,
&
self
);
if
(
self
&&
ret
==
STATUS_SUCCESS
)
set_cpu_context
(
context
);
return
ret
;
}
extern
void
raise_func_trampoline_thumb
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
,
raise_func
func
);
extern
void
raise_func_trampoline_thumb
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
,
raise_func
func
);
__ASM_GLOBAL_FUNC
(
raise_func_trampoline_thumb
,
__ASM_GLOBAL_FUNC
(
raise_func_trampoline_thumb
,
".thumb
\n\t
"
".thumb
\n\t
"
...
...
dlls/ntdll/signal_arm64.c
View file @
675e8218
...
@@ -231,7 +231,7 @@ __ASM_STDCALL_FUNC( RtlCaptureContext, 8,
...
@@ -231,7 +231,7 @@ __ASM_STDCALL_FUNC( RtlCaptureContext, 8,
*
*
* Set the new CPU context.
* Set the new CPU context.
*/
*/
void
set_cpu_context
(
const
CONTEXT
*
context
)
static
void
set_cpu_context
(
const
CONTEXT
*
context
)
{
{
FIXME
(
"Not implemented on ARM64
\n
"
);
FIXME
(
"Not implemented on ARM64
\n
"
);
}
}
...
@@ -331,6 +331,21 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
...
@@ -331,6 +331,21 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
}
}
/***********************************************************************
/***********************************************************************
* NtSetContextThread (NTDLL.@)
* ZwSetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtSetContextThread
(
HANDLE
handle
,
const
CONTEXT
*
context
)
{
NTSTATUS
ret
;
BOOL
self
;
ret
=
set_thread_context
(
handle
,
context
,
&
self
);
if
(
self
&&
ret
==
STATUS_SUCCESS
)
set_cpu_context
(
context
);
return
ret
;
}
/***********************************************************************
* setup_exception_record
* setup_exception_record
*
*
* Setup the exception record and context on the thread stack.
* Setup the exception record and context on the thread stack.
...
...
dlls/ntdll/signal_i386.c
View file @
675e8218
...
@@ -1230,7 +1230,7 @@ __ASM_STDCALL_FUNC( RtlCaptureContext, 4,
...
@@ -1230,7 +1230,7 @@ __ASM_STDCALL_FUNC( RtlCaptureContext, 4,
*
*
* Set the new CPU context. Used by NtSetContextThread.
* Set the new CPU context. Used by NtSetContextThread.
*/
*/
void
set_cpu_context
(
const
CONTEXT
*
context
)
static
void
set_cpu_context
(
const
CONTEXT
*
context
)
{
{
DWORD
flags
=
context
->
ContextFlags
&
~
CONTEXT_i386
;
DWORD
flags
=
context
->
ContextFlags
&
~
CONTEXT_i386
;
...
@@ -1461,6 +1461,31 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
...
@@ -1461,6 +1461,31 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
/***********************************************************************
/***********************************************************************
* NtSetContextThread (NTDLL.@)
* ZwSetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtSetContextThread
(
HANDLE
handle
,
const
CONTEXT
*
context
)
{
NTSTATUS
ret
=
STATUS_SUCCESS
;
BOOL
self
=
(
handle
==
GetCurrentThread
());
/* debug registers require a server call */
if
(
self
&&
(
context
->
ContextFlags
&
(
CONTEXT_DEBUG_REGISTERS
&
~
CONTEXT_i386
)))
self
=
(
ntdll_get_thread_data
()
->
dr0
==
context
->
Dr0
&&
ntdll_get_thread_data
()
->
dr1
==
context
->
Dr1
&&
ntdll_get_thread_data
()
->
dr2
==
context
->
Dr2
&&
ntdll_get_thread_data
()
->
dr3
==
context
->
Dr3
&&
ntdll_get_thread_data
()
->
dr6
==
context
->
Dr6
&&
ntdll_get_thread_data
()
->
dr7
==
context
->
Dr7
);
if
(
!
self
)
ret
=
set_thread_context
(
handle
,
context
,
&
self
);
if
(
self
&&
ret
==
STATUS_SUCCESS
)
set_cpu_context
(
context
);
return
ret
;
}
/***********************************************************************
* is_privileged_instr
* is_privileged_instr
*
*
* Check if the fault location is a privileged instruction.
* Check if the fault location is a privileged instruction.
...
...
dlls/ntdll/signal_powerpc.c
View file @
675e8218
...
@@ -267,7 +267,7 @@ void WINAPI RtlCaptureContext( CONTEXT *context )
...
@@ -267,7 +267,7 @@ void WINAPI RtlCaptureContext( CONTEXT *context )
*
*
* Set the new CPU context.
* Set the new CPU context.
*/
*/
void
set_cpu_context
(
const
CONTEXT
*
context
)
static
void
set_cpu_context
(
const
CONTEXT
*
context
)
{
{
FIXME
(
"not implemented
\n
"
);
FIXME
(
"not implemented
\n
"
);
}
}
...
@@ -568,6 +568,21 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
...
@@ -568,6 +568,21 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
}
}
/***********************************************************************
* NtSetContextThread (NTDLL.@)
* ZwSetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtSetContextThread
(
HANDLE
handle
,
const
CONTEXT
*
context
)
{
NTSTATUS
ret
;
BOOL
self
;
ret
=
set_thread_context
(
handle
,
context
,
&
self
);
if
(
self
&&
ret
==
STATUS_SUCCESS
)
set_cpu_context
(
context
);
return
ret
;
}
/**********************************************************************
/**********************************************************************
* call_stack_handlers
* call_stack_handlers
*
*
...
...
dlls/ntdll/signal_x86_64.c
View file @
675e8218
...
@@ -1858,7 +1858,7 @@ __ASM_GLOBAL_FUNC( set_full_cpu_context,
...
@@ -1858,7 +1858,7 @@ __ASM_GLOBAL_FUNC( set_full_cpu_context,
*
*
* Set the new CPU context. Used by NtSetContextThread.
* Set the new CPU context. Used by NtSetContextThread.
*/
*/
void
set_cpu_context
(
const
CONTEXT
*
context
)
static
void
set_cpu_context
(
const
CONTEXT
*
context
)
{
{
DWORD
flags
=
context
->
ContextFlags
&
~
CONTEXT_AMD64
;
DWORD
flags
=
context
->
ContextFlags
&
~
CONTEXT_AMD64
;
if
(
flags
&
CONTEXT_FULL
)
if
(
flags
&
CONTEXT_FULL
)
...
@@ -2063,6 +2063,21 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
...
@@ -2063,6 +2063,21 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from )
}
}
/***********************************************************************
* NtSetContextThread (NTDLL.@)
* ZwSetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtSetContextThread
(
HANDLE
handle
,
const
CONTEXT
*
context
)
{
NTSTATUS
ret
;
BOOL
self
;
ret
=
set_thread_context
(
handle
,
context
,
&
self
);
if
(
self
&&
ret
==
STATUS_SUCCESS
)
set_cpu_context
(
context
);
return
ret
;
}
extern
void
raise_func_trampoline
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
,
raise_func
func
);
extern
void
raise_func_trampoline
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
,
raise_func
func
);
__ASM_GLOBAL_FUNC
(
raise_func_trampoline
,
__ASM_GLOBAL_FUNC
(
raise_func_trampoline
,
__ASM_CFI
(
".cfi_signal_frame
\n\t
"
)
__ASM_CFI
(
".cfi_signal_frame
\n\t
"
)
...
@@ -3929,7 +3944,7 @@ __ASM_GLOBAL_FUNC( RtlRaiseException,
...
@@ -3929,7 +3944,7 @@ __ASM_GLOBAL_FUNC( RtlRaiseException,
"movq %rcx,0x80(%rdx)
\n\t
"
/* context->Rcx */
"movq %rcx,0x80(%rdx)
\n\t
"
/* context->Rcx */
"call "
__ASM_NAME
(
"__regs_RtlRaiseException"
)
"
\n\t
"
"call "
__ASM_NAME
(
"__regs_RtlRaiseException"
)
"
\n\t
"
"leaq 0x20(%rsp),%rdi
\n\t
"
/* context pointer */
"leaq 0x20(%rsp),%rdi
\n\t
"
/* context pointer */
"call "
__ASM_NAME
(
"set_cpu_context"
)
/* does not return */
);
"call "
__ASM_NAME
(
"set_
full_
cpu_context"
)
/* does not return */
);
/*************************************************************************
/*************************************************************************
...
...
dlls/ntdll/thread.c
View file @
675e8218
...
@@ -771,7 +771,7 @@ NTSTATUS WINAPI NtQueueApcThread( HANDLE handle, PNTAPCFUNC func, ULONG_PTR arg1
...
@@ -771,7 +771,7 @@ NTSTATUS WINAPI NtQueueApcThread( HANDLE handle, PNTAPCFUNC func, ULONG_PTR arg1
/***********************************************************************
/***********************************************************************
* set_thread_context
* set_thread_context
*/
*/
static
NTSTATUS
set_thread_context
(
HANDLE
handle
,
const
CONTEXT
*
context
,
BOOL
*
self
)
NTSTATUS
set_thread_context
(
HANDLE
handle
,
const
CONTEXT
*
context
,
BOOL
*
self
)
{
{
NTSTATUS
ret
;
NTSTATUS
ret
;
DWORD
dummy
,
i
;
DWORD
dummy
,
i
;
...
@@ -817,42 +817,6 @@ static NTSTATUS set_thread_context( HANDLE handle, const CONTEXT *context, BOOL
...
@@ -817,42 +817,6 @@ static NTSTATUS set_thread_context( HANDLE handle, const CONTEXT *context, BOOL
}
}
/***********************************************************************
* NtSetContextThread (NTDLL.@)
* ZwSetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtSetContextThread
(
HANDLE
handle
,
const
CONTEXT
*
context
)
{
NTSTATUS
ret
;
BOOL
self
;
#ifdef __i386__
/* on i386 debug registers always require a server call */
self
=
(
handle
==
GetCurrentThread
());
if
(
self
&&
(
context
->
ContextFlags
&
(
CONTEXT_DEBUG_REGISTERS
&
~
CONTEXT_i386
)))
{
self
=
(
ntdll_get_thread_data
()
->
dr0
==
context
->
Dr0
&&
ntdll_get_thread_data
()
->
dr1
==
context
->
Dr1
&&
ntdll_get_thread_data
()
->
dr2
==
context
->
Dr2
&&
ntdll_get_thread_data
()
->
dr3
==
context
->
Dr3
&&
ntdll_get_thread_data
()
->
dr6
==
context
->
Dr6
&&
ntdll_get_thread_data
()
->
dr7
==
context
->
Dr7
);
}
#else
self
=
FALSE
;
#endif
if
(
!
self
)
{
ret
=
set_thread_context
(
handle
,
context
,
&
self
);
if
(
ret
)
return
ret
;
}
if
(
self
)
set_cpu_context
(
context
);
return
STATUS_SUCCESS
;
}
/* convert CPU-specific flags to generic server flags */
/* convert CPU-specific flags to generic server flags */
static
inline
unsigned
int
get_server_context_flags
(
DWORD
flags
)
static
inline
unsigned
int
get_server_context_flags
(
DWORD
flags
)
{
{
...
...
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