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
bedfb31d
Commit
bedfb31d
authored
Jul 01, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add a helper function to retrieve the CPU area context on the Unix side.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
87948793
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
10 deletions
+32
-10
signal_arm.c
dlls/ntdll/unix/signal_arm.c
+1
-5
signal_i386.c
dlls/ntdll/unix/signal_i386.c
+1
-5
thread.c
dlls/ntdll/unix/thread.c
+29
-0
unix_private.h
dlls/ntdll/unix/unix_private.h
+1
-0
No files found.
dlls/ntdll/unix/signal_arm.c
View file @
bedfb31d
...
...
@@ -921,11 +921,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
context
.
Sp
=
(
DWORD
)
teb
->
Tib
.
StackBase
;
context
.
Pc
=
(
DWORD
)
pRtlUserThreadStart
;
if
(
context
.
Pc
&
1
)
context
.
Cpsr
|=
0x20
;
/* thumb mode */
if
(
NtCurrentTeb64
())
{
WOW64_CPURESERVED
*
cpu
=
ULongToPtr
(
NtCurrentTeb64
()
->
TlsSlots
[
WOW64_TLS_CPURESERVED
]
);
memcpy
(
cpu
+
1
,
&
context
,
sizeof
(
context
)
);
}
if
((
ctx
=
get_cpu_area
(
IMAGE_FILE_MACHINE_ARMNT
)))
*
ctx
=
context
;
if
(
suspend
)
wait_suspend
(
&
context
);
...
...
dlls/ntdll/unix/signal_i386.c
View file @
bedfb31d
...
...
@@ -2337,11 +2337,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
context
.
FloatSave
.
ControlWord
=
0x27f
;
((
XSAVE_FORMAT
*
)
context
.
ExtendedRegisters
)
->
ControlWord
=
0x27f
;
((
XSAVE_FORMAT
*
)
context
.
ExtendedRegisters
)
->
MxCsr
=
0x1f80
;
if
(
NtCurrentTeb64
())
{
WOW64_CPURESERVED
*
cpu
=
ULongToPtr
(
NtCurrentTeb64
()
->
TlsSlots
[
WOW64_TLS_CPURESERVED
]
);
memcpy
(
cpu
+
1
,
&
context
,
sizeof
(
context
)
);
}
if
((
ctx
=
get_cpu_area
(
IMAGE_FILE_MACHINE_I386
)))
*
ctx
=
context
;
if
(
suspend
)
wait_suspend
(
&
context
);
...
...
dlls/ntdll/unix/thread.c
View file @
bedfb31d
...
...
@@ -1098,6 +1098,35 @@ static SIZE_T get_machine_context_size( USHORT machine )
/***********************************************************************
* get_cpu_area
*
* cf. RtlWow64GetCurrentCpuArea
*/
void
*
get_cpu_area
(
USHORT
machine
)
{
WOW64_CPURESERVED
*
cpu
;
ULONG
align
;
if
(
!
NtCurrentTeb
()
->
WowTebOffset
)
return
NULL
;
#ifdef _WIN64
cpu
=
NtCurrentTeb
()
->
TlsSlots
[
WOW64_TLS_CPURESERVED
];
#else
cpu
=
ULongToPtr
(
NtCurrentTeb64
()
->
TlsSlots
[
WOW64_TLS_CPURESERVED
]
);
#endif
if
(
cpu
->
Machine
!=
machine
)
return
NULL
;
switch
(
cpu
->
Machine
)
{
case
IMAGE_FILE_MACHINE_I386
:
align
=
TYPE_ALIGNMENT
(
I386_CONTEXT
);
break
;
case
IMAGE_FILE_MACHINE_AMD64
:
align
=
TYPE_ALIGNMENT
(
ARM_CONTEXT
);
break
;
case
IMAGE_FILE_MACHINE_ARMNT
:
align
=
TYPE_ALIGNMENT
(
AMD64_CONTEXT
);
break
;
case
IMAGE_FILE_MACHINE_ARM64
:
align
=
TYPE_ALIGNMENT
(
ARM64_NT_CONTEXT
);
break
;
default:
return
NULL
;
}
return
(
void
*
)(((
ULONG_PTR
)(
cpu
+
1
)
+
align
-
1
)
&
~
(
align
-
1
));
}
/***********************************************************************
* set_thread_id
*/
void
set_thread_id
(
TEB
*
teb
,
DWORD
pid
,
DWORD
tid
)
...
...
dlls/ntdll/unix/unix_private.h
View file @
bedfb31d
...
...
@@ -181,6 +181,7 @@ extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
extern
void
fpux_to_fpu
(
I386_FLOATING_SAVE_AREA
*
fpu
,
const
XSAVE_FORMAT
*
fpux
)
DECLSPEC_HIDDEN
;
extern
void
fpu_to_fpux
(
XSAVE_FORMAT
*
fpux
,
const
I386_FLOATING_SAVE_AREA
*
fpu
)
DECLSPEC_HIDDEN
;
extern
void
*
get_cpu_area
(
USHORT
machine
)
DECLSPEC_HIDDEN
;
extern
void
set_thread_id
(
TEB
*
teb
,
DWORD
pid
,
DWORD
tid
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
init_thread_stack
(
TEB
*
teb
,
ULONG_PTR
zero_bits
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
abort_thread
(
int
status
)
DECLSPEC_HIDDEN
;
...
...
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