Gave VG_(do_syscall)() a more specific prototype:
Int VG_(do_syscall) ( UInt, UWord, UWord, UWord, UWord, UWord, UWord );
to replace the previous:
Int VG_(do_syscall) ( UInt, ... )
Reason being that sometimes you could get incorrect args passed, when
passing 32-bit ints on 64-bit platforms. I also added macros
VG_(do_syscall[123456]) to make life easier, and converted all the
relevant calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3143 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/amd64-linux/syscalls.c b/coregrind/amd64-linux/syscalls.c
index 389c281..8198da1 100644
--- a/coregrind/amd64-linux/syscalls.c
+++ b/coregrind/amd64-linux/syscalls.c
@@ -97,7 +97,7 @@
|| ARG1 == (VKI_CLONE_PARENT_SETTID|VKI_SIGCHLD)))
{
VGA_(gen_sys_fork_before)(tid, tst);
- SET_RESULT( VG_(do_syscall)(SYSNO, ARG1, ARG2, ARG3, ARG4, ARG5) );
+ SET_RESULT( VG_(do_syscall5)(SYSNO, ARG1, ARG2, ARG3, ARG4, ARG5) );
VGA_(gen_sys_fork_after) (tid, tst);
} else {
VG_(unimplemented)
diff --git a/coregrind/arm-linux/syscalls.c b/coregrind/arm-linux/syscalls.c
index 7332282..4a43ef4 100644
--- a/coregrind/arm-linux/syscalls.c
+++ b/coregrind/arm-linux/syscalls.c
@@ -111,7 +111,7 @@
|| ARG1 == (VKI_CLONE_PARENT_SETTID|VKI_SIGCHLD)))
{
VGA_(gen_sys_fork_before)(tid, tst);
- SET_RESULT( VG_(do_syscall)(SYSNO, ARG1, ARG2, ARG3, ARG4, ARG5) );
+ SET_RESULT( VG_(do_syscall5)(SYSNO, ARG1, ARG2, ARG3, ARG4, ARG5) );
VGA_(gen_sys_fork_after) (tid, tst);
} else {
VG_(unimplemented)
diff --git a/coregrind/core.h b/coregrind/core.h
index 235d79b..012c2b0 100644
--- a/coregrind/core.h
+++ b/coregrind/core.h
@@ -1731,7 +1731,22 @@
Exports of vg_syscall.S
------------------------------------------------------------------ */
-extern Int VG_(do_syscall) ( UInt, ... );
+// We use a full prototype rather than "..." here to ensure that all
+// arguments get converted to a UWord appropriately. Not doing so can
+// cause problems when passing 32-bit integers on 64-bit platforms, because
+// the top 32-bits might not be zeroed appropriately, eg. as would happen
+// with the 6th arg on AMD64 which is passed on the stack.
+extern Int VG_(do_syscall) ( UInt, UWord, UWord, UWord, UWord, UWord, UWord );
+
+// Macros make life easier.
+#define vgPlain_do_syscall0(s) VG_(do_syscall)((s),0,0,0,0,0,0)
+#define vgPlain_do_syscall1(s,a) VG_(do_syscall)((s),(a),0,0,0,0,0)
+#define vgPlain_do_syscall2(s,a,b) VG_(do_syscall)((s),(a),(b),0,0,0,0)
+#define vgPlain_do_syscall3(s,a,b,c) VG_(do_syscall)((s),(a),(b),(c),0,0,0)
+#define vgPlain_do_syscall4(s,a,b,c,d) VG_(do_syscall)((s),(a),(b),(c),(d),0,0)
+#define vgPlain_do_syscall5(s,a,b,c,d,e) VG_(do_syscall)((s),(a),(b),(c),(d),(e),0)
+#define vgPlain_do_syscall6(s,a,b,c,d,e,f) VG_(do_syscall)((s),(a),(b),(c),(d),(e),(f))
+
extern Int VG_(clone) ( Int (*fn)(void *), void *stack, Int flags, void *arg,
Int *child_tid, Int *parent_tid);
extern void VG_(sigreturn)(void);
diff --git a/coregrind/linux/syscalls.c b/coregrind/linux/syscalls.c
index 726dc1d..01dadcf 100644
--- a/coregrind/linux/syscalls.c
+++ b/coregrind/linux/syscalls.c
@@ -446,7 +446,7 @@
VG_(map_segment)(addr, size, VKI_PROT_READ|VKI_PROT_EXEC, SF_FIXED);
VG_(pad_address_space)();
- SET_RESULT( VG_(do_syscall)(SYSNO, ARG1, ARG2) );
+ SET_RESULT( VG_(do_syscall2)(SYSNO, ARG1, ARG2) );
VG_(unpad_address_space)();
if (RES == 0) {
@@ -483,7 +483,7 @@
size = PGROUNDUP(sizeof(struct vki_aio_ring) +
r->nr*sizeof(struct vki_io_event));
- SET_RESULT( VG_(do_syscall)(SYSNO, ARG1) );
+ SET_RESULT( VG_(do_syscall1)(SYSNO, ARG1) );
if (RES == 0 && s != NULL && VG_(seg_contains)(s, ARG1, size)) {
VG_TRACK( die_mem_munmap, ARG1, size );
diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c
index 0a9dc42..4f53731 100644
--- a/coregrind/vg_libpthread.c
+++ b/coregrind/vg_libpthread.c
@@ -266,8 +266,8 @@
if (status == 2) {
const char msg[] = "Error: this libpthread.so should "
"only be run with Valgrind\n";
- VG_(do_syscall)(__NR_write, 2, msg, sizeof(msg)-1);
- VG_(do_syscall)(__NR_exit, 1);
+ VG_(do_syscall3)(__NR_write, 2, (UWord)msg, sizeof(msg)-1);
+ VG_(do_syscall1)(__NR_exit, 1);
}
status = (RUNNING_ON_VALGRIND) ? 1 : 2;
diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c
index ac784c6..04005ab 100644
--- a/coregrind/vg_main.c
+++ b/coregrind/vg_main.c
@@ -2581,7 +2581,7 @@
if (VG_(clo_wait_for_gdb)) {
VG_(printf)("pid=%d\n", VG_(getpid)());
/* do "jump *$eip" to skip this in gdb */
- VG_(do_syscall)(__NR_pause);
+ VG_(do_syscall0)(__NR_pause);
}
//--------------------------------------------------------------
diff --git a/coregrind/vg_memory.c b/coregrind/vg_memory.c
index 4be304a..c7699c9 100644
--- a/coregrind/vg_memory.c
+++ b/coregrind/vg_memory.c
@@ -595,7 +595,7 @@
while (s && addr <= VG_(valgrind_last)) {
if (addr < s->addr) {
- ret = VG_(do_syscall)(__NR_munmap, addr, s->addr - addr);
+ ret = VG_(do_syscall2)(__NR_munmap, addr, s->addr - addr);
}
addr = s->addr + s->len;
@@ -603,7 +603,7 @@
}
if (addr <= VG_(valgrind_last)) {
- ret = VG_(do_syscall)(__NR_munmap, addr, (VG_(valgrind_last) - addr) + 1);
+ ret = VG_(do_syscall2)(__NR_munmap, addr, (VG_(valgrind_last) - addr) + 1);
}
return;
diff --git a/coregrind/vg_mylibc.c b/coregrind/vg_mylibc.c
index 11ee814..2016d6a 100644
--- a/coregrind/vg_mylibc.c
+++ b/coregrind/vg_mylibc.c
@@ -138,10 +138,9 @@
*/
Int VG_(sigprocmask)( Int how, const vki_sigset_t* set, vki_sigset_t* oldset)
{
- Int res
- = VG_(do_syscall)(__NR_rt_sigprocmask,
- how, (UWord)set, (UWord)oldset,
- _VKI_NSIG_WORDS * sizeof(UWord));
+ Int res = VG_(do_syscall4)(__NR_rt_sigprocmask,
+ how, (UWord)set, (UWord)oldset,
+ _VKI_NSIG_WORDS * sizeof(UWord));
return VG_(is_kerror)(res) ? -1 : 0;
}
@@ -149,10 +148,9 @@
Int VG_(sigaction) ( Int signum, const struct vki_sigaction* act,
struct vki_sigaction* oldact)
{
- Int res
- = VG_(do_syscall)(__NR_rt_sigaction,
- signum, (UWord)act, (UWord)oldact,
- _VKI_NSIG_WORDS * sizeof(UWord));
+ Int res = VG_(do_syscall4)(__NR_rt_sigaction,
+ signum, (UWord)act, (UWord)oldact,
+ _VKI_NSIG_WORDS * sizeof(UWord));
/* VG_(printf)("res = %d\n",res); */
return VG_(is_kerror)(res) ? -1 : 0;
}
@@ -160,14 +158,15 @@
Int VG_(sigaltstack)( const vki_stack_t* ss, vki_stack_t* oss )
{
- Int res = VG_(do_syscall)(__NR_sigaltstack, (UWord)ss, (UWord)oss);
+ Int res = VG_(do_syscall2)(__NR_sigaltstack, (UWord)ss, (UWord)oss);
return VG_(is_kerror)(res) ? -1 : 0;
}
Int VG_(sigtimedwait)( const vki_sigset_t *set, vki_siginfo_t *info,
- const struct vki_timespec *timeout )
+ const struct vki_timespec *timeout )
{
- Int res = VG_(do_syscall)(__NR_rt_sigtimedwait, set, info, timeout, sizeof(*set));
+ Int res = VG_(do_syscall4)(__NR_rt_sigtimedwait, (UWord)set, (UWord)info,
+ (UWord)timeout, sizeof(*set));
return VG_(is_kerror)(res) ? -1 : res;
}
@@ -181,8 +180,7 @@
sa.sa_restorer = NULL;
res = VG_(sigemptyset)( &sa.sa_mask );
vg_assert(res == 0);
- res = VG_(do_syscall)(__NR_rt_sigaction,
- signum, (UWord)&sa, (UWord)NULL,
+ res = VG_(do_syscall4)(__NR_rt_sigaction, signum, (UWord)&sa, (UWord)NULL,
_VKI_NSIG_WORDS * sizeof(UWord));
return VG_(is_kerror)(res) ? -1 : 0;
}
@@ -190,7 +188,7 @@
Int VG_(kill)( Int pid, Int signo )
{
- Int res = VG_(do_syscall)(__NR_kill, pid, signo);
+ Int res = VG_(do_syscall2)(__NR_kill, pid, signo);
return VG_(is_kerror)(res) ? -1 : 0;
}
@@ -200,16 +198,16 @@
Int ret = -VKI_ENOSYS;
#ifdef __NR_tgkill
- ret = VG_(do_syscall)(__NR_tgkill, VG_(main_pid), tid, signo);
+ ret = VG_(do_syscall3)(__NR_tgkill, VG_(main_pid), tid, signo);
#endif /* __NR_tgkill */
#ifdef __NR_tkill
if (ret == -VKI_ENOSYS)
- ret = VG_(do_syscall)(__NR_tkill, tid, signo);
+ ret = VG_(do_syscall2)(__NR_tkill, tid, signo);
#endif /* __NR_tkill */
if (ret == -VKI_ENOSYS)
- ret = VG_(do_syscall)(__NR_kill, tid, signo);
+ ret = VG_(do_syscall2)(__NR_kill, tid, signo);
return VG_(is_kerror)(ret) ? -1 : 0;
}
@@ -223,14 +221,14 @@
#ifdef __amd64__
I_die_here;
#else
- Int res = VG_(do_syscall)(__NR_sigpending, (UWord)set);
+ Int res = VG_(do_syscall1)(__NR_sigpending, (UWord)set);
return VG_(is_kerror)(res) ? -1 : 0;
#endif
}
Int VG_(waitpid)(Int pid, Int *status, Int options)
{
- Int ret = VG_(do_syscall)(__NR_wait4, pid, status, options, NULL);
+ Int ret = VG_(do_syscall4)(__NR_wait4, pid, (UWord)status, options, 0);
return VG_(is_kerror)(ret) ? -1 : ret;
}
@@ -239,7 +237,7 @@
{
Int ret;
- ret = VG_(do_syscall)(__NR_gettid);
+ ret = VG_(do_syscall0)(__NR_gettid);
if (ret == -VKI_ENOSYS) {
Char pid[16];
@@ -257,7 +255,9 @@
* So instead of calling getpid here we use readlink to see where
* the /proc/self link is pointing...
*/
- if ((ret = VG_(do_syscall)(__NR_readlink, "/proc/self", pid, sizeof(pid))) >= 0) {
+ if ((ret = VG_(do_syscall3)(__NR_readlink, (UWord)"/proc/self",
+ (UWord)pid, sizeof(pid))) >= 0)
+ {
pid[ret] = '\0';
ret = VG_(atoll)(pid);
}
@@ -274,7 +274,7 @@
static Int munmap_inner(void *start, SizeT length)
{
- return VG_(do_syscall)(__NR_munmap, (UWord)start, length );
+ return VG_(do_syscall2)(__NR_munmap, (UWord)start, length );
}
static Addr mmap_inner(void *start, SizeT length, UInt prot, UInt flags,
@@ -336,7 +336,7 @@
Int VG_(mprotect)( void *start, SizeT length, UInt prot )
{
- Int res = VG_(do_syscall)(__NR_mprotect, (UWord)start, length, prot );
+ Int res = VG_(do_syscall3)(__NR_mprotect, (UWord)start, length, prot );
if (!VG_(is_kerror)(res))
VG_(mprotect_range)((Addr)start, length, prot);
return VG_(is_kerror)(res) ? -1 : 0;
@@ -344,8 +344,8 @@
void VG_(exit)( Int status )
{
- (void)VG_(do_syscall)(__NR_exit_group, status );
- (void)VG_(do_syscall)(__NR_exit, status );
+ (void)VG_(do_syscall1)(__NR_exit_group, status );
+ (void)VG_(do_syscall1)(__NR_exit, status );
/* Why are we still alive here? */
/*NOTREACHED*/
*(volatile Int *)0 = 'x';
@@ -355,13 +355,13 @@
/* Returns -1 on error. */
Int VG_(fcntl) ( Int fd, Int cmd, Int arg )
{
- Int res = VG_(do_syscall)(__NR_fcntl, fd, cmd, arg);
+ Int res = VG_(do_syscall3)(__NR_fcntl, fd, cmd, arg);
return VG_(is_kerror)(res) ? -1 : res;
}
Int VG_(poll)( struct vki_pollfd *ufds, UInt nfds, Int timeout)
{
- Int res = VG_(do_syscall)(__NR_poll, ufds, nfds, timeout);
+ Int res = VG_(do_syscall3)(__NR_poll, (UWord)ufds, nfds, timeout);
return res;
}
@@ -1238,7 +1238,7 @@
/* fd = open( pathname, O_RDONLY ); */
/* ... so we go direct to the horse's mouth, which seems to work
ok: */
- fd = VG_(do_syscall)(__NR_open, (UWord)pathname, flags, mode);
+ fd = VG_(do_syscall3)(__NR_open, (UWord)pathname, flags, mode);
/* VG_(printf)("result = %d\n", fd); */
/* return -ve error code */
return fd;
@@ -1246,13 +1246,13 @@
Int VG_(pipe) ( Int fd[2] )
{
- Int ret = VG_(do_syscall)(__NR_pipe, fd);
+ Int ret = VG_(do_syscall1)(__NR_pipe, (UWord)fd);
return VG_(is_kerror)(ret) ? -1 : 0;
}
void VG_(close) ( Int fd )
{
- VG_(do_syscall)(__NR_close, fd);
+ VG_(do_syscall1)(__NR_close, fd);
}
@@ -1260,7 +1260,7 @@
{
Int res;
/* res = read( fd, buf, count ); */
- res = VG_(do_syscall)(__NR_read, fd, (UWord)buf, count);
+ res = VG_(do_syscall3)(__NR_read, fd, (UWord)buf, count);
/* return -ERRNO on error */
return res;
}
@@ -1269,7 +1269,7 @@
{
Int res;
/* res = write( fd, buf, count ); */
- res = VG_(do_syscall)(__NR_write, fd, (UWord)buf, count);
+ res = VG_(do_syscall3)(__NR_write, fd, (UWord)buf, count);
/* return -ERRNO on error */
return res;
}
@@ -1278,7 +1278,7 @@
{
Int res;
/* res = lseek( fd, offset, whence ); */
- res = VG_(do_syscall)(__NR_lseek, fd, offset, whence);
+ res = VG_(do_syscall3)(__NR_lseek, fd, offset, whence);
if (VG_(is_kerror)(res)) res = -1;
return res;
}
@@ -1286,35 +1286,35 @@
Int VG_(stat) ( Char* file_name, struct vki_stat* buf )
{
Int res;
- res = VG_(do_syscall)(__NR_stat, (UWord)file_name, (UWord)buf);
+ res = VG_(do_syscall2)(__NR_stat, (UWord)file_name, (UWord)buf);
return res; /* return -ve error */
}
Int VG_(fstat) ( Int fd, struct vki_stat* buf )
{
Int res;
- res = VG_(do_syscall)(__NR_fstat, fd, (UWord)buf);
+ res = VG_(do_syscall2)(__NR_fstat, fd, (UWord)buf);
return VG_(is_kerror)(res) ? (-1) : 0;
}
Int VG_(dup2) ( Int oldfd, Int newfd )
{
Int res;
- res = VG_(do_syscall)(__NR_dup2, oldfd, newfd);
+ res = VG_(do_syscall2)(__NR_dup2, oldfd, newfd);
return VG_(is_kerror)(res) ? (-1) : res;
}
Int VG_(rename) ( Char* old_name, Char* new_name )
{
Int res;
- res = VG_(do_syscall)(__NR_rename, (UWord)old_name, (UWord)new_name);
+ res = VG_(do_syscall2)(__NR_rename, (UWord)old_name, (UWord)new_name);
return VG_(is_kerror)(res) ? (-1) : 0;
}
Int VG_(unlink) ( Char* file_name )
{
Int res;
- res = VG_(do_syscall)(__NR_unlink, (UWord)file_name);
+ res = VG_(do_syscall1)(__NR_unlink, (UWord)file_name);
return VG_(is_kerror)(res) ? (-1) : 0;
}
@@ -1324,7 +1324,7 @@
{
Word res;
vg_assert(buf != NULL);
- res = VG_(do_syscall)(__NR_getcwd, (UWord)buf, size);
+ res = VG_(do_syscall2)(__NR_getcwd, (UWord)buf, size);
return VG_(is_kerror)(res) ? ((Char*)NULL) : (Char*)res;
}
@@ -1455,7 +1455,7 @@
{
Int res;
/* res = getrlimit( resource, rlim ); */
- res = VG_(do_syscall)(__NR_getrlimit, resource, (UWord)rlim);
+ res = VG_(do_syscall2)(__NR_getrlimit, resource, (UWord)rlim);
if(VG_(is_kerror)(res)) res = -1;
return res;
}
@@ -1466,7 +1466,7 @@
{
Int res;
/* res = setrlimit( resource, rlim ); */
- res = VG_(do_syscall)(__NR_setrlimit, resource, (UWord)rlim);
+ res = VG_(do_syscall2)(__NR_setrlimit, resource, (UWord)rlim);
if(VG_(is_kerror)(res)) res = -1;
return res;
}
@@ -1477,7 +1477,7 @@
{
Int res;
/* res = getdents( fd, dirp, count ); */
- res = VG_(do_syscall)(__NR_getdents, fd, (UWord)dirp, count);
+ res = VG_(do_syscall3)(__NR_getdents, fd, (UWord)dirp, count);
if (VG_(is_kerror)(res)) res = -1;
return res;
}
@@ -1487,7 +1487,7 @@
{
Int res;
/* res = readlink( path, buf, bufsiz ); */
- res = VG_(do_syscall)(__NR_readlink, (UWord)path, (UWord)buf, bufsiz);
+ res = VG_(do_syscall3)(__NR_readlink, (UWord)path, (UWord)buf, bufsiz);
if (VG_(is_kerror)(res)) res = -1;
return res;
}
@@ -1497,7 +1497,7 @@
{
Int res;
/* res = getpid(); */
- res = VG_(do_syscall)(__NR_getpid);
+ res = VG_(do_syscall0)(__NR_getpid);
return res;
}
@@ -1505,20 +1505,20 @@
{
Int res;
/* res = getpgid(); */
- res = VG_(do_syscall)(__NR_getpgrp);
+ res = VG_(do_syscall0)(__NR_getpgrp);
return res;
}
Int VG_(getppid) ( void )
{
Int res;
- res = VG_(do_syscall)(__NR_getppid);
+ res = VG_(do_syscall0)(__NR_getppid);
return res;
}
Int VG_(setpgid) ( Int pid, Int pgrp )
{
- return VG_(do_syscall)(__NR_setpgid, pid, pgrp);
+ return VG_(do_syscall2)(__NR_setpgid, pid, pgrp);
}
/* Walk through a colon-separated environment variable, and remove the
@@ -1624,7 +1624,7 @@
Int pid, res;
if (cmd == NULL)
return 1;
- pid = VG_(do_syscall)(__NR_fork);
+ pid = VG_(do_syscall0)(__NR_fork);
if (VG_(is_kerror)(pid))
return -1;
if (pid == 0) {
@@ -1643,8 +1643,8 @@
argv[2] = cmd;
argv[3] = 0;
- (void)VG_(do_syscall)(__NR_execve,
- (UWord)"/bin/sh", (UWord)argv, (UWord)envp);
+ (void)VG_(do_syscall3)(__NR_execve,
+ (UWord)"/bin/sh", (UWord)argv, (UWord)envp);
/* If we're still alive here, execve failed. */
VG_(exit)(1);
@@ -1671,7 +1671,7 @@
ULong now;
Int res;
- res = VG_(do_syscall)(__NR_gettimeofday, (UWord)&tv_now, (UWord)NULL);
+ res = VG_(do_syscall2)(__NR_gettimeofday, (UWord)&tv_now, (UWord)NULL);
now = tv_now.tv_sec * 1000000ULL + tv_now.tv_usec;
@@ -1954,7 +1954,7 @@
args[0] = domain;
args[1] = type;
args[2] = protocol;
- res = VG_(do_syscall)(__NR_socketcall, VKI_SYS_SOCKET, (UWord)&args);
+ res = VG_(do_syscall2)(__NR_socketcall, VKI_SYS_SOCKET, (UWord)&args);
if (VG_(is_kerror)(res))
res = -1;
return res;
@@ -1975,7 +1975,7 @@
args[0] = sockfd;
args[1] = (UWord)serv_addr;
args[2] = addrlen;
- res = VG_(do_syscall)(__NR_socketcall, VKI_SYS_CONNECT, (UWord)&args);
+ res = VG_(do_syscall2)(__NR_socketcall, VKI_SYS_CONNECT, (UWord)&args);
if (VG_(is_kerror)(res))
res = -1;
return res;
@@ -2002,7 +2002,7 @@
args[1] = (UWord)msg;
args[2] = count;
args[3] = flags;
- res = VG_(do_syscall)(__NR_socketcall, VKI_SYS_SEND, (UWord)&args);
+ res = VG_(do_syscall2)(__NR_socketcall, VKI_SYS_SEND, (UWord)&args);
if (VG_(is_kerror)(res))
res = -1;
return res;
@@ -2021,7 +2021,7 @@
args[0] = sd;
args[1] = (UWord)name;
args[2] = (UWord)namelen;
- res = VG_(do_syscall)(__NR_socketcall, VKI_SYS_GETSOCKNAME, (UWord)&args);
+ res = VG_(do_syscall2)(__NR_socketcall, VKI_SYS_GETSOCKNAME, (UWord)&args);
if(VG_(is_kerror)(res))
res = -1;
return res;
@@ -2040,7 +2040,7 @@
args[0] = sd;
args[1] = (UWord)name;
args[2] = (UWord)namelen;
- res = VG_(do_syscall)(__NR_socketcall, VKI_SYS_GETPEERNAME, (UWord)&args);
+ res = VG_(do_syscall2)(__NR_socketcall, VKI_SYS_GETPEERNAME, (UWord)&args);
if(VG_(is_kerror)(res))
res = -1;
return res;
@@ -2062,7 +2062,7 @@
args[2] = optname;
args[3] = (UWord)optval;
args[4] = (UWord)optlen;
- res = VG_(do_syscall)(__NR_socketcall, VKI_SYS_GETSOCKOPT, (UWord)&args);
+ res = VG_(do_syscall2)(__NR_socketcall, VKI_SYS_GETSOCKOPT, (UWord)&args);
if(VG_(is_kerror)(res))
res = -1;
return res;
diff --git a/coregrind/vg_proxylwp.c b/coregrind/vg_proxylwp.c
index 6ef4bf6..31671bc 100644
--- a/coregrind/vg_proxylwp.c
+++ b/coregrind/vg_proxylwp.c
@@ -794,9 +794,11 @@
vg_assert(tst->status == VgTs_Runnable);
}
-static Int do_futex(void *addr, Int op, Int val, struct vki_timespec *time, void *addr2)
+static Int do_futex(void *addr, Int op, Int val, struct vki_timespec *time,
+ void *addr2)
{
- return VG_(do_syscall)(__NR_futex, addr, op, val, time, addr2);
+ return VG_(do_syscall5)(__NR_futex, (UWord)addr, op, val, (UWord)time,
+ (UWord)addr2);
}
static Int have_settid = -1; /* -1 -> unknown */
diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c
index 2637596..353cd67 100644
--- a/coregrind/vg_syscalls.c
+++ b/coregrind/vg_syscalls.c
@@ -268,8 +268,8 @@
/* we've nailed down the location */
flags |= VKI_MREMAP_FIXED|VKI_MREMAP_MAYMOVE;
- ret = VG_(do_syscall)(__NR_mremap, old_addr, old_size, new_size,
- flags, new_addr);
+ ret = VG_(do_syscall5)(__NR_mremap, old_addr, old_size, new_size,
+ flags, new_addr);
if (ret != new_addr) {
vg_assert(VG_(is_kerror)(ret));
@@ -308,8 +308,8 @@
VG_(printf)("mremap: old_addr=%p old_size=%d new_size=%d flags=%d\n",
old_addr, old_size, new_size, flags);
- ret = VG_(do_syscall)(__NR_mremap, old_addr, old_size, new_size,
- flags, 0);
+ ret = VG_(do_syscall5)(__NR_mremap, old_addr, old_size, new_size,
+ flags, 0);
if (ret != old_addr)
return ret;
@@ -1653,7 +1653,7 @@
/* restore the DATA rlimit for the child */
VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data));
- SET_RESULT( VG_(do_syscall)(__NR_execve, ARG1, ARG2, ARG3) );
+ SET_RESULT( VG_(do_syscall3)(__NR_execve, ARG1, ARG2, ARG3) );
/* If we got here, then the execve failed. We've already made too much of a mess
of ourselves to continue, so we have to abort. */
@@ -3934,7 +3934,7 @@
* /proc/<pid>/exe.
*/
- SET_RESULT( VG_(do_syscall)(saved, ARG1, ARG2, ARG3));
+ SET_RESULT( VG_(do_syscall3)(saved, ARG1, ARG2, ARG3));
if ((Int)RES == -2) {
char name[25];
@@ -3943,7 +3943,7 @@
if (VG_(strcmp)((Char *)ARG1, name) == 0 ||
VG_(strcmp)((Char *)ARG1, "/proc/self/exe") == 0) {
VG_(sprintf)(name, "/proc/self/fd/%d", VG_(clexecfd));
- SET_RESULT( VG_(do_syscall)(saved, name, ARG2, ARG3));
+ SET_RESULT( VG_(do_syscall3)(saved, (UWord)name, ARG2, ARG3));
}
}
@@ -5329,7 +5329,7 @@
VG_(sys_issue)(tid);
} else {
/* run the syscall directly */
- RES = VG_(do_syscall)(syscallno, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
+ RES = VG_(do_syscall6)(syscallno, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
PRINT(" --> %lld (0x%llx)\n", (Long)(Word)RES, (ULong)RES);
syscall_done = True;
}
diff --git a/coregrind/x86-linux/core_platform.h b/coregrind/x86-linux/core_platform.h
index 398d31b..659956e 100644
--- a/coregrind/x86-linux/core_platform.h
+++ b/coregrind/x86-linux/core_platform.h
@@ -102,7 +102,7 @@
__args[4] = (fd); \
__args[5] = (offset); \
\
- ret = VG_(do_syscall)(__NR_mmap, (UWord)(&(__args[0])) ); \
+ ret = VG_(do_syscall1)(__NR_mmap, (UWord)(&(__args[0])) ); \
} while (0)
#define PLATFORM_GET_MMAP_ARGS(tst, a1, a2, a3, a4, a5, a6) do {\
diff --git a/coregrind/x86-linux/syscall.S b/coregrind/x86-linux/syscall.S
index c8f9c6e..8611476 100644
--- a/coregrind/x86-linux/syscall.S
+++ b/coregrind/x86-linux/syscall.S
@@ -35,7 +35,8 @@
Perform a Linux syscall with int 0x80
Syscall args are passed on the stack
- Int VG_(do_syscall)(Int syscall_no, ...)
+ Int VG_(do_syscall)(Int syscall_no, UWord a1, UWord a2, UWord a3,
+ UWord a4, UWord a5, UWord a6)
This has no effect on the virtual machine; the expectation is
that the syscall mechanism makes no useful changes to any
diff --git a/coregrind/x86-linux/syscalls.c b/coregrind/x86-linux/syscalls.c
index b19fee3..dca3482 100644
--- a/coregrind/x86-linux/syscalls.c
+++ b/coregrind/x86-linux/syscalls.c
@@ -164,7 +164,7 @@
|| ARG1 == (VKI_CLONE_PARENT_SETTID|VKI_SIGCHLD)))
{
VGA_(gen_sys_fork_before)(tid, tst);
- SET_RESULT( VG_(do_syscall)(SYSNO, ARG1, ARG2, ARG3, ARG4, ARG5) );
+ SET_RESULT( VG_(do_syscall5)(SYSNO, ARG1, ARG2, ARG3, ARG4, ARG5) );
VGA_(gen_sys_fork_after) (tid, tst);
} else {
VG_(unimplemented)
@@ -290,7 +290,8 @@
UInt get_shm_size ( Int shmid )
{
struct vki_shmid_ds buf;
- long __res = VG_(do_syscall)(__NR_ipc, 24 /* IPCOP_shmctl */, shmid, VKI_IPC_STAT, 0, &buf);
+ long __res = VG_(do_syscall5)(__NR_ipc, 24 /* IPCOP_shmctl */, shmid,
+ VKI_IPC_STAT, 0, &buf);
if ( VG_(is_kerror) ( __res ) )
return 0;
@@ -306,7 +307,8 @@
arg.buf = &buf;
- res = VG_(do_syscall)(__NR_ipc, 3 /* IPCOP_semctl */, semid, 0, VKI_IPC_STAT, &arg);
+ res = VG_(do_syscall5)(__NR_ipc, 3 /* IPCOP_semctl */, semid, 0,
+ VKI_IPC_STAT, &arg);
if ( VG_(is_kerror)(res) )
return 0;
diff --git a/coregrind/x86/libpthread.c b/coregrind/x86/libpthread.c
index 0901de1..ce74e4d 100644
--- a/coregrind/x86/libpthread.c
+++ b/coregrind/x86/libpthread.c
@@ -151,7 +151,7 @@
ldt_info.reserved = 0;
/* Install the thread area */
- VG_(do_syscall)(__NR_set_thread_area, &ldt_info);
+ VG_(do_syscall1)(__NR_set_thread_area, (UWord)&ldt_info);
/* Setup the GS segment register */
set_gs(ldt_info.entry_number * 8 + 3);
diff --git a/coregrind/x86/state.c b/coregrind/x86/state.c
index 5459656..024bc4e 100644
--- a/coregrind/x86/state.c
+++ b/coregrind/x86/state.c
@@ -204,7 +204,7 @@
0, // ! seg not present
1, // useable
};
- int ret = VG_(do_syscall)(__NR_modify_ldt, 1, &ldt, sizeof(ldt));
+ int ret = VG_(do_syscall3)(__NR_modify_ldt, 1, (UWord)&ldt, sizeof(ldt));
if (ret < 0) {
VG_(message)(Vg_UserMsg,
"Warning: ignoring --pointercheck=yes, "