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
ce46de5a
Commit
ce46de5a
authored
Jul 18, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move NtGetContextThread implementation to the platform-specific files.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
675e8218
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
161 additions
and
57 deletions
+161
-57
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-1
signal_arm.c
dlls/ntdll/signal_arm.c
+28
-1
signal_arm64.c
dlls/ntdll/signal_arm64.c
+28
-1
signal_i386.c
dlls/ntdll/signal_i386.c
+44
-1
signal_powerpc.c
dlls/ntdll/signal_powerpc.c
+28
-1
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+31
-1
thread.c
dlls/ntdll/thread.c
+1
-51
No files found.
dlls/ntdll/ntdll_misc.h
View file @
ce46de5a
...
...
@@ -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
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
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_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
NTSTATUS
get_thread_context
(
HANDLE
handle
,
CONTEXT
*
context
,
BOOL
*
self
)
DECLSPEC_HIDDEN
;
extern
void
call_thread_entry_point
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
)
DECLSPEC_NORETURN
DECLSPEC_HIDDEN
;
/* debug helpers */
...
...
dlls/ntdll/signal_arm.c
View file @
ce46de5a
...
...
@@ -320,7 +320,7 @@ __ASM_GLOBAL_FUNC( set_cpu_context,
*
* Copy a register context according to the flags.
*/
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
static
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
{
flags
&=
~
CONTEXT_ARM
;
/* get rid of CPU id */
if
(
flags
&
CONTEXT_CONTROL
)
...
...
@@ -443,6 +443,33 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
}
/***********************************************************************
* NtGetContextThread (NTDLL.@)
* ZwGetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtGetContextThread
(
HANDLE
handle
,
CONTEXT
*
context
)
{
NTSTATUS
ret
;
DWORD
needed_flags
=
context
->
ContextFlags
;
BOOL
self
=
(
handle
==
GetCurrentThread
());
if
(
!
self
)
{
if
((
ret
=
get_thread_context
(
handle
,
context
,
&
self
)))
return
ret
;
needed_flags
&=
~
context
->
ContextFlags
;
}
if
(
self
&&
needed_flags
)
{
CONTEXT
ctx
;
RtlCaptureContext
(
&
ctx
);
copy_context
(
context
,
&
ctx
,
ctx
.
ContextFlags
&
needed_flags
);
context
->
ContextFlags
|=
ctx
.
ContextFlags
&
needed_flags
;
}
return
STATUS_SUCCESS
;
}
extern
void
raise_func_trampoline_thumb
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
,
raise_func
func
);
__ASM_GLOBAL_FUNC
(
raise_func_trampoline_thumb
,
".thumb
\n\t
"
...
...
dlls/ntdll/signal_arm64.c
View file @
ce46de5a
...
...
@@ -241,7 +241,7 @@ static void set_cpu_context( const CONTEXT *context )
*
* Copy a register context according to the flags.
*/
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
static
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
{
flags
&=
~
CONTEXT_ARM64
;
/* get rid of CPU id */
if
(
flags
&
CONTEXT_CONTROL
)
...
...
@@ -346,6 +346,33 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
/***********************************************************************
* NtGetContextThread (NTDLL.@)
* ZwGetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtGetContextThread
(
HANDLE
handle
,
CONTEXT
*
context
)
{
NTSTATUS
ret
;
DWORD
needed_flags
=
context
->
ContextFlags
;
BOOL
self
=
(
handle
==
GetCurrentThread
());
if
(
!
self
)
{
if
((
ret
=
get_thread_context
(
handle
,
context
,
&
self
)))
return
ret
;
needed_flags
&=
~
context
->
ContextFlags
;
}
if
(
self
&&
needed_flags
)
{
CONTEXT
ctx
;
RtlCaptureContext
(
&
ctx
);
copy_context
(
context
,
&
ctx
,
ctx
.
ContextFlags
&
needed_flags
);
context
->
ContextFlags
|=
ctx
.
ContextFlags
&
needed_flags
;
}
return
STATUS_SUCCESS
;
}
/***********************************************************************
* setup_exception_record
*
* Setup the exception record and context on the thread stack.
...
...
dlls/ntdll/signal_i386.c
View file @
ce46de5a
...
...
@@ -1270,7 +1270,7 @@ static void set_cpu_context( const CONTEXT *context )
*
* Copy a register context according to the flags.
*/
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
static
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
{
flags
&=
~
CONTEXT_i386
;
/* get rid of CPU id */
if
(
flags
&
CONTEXT_INTEGER
)
...
...
@@ -1486,6 +1486,49 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
/***********************************************************************
* NtGetContextThread (NTDLL.@)
* ZwGetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtGetContextThread
(
HANDLE
handle
,
CONTEXT
*
context
)
{
NTSTATUS
ret
;
DWORD
needed_flags
=
context
->
ContextFlags
;
BOOL
self
=
(
handle
==
GetCurrentThread
());
/* debug registers require a server call */
if
(
context
->
ContextFlags
&
(
CONTEXT_DEBUG_REGISTERS
&
~
CONTEXT_i386
))
self
=
FALSE
;
if
(
!
self
)
{
if
((
ret
=
get_thread_context
(
handle
,
context
,
&
self
)))
return
ret
;
needed_flags
&=
~
context
->
ContextFlags
;
}
if
(
self
)
{
if
(
needed_flags
)
{
CONTEXT
ctx
;
RtlCaptureContext
(
&
ctx
);
copy_context
(
context
,
&
ctx
,
ctx
.
ContextFlags
&
needed_flags
);
context
->
ContextFlags
|=
ctx
.
ContextFlags
&
needed_flags
;
}
/* update the cached version of the debug registers */
if
(
context
->
ContextFlags
&
(
CONTEXT_DEBUG_REGISTERS
&
~
CONTEXT_i386
))
{
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
;
}
}
return
STATUS_SUCCESS
;
}
/***********************************************************************
* is_privileged_instr
*
* Check if the fault location is a privileged instruction.
...
...
dlls/ntdll/signal_powerpc.c
View file @
ce46de5a
...
...
@@ -278,7 +278,7 @@ static void set_cpu_context( const CONTEXT *context )
*
* Copy a register context according to the flags.
*/
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
static
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
{
if
(
flags
&
CONTEXT_CONTROL
)
{
...
...
@@ -583,6 +583,33 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
}
/***********************************************************************
* NtGetContextThread (NTDLL.@)
* ZwGetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtGetContextThread
(
HANDLE
handle
,
CONTEXT
*
context
)
{
NTSTATUS
ret
;
DWORD
needed_flags
=
context
->
ContextFlags
;
BOOL
self
=
(
handle
==
GetCurrentThread
());
if
(
!
self
)
{
if
((
ret
=
get_thread_context
(
handle
,
context
,
&
self
)))
return
ret
;
needed_flags
&=
~
context
->
ContextFlags
;
}
if
(
self
&&
needed_flags
)
{
CONTEXT
ctx
;
RtlCaptureContext
(
&
ctx
);
copy_context
(
context
,
&
ctx
,
ctx
.
ContextFlags
&
needed_flags
);
context
->
ContextFlags
|=
ctx
.
ContextFlags
&
needed_flags
;
}
return
STATUS_SUCCESS
;
}
/**********************************************************************
* call_stack_handlers
*
...
...
dlls/ntdll/signal_x86_64.c
View file @
ce46de5a
...
...
@@ -1876,7 +1876,7 @@ static void set_cpu_context( const CONTEXT *context )
*
* Copy a register context according to the flags.
*/
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
static
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
)
{
flags
&=
~
CONTEXT_AMD64
;
/* get rid of CPU id */
if
(
flags
&
CONTEXT_CONTROL
)
...
...
@@ -2078,6 +2078,36 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
}
/***********************************************************************
* NtGetContextThread (NTDLL.@)
* ZwGetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtGetContextThread
(
HANDLE
handle
,
CONTEXT
*
context
)
{
NTSTATUS
ret
;
DWORD
needed_flags
=
context
->
ContextFlags
;
BOOL
self
=
(
handle
==
GetCurrentThread
());
/* debug registers require a server call */
if
(
context
->
ContextFlags
&
(
CONTEXT_DEBUG_REGISTERS
&
~
CONTEXT_AMD64
))
self
=
FALSE
;
if
(
!
self
)
{
if
((
ret
=
get_thread_context
(
handle
,
context
,
&
self
)))
return
ret
;
needed_flags
&=
~
context
->
ContextFlags
;
}
if
(
self
&&
needed_flags
)
{
CONTEXT
ctx
;
RtlCaptureContext
(
&
ctx
);
copy_context
(
context
,
&
ctx
,
ctx
.
ContextFlags
&
needed_flags
);
context
->
ContextFlags
|=
ctx
.
ContextFlags
&
needed_flags
;
}
return
STATUS_SUCCESS
;
}
extern
void
raise_func_trampoline
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
,
raise_func
func
);
__ASM_GLOBAL_FUNC
(
raise_func_trampoline
,
__ASM_CFI
(
".cfi_signal_frame
\n\t
"
)
...
...
dlls/ntdll/thread.c
View file @
ce46de5a
...
...
@@ -843,7 +843,7 @@ static inline unsigned int get_server_context_flags( DWORD flags )
/***********************************************************************
* get_thread_context
*/
static
NTSTATUS
get_thread_context
(
HANDLE
handle
,
CONTEXT
*
context
,
BOOL
*
self
)
NTSTATUS
get_thread_context
(
HANDLE
handle
,
CONTEXT
*
context
,
BOOL
*
self
)
{
NTSTATUS
ret
;
DWORD
dummy
,
i
;
...
...
@@ -890,56 +890,6 @@ static NTSTATUS get_thread_context( HANDLE handle, CONTEXT *context, BOOL *self
}
/***********************************************************************
* NtGetContextThread (NTDLL.@)
* ZwGetContextThread (NTDLL.@)
*/
NTSTATUS
WINAPI
NtGetContextThread
(
HANDLE
handle
,
CONTEXT
*
context
)
{
NTSTATUS
ret
;
DWORD
needed_flags
=
context
->
ContextFlags
;
BOOL
self
=
(
handle
==
GetCurrentThread
());
/* on i386/amd64 debug registers always require a server call */
#ifdef __i386__
if
(
context
->
ContextFlags
&
(
CONTEXT_DEBUG_REGISTERS
&
~
CONTEXT_i386
))
self
=
FALSE
;
#elif defined(__x86_64__)
if
(
context
->
ContextFlags
&
(
CONTEXT_DEBUG_REGISTERS
&
~
CONTEXT_AMD64
))
self
=
FALSE
;
#endif
if
(
!
self
)
{
ret
=
get_thread_context
(
handle
,
context
,
&
self
);
if
(
ret
)
return
ret
;
needed_flags
&=
~
context
->
ContextFlags
;
}
if
(
self
)
{
if
(
needed_flags
)
{
CONTEXT
ctx
;
RtlCaptureContext
(
&
ctx
);
copy_context
(
context
,
&
ctx
,
ctx
.
ContextFlags
&
needed_flags
);
context
->
ContextFlags
|=
ctx
.
ContextFlags
&
needed_flags
;
}
#ifdef __i386__
/* update the cached version of the debug registers */
if
(
context
->
ContextFlags
&
(
CONTEXT_DEBUG_REGISTERS
&
~
CONTEXT_i386
))
{
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
;
}
#endif
}
return
STATUS_SUCCESS
;
}
/******************************************************************************
* NtQueryInformationThread (NTDLL.@)
* ZwQueryInformationThread (NTDLL.@)
...
...
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