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
3b8ab28c
Commit
3b8ab28c
authored
Feb 13, 2013
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loader: Define our own auxv structure.
parent
fc7e81be
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
preloader.c
loader/preloader.c
+16
-8
No files found.
loader/preloader.c
View file @
3b8ab28c
...
@@ -158,6 +158,14 @@ struct wld_link_map {
...
@@ -158,6 +158,14 @@ struct wld_link_map {
ElfW
(
Addr
)
l_interp
;
ElfW
(
Addr
)
l_interp
;
};
};
struct
wld_auxv
{
ElfW
(
Addr
)
a_type
;
union
{
ElfW
(
Addr
)
a_val
;
}
a_un
;
};
/*
/*
* The __bb_init_func is an empty function only called when file is
* The __bb_init_func is an empty function only called when file is
...
@@ -540,7 +548,7 @@ static __attribute__((noreturn,format(printf,1,2))) void fatal_error(const char
...
@@ -540,7 +548,7 @@ static __attribute__((noreturn,format(printf,1,2))) void fatal_error(const char
* Dump interesting bits of the ELF auxv_t structure that is passed
* Dump interesting bits of the ELF auxv_t structure that is passed
* as the 4th parameter to the _start function
* as the 4th parameter to the _start function
*/
*/
static
void
dump_auxiliary
(
ElfW
(
auxv_t
)
*
av
)
static
void
dump_auxiliary
(
struct
wld_auxv
*
av
)
{
{
#define NAME(at) { at, #at }
#define NAME(at) { at, #at }
static
const
struct
{
int
val
;
const
char
*
name
;
}
names
[]
=
static
const
struct
{
int
val
;
const
char
*
name
;
}
names
[]
=
...
@@ -581,8 +589,8 @@ static void dump_auxiliary( ElfW(auxv_t) *av )
...
@@ -581,8 +589,8 @@ static void dump_auxiliary( ElfW(auxv_t) *av )
*
*
* Set the new auxiliary values
* Set the new auxiliary values
*/
*/
static
void
set_auxiliary_values
(
ElfW
(
auxv_t
)
*
av
,
const
ElfW
(
auxv_t
)
*
new_av
,
static
void
set_auxiliary_values
(
struct
wld_auxv
*
av
,
const
struct
wld_auxv
*
new_av
,
const
ElfW
(
auxv_t
)
*
delete_av
,
void
**
stack
)
const
struct
wld_auxv
*
delete_av
,
void
**
stack
)
{
{
int
i
,
j
,
av_count
=
0
,
new_count
=
0
,
delete_count
=
0
;
int
i
,
j
,
av_count
=
0
,
new_count
=
0
,
delete_count
=
0
;
char
*
src
,
*
dst
;
char
*
src
,
*
dst
;
...
@@ -624,7 +632,7 @@ static void set_auxiliary_values( ElfW(auxv_t) *av, const ElfW(auxv_t) *new_av,
...
@@ -624,7 +632,7 @@ static void set_auxiliary_values( ElfW(auxv_t) *av, const ElfW(auxv_t) *new_av,
for
(
i
=
len
-
1
;
i
>=
0
;
i
--
)
dst
[
i
]
=
src
[
i
];
for
(
i
=
len
-
1
;
i
>=
0
;
i
--
)
dst
[
i
]
=
src
[
i
];
}
}
*
stack
=
dst
;
*
stack
=
dst
;
av
=
(
ElfW
(
auxv_t
)
*
)((
char
*
)
av
+
(
dst
-
src
));
av
=
(
struct
wld_auxv
*
)((
char
*
)
av
+
(
dst
-
src
));
/* now set the values */
/* now set the values */
for
(
j
=
0
;
new_av
[
j
].
a_type
!=
AT_NULL
;
j
++
)
for
(
j
=
0
;
new_av
[
j
].
a_type
!=
AT_NULL
;
j
++
)
...
@@ -650,7 +658,7 @@ static void set_auxiliary_values( ElfW(auxv_t) *av, const ElfW(auxv_t) *new_av,
...
@@ -650,7 +658,7 @@ static void set_auxiliary_values( ElfW(auxv_t) *av, const ElfW(auxv_t) *new_av,
*
*
* Get a field of the auxiliary structure
* Get a field of the auxiliary structure
*/
*/
static
int
get_auxiliary
(
ElfW
(
auxv_t
)
*
av
,
int
type
,
int
def_val
)
static
int
get_auxiliary
(
struct
wld_auxv
*
av
,
int
type
,
int
def_val
)
{
{
for
(
;
av
->
a_type
!=
AT_NULL
;
av
++
)
for
(
;
av
->
a_type
!=
AT_NULL
;
av
++
)
if
(
av
->
a_type
==
type
)
return
av
->
a_un
.
a_val
;
if
(
av
->
a_type
==
type
)
return
av
->
a_un
.
a_val
;
...
@@ -1110,7 +1118,7 @@ static void remove_preload_range( int i )
...
@@ -1110,7 +1118,7 @@ static void remove_preload_range( int i )
*
*
* Check if address of the given aux value is in one of the reserved ranges
* Check if address of the given aux value is in one of the reserved ranges
*/
*/
static
int
is_in_preload_range
(
const
ElfW
(
auxv_t
)
*
av
,
int
type
)
static
int
is_in_preload_range
(
const
struct
wld_auxv
*
av
,
int
type
)
{
{
while
(
av
->
a_type
!=
AT_NULL
)
while
(
av
->
a_type
!=
AT_NULL
)
{
{
...
@@ -1153,7 +1161,7 @@ void* wld_start( void **stack )
...
@@ -1153,7 +1161,7 @@ void* wld_start( void **stack )
long
i
,
*
pargc
;
long
i
,
*
pargc
;
char
**
argv
,
**
p
;
char
**
argv
,
**
p
;
char
*
interp
,
*
reserve
=
NULL
;
char
*
interp
,
*
reserve
=
NULL
;
ElfW
(
auxv_t
)
new_av
[
12
],
delete_av
[
3
],
*
av
;
struct
wld_auxv
new_av
[
12
],
delete_av
[
3
],
*
av
;
struct
wld_link_map
main_binary_map
,
ld_so_map
;
struct
wld_link_map
main_binary_map
,
ld_so_map
;
struct
wine_preload_info
**
wine_main_preload_info
;
struct
wine_preload_info
**
wine_main_preload_info
;
...
@@ -1172,7 +1180,7 @@ void* wld_start( void **stack )
...
@@ -1172,7 +1180,7 @@ void* wld_start( void **stack )
p
++
;
p
++
;
}
}
av
=
(
ElfW
(
auxv_t
)
*
)
(
p
+
1
);
av
=
(
struct
wld_auxv
*
)
(
p
+
1
);
page_size
=
get_auxiliary
(
av
,
AT_PAGESZ
,
4096
);
page_size
=
get_auxiliary
(
av
,
AT_PAGESZ
,
4096
);
page_mask
=
page_size
-
1
;
page_mask
=
page_size
-
1
;
...
...
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