Commit 285a7c9f authored by Miles Bader's avatar Miles Bader Committed by Linus Torvalds

[PATCH] Add v850 support for `sys_restart_syscall'

parent 31c9fa59
......@@ -781,7 +781,7 @@ C_END(trap_table)
.align 4
C_DATA(sys_call_table):
.long CSYM(sys_ni_syscall) // 0 - old "setup()" system call
.long CSYM(sys_restart_syscall) // 0
.long CSYM(sys_exit)
.long sys_fork_wrapper
.long CSYM(sys_read)
......
......@@ -439,6 +439,10 @@ handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
if (PT_REGS_SYSCALL (regs)) {
/* If so, check system call restarting.. */
switch (regs->gpr[GPR_RVAL]) {
case -ERESTART_RESTARTBLOCK:
current_thread_info()->restart_block.fn =
do_no_restart_syscall;
/* fall through */
case -ERESTARTNOHAND:
regs->gpr[GPR_RVAL] = -EINTR;
break;
......@@ -510,14 +514,19 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
/* Did we come from a system call? */
if (PT_REGS_SYSCALL (regs)) {
int rval = (int)regs->gpr[GPR_RVAL];
/* Restart the system call - no handlers present */
if (regs->gpr[GPR_RVAL] == (v850_reg_t)-ERESTARTNOHAND ||
regs->gpr[GPR_RVAL] == (v850_reg_t)-ERESTARTSYS ||
regs->gpr[GPR_RVAL] == (v850_reg_t)-ERESTARTNOINTR)
if (rval == -ERESTARTNOHAND
|| rval == -ERESTARTSYS
|| rval == -ERESTARTNOINTR)
{
regs->gpr[12] = PT_REGS_SYSCALL (regs);
regs->pc -= 4; /* Size of `trap 0' insn. */
}
else if (rval == -ERESTART_RESTARTBLOCK) {
regs->gpr[12] = __NR_restart_syscall;
regs->pc -= 4; /* Size of `trap 0' insn. */
}
}
return 0;
}
......@@ -14,8 +14,11 @@
#ifndef __V850_CURRENT_H__
#define __V850_CURRENT_H__
#ifndef __ASSEMBLY__ /* <linux/thread_info.h> is not asm-safe. */
#include <linux/thread_info.h>
#endif
#include <asm/macrology.h>
#include <asm/thread_info.h>
/* Register used to hold the current task pointer while in the kernel.
......
......@@ -15,9 +15,11 @@
#define __V850_PROCESSOR_H__
#include <linux/config.h>
#ifndef __ASSEMBLY__ /* <linux/thread_info.h> is not asm-safe. */
#include <linux/thread_info.h>
#endif
#include <asm/ptrace.h>
#include <asm/thread_info.h>
#include <asm/entry.h>
/* Some code expects `segment' stuff to be defined here. */
......
......@@ -31,6 +31,7 @@ struct thread_info {
unsigned long flags; /* low level flags */
int cpu; /* cpu we're on */
int preempt_count;
struct restart_block restart_block;
};
#define INIT_THREAD_INFO(tsk) \
......@@ -39,7 +40,10 @@ struct thread_info {
.exec_domain = &default_exec_domain, \
.flags = 0, \
.cpu = 0, \
.preempt_count = 1 \
.preempt_count = 1, \
.restart_block = { \
.fn = do_no_restart_syscall, \
}, \
}
#define init_thread_info (init_thread_union.thread_info)
......@@ -67,8 +71,6 @@ struct thread_info {
#define TI_FLAGS 8
#define TI_CPU 12
#define TI_PREEMPT 16
#define TI_SOFTIRQ 20
#define TI_HARDIRQ 24
#define PREEMPT_ACTIVE 0x4000000
......
......@@ -16,6 +16,7 @@
#include <asm/clinkage.h>
#define __NR_restart_syscall 0
#define __NR_exit 1
#define __NR_fork 2
#define __NR_read 3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment