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
02ebacca
Commit
02ebacca
authored
Feb 13, 2024
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move find_function_info() to the CPU backends.
parent
215a8e68
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
37 deletions
+97
-37
exception.c
dlls/ntdll/exception.c
+0
-36
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+0
-1
signal_arm.c
dlls/ntdll/signal_arm.c
+26
-0
signal_arm64.c
dlls/ntdll/signal_arm64.c
+27
-0
signal_arm64ec.c
dlls/ntdll/signal_arm64ec.c
+22
-0
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+22
-0
No files found.
dlls/ntdll/exception.c
View file @
02ebacca
...
...
@@ -626,42 +626,6 @@ RUNTIME_FUNCTION *lookup_dynamic_function_table( ULONG_PTR pc, ULONG_PTR *base,
return
ret
;
}
/* helper for lookup_function_info() */
RUNTIME_FUNCTION
*
find_function_info
(
ULONG_PTR
pc
,
ULONG_PTR
base
,
RUNTIME_FUNCTION
*
func
,
ULONG
size
)
{
int
min
=
0
;
int
max
=
size
-
1
;
while
(
min
<=
max
)
{
#ifdef __x86_64__
int
pos
=
(
min
+
max
)
/
2
;
if
(
pc
<
base
+
func
[
pos
].
BeginAddress
)
max
=
pos
-
1
;
else
if
(
pc
>=
base
+
func
[
pos
].
EndAddress
)
min
=
pos
+
1
;
else
{
func
+=
pos
;
while
(
func
->
UnwindData
&
1
)
/* follow chained entry */
func
=
(
RUNTIME_FUNCTION
*
)(
base
+
(
func
->
UnwindData
&
~
1
));
return
func
;
}
#elif defined(__arm__)
int
pos
=
(
min
+
max
)
/
2
;
if
(
pc
<
base
+
(
func
[
pos
].
BeginAddress
&
~
1
))
max
=
pos
-
1
;
else
if
(
pc
>=
base
+
get_runtime_function_end
(
&
func
[
pos
],
base
))
min
=
pos
+
1
;
else
return
func
+
pos
;
#else
/* __aarch64__ */
int
pos
=
(
min
+
max
)
/
2
;
if
(
pc
<
base
+
func
[
pos
].
BeginAddress
)
max
=
pos
-
1
;
else
if
(
pc
>=
base
+
get_runtime_function_end
(
&
func
[
pos
],
base
))
min
=
pos
+
1
;
else
return
func
+
pos
;
#endif
}
return
NULL
;
}
#endif
/* __x86_64__ || __arm__ || __aarch64__ */
...
...
dlls/ntdll/ntdll_misc.h
View file @
02ebacca
...
...
@@ -86,7 +86,6 @@ extern void (WINAPI *pWow64PrepareForException)( EXCEPTION_RECORD *rec, CONTEXT
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
extern
RUNTIME_FUNCTION
*
lookup_dynamic_function_table
(
ULONG_PTR
pc
,
ULONG_PTR
*
base
,
ULONG
*
count
);
extern
RUNTIME_FUNCTION
*
find_function_info
(
ULONG_PTR
pc
,
ULONG_PTR
base
,
RUNTIME_FUNCTION
*
func
,
ULONG
size
);
#endif
/* debug helpers */
...
...
dlls/ntdll/signal_arm.c
View file @
02ebacca
...
...
@@ -1113,6 +1113,32 @@ static void *unwind_full_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION *f
return
NULL
;
}
/**********************************************************************
* find_function_info
*/
static
RUNTIME_FUNCTION
*
find_function_info
(
ULONG_PTR
pc
,
ULONG_PTR
base
,
RUNTIME_FUNCTION
*
func
,
ULONG
size
)
{
int
min
=
0
;
int
max
=
size
-
1
;
while
(
min
<=
max
)
{
int
pos
=
(
min
+
max
)
/
2
;
ULONG_PTR
start
=
base
+
(
func
[
pos
].
BeginAddress
&
~
1
);
if
(
pc
>=
start
)
{
struct
unwind_info
*
info
=
(
struct
unwind_info
*
)(
base
+
func
[
pos
].
UnwindData
);
if
(
pc
<
start
+
2
*
(
func
[
pos
].
Flag
?
func
[
pos
].
FunctionLength
:
info
->
function_length
))
return
func
+
pos
;
min
=
pos
+
1
;
}
else
max
=
pos
-
1
;
}
return
NULL
;
}
/***********************************************************************
* RtlVirtualUnwind (NTDLL.@)
*/
...
...
dlls/ntdll/signal_arm64.c
View file @
02ebacca
...
...
@@ -1015,6 +1015,33 @@ static void *unwind_full_data( ULONG_PTR base, ULONG_PTR pc, RUNTIME_FUNCTION *f
/**********************************************************************
* find_function_info
*/
static
RUNTIME_FUNCTION
*
find_function_info
(
ULONG_PTR
pc
,
ULONG_PTR
base
,
RUNTIME_FUNCTION
*
func
,
ULONG
size
)
{
int
min
=
0
;
int
max
=
size
-
1
;
while
(
min
<=
max
)
{
int
pos
=
(
min
+
max
)
/
2
;
ULONG_PTR
start
=
base
+
func
[
pos
].
BeginAddress
;
if
(
pc
>=
start
)
{
ULONG
len
=
func
[
pos
].
Flag
?
func
[
pos
].
FunctionLength
:
((
IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY_XDATA
*
)(
base
+
func
[
pos
].
UnwindData
))
->
FunctionLength
;
if
(
pc
<
start
+
4
*
len
)
return
func
+
pos
;
min
=
pos
+
1
;
}
else
max
=
pos
-
1
;
}
return
NULL
;
}
/**********************************************************************
* RtlVirtualUnwind (NTDLL.@)
*/
PVOID
WINAPI
RtlVirtualUnwind
(
ULONG
type
,
ULONG_PTR
base
,
ULONG_PTR
pc
,
...
...
dlls/ntdll/signal_arm64ec.c
View file @
02ebacca
...
...
@@ -229,6 +229,28 @@ static void context_arm_to_x64( CONTEXT *ctx, const ARM64_NT_CONTEXT *arm_ctx )
memcpy
(
ec_ctx
->
V
,
arm_ctx
->
V
,
sizeof
(
ec_ctx
->
V
)
);
}
static
RUNTIME_FUNCTION
*
find_function_info
(
ULONG_PTR
pc
,
ULONG_PTR
base
,
RUNTIME_FUNCTION
*
func
,
ULONG
size
)
{
int
min
=
0
;
int
max
=
size
-
1
;
while
(
min
<=
max
)
{
int
pos
=
(
min
+
max
)
/
2
;
if
(
pc
<
base
+
func
[
pos
].
BeginAddress
)
max
=
pos
-
1
;
else
if
(
pc
>=
base
+
func
[
pos
].
EndAddress
)
min
=
pos
+
1
;
else
{
func
+=
pos
;
while
(
func
->
UnwindData
&
1
)
/* follow chained entry */
func
=
(
RUNTIME_FUNCTION
*
)(
base
+
(
func
->
UnwindData
&
~
1
));
return
func
;
}
}
return
NULL
;
}
/*******************************************************************
* syscalls
...
...
dlls/ntdll/signal_x86_64.c
View file @
02ebacca
...
...
@@ -249,6 +249,28 @@ static void dump_scope_table( ULONG64 base, const SCOPE_TABLE *table )
(
char
*
)
base
+
table
->
ScopeRecord
[
i
].
JumpTarget
);
}
static
RUNTIME_FUNCTION
*
find_function_info
(
ULONG_PTR
pc
,
ULONG_PTR
base
,
RUNTIME_FUNCTION
*
func
,
ULONG
size
)
{
int
min
=
0
;
int
max
=
size
-
1
;
while
(
min
<=
max
)
{
int
pos
=
(
min
+
max
)
/
2
;
if
(
pc
<
base
+
func
[
pos
].
BeginAddress
)
max
=
pos
-
1
;
else
if
(
pc
>=
base
+
func
[
pos
].
EndAddress
)
min
=
pos
+
1
;
else
{
func
+=
pos
;
while
(
func
->
UnwindData
&
1
)
/* follow chained entry */
func
=
(
RUNTIME_FUNCTION
*
)(
base
+
(
func
->
UnwindData
&
~
1
));
return
func
;
}
}
return
NULL
;
}
/***********************************************************************
* virtual_unwind
...
...
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