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
da16581e
Commit
da16581e
authored
Apr 26, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use nameless unions/structs for register contexts.
parent
33598db7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
352 additions
and
365 deletions
+352
-365
signal_arm.c
dlls/ntdll/signal_arm.c
+39
-41
signal_arm64.c
dlls/ntdll/signal_arm64.c
+80
-83
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+15
-17
dwarf.h
dlls/ntdll/unix/dwarf.h
+110
-110
signal_arm.c
dlls/ntdll/unix/signal_arm.c
+5
-7
signal_arm64.c
dlls/ntdll/unix/signal_arm64.c
+79
-81
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+24
-26
No files found.
dlls/ntdll/signal_arm.c
View file @
da16581e
...
...
@@ -24,8 +24,6 @@
#include <stdlib.h>
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -685,7 +683,7 @@ static void pop_fpregs_range( int first, int last, CONTEXT *context,
for
(
i
=
first
;
i
<=
last
;
i
++
)
{
if
(
ptrs
&&
i
>=
8
&&
i
<=
15
)
(
&
ptrs
->
D8
)[
i
-
8
]
=
(
ULONGLONG
*
)
context
->
Sp
;
context
->
u
.
D
[
i
]
=
*
(
ULONGLONG
*
)
context
->
Sp
;
context
->
D
[
i
]
=
*
(
ULONGLONG
*
)
context
->
Sp
;
context
->
Sp
+=
8
;
}
}
...
...
@@ -781,32 +779,32 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
CONTEXT
*
context
,
KNONVOLATILE_CONTEXT_POINTERS
*
ptrs
)
{
int
i
,
pos
=
0
;
int
pf
=
0
,
ef
=
0
,
fpoffset
=
0
,
stack
=
func
->
u
.
s
.
StackAdjust
;
int
pf
=
0
,
ef
=
0
,
fpoffset
=
0
,
stack
=
func
->
StackAdjust
;
int
prologue_regmask
=
0
;
int
epilogue_regmask
=
0
;
unsigned
int
offset
,
len
;
BYTE
prologue
[
10
],
*
prologue_end
,
epilogue
[
20
],
*
epilogue_end
;
TRACE
(
"function %lx-%lx: len=%#x flag=%x ret=%u H=%u reg=%u R=%u L=%u C=%u stackadjust=%x
\n
"
,
base
+
func
->
BeginAddress
,
base
+
func
->
BeginAddress
+
func
->
u
.
s
.
FunctionLength
*
2
,
func
->
u
.
s
.
FunctionLength
,
func
->
u
.
s
.
Flag
,
func
->
u
.
s
.
Ret
,
func
->
u
.
s
.
H
,
func
->
u
.
s
.
Reg
,
func
->
u
.
s
.
R
,
func
->
u
.
s
.
L
,
func
->
u
.
s
.
C
,
func
->
u
.
s
.
StackAdjust
);
base
+
func
->
BeginAddress
,
base
+
func
->
BeginAddress
+
func
->
FunctionLength
*
2
,
func
->
FunctionLength
,
func
->
Flag
,
func
->
Ret
,
func
->
H
,
func
->
Reg
,
func
->
R
,
func
->
L
,
func
->
C
,
func
->
StackAdjust
);
offset
=
(
pc
-
base
)
-
func
->
BeginAddress
;
if
(
func
->
u
.
s
.
StackAdjust
>=
0x03f4
)
if
(
func
->
StackAdjust
>=
0x03f4
)
{
pf
=
func
->
u
.
s
.
StackAdjust
&
0x04
;
ef
=
func
->
u
.
s
.
StackAdjust
&
0x08
;
stack
=
(
func
->
u
.
s
.
StackAdjust
&
3
)
+
1
;
pf
=
func
->
StackAdjust
&
0x04
;
ef
=
func
->
StackAdjust
&
0x08
;
stack
=
(
func
->
StackAdjust
&
3
)
+
1
;
}
if
(
!
func
->
u
.
s
.
R
||
pf
)
if
(
!
func
->
R
||
pf
)
{
int
first
=
4
,
last
=
func
->
u
.
s
.
Reg
+
4
;
int
first
=
4
,
last
=
func
->
Reg
+
4
;
if
(
pf
)
{
first
=
(
~
func
->
u
.
s
.
StackAdjust
)
&
3
;
if
(
func
->
u
.
s
.
R
)
first
=
(
~
func
->
StackAdjust
)
&
3
;
if
(
func
->
R
)
last
=
3
;
}
for
(
i
=
first
;
i
<=
last
;
i
++
)
...
...
@@ -814,31 +812,31 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
fpoffset
=
last
+
1
-
first
;
}
if
(
!
func
->
u
.
s
.
R
||
ef
)
if
(
!
func
->
R
||
ef
)
{
int
first
=
4
,
last
=
func
->
u
.
s
.
Reg
+
4
;
int
first
=
4
,
last
=
func
->
Reg
+
4
;
if
(
ef
)
{
first
=
(
~
func
->
u
.
s
.
StackAdjust
)
&
3
;
if
(
func
->
u
.
s
.
R
)
first
=
(
~
func
->
StackAdjust
)
&
3
;
if
(
func
->
R
)
last
=
3
;
}
for
(
i
=
first
;
i
<=
last
;
i
++
)
epilogue_regmask
|=
1
<<
i
;
}
if
(
func
->
u
.
s
.
C
)
if
(
func
->
C
)
{
prologue_regmask
|=
1
<<
11
;
epilogue_regmask
|=
1
<<
11
;
}
if
(
func
->
u
.
s
.
L
)
if
(
func
->
L
)
{
prologue_regmask
|=
1
<<
14
;
/* lr */
if
(
func
->
u
.
s
.
Ret
!=
0
)
if
(
func
->
Ret
!=
0
)
epilogue_regmask
|=
1
<<
14
;
/* lr */
else
if
(
!
func
->
u
.
s
.
H
)
else
if
(
!
func
->
H
)
epilogue_regmask
|=
1
<<
15
;
/* pc */
}
...
...
@@ -856,12 +854,12 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
}
}
if
(
func
->
u
.
s
.
R
&&
func
->
u
.
s
.
Reg
!=
7
)
prologue
[
pos
++
]
=
0xe0
|
func
->
u
.
s
.
Reg
;
/* vpush {d8-dX} */
if
(
func
->
R
&&
func
->
Reg
!=
7
)
prologue
[
pos
++
]
=
0xe0
|
func
->
Reg
;
/* vpush {d8-dX} */
if
(
func
->
u
.
s
.
C
&&
fpoffset
==
0
)
if
(
func
->
C
&&
fpoffset
==
0
)
prologue
[
pos
++
]
=
0xfb
;
/* mov r11, sp - handled as nop16 */
else
if
(
func
->
u
.
s
.
C
)
else
if
(
func
->
C
)
prologue
[
pos
++
]
=
0xfc
;
/* add r11, sp, #x - handled as nop32 */
if
(
prologue_regmask
&
0xf00
)
/* r8-r11 set */
...
...
@@ -881,7 +879,7 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
prologue
[
pos
++
]
=
bitmask
&
0xff
;
}
if
(
func
->
u
.
s
.
H
)
if
(
func
->
H
)
prologue
[
pos
++
]
=
0x04
;
/* push {r0-r3} - handled as sub sp, sp, #16 */
prologue
[
pos
++
]
=
0xff
;
/* end */
...
...
@@ -902,8 +900,8 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
}
}
if
(
func
->
u
.
s
.
R
&&
func
->
u
.
s
.
Reg
!=
7
)
epilogue
[
pos
++
]
=
0xe0
|
func
->
u
.
s
.
Reg
;
/* vpush {d8-dX} */
if
(
func
->
R
&&
func
->
Reg
!=
7
)
epilogue
[
pos
++
]
=
0xe0
|
func
->
Reg
;
/* vpush {d8-dX} */
if
(
epilogue_regmask
&
0x7f00
)
/* r8-r11, lr set */
{
...
...
@@ -922,23 +920,23 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
epilogue
[
pos
++
]
=
bitmask
&
0xff
;
}
if
(
func
->
u
.
s
.
H
&&
!
(
func
->
u
.
s
.
L
&&
func
->
u
.
s
.
Ret
==
0
))
if
(
func
->
H
&&
!
(
func
->
L
&&
func
->
Ret
==
0
))
epilogue
[
pos
++
]
=
0x04
;
/* add sp, sp, #16 */
else
if
(
func
->
u
.
s
.
H
&&
(
func
->
u
.
s
.
L
&&
func
->
u
.
s
.
Ret
==
0
))
else
if
(
func
->
H
&&
(
func
->
L
&&
func
->
Ret
==
0
))
{
epilogue
[
pos
++
]
=
0xef
;
/* ldr lr, [sp], #20 */
epilogue
[
pos
++
]
=
5
;
}
if
(
func
->
u
.
s
.
Ret
==
1
)
if
(
func
->
Ret
==
1
)
epilogue
[
pos
++
]
=
0xfd
;
/* bx lr */
else
if
(
func
->
u
.
s
.
Ret
==
2
)
else
if
(
func
->
Ret
==
2
)
epilogue
[
pos
++
]
=
0xfe
;
/* b address */
else
epilogue
[
pos
++
]
=
0xff
;
/* end */
epilogue_end
=
&
epilogue
[
pos
];
if
(
func
->
u
.
s
.
Flag
==
1
&&
offset
<
4
*
(
prologue_end
-
prologue
))
{
if
(
func
->
Flag
==
1
&&
offset
<
4
*
(
prologue_end
-
prologue
))
{
/* Check prologue */
len
=
get_sequence_len
(
prologue
,
prologue_end
,
0
);
if
(
offset
<
len
)
...
...
@@ -948,12 +946,12 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
}
}
if
(
func
->
u
.
s
.
Ret
!=
3
&&
2
*
func
->
u
.
s
.
FunctionLength
-
offset
<=
4
*
(
epilogue_end
-
epilogue
))
{
if
(
func
->
Ret
!=
3
&&
2
*
func
->
FunctionLength
-
offset
<=
4
*
(
epilogue_end
-
epilogue
))
{
/* Check epilogue */
len
=
get_sequence_len
(
epilogue
,
epilogue_end
,
1
);
if
(
offset
>=
2
*
func
->
u
.
s
.
FunctionLength
-
len
)
if
(
offset
>=
2
*
func
->
FunctionLength
-
len
)
{
process_unwind_codes
(
epilogue
,
epilogue_end
,
context
,
ptrs
,
offset
-
(
2
*
func
->
u
.
s
.
FunctionLength
-
len
)
);
process_unwind_codes
(
epilogue
,
epilogue_end
,
context
,
ptrs
,
offset
-
(
2
*
func
->
FunctionLength
-
len
)
);
return
NULL
;
}
}
...
...
@@ -977,7 +975,7 @@ static void *unwind_full_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION *f
void
*
data
;
BYTE
*
end
;
info
=
(
struct
unwind_info
*
)((
char
*
)
base
+
func
->
u
.
UnwindData
);
info
=
(
struct
unwind_info
*
)((
char
*
)
base
+
func
->
UnwindData
);
data
=
info
+
1
;
epilogs
=
info
->
epilog
;
codes
=
info
->
codes
;
...
...
@@ -1066,7 +1064,7 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG_PTR base, ULONG_PTR pc,
*
handler_data
=
NULL
;
context
->
Pc
=
0
;
if
(
func
->
u
.
s
.
Flag
)
if
(
func
->
Flag
)
handler
=
unwind_packed_data
(
base
,
pc
,
func
,
context
,
ctx_ptr
);
else
handler
=
unwind_full_data
(
base
,
pc
,
func
,
context
,
handler_data
,
ctx_ptr
);
...
...
@@ -1171,7 +1169,7 @@ void CDECL RtlRestoreContext( CONTEXT *context, EXCEPTION_RECORD *rec )
context
->
Fpscr
=
jmp
->
Fpscr
;
for
(
i
=
0
;
i
<
8
;
i
++
)
context
->
u
.
D
[
8
+
i
]
=
jmp
->
D
[
i
];
context
->
D
[
8
+
i
]
=
jmp
->
D
[
i
];
}
else
if
(
rec
&&
rec
->
ExceptionCode
==
STATUS_UNWIND_CONSOLIDATE
&&
rec
->
NumberParameters
>=
1
)
{
...
...
dlls/ntdll/signal_arm64.c
View file @
da16581e
...
...
@@ -26,8 +26,6 @@
#include <stdarg.h>
#include <stdio.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -215,21 +213,21 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX
}
else
{
status
=
context
->
Pc
!=
context
->
u
.
s
.
Lr
?
status
=
context
->
Pc
!=
context
->
Lr
?
STATUS_SUCCESS
:
STATUS_INVALID_DISPOSITION
;
WARN
(
"exception data not found in %s for %p, LR %p, status %lx
\n
"
,
debugstr_w
(
module
->
BaseDllName
.
Buffer
),
(
void
*
)
context
->
Pc
,
(
void
*
)
context
->
u
.
s
.
Lr
,
status
);
(
void
*
)
context
->
Lr
,
status
);
dispatch
->
EstablisherFrame
=
context
->
Sp
;
dispatch
->
LanguageHandler
=
NULL
;
context
->
Pc
=
context
->
u
.
s
.
Lr
;
context
->
Pc
=
context
->
Lr
;
context
->
ContextFlags
|=
CONTEXT_UNWOUND_TO_CALL
;
return
status
;
}
dispatch
->
EstablisherFrame
=
context
->
u
.
s
.
Fp
;
dispatch
->
EstablisherFrame
=
context
->
Fp
;
dispatch
->
LanguageHandler
=
NULL
;
context
->
Pc
=
context
->
u
.
s
.
Lr
;
context
->
Pc
=
context
->
Lr
;
context
->
ContextFlags
|=
CONTEXT_UNWOUND_TO_CALL
;
return
STATUS_SUCCESS
;
}
...
...
@@ -402,7 +400,7 @@ static NTSTATUS call_function_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_con
dispatch
.
ContextRecord
=
&
context
;
dispatch
.
HistoryTable
=
&
table
;
prev_context
=
context
;
dispatch
.
NonVolatileRegisters
=
(
BYTE
*
)
&
prev_context
.
u
.
s
.
X19
;
dispatch
.
NonVolatileRegisters
=
(
BYTE
*
)
&
prev_context
.
X19
;
for
(;;)
{
...
...
@@ -538,21 +536,21 @@ NTSTATUS WINAPI KiUserExceptionDispatcher( EXCEPTION_RECORD *rec, CONTEXT *conte
WARN
(
"%s exception (code=%lx) raised
\n
"
,
debugstr_exception_code
(
rec
->
ExceptionCode
),
rec
->
ExceptionCode
);
TRACE
(
" x0=%016I64x x1=%016I64x x2=%016I64x x3=%016I64x
\n
"
,
context
->
u
.
s
.
X0
,
context
->
u
.
s
.
X1
,
context
->
u
.
s
.
X2
,
context
->
u
.
s
.
X3
);
context
->
X0
,
context
->
X1
,
context
->
X2
,
context
->
X3
);
TRACE
(
" x4=%016I64x x5=%016I64x x6=%016I64x x7=%016I64x
\n
"
,
context
->
u
.
s
.
X4
,
context
->
u
.
s
.
X5
,
context
->
u
.
s
.
X6
,
context
->
u
.
s
.
X7
);
context
->
X4
,
context
->
X5
,
context
->
X6
,
context
->
X7
);
TRACE
(
" x8=%016I64x x9=%016I64x x10=%016I64x x11=%016I64x
\n
"
,
context
->
u
.
s
.
X8
,
context
->
u
.
s
.
X9
,
context
->
u
.
s
.
X10
,
context
->
u
.
s
.
X11
);
context
->
X8
,
context
->
X9
,
context
->
X10
,
context
->
X11
);
TRACE
(
" x12=%016I64x x13=%016I64x x14=%016I64x x15=%016I64x
\n
"
,
context
->
u
.
s
.
X12
,
context
->
u
.
s
.
X13
,
context
->
u
.
s
.
X14
,
context
->
u
.
s
.
X15
);
context
->
X12
,
context
->
X13
,
context
->
X14
,
context
->
X15
);
TRACE
(
" x16=%016I64x x17=%016I64x x18=%016I64x x19=%016I64x
\n
"
,
context
->
u
.
s
.
X16
,
context
->
u
.
s
.
X17
,
context
->
u
.
s
.
X18
,
context
->
u
.
s
.
X19
);
context
->
X16
,
context
->
X17
,
context
->
X18
,
context
->
X19
);
TRACE
(
" x20=%016I64x x21=%016I64x x22=%016I64x x23=%016I64x
\n
"
,
context
->
u
.
s
.
X20
,
context
->
u
.
s
.
X21
,
context
->
u
.
s
.
X22
,
context
->
u
.
s
.
X23
);
context
->
X20
,
context
->
X21
,
context
->
X22
,
context
->
X23
);
TRACE
(
" x24=%016I64x x25=%016I64x x26=%016I64x x27=%016I64x
\n
"
,
context
->
u
.
s
.
X24
,
context
->
u
.
s
.
X25
,
context
->
u
.
s
.
X26
,
context
->
u
.
s
.
X27
);
context
->
X24
,
context
->
X25
,
context
->
X26
,
context
->
X27
);
TRACE
(
" x28=%016I64x fp=%016I64x lr=%016I64x sp=%016I64x
\n
"
,
context
->
u
.
s
.
X28
,
context
->
u
.
s
.
Fp
,
context
->
u
.
s
.
Lr
,
context
->
Sp
);
context
->
X28
,
context
->
Fp
,
context
->
Lr
,
context
->
Sp
);
}
if
(
call_vectored_handlers
(
rec
,
context
)
==
EXCEPTION_CONTINUE_EXECUTION
)
...
...
@@ -668,7 +666,7 @@ static void restore_regs( int reg, int count, int pos, CONTEXT *context,
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
ptrs
&&
reg
+
i
>=
19
)
(
&
ptrs
->
X19
)[
reg
+
i
-
19
]
=
(
DWORD64
*
)
context
->
Sp
+
i
+
offset
;
context
->
u
.
X
[
reg
+
i
]
=
((
DWORD64
*
)
context
->
Sp
)[
i
+
offset
];
context
->
X
[
reg
+
i
]
=
((
DWORD64
*
)
context
->
Sp
)[
i
+
offset
];
}
if
(
pos
<
0
)
context
->
Sp
+=
-
8
*
pos
;
}
...
...
@@ -692,7 +690,7 @@ static void restore_fpregs( int reg, int count, int pos, CONTEXT *context,
static
void
do_pac_auth
(
CONTEXT
*
context
)
{
register
DWORD64
x17
__asm__
(
"x17"
)
=
context
->
u
.
s
.
Lr
;
register
DWORD64
x17
__asm__
(
"x17"
)
=
context
->
Lr
;
register
DWORD64
x16
__asm__
(
"x16"
)
=
context
->
Sp
;
/* This is the autib1716 instruction. The hint instruction is used here
...
...
@@ -701,7 +699,7 @@ static void do_pac_auth( CONTEXT *context )
* is ignored. */
__asm__
(
"hint 0xe"
:
"+r"
(
x17
)
:
"r"
(
x16
)
);
context
->
u
.
s
.
Lr
=
x17
;
context
->
Lr
=
x17
;
}
/***********************************************************************
...
...
@@ -763,9 +761,9 @@ static void process_unwind_codes( BYTE *ptr, BYTE *end, CONTEXT *context,
else
if
(
*
ptr
==
0xe0
)
/* alloc_l */
context
->
Sp
+=
16
*
((
ptr
[
1
]
<<
16
)
+
(
ptr
[
2
]
<<
8
)
+
ptr
[
3
]);
else
if
(
*
ptr
==
0xe1
)
/* set_fp */
context
->
Sp
=
context
->
u
.
s
.
Fp
;
context
->
Sp
=
context
->
Fp
;
else
if
(
*
ptr
==
0xe2
)
/* add_fp */
context
->
Sp
=
context
->
u
.
s
.
Fp
-
8
*
(
val
&
0xff
);
context
->
Sp
=
context
->
Fp
-
8
*
(
val
&
0xff
);
else
if
(
*
ptr
==
0xe3
)
/* nop */
/* nop */
;
else
if
(
*
ptr
==
0xe4
)
/* end */
...
...
@@ -810,19 +808,18 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
{
int
i
;
unsigned
int
len
,
offset
,
skip
=
0
;
unsigned
int
int_size
=
func
->
u
.
s
.
RegI
*
8
,
fp_size
=
func
->
u
.
s
.
RegF
*
8
,
regsave
,
local_size
;
unsigned
int
int_size
=
func
->
RegI
*
8
,
fp_size
=
func
->
RegF
*
8
,
regsave
,
local_size
;
unsigned
int
int_regs
,
fp_regs
,
saved_regs
,
local_size_regs
;
TRACE
(
"function %I64x-%I64x: len=%#x flag=%x regF=%u regI=%u H=%u CR=%u frame=%x
\n
"
,
base
+
func
->
BeginAddress
,
base
+
func
->
BeginAddress
+
func
->
u
.
s
.
FunctionLength
*
4
,
func
->
u
.
s
.
FunctionLength
,
func
->
u
.
s
.
Flag
,
func
->
u
.
s
.
RegF
,
func
->
u
.
s
.
RegI
,
func
->
u
.
s
.
H
,
func
->
u
.
s
.
CR
,
func
->
u
.
s
.
FrameSize
);
base
+
func
->
BeginAddress
,
base
+
func
->
BeginAddress
+
func
->
FunctionLength
*
4
,
func
->
FunctionLength
,
func
->
Flag
,
func
->
RegF
,
func
->
RegI
,
func
->
H
,
func
->
CR
,
func
->
FrameSize
);
if
(
func
->
u
.
s
.
CR
==
1
)
int_size
+=
8
;
if
(
func
->
u
.
s
.
RegF
)
fp_size
+=
8
;
if
(
func
->
CR
==
1
)
int_size
+=
8
;
if
(
func
->
RegF
)
fp_size
+=
8
;
regsave
=
((
int_size
+
fp_size
+
8
*
8
*
func
->
u
.
s
.
H
)
+
0xf
)
&
~
0xf
;
local_size
=
func
->
u
.
s
.
FrameSize
*
16
-
regsave
;
regsave
=
((
int_size
+
fp_size
+
8
*
8
*
func
->
H
)
+
0xf
)
&
~
0xf
;
local_size
=
func
->
FrameSize
*
16
-
regsave
;
int_regs
=
int_size
/
8
;
fp_regs
=
fp_size
/
8
;
...
...
@@ -830,13 +827,13 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
local_size_regs
=
local_size
/
8
;
/* check for prolog/epilog */
if
(
func
->
u
.
s
.
Flag
==
1
)
if
(
func
->
Flag
==
1
)
{
offset
=
((
pc
-
base
)
-
func
->
BeginAddress
)
/
4
;
if
(
offset
<
17
||
offset
>=
func
->
u
.
s
.
FunctionLength
-
15
)
if
(
offset
<
17
||
offset
>=
func
->
FunctionLength
-
15
)
{
len
=
(
int_size
+
8
)
/
16
+
(
fp_size
+
8
)
/
16
;
switch
(
func
->
u
.
s
.
CR
)
switch
(
func
->
CR
)
{
case
2
:
len
++
;
/* pacibsp */
...
...
@@ -852,42 +849,42 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
if
(
local_size
>
4088
)
len
++
;
/* sub sp,sp,#4088 */
break
;
}
len
+=
4
*
func
->
u
.
s
.
H
;
len
+=
4
*
func
->
H
;
if
(
offset
<
len
)
/* prolog */
{
skip
=
len
-
offset
;
}
else
if
(
offset
>=
func
->
u
.
s
.
FunctionLength
-
(
len
+
1
))
/* epilog */
else
if
(
offset
>=
func
->
FunctionLength
-
(
len
+
1
))
/* epilog */
{
skip
=
offset
-
(
func
->
u
.
s
.
FunctionLength
-
(
len
+
1
));
skip
=
offset
-
(
func
->
FunctionLength
-
(
len
+
1
));
}
}
}
if
(
!
skip
)
{
if
(
func
->
u
.
s
.
CR
==
3
||
func
->
u
.
s
.
CR
==
2
)
if
(
func
->
CR
==
3
||
func
->
CR
==
2
)
{
DWORD64
*
fp
=
(
DWORD64
*
)
context
->
u
.
s
.
Fp
;
/* u.
X[29] */
context
->
Sp
=
context
->
u
.
s
.
Fp
;
context
->
u
.
X
[
29
]
=
fp
[
0
];
context
->
u
.
X
[
30
]
=
fp
[
1
];
DWORD64
*
fp
=
(
DWORD64
*
)
context
->
Fp
;
/*
X[29] */
context
->
Sp
=
context
->
Fp
;
context
->
X
[
29
]
=
fp
[
0
];
context
->
X
[
30
]
=
fp
[
1
];
}
context
->
Sp
+=
local_size
;
if
(
fp_size
)
restore_fpregs
(
8
,
fp_regs
,
int_regs
,
context
,
ptrs
);
if
(
func
->
u
.
s
.
CR
==
1
)
restore_regs
(
30
,
1
,
int_regs
-
1
,
context
,
ptrs
);
restore_regs
(
19
,
func
->
u
.
s
.
RegI
,
-
saved_regs
,
context
,
ptrs
);
if
(
func
->
CR
==
1
)
restore_regs
(
30
,
1
,
int_regs
-
1
,
context
,
ptrs
);
restore_regs
(
19
,
func
->
RegI
,
-
saved_regs
,
context
,
ptrs
);
}
else
{
unsigned
int
pos
=
0
;
switch
(
func
->
u
.
s
.
CR
)
switch
(
func
->
CR
)
{
case
3
:
case
2
:
/* mov x29,sp */
if
(
pos
++
>=
skip
)
context
->
Sp
=
context
->
u
.
s
.
Fp
;
if
(
pos
++
>=
skip
)
context
->
Sp
=
context
->
Fp
;
if
(
local_size
<=
512
)
{
/* stp x29,lr,[sp,-#local_size]! */
...
...
@@ -906,14 +903,14 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
break
;
}
if
(
func
->
u
.
s
.
H
)
pos
+=
4
;
if
(
func
->
H
)
pos
+=
4
;
if
(
fp_size
)
{
if
(
func
->
u
.
s
.
RegF
%
2
==
0
&&
pos
++
>=
skip
)
if
(
func
->
RegF
%
2
==
0
&&
pos
++
>=
skip
)
/* str d%u,[sp,#fp_size] */
restore_fpregs
(
8
+
func
->
u
.
s
.
RegF
,
1
,
int_regs
+
fp_regs
-
1
,
context
,
ptrs
);
for
(
i
=
(
func
->
u
.
s
.
RegF
+
1
)
/
2
-
1
;
i
>=
0
;
i
--
)
restore_fpregs
(
8
+
func
->
RegF
,
1
,
int_regs
+
fp_regs
-
1
,
context
,
ptrs
);
for
(
i
=
(
func
->
RegF
+
1
)
/
2
-
1
;
i
>=
0
;
i
--
)
{
if
(
pos
++
<
skip
)
continue
;
if
(
!
i
&&
!
int_size
)
...
...
@@ -925,25 +922,25 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
}
}
if
(
func
->
u
.
s
.
RegI
%
2
)
if
(
func
->
RegI
%
2
)
{
if
(
pos
++
>=
skip
)
{
/* stp xn,lr,[sp,#offset] */
if
(
func
->
u
.
s
.
CR
==
1
)
restore_regs
(
30
,
1
,
int_regs
-
1
,
context
,
ptrs
);
if
(
func
->
CR
==
1
)
restore_regs
(
30
,
1
,
int_regs
-
1
,
context
,
ptrs
);
/* str xn,[sp,#offset] */
restore_regs
(
18
+
func
->
u
.
s
.
RegI
,
1
,
(
func
->
u
.
s
.
RegI
>
1
)
?
func
->
u
.
s
.
RegI
-
1
:
-
saved_regs
,
restore_regs
(
18
+
func
->
RegI
,
1
,
(
func
->
RegI
>
1
)
?
func
->
RegI
-
1
:
-
saved_regs
,
context
,
ptrs
);
}
}
else
if
(
func
->
u
.
s
.
CR
==
1
)
else
if
(
func
->
CR
==
1
)
{
/* str lr,[sp,#offset] */
if
(
pos
++
>=
skip
)
restore_regs
(
30
,
1
,
func
->
u
.
s
.
RegI
?
int_regs
-
1
:
-
saved_regs
,
context
,
ptrs
);
if
(
pos
++
>=
skip
)
restore_regs
(
30
,
1
,
func
->
RegI
?
int_regs
-
1
:
-
saved_regs
,
context
,
ptrs
);
}
for
(
i
=
func
->
u
.
s
.
RegI
/
2
-
1
;
i
>=
0
;
i
--
)
for
(
i
=
func
->
RegI
/
2
-
1
;
i
>=
0
;
i
--
)
{
if
(
pos
++
<
skip
)
continue
;
if
(
i
)
...
...
@@ -954,7 +951,7 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION
restore_regs
(
19
,
2
,
-
saved_regs
,
context
,
ptrs
);
}
}
if
(
func
->
u
.
s
.
CR
==
2
)
do_pac_auth
(
context
);
if
(
func
->
CR
==
2
)
do_pac_auth
(
context
);
return
NULL
;
}
...
...
@@ -971,7 +968,7 @@ static void *unwind_full_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION *f
void
*
data
;
BYTE
*
end
;
info
=
(
struct
unwind_info
*
)((
char
*
)
base
+
func
->
u
.
UnwindData
);
info
=
(
struct
unwind_info
*
)((
char
*
)
base
+
func
->
UnwindData
);
data
=
info
+
1
;
epilogs
=
info
->
epilog
;
codes
=
info
->
codes
;
...
...
@@ -1060,14 +1057,14 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG_PTR base, ULONG_PTR pc,
*
handler_data
=
NULL
;
context
->
Pc
=
0
;
if
(
func
->
u
.
s
.
Flag
)
if
(
func
->
Flag
)
handler
=
unwind_packed_data
(
base
,
pc
,
func
,
context
,
ctx_ptr
);
else
handler
=
unwind_full_data
(
base
,
pc
,
func
,
context
,
handler_data
,
ctx_ptr
);
TRACE
(
"ret: lr=%I64x sp=%I64x handler=%p
\n
"
,
context
->
u
.
s
.
Lr
,
context
->
Sp
,
handler
);
TRACE
(
"ret: lr=%I64x sp=%I64x handler=%p
\n
"
,
context
->
Lr
,
context
->
Sp
,
handler
);
if
(
!
context
->
Pc
)
context
->
Pc
=
context
->
u
.
s
.
Lr
;
context
->
Pc
=
context
->
Lr
;
context
->
ContextFlags
|=
CONTEXT_UNWOUND_TO_CALL
;
*
frame_ret
=
context
->
Sp
;
return
handler
;
...
...
@@ -1162,18 +1159,18 @@ void CDECL RtlRestoreContext( CONTEXT *context, EXCEPTION_RECORD *rec )
struct
MSVCRT_JUMP_BUFFER
*
jmp
=
(
struct
MSVCRT_JUMP_BUFFER
*
)
rec
->
ExceptionInformation
[
0
];
int
i
;
context
->
u
.
s
.
X19
=
jmp
->
X19
;
context
->
u
.
s
.
X20
=
jmp
->
X20
;
context
->
u
.
s
.
X21
=
jmp
->
X21
;
context
->
u
.
s
.
X22
=
jmp
->
X22
;
context
->
u
.
s
.
X23
=
jmp
->
X23
;
context
->
u
.
s
.
X24
=
jmp
->
X24
;
context
->
u
.
s
.
X25
=
jmp
->
X25
;
context
->
u
.
s
.
X26
=
jmp
->
X26
;
context
->
u
.
s
.
X27
=
jmp
->
X27
;
context
->
u
.
s
.
X28
=
jmp
->
X28
;
context
->
u
.
s
.
Fp
=
jmp
->
Fp
;
context
->
u
.
s
.
Lr
=
jmp
->
Lr
;
context
->
X19
=
jmp
->
X19
;
context
->
X20
=
jmp
->
X20
;
context
->
X21
=
jmp
->
X21
;
context
->
X22
=
jmp
->
X22
;
context
->
X23
=
jmp
->
X23
;
context
->
X24
=
jmp
->
X24
;
context
->
X25
=
jmp
->
X25
;
context
->
X26
=
jmp
->
X26
;
context
->
X27
=
jmp
->
X27
;
context
->
X28
=
jmp
->
X28
;
context
->
Fp
=
jmp
->
Fp
;
context
->
Lr
=
jmp
->
Lr
;
context
->
Sp
=
jmp
->
Sp
;
context
->
Fpcr
=
jmp
->
Fpcr
;
context
->
Fpsr
=
jmp
->
Fpsr
;
...
...
@@ -1185,7 +1182,7 @@ void CDECL RtlRestoreContext( CONTEXT *context, EXCEPTION_RECORD *rec )
{
PVOID
(
CALLBACK
*
consolidate
)(
EXCEPTION_RECORD
*
)
=
(
void
*
)
rec
->
ExceptionInformation
[
0
];
TRACE
(
"calling consolidate callback %p (rec=%p)
\n
"
,
consolidate
,
rec
);
rec
->
ExceptionInformation
[
10
]
=
(
ULONG_PTR
)
&
context
->
u
.
s
.
X19
;
rec
->
ExceptionInformation
[
10
]
=
(
ULONG_PTR
)
&
context
->
X19
;
context
->
Pc
=
(
ULONG64
)
call_consolidate_callback
(
context
,
consolidate
,
rec
,
NtCurrentTeb
()
);
}
...
...
@@ -1235,26 +1232,26 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
for
(
i
=
0
;
i
<
min
(
EXCEPTION_MAXIMUM_PARAMETERS
,
rec
->
NumberParameters
);
i
++
)
TRACE
(
" info[%ld]=%016I64x
\n
"
,
i
,
rec
->
ExceptionInformation
[
i
]
);
TRACE
(
" x0=%016I64x x1=%016I64x x2=%016I64x x3=%016I64x
\n
"
,
context
->
u
.
s
.
X0
,
context
->
u
.
s
.
X1
,
context
->
u
.
s
.
X2
,
context
->
u
.
s
.
X3
);
context
->
X0
,
context
->
X1
,
context
->
X2
,
context
->
X3
);
TRACE
(
" x4=%016I64x x5=%016I64x x6=%016I64x x7=%016I64x
\n
"
,
context
->
u
.
s
.
X4
,
context
->
u
.
s
.
X5
,
context
->
u
.
s
.
X6
,
context
->
u
.
s
.
X7
);
context
->
X4
,
context
->
X5
,
context
->
X6
,
context
->
X7
);
TRACE
(
" x8=%016I64x x9=%016I64x x10=%016I64x x11=%016I64x
\n
"
,
context
->
u
.
s
.
X8
,
context
->
u
.
s
.
X9
,
context
->
u
.
s
.
X10
,
context
->
u
.
s
.
X11
);
context
->
X8
,
context
->
X9
,
context
->
X10
,
context
->
X11
);
TRACE
(
" x12=%016I64x x13=%016I64x x14=%016I64x x15=%016I64x
\n
"
,
context
->
u
.
s
.
X12
,
context
->
u
.
s
.
X13
,
context
->
u
.
s
.
X14
,
context
->
u
.
s
.
X15
);
context
->
X12
,
context
->
X13
,
context
->
X14
,
context
->
X15
);
TRACE
(
" x16=%016I64x x17=%016I64x x18=%016I64x x19=%016I64x
\n
"
,
context
->
u
.
s
.
X16
,
context
->
u
.
s
.
X17
,
context
->
u
.
s
.
X18
,
context
->
u
.
s
.
X19
);
context
->
X16
,
context
->
X17
,
context
->
X18
,
context
->
X19
);
TRACE
(
" x20=%016I64x x21=%016I64x x22=%016I64x x23=%016I64x
\n
"
,
context
->
u
.
s
.
X20
,
context
->
u
.
s
.
X21
,
context
->
u
.
s
.
X22
,
context
->
u
.
s
.
X23
);
context
->
X20
,
context
->
X21
,
context
->
X22
,
context
->
X23
);
TRACE
(
" x24=%016I64x x25=%016I64x x26=%016I64x x27=%016I64x
\n
"
,
context
->
u
.
s
.
X24
,
context
->
u
.
s
.
X25
,
context
->
u
.
s
.
X26
,
context
->
u
.
s
.
X27
);
context
->
X24
,
context
->
X25
,
context
->
X26
,
context
->
X27
);
TRACE
(
" x28=%016I64x fp=%016I64x lr=%016I64x sp=%016I64x
\n
"
,
context
->
u
.
s
.
X28
,
context
->
u
.
s
.
Fp
,
context
->
u
.
s
.
Lr
,
context
->
Sp
);
context
->
X28
,
context
->
Fp
,
context
->
Lr
,
context
->
Sp
);
dispatch
.
TargetPc
=
(
ULONG64
)
target_ip
;
dispatch
.
ContextRecord
=
context
;
dispatch
.
HistoryTable
=
table
;
dispatch
.
NonVolatileRegisters
=
(
BYTE
*
)
&
context
->
u
.
s
.
X19
;
dispatch
.
NonVolatileRegisters
=
(
BYTE
*
)
&
context
->
X19
;
for
(;;)
{
...
...
@@ -1327,7 +1324,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
*
context
=
new_context
;
}
context
->
u
.
s
.
X0
=
(
ULONG64
)
retval
;
context
->
X0
=
(
ULONG64
)
retval
;
context
->
Pc
=
(
ULONG64
)
target_ip
;
RtlRestoreContext
(
context
,
rec
);
}
...
...
dlls/ntdll/signal_x86_64.c
View file @
da16581e
...
...
@@ -23,8 +23,6 @@
#include <stdlib.h>
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -690,14 +688,14 @@ static ULONG64 get_int_reg( CONTEXT *context, int reg )
static
void
set_int_reg
(
CONTEXT
*
context
,
KNONVOLATILE_CONTEXT_POINTERS
*
ctx_ptr
,
int
reg
,
ULONG64
*
val
)
{
*
(
&
context
->
Rax
+
reg
)
=
*
val
;
if
(
ctx_ptr
)
ctx_ptr
->
u2
.
IntegerContext
[
reg
]
=
val
;
if
(
ctx_ptr
)
ctx_ptr
->
IntegerContext
[
reg
]
=
val
;
}
static
void
set_float_reg
(
CONTEXT
*
context
,
KNONVOLATILE_CONTEXT_POINTERS
*
ctx_ptr
,
int
reg
,
M128A
*
val
)
{
/* Use a memcpy() to avoid issues if val is misaligned. */
memcpy
(
&
context
->
u
.
s
.
Xmm0
+
reg
,
val
,
sizeof
(
*
val
));
if
(
ctx_ptr
)
ctx_ptr
->
u
.
FloatingContext
[
reg
]
=
val
;
memcpy
(
&
context
->
Xmm0
+
reg
,
val
,
sizeof
(
*
val
));
if
(
ctx_ptr
)
ctx_ptr
->
FloatingContext
[
reg
]
=
val
;
}
static
int
get_opcode_size
(
struct
opcode
op
)
...
...
@@ -1229,19 +1227,19 @@ void CDECL RtlRestoreContext( CONTEXT *context, EXCEPTION_RECORD *rec )
context
->
R14
=
jmp
->
R14
;
context
->
R15
=
jmp
->
R15
;
context
->
Rip
=
jmp
->
Rip
;
context
->
u
.
s
.
Xmm6
=
jmp
->
Xmm6
;
context
->
u
.
s
.
Xmm7
=
jmp
->
Xmm7
;
context
->
u
.
s
.
Xmm8
=
jmp
->
Xmm8
;
context
->
u
.
s
.
Xmm9
=
jmp
->
Xmm9
;
context
->
u
.
s
.
Xmm10
=
jmp
->
Xmm10
;
context
->
u
.
s
.
Xmm11
=
jmp
->
Xmm11
;
context
->
u
.
s
.
Xmm12
=
jmp
->
Xmm12
;
context
->
u
.
s
.
Xmm13
=
jmp
->
Xmm13
;
context
->
u
.
s
.
Xmm14
=
jmp
->
Xmm14
;
context
->
u
.
s
.
Xmm15
=
jmp
->
Xmm15
;
context
->
Xmm6
=
jmp
->
Xmm6
;
context
->
Xmm7
=
jmp
->
Xmm7
;
context
->
Xmm8
=
jmp
->
Xmm8
;
context
->
Xmm9
=
jmp
->
Xmm9
;
context
->
Xmm10
=
jmp
->
Xmm10
;
context
->
Xmm11
=
jmp
->
Xmm11
;
context
->
Xmm12
=
jmp
->
Xmm12
;
context
->
Xmm13
=
jmp
->
Xmm13
;
context
->
Xmm14
=
jmp
->
Xmm14
;
context
->
Xmm15
=
jmp
->
Xmm15
;
context
->
MxCsr
=
jmp
->
MxCsr
;
context
->
u
.
FltSave
.
MxCsr
=
jmp
->
MxCsr
;
context
->
u
.
FltSave
.
ControlWord
=
jmp
->
FpCsr
;
context
->
FltSave
.
MxCsr
=
jmp
->
MxCsr
;
context
->
FltSave
.
ControlWord
=
jmp
->
FpCsr
;
}
else
if
(
rec
&&
rec
->
ExceptionCode
==
STATUS_UNWIND_CONSOLIDATE
&&
rec
->
NumberParameters
>=
1
)
{
...
...
dlls/ntdll/unix/dwarf.h
View file @
da16581e
...
...
@@ -658,62 +658,62 @@ static void *get_context_reg( CONTEXT *context, ULONG_PTR dw_reg )
case
14
:
return
&
context
->
R14
;
case
15
:
return
&
context
->
R15
;
case
16
:
return
&
context
->
Rip
;
case
17
:
return
&
context
->
u
.
s
.
Xmm0
;
case
18
:
return
&
context
->
u
.
s
.
Xmm1
;
case
19
:
return
&
context
->
u
.
s
.
Xmm2
;
case
20
:
return
&
context
->
u
.
s
.
Xmm3
;
case
21
:
return
&
context
->
u
.
s
.
Xmm4
;
case
22
:
return
&
context
->
u
.
s
.
Xmm5
;
case
23
:
return
&
context
->
u
.
s
.
Xmm6
;
case
24
:
return
&
context
->
u
.
s
.
Xmm7
;
case
25
:
return
&
context
->
u
.
s
.
Xmm8
;
case
26
:
return
&
context
->
u
.
s
.
Xmm9
;
case
27
:
return
&
context
->
u
.
s
.
Xmm10
;
case
28
:
return
&
context
->
u
.
s
.
Xmm11
;
case
29
:
return
&
context
->
u
.
s
.
Xmm12
;
case
30
:
return
&
context
->
u
.
s
.
Xmm13
;
case
31
:
return
&
context
->
u
.
s
.
Xmm14
;
case
32
:
return
&
context
->
u
.
s
.
Xmm15
;
case
33
:
return
&
context
->
u
.
s
.
Legacy
[
0
];
case
34
:
return
&
context
->
u
.
s
.
Legacy
[
1
];
case
35
:
return
&
context
->
u
.
s
.
Legacy
[
2
];
case
36
:
return
&
context
->
u
.
s
.
Legacy
[
3
];
case
37
:
return
&
context
->
u
.
s
.
Legacy
[
4
];
case
38
:
return
&
context
->
u
.
s
.
Legacy
[
5
];
case
39
:
return
&
context
->
u
.
s
.
Legacy
[
6
];
case
40
:
return
&
context
->
u
.
s
.
Legacy
[
7
];
case
17
:
return
&
context
->
Xmm0
;
case
18
:
return
&
context
->
Xmm1
;
case
19
:
return
&
context
->
Xmm2
;
case
20
:
return
&
context
->
Xmm3
;
case
21
:
return
&
context
->
Xmm4
;
case
22
:
return
&
context
->
Xmm5
;
case
23
:
return
&
context
->
Xmm6
;
case
24
:
return
&
context
->
Xmm7
;
case
25
:
return
&
context
->
Xmm8
;
case
26
:
return
&
context
->
Xmm9
;
case
27
:
return
&
context
->
Xmm10
;
case
28
:
return
&
context
->
Xmm11
;
case
29
:
return
&
context
->
Xmm12
;
case
30
:
return
&
context
->
Xmm13
;
case
31
:
return
&
context
->
Xmm14
;
case
32
:
return
&
context
->
Xmm15
;
case
33
:
return
&
context
->
Legacy
[
0
];
case
34
:
return
&
context
->
Legacy
[
1
];
case
35
:
return
&
context
->
Legacy
[
2
];
case
36
:
return
&
context
->
Legacy
[
3
];
case
37
:
return
&
context
->
Legacy
[
4
];
case
38
:
return
&
context
->
Legacy
[
5
];
case
39
:
return
&
context
->
Legacy
[
6
];
case
40
:
return
&
context
->
Legacy
[
7
];
#elif defined(__aarch64__)
case
0
:
return
&
context
->
u
.
s
.
X0
;
case
1
:
return
&
context
->
u
.
s
.
X1
;
case
2
:
return
&
context
->
u
.
s
.
X2
;
case
3
:
return
&
context
->
u
.
s
.
X3
;
case
4
:
return
&
context
->
u
.
s
.
X4
;
case
5
:
return
&
context
->
u
.
s
.
X5
;
case
6
:
return
&
context
->
u
.
s
.
X6
;
case
7
:
return
&
context
->
u
.
s
.
X7
;
case
8
:
return
&
context
->
u
.
s
.
X8
;
case
9
:
return
&
context
->
u
.
s
.
X9
;
case
10
:
return
&
context
->
u
.
s
.
X10
;
case
11
:
return
&
context
->
u
.
s
.
X11
;
case
12
:
return
&
context
->
u
.
s
.
X12
;
case
13
:
return
&
context
->
u
.
s
.
X13
;
case
14
:
return
&
context
->
u
.
s
.
X14
;
case
15
:
return
&
context
->
u
.
s
.
X15
;
case
16
:
return
&
context
->
u
.
s
.
X16
;
case
17
:
return
&
context
->
u
.
s
.
X17
;
case
18
:
return
&
context
->
u
.
s
.
X18
;
case
19
:
return
&
context
->
u
.
s
.
X19
;
case
20
:
return
&
context
->
u
.
s
.
X20
;
case
21
:
return
&
context
->
u
.
s
.
X21
;
case
22
:
return
&
context
->
u
.
s
.
X22
;
case
23
:
return
&
context
->
u
.
s
.
X23
;
case
24
:
return
&
context
->
u
.
s
.
X24
;
case
25
:
return
&
context
->
u
.
s
.
X25
;
case
26
:
return
&
context
->
u
.
s
.
X26
;
case
27
:
return
&
context
->
u
.
s
.
X27
;
case
28
:
return
&
context
->
u
.
s
.
X28
;
case
29
:
return
&
context
->
u
.
s
.
Fp
;
case
30
:
return
&
context
->
u
.
s
.
Lr
;
case
0
:
return
&
context
->
X0
;
case
1
:
return
&
context
->
X1
;
case
2
:
return
&
context
->
X2
;
case
3
:
return
&
context
->
X3
;
case
4
:
return
&
context
->
X4
;
case
5
:
return
&
context
->
X5
;
case
6
:
return
&
context
->
X6
;
case
7
:
return
&
context
->
X7
;
case
8
:
return
&
context
->
X8
;
case
9
:
return
&
context
->
X9
;
case
10
:
return
&
context
->
X10
;
case
11
:
return
&
context
->
X11
;
case
12
:
return
&
context
->
X12
;
case
13
:
return
&
context
->
X13
;
case
14
:
return
&
context
->
X14
;
case
15
:
return
&
context
->
X15
;
case
16
:
return
&
context
->
X16
;
case
17
:
return
&
context
->
X17
;
case
18
:
return
&
context
->
X18
;
case
19
:
return
&
context
->
X19
;
case
20
:
return
&
context
->
X20
;
case
21
:
return
&
context
->
X21
;
case
22
:
return
&
context
->
X22
;
case
23
:
return
&
context
->
X23
;
case
24
:
return
&
context
->
X24
;
case
25
:
return
&
context
->
X25
;
case
26
:
return
&
context
->
X26
;
case
27
:
return
&
context
->
X27
;
case
28
:
return
&
context
->
X28
;
case
29
:
return
&
context
->
Fp
;
case
30
:
return
&
context
->
Lr
;
case
31
:
return
&
context
->
Sp
;
case
32
:
return
&
context
->
Pc
;
case
64
:
...
...
@@ -777,62 +777,62 @@ static void set_context_reg( CONTEXT *context, ULONG_PTR dw_reg, void *val )
case
14
:
context
->
R14
=
*
(
ULONG64
*
)
val
;
break
;
case
15
:
context
->
R15
=
*
(
ULONG64
*
)
val
;
break
;
case
16
:
context
->
Rip
=
*
(
ULONG64
*
)
val
;
break
;
case
17
:
memcpy
(
&
context
->
u
.
s
.
Xmm0
,
val
,
sizeof
(
M128A
)
);
break
;
case
18
:
memcpy
(
&
context
->
u
.
s
.
Xmm1
,
val
,
sizeof
(
M128A
)
);
break
;
case
19
:
memcpy
(
&
context
->
u
.
s
.
Xmm2
,
val
,
sizeof
(
M128A
)
);
break
;
case
20
:
memcpy
(
&
context
->
u
.
s
.
Xmm3
,
val
,
sizeof
(
M128A
)
);
break
;
case
21
:
memcpy
(
&
context
->
u
.
s
.
Xmm4
,
val
,
sizeof
(
M128A
)
);
break
;
case
22
:
memcpy
(
&
context
->
u
.
s
.
Xmm5
,
val
,
sizeof
(
M128A
)
);
break
;
case
23
:
memcpy
(
&
context
->
u
.
s
.
Xmm6
,
val
,
sizeof
(
M128A
)
);
break
;
case
24
:
memcpy
(
&
context
->
u
.
s
.
Xmm7
,
val
,
sizeof
(
M128A
)
);
break
;
case
25
:
memcpy
(
&
context
->
u
.
s
.
Xmm8
,
val
,
sizeof
(
M128A
)
);
break
;
case
26
:
memcpy
(
&
context
->
u
.
s
.
Xmm9
,
val
,
sizeof
(
M128A
)
);
break
;
case
27
:
memcpy
(
&
context
->
u
.
s
.
Xmm10
,
val
,
sizeof
(
M128A
)
);
break
;
case
28
:
memcpy
(
&
context
->
u
.
s
.
Xmm11
,
val
,
sizeof
(
M128A
)
);
break
;
case
29
:
memcpy
(
&
context
->
u
.
s
.
Xmm12
,
val
,
sizeof
(
M128A
)
);
break
;
case
30
:
memcpy
(
&
context
->
u
.
s
.
Xmm13
,
val
,
sizeof
(
M128A
)
);
break
;
case
31
:
memcpy
(
&
context
->
u
.
s
.
Xmm14
,
val
,
sizeof
(
M128A
)
);
break
;
case
32
:
memcpy
(
&
context
->
u
.
s
.
Xmm15
,
val
,
sizeof
(
M128A
)
);
break
;
case
33
:
memcpy
(
&
context
->
u
.
s
.
Legacy
[
0
],
val
,
sizeof
(
M128A
)
);
break
;
case
34
:
memcpy
(
&
context
->
u
.
s
.
Legacy
[
1
],
val
,
sizeof
(
M128A
)
);
break
;
case
35
:
memcpy
(
&
context
->
u
.
s
.
Legacy
[
2
],
val
,
sizeof
(
M128A
)
);
break
;
case
36
:
memcpy
(
&
context
->
u
.
s
.
Legacy
[
3
],
val
,
sizeof
(
M128A
)
);
break
;
case
37
:
memcpy
(
&
context
->
u
.
s
.
Legacy
[
4
],
val
,
sizeof
(
M128A
)
);
break
;
case
38
:
memcpy
(
&
context
->
u
.
s
.
Legacy
[
5
],
val
,
sizeof
(
M128A
)
);
break
;
case
39
:
memcpy
(
&
context
->
u
.
s
.
Legacy
[
6
],
val
,
sizeof
(
M128A
)
);
break
;
case
40
:
memcpy
(
&
context
->
u
.
s
.
Legacy
[
7
],
val
,
sizeof
(
M128A
)
);
break
;
case
17
:
memcpy
(
&
context
->
Xmm0
,
val
,
sizeof
(
M128A
)
);
break
;
case
18
:
memcpy
(
&
context
->
Xmm1
,
val
,
sizeof
(
M128A
)
);
break
;
case
19
:
memcpy
(
&
context
->
Xmm2
,
val
,
sizeof
(
M128A
)
);
break
;
case
20
:
memcpy
(
&
context
->
Xmm3
,
val
,
sizeof
(
M128A
)
);
break
;
case
21
:
memcpy
(
&
context
->
Xmm4
,
val
,
sizeof
(
M128A
)
);
break
;
case
22
:
memcpy
(
&
context
->
Xmm5
,
val
,
sizeof
(
M128A
)
);
break
;
case
23
:
memcpy
(
&
context
->
Xmm6
,
val
,
sizeof
(
M128A
)
);
break
;
case
24
:
memcpy
(
&
context
->
Xmm7
,
val
,
sizeof
(
M128A
)
);
break
;
case
25
:
memcpy
(
&
context
->
Xmm8
,
val
,
sizeof
(
M128A
)
);
break
;
case
26
:
memcpy
(
&
context
->
Xmm9
,
val
,
sizeof
(
M128A
)
);
break
;
case
27
:
memcpy
(
&
context
->
Xmm10
,
val
,
sizeof
(
M128A
)
);
break
;
case
28
:
memcpy
(
&
context
->
Xmm11
,
val
,
sizeof
(
M128A
)
);
break
;
case
29
:
memcpy
(
&
context
->
Xmm12
,
val
,
sizeof
(
M128A
)
);
break
;
case
30
:
memcpy
(
&
context
->
Xmm13
,
val
,
sizeof
(
M128A
)
);
break
;
case
31
:
memcpy
(
&
context
->
Xmm14
,
val
,
sizeof
(
M128A
)
);
break
;
case
32
:
memcpy
(
&
context
->
Xmm15
,
val
,
sizeof
(
M128A
)
);
break
;
case
33
:
memcpy
(
&
context
->
Legacy
[
0
],
val
,
sizeof
(
M128A
)
);
break
;
case
34
:
memcpy
(
&
context
->
Legacy
[
1
],
val
,
sizeof
(
M128A
)
);
break
;
case
35
:
memcpy
(
&
context
->
Legacy
[
2
],
val
,
sizeof
(
M128A
)
);
break
;
case
36
:
memcpy
(
&
context
->
Legacy
[
3
],
val
,
sizeof
(
M128A
)
);
break
;
case
37
:
memcpy
(
&
context
->
Legacy
[
4
],
val
,
sizeof
(
M128A
)
);
break
;
case
38
:
memcpy
(
&
context
->
Legacy
[
5
],
val
,
sizeof
(
M128A
)
);
break
;
case
39
:
memcpy
(
&
context
->
Legacy
[
6
],
val
,
sizeof
(
M128A
)
);
break
;
case
40
:
memcpy
(
&
context
->
Legacy
[
7
],
val
,
sizeof
(
M128A
)
);
break
;
#elif defined(__aarch64__)
case
0
:
context
->
u
.
s
.
X0
=
*
(
DWORD64
*
)
val
;
break
;
case
1
:
context
->
u
.
s
.
X1
=
*
(
DWORD64
*
)
val
;
break
;
case
2
:
context
->
u
.
s
.
X2
=
*
(
DWORD64
*
)
val
;
break
;
case
3
:
context
->
u
.
s
.
X3
=
*
(
DWORD64
*
)
val
;
break
;
case
4
:
context
->
u
.
s
.
X4
=
*
(
DWORD64
*
)
val
;
break
;
case
5
:
context
->
u
.
s
.
X5
=
*
(
DWORD64
*
)
val
;
break
;
case
6
:
context
->
u
.
s
.
X6
=
*
(
DWORD64
*
)
val
;
break
;
case
7
:
context
->
u
.
s
.
X7
=
*
(
DWORD64
*
)
val
;
break
;
case
8
:
context
->
u
.
s
.
X8
=
*
(
DWORD64
*
)
val
;
break
;
case
9
:
context
->
u
.
s
.
X9
=
*
(
DWORD64
*
)
val
;
break
;
case
10
:
context
->
u
.
s
.
X10
=
*
(
DWORD64
*
)
val
;
break
;
case
11
:
context
->
u
.
s
.
X11
=
*
(
DWORD64
*
)
val
;
break
;
case
12
:
context
->
u
.
s
.
X12
=
*
(
DWORD64
*
)
val
;
break
;
case
13
:
context
->
u
.
s
.
X13
=
*
(
DWORD64
*
)
val
;
break
;
case
14
:
context
->
u
.
s
.
X14
=
*
(
DWORD64
*
)
val
;
break
;
case
15
:
context
->
u
.
s
.
X15
=
*
(
DWORD64
*
)
val
;
break
;
case
16
:
context
->
u
.
s
.
X16
=
*
(
DWORD64
*
)
val
;
break
;
case
17
:
context
->
u
.
s
.
X17
=
*
(
DWORD64
*
)
val
;
break
;
case
18
:
context
->
u
.
s
.
X18
=
*
(
DWORD64
*
)
val
;
break
;
case
19
:
context
->
u
.
s
.
X19
=
*
(
DWORD64
*
)
val
;
break
;
case
20
:
context
->
u
.
s
.
X20
=
*
(
DWORD64
*
)
val
;
break
;
case
21
:
context
->
u
.
s
.
X21
=
*
(
DWORD64
*
)
val
;
break
;
case
22
:
context
->
u
.
s
.
X22
=
*
(
DWORD64
*
)
val
;
break
;
case
23
:
context
->
u
.
s
.
X23
=
*
(
DWORD64
*
)
val
;
break
;
case
24
:
context
->
u
.
s
.
X24
=
*
(
DWORD64
*
)
val
;
break
;
case
25
:
context
->
u
.
s
.
X25
=
*
(
DWORD64
*
)
val
;
break
;
case
26
:
context
->
u
.
s
.
X26
=
*
(
DWORD64
*
)
val
;
break
;
case
27
:
context
->
u
.
s
.
X27
=
*
(
DWORD64
*
)
val
;
break
;
case
28
:
context
->
u
.
s
.
X28
=
*
(
DWORD64
*
)
val
;
break
;
case
29
:
context
->
u
.
s
.
Fp
=
*
(
DWORD64
*
)
val
;
break
;
case
30
:
context
->
u
.
s
.
Lr
=
*
(
DWORD64
*
)
val
;
break
;
case
0
:
context
->
X0
=
*
(
DWORD64
*
)
val
;
break
;
case
1
:
context
->
X1
=
*
(
DWORD64
*
)
val
;
break
;
case
2
:
context
->
X2
=
*
(
DWORD64
*
)
val
;
break
;
case
3
:
context
->
X3
=
*
(
DWORD64
*
)
val
;
break
;
case
4
:
context
->
X4
=
*
(
DWORD64
*
)
val
;
break
;
case
5
:
context
->
X5
=
*
(
DWORD64
*
)
val
;
break
;
case
6
:
context
->
X6
=
*
(
DWORD64
*
)
val
;
break
;
case
7
:
context
->
X7
=
*
(
DWORD64
*
)
val
;
break
;
case
8
:
context
->
X8
=
*
(
DWORD64
*
)
val
;
break
;
case
9
:
context
->
X9
=
*
(
DWORD64
*
)
val
;
break
;
case
10
:
context
->
X10
=
*
(
DWORD64
*
)
val
;
break
;
case
11
:
context
->
X11
=
*
(
DWORD64
*
)
val
;
break
;
case
12
:
context
->
X12
=
*
(
DWORD64
*
)
val
;
break
;
case
13
:
context
->
X13
=
*
(
DWORD64
*
)
val
;
break
;
case
14
:
context
->
X14
=
*
(
DWORD64
*
)
val
;
break
;
case
15
:
context
->
X15
=
*
(
DWORD64
*
)
val
;
break
;
case
16
:
context
->
X16
=
*
(
DWORD64
*
)
val
;
break
;
case
17
:
context
->
X17
=
*
(
DWORD64
*
)
val
;
break
;
case
18
:
context
->
X18
=
*
(
DWORD64
*
)
val
;
break
;
case
19
:
context
->
X19
=
*
(
DWORD64
*
)
val
;
break
;
case
20
:
context
->
X20
=
*
(
DWORD64
*
)
val
;
break
;
case
21
:
context
->
X21
=
*
(
DWORD64
*
)
val
;
break
;
case
22
:
context
->
X22
=
*
(
DWORD64
*
)
val
;
break
;
case
23
:
context
->
X23
=
*
(
DWORD64
*
)
val
;
break
;
case
24
:
context
->
X24
=
*
(
DWORD64
*
)
val
;
break
;
case
25
:
context
->
X25
=
*
(
DWORD64
*
)
val
;
break
;
case
26
:
context
->
X26
=
*
(
DWORD64
*
)
val
;
break
;
case
27
:
context
->
X27
=
*
(
DWORD64
*
)
val
;
break
;
case
28
:
context
->
X28
=
*
(
DWORD64
*
)
val
;
break
;
case
29
:
context
->
Fp
=
*
(
DWORD64
*
)
val
;
break
;
case
30
:
context
->
Lr
=
*
(
DWORD64
*
)
val
;
break
;
case
31
:
context
->
Sp
=
*
(
DWORD64
*
)
val
;
break
;
case
32
:
context
->
Pc
=
*
(
DWORD64
*
)
val
;
break
;
case
64
:
...
...
dlls/ntdll/unix/signal_arm.c
View file @
da16581e
...
...
@@ -59,8 +59,6 @@
# include <link.h>
#endif
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -135,7 +133,7 @@ static void save_fpu( CONTEXT *context, const ucontext_t *sigcontext )
struct
vfp_sigframe
*
frame
=
get_extended_sigcontext
(
sigcontext
,
0x56465001
);
if
(
!
frame
)
return
;
memcpy
(
context
->
u
.
D
,
frame
->
fpregs
,
sizeof
(
context
->
u
.
D
)
);
memcpy
(
context
->
D
,
frame
->
fpregs
,
sizeof
(
context
->
D
)
);
context
->
Fpscr
=
frame
->
fpscr
;
}
...
...
@@ -144,7 +142,7 @@ static void restore_fpu( const CONTEXT *context, ucontext_t *sigcontext )
struct
vfp_sigframe
*
frame
=
get_extended_sigcontext
(
sigcontext
,
0x56465001
);
if
(
!
frame
)
return
;
memcpy
(
frame
->
fpregs
,
context
->
u
.
D
,
sizeof
(
context
->
u
.
D
)
);
memcpy
(
frame
->
fpregs
,
context
->
D
,
sizeof
(
context
->
D
)
);
frame
->
fpscr
=
context
->
Fpscr
;
}
...
...
@@ -288,7 +286,7 @@ static void pop_vfp(CONTEXT *context, int first, int last)
int
i
;
for
(
i
=
first
;
i
<=
last
;
i
++
)
{
context
->
u
.
D
[
i
]
=
*
(
ULONGLONG
*
)
context
->
Sp
;
context
->
D
[
i
]
=
*
(
ULONGLONG
*
)
context
->
Sp
;
context
->
Sp
+=
8
;
}
}
...
...
@@ -943,7 +941,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
if
(
flags
&
CONTEXT_FLOATING_POINT
)
{
frame
->
fpscr
=
context
->
Fpscr
;
memcpy
(
frame
->
d
,
context
->
u
.
D
,
sizeof
(
context
->
u
.
D
)
);
memcpy
(
frame
->
d
,
context
->
D
,
sizeof
(
context
->
D
)
);
}
frame
->
restore_flags
|=
flags
&
~
CONTEXT_INTEGER
;
return
STATUS_SUCCESS
;
...
...
@@ -994,7 +992,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
if
(
needed_flags
&
CONTEXT_FLOATING_POINT
)
{
context
->
Fpscr
=
frame
->
fpscr
;
memcpy
(
context
->
u
.
D
,
frame
->
d
,
sizeof
(
frame
->
d
)
);
memcpy
(
context
->
D
,
frame
->
d
,
sizeof
(
frame
->
d
)
);
context
->
ContextFlags
|=
CONTEXT_FLOATING_POINT
;
}
return
STATUS_SUCCESS
;
...
...
dlls/ntdll/unix/signal_arm64.c
View file @
da16581e
...
...
@@ -55,8 +55,6 @@
# include <libunwind.h>
#endif
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -273,7 +271,7 @@ static NTSTATUS dwarf_virtual_unwind( ULONG64 ip, ULONG64 *frame, CONTEXT *conte
apply_frame_state
(
context
,
&
info
.
state
,
bases
);
context
->
ContextFlags
|=
CONTEXT_UNWOUND_TO_CALL
;
/* Set Pc based on Lr; libunwind also does this as part of unw_step. */
context
->
Pc
=
context
->
u
.
s
.
Lr
;
context
->
Pc
=
context
->
Lr
;
if
(
bases
->
func
==
(
void
*
)
raise_func_trampoline
)
{
/* raise_func_trampoline has a full CONTEXT stored on the stack;
...
...
@@ -283,26 +281,26 @@ static NTSTATUS dwarf_virtual_unwind( ULONG64 ip, ULONG64 *frame, CONTEXT *conte
* We could also just restore the full context here without doing
* unw_step at all. */
const
CONTEXT
*
next_ctx
=
(
const
CONTEXT
*
)
*
frame
;
context
->
u
.
s
.
Lr
=
next_ctx
->
u
.
s
.
Lr
;
context
->
Lr
=
next_ctx
->
Lr
;
}
TRACE
(
"next function pc=%016lx
\n
"
,
context
->
Pc
);
TRACE
(
" x0=%016lx x1=%016lx x2=%016lx x3=%016lx
\n
"
,
context
->
u
.
s
.
X0
,
context
->
u
.
s
.
X1
,
context
->
u
.
s
.
X2
,
context
->
u
.
s
.
X3
);
context
->
X0
,
context
->
X1
,
context
->
X2
,
context
->
X3
);
TRACE
(
" x4=%016lx x5=%016lx x6=%016lx x7=%016lx
\n
"
,
context
->
u
.
s
.
X4
,
context
->
u
.
s
.
X5
,
context
->
u
.
s
.
X6
,
context
->
u
.
s
.
X7
);
context
->
X4
,
context
->
X5
,
context
->
X6
,
context
->
X7
);
TRACE
(
" x8=%016lx x9=%016lx x10=%016lx x11=%016lx
\n
"
,
context
->
u
.
s
.
X8
,
context
->
u
.
s
.
X9
,
context
->
u
.
s
.
X10
,
context
->
u
.
s
.
X11
);
context
->
X8
,
context
->
X9
,
context
->
X10
,
context
->
X11
);
TRACE
(
" x12=%016lx x13=%016lx x14=%016lx x15=%016lx
\n
"
,
context
->
u
.
s
.
X12
,
context
->
u
.
s
.
X13
,
context
->
u
.
s
.
X14
,
context
->
u
.
s
.
X15
);
context
->
X12
,
context
->
X13
,
context
->
X14
,
context
->
X15
);
TRACE
(
" x16=%016lx x17=%016lx x18=%016lx x19=%016lx
\n
"
,
context
->
u
.
s
.
X16
,
context
->
u
.
s
.
X17
,
context
->
u
.
s
.
X18
,
context
->
u
.
s
.
X19
);
context
->
X16
,
context
->
X17
,
context
->
X18
,
context
->
X19
);
TRACE
(
" x20=%016lx x21=%016lx x22=%016lx x23=%016lx
\n
"
,
context
->
u
.
s
.
X20
,
context
->
u
.
s
.
X21
,
context
->
u
.
s
.
X22
,
context
->
u
.
s
.
X23
);
context
->
X20
,
context
->
X21
,
context
->
X22
,
context
->
X23
);
TRACE
(
" x24=%016lx x25=%016lx x26=%016lx x27=%016lx
\n
"
,
context
->
u
.
s
.
X24
,
context
->
u
.
s
.
X25
,
context
->
u
.
s
.
X26
,
context
->
u
.
s
.
X27
);
context
->
X24
,
context
->
X25
,
context
->
X26
,
context
->
X27
);
TRACE
(
" x28=%016lx fp=%016lx lr=%016lx sp=%016lx
\n
"
,
context
->
u
.
s
.
X28
,
context
->
u
.
s
.
Fp
,
context
->
u
.
s
.
Lr
,
context
->
Sp
);
context
->
X28
,
context
->
Fp
,
context
->
Lr
,
context
->
Sp
);
return
STATUS_SUCCESS
;
}
...
...
@@ -325,14 +323,14 @@ static NTSTATUS libunwind_virtual_unwind( ULONG_PTR ip, ULONG_PTR *frame, CONTEX
{
int
i
;
for
(
i
=
0
;
i
<=
28
;
i
++
)
unw_set_reg
(
&
cursor
,
UNW_ARM64_X0
+
i
,
context
->
u
.
X
[
i
]
);
unw_set_reg
(
&
cursor
,
UNW_ARM64_FP
,
context
->
u
.
s
.
Fp
);
unw_set_reg
(
&
cursor
,
UNW_ARM64_LR
,
context
->
u
.
s
.
Lr
);
unw_set_reg
(
&
cursor
,
UNW_ARM64_X0
+
i
,
context
->
X
[
i
]
);
unw_set_reg
(
&
cursor
,
UNW_ARM64_FP
,
context
->
Fp
);
unw_set_reg
(
&
cursor
,
UNW_ARM64_LR
,
context
->
Lr
);
unw_set_reg
(
&
cursor
,
UNW_ARM64_SP
,
context
->
Sp
);
unw_set_reg
(
&
cursor
,
UNW_REG_IP
,
context
->
Pc
);
}
#else
memcpy
(
unw_context
.
uc_mcontext
.
regs
,
context
->
u
.
X
,
sizeof
(
context
->
u
.
X
)
);
memcpy
(
unw_context
.
uc_mcontext
.
regs
,
context
->
X
,
sizeof
(
context
->
X
)
);
unw_context
.
uc_mcontext
.
sp
=
context
->
Sp
;
unw_context
.
uc_mcontext
.
pc
=
context
->
Pc
;
...
...
@@ -356,7 +354,7 @@ static NTSTATUS libunwind_virtual_unwind( ULONG_PTR ip, ULONG_PTR *frame, CONTEX
ip
,
info
.
start_ip
,
info
.
end_ip
);
*
handler
=
NULL
;
*
frame
=
context
->
Sp
;
context
->
Pc
=
context
->
u
.
s
.
Lr
;
context
->
Pc
=
context
->
Lr
;
context
->
ContextFlags
|=
CONTEXT_UNWOUND_TO_CALL
;
return
STATUS_SUCCESS
;
}
...
...
@@ -379,43 +377,43 @@ static NTSTATUS libunwind_virtual_unwind( ULONG_PTR ip, ULONG_PTR *frame, CONTEX
{
int
i
;
for
(
i
=
0
;
i
<=
28
;
i
++
)
unw_get_reg
(
&
cursor
,
UNW_ARM64_X0
+
i
,
(
unw_word_t
*
)
&
context
->
u
.
X
[
i
]
);
unw_get_reg
(
&
cursor
,
UNW_ARM64_X0
+
i
,
(
unw_word_t
*
)
&
context
->
X
[
i
]
);
}
unw_get_reg
(
&
cursor
,
UNW_ARM64_FP
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
Fp
);
unw_get_reg
(
&
cursor
,
UNW_ARM64_X30
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
Lr
);
unw_get_reg
(
&
cursor
,
UNW_ARM64_FP
,
(
unw_word_t
*
)
&
context
->
Fp
);
unw_get_reg
(
&
cursor
,
UNW_ARM64_X30
,
(
unw_word_t
*
)
&
context
->
Lr
);
unw_get_reg
(
&
cursor
,
UNW_ARM64_SP
,
(
unw_word_t
*
)
&
context
->
Sp
);
#else
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X0
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X0
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X1
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X1
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X2
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X2
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X3
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X3
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X4
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X4
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X5
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X5
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X6
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X6
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X7
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X7
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X8
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X8
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X9
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X9
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X10
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X10
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X11
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X11
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X12
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X12
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X13
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X13
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X14
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X14
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X15
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X15
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X16
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X16
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X17
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X17
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X18
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X18
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X19
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X19
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X20
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X20
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X21
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X21
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X22
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X22
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X23
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X23
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X24
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X24
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X25
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X25
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X26
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X26
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X27
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X27
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X28
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
X28
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X29
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
Fp
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X30
,
(
unw_word_t
*
)
&
context
->
u
.
s
.
Lr
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X0
,
(
unw_word_t
*
)
&
context
->
X0
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X1
,
(
unw_word_t
*
)
&
context
->
X1
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X2
,
(
unw_word_t
*
)
&
context
->
X2
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X3
,
(
unw_word_t
*
)
&
context
->
X3
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X4
,
(
unw_word_t
*
)
&
context
->
X4
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X5
,
(
unw_word_t
*
)
&
context
->
X5
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X6
,
(
unw_word_t
*
)
&
context
->
X6
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X7
,
(
unw_word_t
*
)
&
context
->
X7
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X8
,
(
unw_word_t
*
)
&
context
->
X8
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X9
,
(
unw_word_t
*
)
&
context
->
X9
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X10
,
(
unw_word_t
*
)
&
context
->
X10
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X11
,
(
unw_word_t
*
)
&
context
->
X11
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X12
,
(
unw_word_t
*
)
&
context
->
X12
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X13
,
(
unw_word_t
*
)
&
context
->
X13
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X14
,
(
unw_word_t
*
)
&
context
->
X14
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X15
,
(
unw_word_t
*
)
&
context
->
X15
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X16
,
(
unw_word_t
*
)
&
context
->
X16
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X17
,
(
unw_word_t
*
)
&
context
->
X17
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X18
,
(
unw_word_t
*
)
&
context
->
X18
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X19
,
(
unw_word_t
*
)
&
context
->
X19
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X20
,
(
unw_word_t
*
)
&
context
->
X20
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X21
,
(
unw_word_t
*
)
&
context
->
X21
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X22
,
(
unw_word_t
*
)
&
context
->
X22
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X23
,
(
unw_word_t
*
)
&
context
->
X23
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X24
,
(
unw_word_t
*
)
&
context
->
X24
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X25
,
(
unw_word_t
*
)
&
context
->
X25
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X26
,
(
unw_word_t
*
)
&
context
->
X26
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X27
,
(
unw_word_t
*
)
&
context
->
X27
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X28
,
(
unw_word_t
*
)
&
context
->
X28
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X29
,
(
unw_word_t
*
)
&
context
->
Fp
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_X30
,
(
unw_word_t
*
)
&
context
->
Lr
);
unw_get_reg
(
&
cursor
,
UNW_AARCH64_SP
,
(
unw_word_t
*
)
&
context
->
Sp
);
#endif
unw_get_reg
(
&
cursor
,
UNW_REG_IP
,
(
unw_word_t
*
)
&
context
->
Pc
);
...
...
@@ -429,26 +427,26 @@ static NTSTATUS libunwind_virtual_unwind( ULONG_PTR ip, ULONG_PTR *frame, CONTEX
* We could also just restore the full context here without doing
* unw_step at all. */
const
CONTEXT
*
next_ctx
=
(
const
CONTEXT
*
)
*
frame
;
context
->
u
.
s
.
Lr
=
next_ctx
->
u
.
s
.
Lr
;
context
->
Lr
=
next_ctx
->
Lr
;
}
TRACE
(
"next function pc=%016lx%s
\n
"
,
context
->
Pc
,
rc
?
""
:
" (last frame)"
);
TRACE
(
" x0=%016lx x1=%016lx x2=%016lx x3=%016lx
\n
"
,
context
->
u
.
s
.
X0
,
context
->
u
.
s
.
X1
,
context
->
u
.
s
.
X2
,
context
->
u
.
s
.
X3
);
context
->
X0
,
context
->
X1
,
context
->
X2
,
context
->
X3
);
TRACE
(
" x4=%016lx x5=%016lx x6=%016lx x7=%016lx
\n
"
,
context
->
u
.
s
.
X4
,
context
->
u
.
s
.
X5
,
context
->
u
.
s
.
X6
,
context
->
u
.
s
.
X7
);
context
->
X4
,
context
->
X5
,
context
->
X6
,
context
->
X7
);
TRACE
(
" x8=%016lx x9=%016lx x10=%016lx x11=%016lx
\n
"
,
context
->
u
.
s
.
X8
,
context
->
u
.
s
.
X9
,
context
->
u
.
s
.
X10
,
context
->
u
.
s
.
X11
);
context
->
X8
,
context
->
X9
,
context
->
X10
,
context
->
X11
);
TRACE
(
" x12=%016lx x13=%016lx x14=%016lx x15=%016lx
\n
"
,
context
->
u
.
s
.
X12
,
context
->
u
.
s
.
X13
,
context
->
u
.
s
.
X14
,
context
->
u
.
s
.
X15
);
context
->
X12
,
context
->
X13
,
context
->
X14
,
context
->
X15
);
TRACE
(
" x16=%016lx x17=%016lx x18=%016lx x19=%016lx
\n
"
,
context
->
u
.
s
.
X16
,
context
->
u
.
s
.
X17
,
context
->
u
.
s
.
X18
,
context
->
u
.
s
.
X19
);
context
->
X16
,
context
->
X17
,
context
->
X18
,
context
->
X19
);
TRACE
(
" x20=%016lx x21=%016lx x22=%016lx x23=%016lx
\n
"
,
context
->
u
.
s
.
X20
,
context
->
u
.
s
.
X21
,
context
->
u
.
s
.
X22
,
context
->
u
.
s
.
X23
);
context
->
X20
,
context
->
X21
,
context
->
X22
,
context
->
X23
);
TRACE
(
" x24=%016lx x25=%016lx x26=%016lx x27=%016lx
\n
"
,
context
->
u
.
s
.
X24
,
context
->
u
.
s
.
X25
,
context
->
u
.
s
.
X26
,
context
->
u
.
s
.
X27
);
context
->
X24
,
context
->
X25
,
context
->
X26
,
context
->
X27
);
TRACE
(
" x28=%016lx fp=%016lx lr=%016lx sp=%016lx
\n
"
,
context
->
u
.
s
.
X28
,
context
->
u
.
s
.
Fp
,
context
->
u
.
s
.
Lr
,
context
->
Sp
);
context
->
X28
,
context
->
Fp
,
context
->
Lr
,
context
->
Sp
);
return
STATUS_SUCCESS
;
}
#endif
...
...
@@ -535,12 +533,12 @@ static void save_context( CONTEXT *context, const ucontext_t *sigcontext )
DWORD
i
;
context
->
ContextFlags
=
CONTEXT_FULL
;
context
->
u
.
s
.
Fp
=
FP_sig
(
sigcontext
);
/* Frame pointer */
context
->
u
.
s
.
Lr
=
LR_sig
(
sigcontext
);
/* Link register */
context
->
Fp
=
FP_sig
(
sigcontext
);
/* Frame pointer */
context
->
Lr
=
LR_sig
(
sigcontext
);
/* Link register */
context
->
Sp
=
SP_sig
(
sigcontext
);
/* Stack pointer */
context
->
Pc
=
PC_sig
(
sigcontext
);
/* Program Counter */
context
->
Cpsr
=
PSTATE_sig
(
sigcontext
);
/* Current State Register */
for
(
i
=
0
;
i
<=
28
;
i
++
)
context
->
u
.
X
[
i
]
=
REGn_sig
(
i
,
sigcontext
);
for
(
i
=
0
;
i
<=
28
;
i
++
)
context
->
X
[
i
]
=
REGn_sig
(
i
,
sigcontext
);
save_fpu
(
context
,
sigcontext
);
}
...
...
@@ -554,12 +552,12 @@ static void restore_context( const CONTEXT *context, ucontext_t *sigcontext )
{
DWORD
i
;
FP_sig
(
sigcontext
)
=
context
->
u
.
s
.
Fp
;
/* Frame pointer */
LR_sig
(
sigcontext
)
=
context
->
u
.
s
.
Lr
;
/* Link register */
FP_sig
(
sigcontext
)
=
context
->
Fp
;
/* Frame pointer */
LR_sig
(
sigcontext
)
=
context
->
Lr
;
/* Link register */
SP_sig
(
sigcontext
)
=
context
->
Sp
;
/* Stack pointer */
PC_sig
(
sigcontext
)
=
context
->
Pc
;
/* Program Counter */
PSTATE_sig
(
sigcontext
)
=
context
->
Cpsr
;
/* Current State Register */
for
(
i
=
0
;
i
<=
28
;
i
++
)
REGn_sig
(
i
,
sigcontext
)
=
context
->
u
.
X
[
i
];
for
(
i
=
0
;
i
<=
28
;
i
++
)
REGn_sig
(
i
,
sigcontext
)
=
context
->
X
[
i
];
restore_fpu
(
context
,
sigcontext
);
}
...
...
@@ -615,14 +613,14 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
if
(
flags
&
CONTEXT_INTEGER
)
{
memcpy
(
frame
->
x
,
context
->
u
.
X
,
sizeof
(
context
->
u
.
X
[
0
])
*
18
);
memcpy
(
frame
->
x
,
context
->
X
,
sizeof
(
context
->
X
[
0
])
*
18
);
/* skip x18 */
memcpy
(
frame
->
x
+
19
,
context
->
u
.
X
+
19
,
sizeof
(
context
->
u
.
X
[
0
])
*
10
);
memcpy
(
frame
->
x
+
19
,
context
->
X
+
19
,
sizeof
(
context
->
X
[
0
])
*
10
);
}
if
(
flags
&
CONTEXT_CONTROL
)
{
frame
->
fp
=
context
->
u
.
s
.
Fp
;
frame
->
lr
=
context
->
u
.
s
.
Lr
;
frame
->
fp
=
context
->
Fp
;
frame
->
lr
=
context
->
Lr
;
frame
->
sp
=
context
->
Sp
;
frame
->
pc
=
context
->
Pc
;
frame
->
cpsr
=
context
->
Cpsr
;
...
...
@@ -635,7 +633,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
}
if
(
flags
&
CONTEXT_ARM64_X18
)
{
frame
->
x
[
18
]
=
context
->
u
.
X
[
18
];
frame
->
x
[
18
]
=
context
->
X
[
18
];
}
if
(
flags
&
CONTEXT_DEBUG_REGISTERS
)
FIXME
(
"debug registers not supported
\n
"
);
frame
->
restore_flags
|=
flags
&
~
CONTEXT_INTEGER
;
...
...
@@ -661,13 +659,13 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
if
(
needed_flags
&
CONTEXT_INTEGER
)
{
memcpy
(
context
->
u
.
X
,
frame
->
x
,
sizeof
(
context
->
u
.
X
[
0
])
*
29
);
memcpy
(
context
->
X
,
frame
->
x
,
sizeof
(
context
->
X
[
0
])
*
29
);
context
->
ContextFlags
|=
CONTEXT_INTEGER
;
}
if
(
needed_flags
&
CONTEXT_CONTROL
)
{
context
->
u
.
s
.
Fp
=
frame
->
fp
;
context
->
u
.
s
.
Lr
=
frame
->
lr
;
context
->
Fp
=
frame
->
fp
;
context
->
Lr
=
frame
->
lr
;
context
->
Sp
=
frame
->
sp
;
context
->
Pc
=
frame
->
pc
;
context
->
Cpsr
=
frame
->
cpsr
;
...
...
@@ -799,7 +797,7 @@ NTSTATUS set_thread_wow64_context( HANDLE handle, const void *ctx, ULONG size )
if
(
flags
&
CONTEXT_FLOATING_POINT
)
{
wow_frame
->
Fpscr
=
context
->
Fpscr
;
memcpy
(
wow_frame
->
u
.
D
,
context
->
u
.
D
,
sizeof
(
context
->
u
.
D
)
);
memcpy
(
wow_frame
->
D
,
context
->
D
,
sizeof
(
context
->
D
)
);
}
break
;
}
...
...
@@ -924,7 +922,7 @@ NTSTATUS get_thread_wow64_context( HANDLE handle, void *ctx, ULONG size )
if
(
needed_flags
&
CONTEXT_FLOATING_POINT
)
{
context
->
Fpscr
=
wow_frame
->
Fpscr
;
memcpy
(
context
->
u
.
D
,
wow_frame
->
u
.
D
,
sizeof
(
wow_frame
->
u
.
D
)
);
memcpy
(
context
->
D
,
wow_frame
->
D
,
sizeof
(
wow_frame
->
D
)
);
context
->
ContextFlags
|=
CONTEXT_FLOATING_POINT
;
}
break
;
...
...
@@ -1045,7 +1043,7 @@ NTSTATUS call_user_apc_dispatcher( CONTEXT *context, ULONG_PTR arg1, ULONG_PTR a
{
stack
->
context
.
ContextFlags
=
CONTEXT_FULL
;
NtGetContextThread
(
GetCurrentThread
(),
&
stack
->
context
);
stack
->
context
.
u
.
s
.
X0
=
status
;
stack
->
context
.
X0
=
status
;
}
frame
->
sp
=
(
ULONG64
)
stack
;
frame
->
pc
=
(
ULONG64
)
pKiUserApcDispatcher
;
...
...
@@ -1339,7 +1337,7 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext )
rec
.
ExceptionAddress
=
(
void
*
)
ctx
.
Pc
;
rec
.
ExceptionFlags
=
EH_NONCONTINUABLE
;
rec
.
NumberParameters
=
1
;
rec
.
ExceptionInformation
[
0
]
=
ctx
.
u
.
X
[
0
];
rec
.
ExceptionInformation
[
0
]
=
ctx
.
X
[
0
];
NtRaiseException
(
&
rec
,
&
ctx
,
FALSE
);
return
;
}
...
...
@@ -1607,9 +1605,9 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
I386_CONTEXT
*
i386_context
;
ARM_CONTEXT
*
arm_context
;
context
.
u
.
s
.
X0
=
(
DWORD64
)
entry
;
context
.
u
.
s
.
X1
=
(
DWORD64
)
arg
;
context
.
u
.
s
.
X18
=
(
DWORD64
)
teb
;
context
.
X0
=
(
DWORD64
)
entry
;
context
.
X1
=
(
DWORD64
)
arg
;
context
.
X18
=
(
DWORD64
)
teb
;
context
.
Sp
=
(
DWORD64
)
teb
->
Tib
.
StackBase
;
context
.
Pc
=
(
DWORD64
)
pRtlUserThreadStart
;
...
...
dlls/ntdll/unix/signal_x86_64.c
View file @
da16581e
...
...
@@ -65,8 +65,6 @@
# include <mach/mach.h>
#endif
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
@@ -894,8 +892,8 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex
XSTATE
*
xs
;
context
->
ContextFlags
|=
CONTEXT_FLOATING_POINT
;
context
->
u
.
FltSave
=
*
FPU_sig
(
sigcontext
);
context
->
MxCsr
=
context
->
u
.
FltSave
.
MxCsr
;
context
->
FltSave
=
*
FPU_sig
(
sigcontext
);
context
->
MxCsr
=
context
->
FltSave
.
MxCsr
;
if
((
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_AVX
)
&&
(
xs
=
XState_sig
(
FPU_sig
(
sigcontext
))))
{
/* xcontext and sigcontext are both on the signal stack, so we can
...
...
@@ -925,7 +923,7 @@ static void restore_context( const struct xcontext *xcontext, ucontext_t *sigcon
amd64_thread_data
()
->
dr6
=
context
->
Dr6
;
amd64_thread_data
()
->
dr7
=
context
->
Dr7
;
set_sigcontext
(
context
,
sigcontext
);
if
(
FPU_sig
(
sigcontext
))
*
FPU_sig
(
sigcontext
)
=
context
->
u
.
FltSave
;
if
(
FPU_sig
(
sigcontext
))
*
FPU_sig
(
sigcontext
)
=
context
->
FltSave
;
if
((
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_AVX
)
&&
(
xs
=
XState_sig
(
FPU_sig
(
sigcontext
))))
xs
->
CompactionMask
=
xcontext
->
host_compaction_mask
;
leave_handler
(
sigcontext
);
...
...
@@ -1051,7 +1049,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
}
if
(
flags
&
CONTEXT_FLOATING_POINT
)
{
frame
->
xsave
=
context
->
u
.
FltSave
;
frame
->
xsave
=
context
->
FltSave
;
frame
->
xstate
.
Mask
|=
XSTATE_MASK_LEGACY
;
}
if
(
flags
&
CONTEXT_XSTATE
)
...
...
@@ -1132,34 +1130,34 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
if
(
!
xstate_compaction_enabled
||
(
frame
->
xstate
.
Mask
&
XSTATE_MASK_LEGACY_FLOATING_POINT
))
{
memcpy
(
&
context
->
u
.
FltSave
,
&
frame
->
xsave
,
FIELD_OFFSET
(
XSAVE_FORMAT
,
MxCsr
));
memcpy
(
context
->
u
.
FltSave
.
FloatRegisters
,
frame
->
xsave
.
FloatRegisters
,
sizeof
(
context
->
u
.
FltSave
.
FloatRegisters
));
memcpy
(
&
context
->
FltSave
,
&
frame
->
xsave
,
FIELD_OFFSET
(
XSAVE_FORMAT
,
MxCsr
));
memcpy
(
context
->
FltSave
.
FloatRegisters
,
frame
->
xsave
.
FloatRegisters
,
sizeof
(
context
->
FltSave
.
FloatRegisters
));
}
else
{
memset
(
&
context
->
u
.
FltSave
,
0
,
FIELD_OFFSET
(
XSAVE_FORMAT
,
MxCsr
));
memset
(
context
->
u
.
FltSave
.
FloatRegisters
,
0
,
sizeof
(
context
->
u
.
FltSave
.
FloatRegisters
));
context
->
u
.
FltSave
.
ControlWord
=
0x37f
;
memset
(
&
context
->
FltSave
,
0
,
FIELD_OFFSET
(
XSAVE_FORMAT
,
MxCsr
));
memset
(
context
->
FltSave
.
FloatRegisters
,
0
,
sizeof
(
context
->
FltSave
.
FloatRegisters
));
context
->
FltSave
.
ControlWord
=
0x37f
;
}
if
(
!
xstate_compaction_enabled
||
(
frame
->
xstate
.
Mask
&
XSTATE_MASK_LEGACY_SSE
))
{
memcpy
(
context
->
u
.
FltSave
.
XmmRegisters
,
frame
->
xsave
.
XmmRegisters
,
sizeof
(
context
->
u
.
FltSave
.
XmmRegisters
));
context
->
u
.
FltSave
.
MxCsr
=
frame
->
xsave
.
MxCsr
;
context
->
u
.
FltSave
.
MxCsr_Mask
=
frame
->
xsave
.
MxCsr_Mask
;
memcpy
(
context
->
FltSave
.
XmmRegisters
,
frame
->
xsave
.
XmmRegisters
,
sizeof
(
context
->
FltSave
.
XmmRegisters
));
context
->
FltSave
.
MxCsr
=
frame
->
xsave
.
MxCsr
;
context
->
FltSave
.
MxCsr_Mask
=
frame
->
xsave
.
MxCsr_Mask
;
}
else
{
memset
(
context
->
u
.
FltSave
.
XmmRegisters
,
0
,
sizeof
(
context
->
u
.
FltSave
.
XmmRegisters
));
context
->
u
.
FltSave
.
MxCsr
=
0x1f80
;
context
->
u
.
FltSave
.
MxCsr_Mask
=
0x2ffff
;
memset
(
context
->
FltSave
.
XmmRegisters
,
0
,
sizeof
(
context
->
FltSave
.
XmmRegisters
));
context
->
FltSave
.
MxCsr
=
0x1f80
;
context
->
FltSave
.
MxCsr_Mask
=
0x2ffff
;
}
context
->
MxCsr
=
context
->
u
.
FltSave
.
MxCsr
;
context
->
MxCsr
=
context
->
FltSave
.
MxCsr
;
context
->
ContextFlags
|=
CONTEXT_FLOATING_POINT
;
}
if
((
needed_flags
&
CONTEXT_XSTATE
)
&&
(
cpu_info
.
ProcessorFeatureBits
&
CPU_FEATURE_AVX
))
...
...
@@ -2548,8 +2546,8 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
context
.
SegGs
=
ds64_sel
;
context
.
SegSs
=
ds64_sel
;
context
.
EFlags
=
0x200
;
context
.
u
.
FltSave
.
ControlWord
=
0x27f
;
context
.
u
.
FltSave
.
MxCsr
=
context
.
MxCsr
=
0x1f80
;
context
.
FltSave
.
ControlWord
=
0x27f
;
context
.
FltSave
.
MxCsr
=
context
.
MxCsr
=
0x1f80
;
if
((
wow_context
=
get_cpu_area
(
IMAGE_FILE_MACHINE_I386
)))
{
...
...
@@ -2565,8 +2563,8 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
wow_context
->
SegGs
=
context
.
SegGs
;
wow_context
->
SegSs
=
context
.
SegSs
;
wow_context
->
EFlags
=
0x202
;
wow_context
->
FloatSave
.
ControlWord
=
context
.
u
.
FltSave
.
ControlWord
;
*
(
XSAVE_FORMAT
*
)
wow_context
->
ExtendedRegisters
=
context
.
u
.
FltSave
;
wow_context
->
FloatSave
.
ControlWord
=
context
.
FltSave
.
ControlWord
;
*
(
XSAVE_FORMAT
*
)
wow_context
->
ExtendedRegisters
=
context
.
FltSave
;
}
if
(
suspend
)
wait_suspend
(
&
context
);
...
...
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