summaryrefslogtreecommitdiffstats
path: root/arch/openrisc/include
diff options
context:
space:
mode:
authorJonas Bonn <jonas@southpole.se>2012-03-02 10:05:24 +0100
committerJonas Bonn <jonas@southpole.se>2012-03-06 10:37:00 +0100
commit6cbe5e95267449ea0b79c0b049342409949da3ac (patch)
tree21243a6c899b27f67338d77a28ccbe0f473272bc /arch/openrisc/include
parent2f099a280e92c259598d8ed8da82c7ec2dd49845 (diff)
downloadop-kernel-dev-6cbe5e95267449ea0b79c0b049342409949da3ac.zip
op-kernel-dev-6cbe5e95267449ea0b79c0b049342409949da3ac.tar.gz
openrisc: sanitize use of orig_gpr11
The pt_regs struct had both a 'syscallno' field and an 'orig_gpr11' field and it wasn't really clear how these were supposed to be used. This patch removes the syscallno field altogether and makes orig_gpr11 work more like other architectures: keep track of syscall number in progress or hold -1 for non-syscall exceptions. Signed-off-by: Jonas Bonn <jonas@southpole.se>
Diffstat (limited to 'arch/openrisc/include')
-rw-r--r--arch/openrisc/include/asm/ptrace.h6
-rw-r--r--arch/openrisc/include/asm/syscall.h7
2 files changed, 7 insertions, 6 deletions
diff --git a/arch/openrisc/include/asm/ptrace.h b/arch/openrisc/include/asm/ptrace.h
index e612ce4..4651a73 100644
--- a/arch/openrisc/include/asm/ptrace.h
+++ b/arch/openrisc/include/asm/ptrace.h
@@ -73,9 +73,13 @@ struct pt_regs {
};
};
long pc;
+ /* For restarting system calls:
+ * Set to syscall number for syscall exceptions,
+ * -1 for all other exceptions.
+ */
long orig_gpr11; /* For restarting system calls */
- long syscallno; /* Syscall number (used by strace) */
long dummy; /* Cheap alignment fix */
+ long dummy2; /* Cheap alignment fix */
};
/* TODO: Rename this to REDZONE because that's what it is */
diff --git a/arch/openrisc/include/asm/syscall.h b/arch/openrisc/include/asm/syscall.h
index 9f03370..b752bb6 100644
--- a/arch/openrisc/include/asm/syscall.h
+++ b/arch/openrisc/include/asm/syscall.h
@@ -25,7 +25,7 @@
static inline int
syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
{
- return regs->syscallno ? regs->syscallno : -1;
+ return regs->orig_gpr11;
}
static inline void
@@ -50,10 +50,7 @@ static inline void
syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
int error, long val)
{
- if (error)
- regs->gpr[11] = -error;
- else
- regs->gpr[11] = val;
+ regs->gpr[11] = (long) error ?: val;
}
static inline void
OpenPOWER on IntegriCloud