public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Roel Kluin <roel.kluin@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] SH-5: struct pt_regs:syscall_nr is unsigned.
Date: Thu, 23 Apr 2009 19:47:11 +0000	[thread overview]
Message-ID: <49F0C5BF.4090207@gmail.com> (raw)

vi arch/sh/include/asm/ptrace.h +9
And note that struct pt_regs:syscall_nr is unsigned.

So I think something like the patch below is required, isn't it? As an
alternative to the patch below, syscall_nr could become signed. what is
preferred?
--------------------------->8-------------8<------------------------------
In restore_sigcontext() syscall_nr is set to -1, but it is unsigned for
SH-5.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/arch/sh/include/asm/syscall_64.h b/arch/sh/include/asm/syscall_64.h
index c3561ca..291fc86 100644
--- a/arch/sh/include/asm/syscall_64.h
+++ b/arch/sh/include/asm/syscall_64.h
@@ -9,7 +9,7 @@
 static inline long syscall_get_nr(struct task_struct *task,
 				  struct pt_regs *regs)
 {
-	return (regs->syscall_nr >= 0) ? regs->regs[9] : -1L;
+	return (regs->syscall_nr != -1) ? regs->regs[9] : -1L;
 }
 
 static inline void syscall_rollback(struct task_struct *task,
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c
index 0663a0e..b851141 100644
--- a/arch/sh/kernel/signal_64.c
+++ b/arch/sh/kernel/signal_64.c
@@ -51,7 +51,7 @@ static inline void
 handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa)
 {
 	/* If we're not from a syscall, bail out */
-	if (regs->syscall_nr < 0)
+	if (regs->syscall_nr = -1)
 		return;
 
 	/* check for system call restart.. */
@@ -127,7 +127,7 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset)
 
 no_signal:
 	/* Did we come from a system call? */
-	if (regs->syscall_nr >= 0) {
+	if (regs->syscall_nr != -1) {
 		/* Restart the system call - no handlers present */
 		switch (regs->regs[REG_RET]) {
 		case -ERESTARTNOHAND:

             reply	other threads:[~2009-04-23 19:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-23 19:47 Roel Kluin [this message]
2009-04-27  8:05 ` [PATCH] SH-5: struct pt_regs:syscall_nr is unsigned Paul Mundt

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=49F0C5BF.4090207@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=linux-sh@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