trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markos Chandras <markos.chandras@imgtec.com>
To: trinity@vger.kernel.org
Cc: Markos Chandras <markos.chandras@imgtec.com>
Subject: [PATCH] syscall: Take SYSCALL_OFFSET into account
Date: Wed, 14 May 2014 12:35:38 +0100	[thread overview]
Message-ID: <1400067338-12416-1-git-send-email-markos.chandras@imgtec.com> (raw)

MIPS and IA64 have their syscall tables starting at non-zero
offsets so take that into account when executing a sycall
otherwise trinity just fails with ENOSYS error messages.

Tested on MIPS 32/LE system.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 syscall.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/syscall.c b/syscall.c
index 968962b..a1ccb6b 100644
--- a/syscall.c
+++ b/syscall.c
@@ -79,6 +79,7 @@ static long syscall32(unsigned int call,
 static unsigned long do_syscall(int childno, int *errno_saved)
 {
 	int nr = shm->syscall[childno].nr;
+	int call = nr + SYSCALL_OFFSET;
 	unsigned long a1, a2, a3, a4, a5, a6;
 	unsigned long ret = 0;
 
@@ -99,9 +100,9 @@ static unsigned long do_syscall(int childno, int *errno_saved)
 	errno = 0;
 
 	if (shm->syscall[childno].do32bit == FALSE)
-		ret = syscall(nr, a1, a2, a3, a4, a5, a6);
+		ret = syscall(call, a1, a2, a3, a4, a5, a6);
 	else
-		ret = syscall32(nr, a1, a2, a3, a4, a5, a6);
+		ret = syscall32(call, a1, a2, a3, a4, a5, a6);
 
 	*errno_saved = errno;
 
-- 
1.9.3

             reply	other threads:[~2014-05-14 11:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 11:35 Markos Chandras [this message]
2014-05-14 15:22 ` [PATCH] syscall: Take SYSCALL_OFFSET into account Dave Jones
2014-05-15  8:26   ` Markos Chandras
2014-05-15 15:23     ` Dave Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400067338-12416-1-git-send-email-markos.chandras@imgtec.com \
    --to=markos.chandras@imgtec.com \
    --cc=trinity@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).