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
6f1932db
Commit
6f1932db
authored
Jan 21, 2013
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loader: Hardcode Linux syscall numbers.
parent
1ae300d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
main.c
loader/main.c
+1
-1
preloader.c
loader/preloader.c
+12
-12
No files found.
loader/main.c
View file @
6f1932db
...
@@ -114,7 +114,7 @@ static void check_command_line( int argc, char *argv[] )
...
@@ -114,7 +114,7 @@ static void check_command_line( int argc, char *argv[] )
/* separate thread to check for NPTL and TLS features */
/* separate thread to check for NPTL and TLS features */
static
void
*
needs_pthread
(
void
*
arg
)
static
void
*
needs_pthread
(
void
*
arg
)
{
{
pid_t
tid
=
syscall
(
SYS_gettid
);
pid_t
tid
=
syscall
(
224
/* SYS_gettid */
);
/* check for NPTL */
/* check for NPTL */
if
(
tid
!=
-
1
&&
tid
!=
getpid
())
return
(
void
*
)
1
;
if
(
tid
!=
-
1
&&
tid
!=
getpid
())
return
(
void
*
)
1
;
/* check for TLS glibc */
/* check for TLS glibc */
...
...
loader/preloader.c
View file @
6f1932db
...
@@ -236,14 +236,14 @@ static inline __attribute__((noreturn)) void wld_exit( int code )
...
@@ -236,14 +236,14 @@ static inline __attribute__((noreturn)) void wld_exit( int code )
{
{
for
(;;)
/* avoid warning */
for
(;;)
/* avoid warning */
__asm__
__volatile__
(
"pushl %%ebx; movl %1,%%ebx; int $0x80; popl %%ebx"
__asm__
__volatile__
(
"pushl %%ebx; movl %1,%%ebx; int $0x80; popl %%ebx"
:
:
"a"
(
SYS_exit
),
"r"
(
code
)
);
:
:
"a"
(
1
/* SYS_exit */
),
"r"
(
code
)
);
}
}
static
inline
int
wld_open
(
const
char
*
name
,
int
flags
)
static
inline
int
wld_open
(
const
char
*
name
,
int
flags
)
{
{
int
ret
;
int
ret
;
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
:
"=a"
(
ret
)
:
"0"
(
SYS_open
),
"r"
(
name
),
"c"
(
flags
)
);
:
"=a"
(
ret
)
:
"0"
(
5
/* SYS_open */
),
"r"
(
name
),
"c"
(
flags
)
);
return
SYSCALL_RET
(
ret
);
return
SYSCALL_RET
(
ret
);
}
}
...
@@ -251,7 +251,7 @@ static inline int wld_close( int fd )
...
@@ -251,7 +251,7 @@ static inline int wld_close( int fd )
{
{
int
ret
;
int
ret
;
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
:
"=a"
(
ret
)
:
"0"
(
SYS_close
),
"r"
(
fd
)
);
:
"=a"
(
ret
)
:
"0"
(
6
/* SYS_close */
),
"r"
(
fd
)
);
return
SYSCALL_RET
(
ret
);
return
SYSCALL_RET
(
ret
);
}
}
...
@@ -260,7 +260,7 @@ static inline ssize_t wld_read( int fd, void *buffer, size_t len )
...
@@ -260,7 +260,7 @@ static inline ssize_t wld_read( int fd, void *buffer, size_t len )
int
ret
;
int
ret
;
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
:
"=a"
(
ret
)
:
"=a"
(
ret
)
:
"0"
(
SYS_read
),
"r"
(
fd
),
"c"
(
buffer
),
"d"
(
len
)
:
"0"
(
3
/* SYS_read */
),
"r"
(
fd
),
"c"
(
buffer
),
"d"
(
len
)
:
"memory"
);
:
"memory"
);
return
SYSCALL_RET
(
ret
);
return
SYSCALL_RET
(
ret
);
}
}
...
@@ -269,7 +269,7 @@ static inline ssize_t wld_write( int fd, const void *buffer, size_t len )
...
@@ -269,7 +269,7 @@ static inline ssize_t wld_write( int fd, const void *buffer, size_t len )
{
{
int
ret
;
int
ret
;
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
:
"=a"
(
ret
)
:
"0"
(
SYS_write
),
"r"
(
fd
),
"c"
(
buffer
),
"d"
(
len
)
);
:
"=a"
(
ret
)
:
"0"
(
4
/* SYS_write */
),
"r"
(
fd
),
"c"
(
buffer
),
"d"
(
len
)
);
return
SYSCALL_RET
(
ret
);
return
SYSCALL_RET
(
ret
);
}
}
...
@@ -277,7 +277,7 @@ static inline int wld_mprotect( const void *addr, size_t len, int prot )
...
@@ -277,7 +277,7 @@ static inline int wld_mprotect( const void *addr, size_t len, int prot )
{
{
int
ret
;
int
ret
;
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
:
"=a"
(
ret
)
:
"0"
(
SYS_mprotect
),
"r"
(
addr
),
"c"
(
len
),
"d"
(
prot
)
);
:
"=a"
(
ret
)
:
"0"
(
125
/* SYS_mprotect */
),
"r"
(
addr
),
"c"
(
len
),
"d"
(
prot
)
);
return
SYSCALL_RET
(
ret
);
return
SYSCALL_RET
(
ret
);
}
}
...
@@ -302,35 +302,35 @@ static void *wld_mmap( void *start, size_t len, int prot, int flags, int fd, off
...
@@ -302,35 +302,35 @@ static void *wld_mmap( void *start, size_t len, int prot, int flags, int fd, off
args
.
fd
=
fd
;
args
.
fd
=
fd
;
args
.
offset
=
offset
;
args
.
offset
=
offset
;
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
:
"=a"
(
ret
)
:
"0"
(
SYS_mmap
),
"q"
(
&
args
)
:
"memory"
);
:
"=a"
(
ret
)
:
"0"
(
90
/* SYS_mmap */
),
"q"
(
&
args
)
:
"memory"
);
return
(
void
*
)
SYSCALL_RET
(
ret
);
return
(
void
*
)
SYSCALL_RET
(
ret
);
}
}
static
inline
uid_t
wld_getuid
(
void
)
static
inline
uid_t
wld_getuid
(
void
)
{
{
uid_t
ret
;
uid_t
ret
;
__asm__
(
"int $0x80"
:
"=a"
(
ret
)
:
"0"
(
SYS_getuid
)
);
__asm__
(
"int $0x80"
:
"=a"
(
ret
)
:
"0"
(
24
/* SYS_getuid */
)
);
return
ret
;
return
ret
;
}
}
static
inline
uid_t
wld_geteuid
(
void
)
static
inline
uid_t
wld_geteuid
(
void
)
{
{
uid_t
ret
;
uid_t
ret
;
__asm__
(
"int $0x80"
:
"=a"
(
ret
)
:
"0"
(
SYS_geteuid
)
);
__asm__
(
"int $0x80"
:
"=a"
(
ret
)
:
"0"
(
49
/* SYS_geteuid */
)
);
return
ret
;
return
ret
;
}
}
static
inline
gid_t
wld_getgid
(
void
)
static
inline
gid_t
wld_getgid
(
void
)
{
{
gid_t
ret
;
gid_t
ret
;
__asm__
(
"int $0x80"
:
"=a"
(
ret
)
:
"0"
(
SYS_getgid
)
);
__asm__
(
"int $0x80"
:
"=a"
(
ret
)
:
"0"
(
47
/* SYS_getgid */
)
);
return
ret
;
return
ret
;
}
}
static
inline
gid_t
wld_getegid
(
void
)
static
inline
gid_t
wld_getegid
(
void
)
{
{
gid_t
ret
;
gid_t
ret
;
__asm__
(
"int $0x80"
:
"=a"
(
ret
)
:
"0"
(
SYS_getegid
)
);
__asm__
(
"int $0x80"
:
"=a"
(
ret
)
:
"0"
(
50
/* SYS_getegid */
)
);
return
ret
;
return
ret
;
}
}
...
@@ -338,7 +338,7 @@ static inline int wld_prctl( int code, long arg )
...
@@ -338,7 +338,7 @@ static inline int wld_prctl( int code, long arg )
{
{
int
ret
;
int
ret
;
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
__asm__
__volatile__
(
"pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
:
"=a"
(
ret
)
:
"0"
(
SYS_prctl
),
"r"
(
code
),
"c"
(
arg
)
);
:
"=a"
(
ret
)
:
"0"
(
172
/* SYS_prctl */
),
"r"
(
code
),
"c"
(
arg
)
);
return
SYSCALL_RET
(
ret
);
return
SYSCALL_RET
(
ret
);
}
}
...
...
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