Commit fbe4ef29 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: Add sys_restart_syscall, from ppc32

parent d9ef85c0
...@@ -508,7 +508,7 @@ _GLOBAL(kernel_thread) ...@@ -508,7 +508,7 @@ _GLOBAL(kernel_thread)
/* Why isn't this a) automatic, b) written in 'C'? */ /* Why isn't this a) automatic, b) written in 'C'? */
.balign 8 .balign 8
_GLOBAL(sys_call_table32) _GLOBAL(sys_call_table32)
.llong .sys_ni_syscall /* 0 - old setup syscall */ .llong .sys_restart_syscall /* 0 */
.llong .sys_exit .llong .sys_exit
.llong .sys_fork .llong .sys_fork
.llong .sys_read .llong .sys_read
...@@ -756,7 +756,7 @@ _GLOBAL(sys_call_table32) ...@@ -756,7 +756,7 @@ _GLOBAL(sys_call_table32)
.balign 8 .balign 8
_GLOBAL(sys_call_table) _GLOBAL(sys_call_table)
.llong .sys_ni_syscall /* 0 - old setup syscall */ .llong .sys_restart_syscall /* 0 */
.llong .sys_exit .llong .sys_exit
.llong .sys_fork .llong .sys_fork
.llong .sys_read .llong .sys_read
......
...@@ -450,9 +450,14 @@ static void handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset, ...@@ -450,9 +450,14 @@ static void handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
if (regs->trap == 0x0C00 /* System Call! */ if (regs->trap == 0x0C00 /* System Call! */
&& ((int)regs->result == -ERESTARTNOHAND || && ((int)regs->result == -ERESTARTNOHAND ||
(int)regs->result == -ERESTART_RESTARTBLOCK ||
((int)regs->result == -ERESTARTSYS && ((int)regs->result == -ERESTARTSYS &&
!(ka->sa.sa_flags & SA_RESTART)))) !(ka->sa.sa_flags & SA_RESTART)))) {
if ((int)regs->result == -ERESTART_RESTARTBLOCK)
current_thread_info()->restart_block.fn
= do_no_restart_syscall;
regs->result = -EINTR; regs->result = -EINTR;
}
/* Set up Signal Frame */ /* Set up Signal Frame */
if (ka->sa.sa_flags & SA_SIGINFO) { if (ka->sa.sa_flags & SA_SIGINFO) {
...@@ -560,13 +565,18 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs) ...@@ -560,13 +565,18 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
handle_signal(signr, &info, oldset, regs, &newsp, frame); handle_signal(signr, &info, oldset, regs, &newsp, frame);
} }
if (regs->trap == 0x0C00 /* System Call! */ && if (regs->trap == 0x0C00) { /* System Call! */
((int)regs->result == -ERESTARTNOHAND || if ((int)regs->result == -ERESTARTNOHAND ||
(int)regs->result == -ERESTARTSYS || (int)regs->result == -ERESTARTSYS ||
(int)regs->result == -ERESTARTNOINTR)) { (int)regs->result == -ERESTARTNOINTR) {
regs->gpr[3] = regs->orig_gpr3; regs->gpr[3] = regs->orig_gpr3;
regs->nip -= 4; /* Back up & retry system call */ regs->nip -= 4; /* Back up & retry system call */
regs->result = 0; regs->result = 0;
} else if ((int)regs->result == -ERESTART_RESTARTBLOCK) {
regs->gpr[0] = __NR_restart_syscall;
regs->nip -= 4;
regs->result = 0;
}
} }
if (newsp == frame) if (newsp == frame)
......
...@@ -968,9 +968,14 @@ static void handle_signal32(unsigned long sig, siginfo_t *info, ...@@ -968,9 +968,14 @@ static void handle_signal32(unsigned long sig, siginfo_t *info,
if (regs->trap == 0x0C00 /* System Call! */ if (regs->trap == 0x0C00 /* System Call! */
&& ((int)regs->result == -ERESTARTNOHAND || && ((int)regs->result == -ERESTARTNOHAND ||
(int)regs->result == -ERESTART_RESTARTBLOCK ||
((int)regs->result == -ERESTARTSYS && ((int)regs->result == -ERESTARTSYS &&
!(ka->sa.sa_flags & SA_RESTART)))) !(ka->sa.sa_flags & SA_RESTART)))) {
if ((int)regs->result == -ERESTART_RESTARTBLOCK)
current_thread_info()->restart_block.fn
= do_no_restart_syscall;
regs->result = -EINTR; regs->result = -EINTR;
}
/* /*
* Set up the signal frame * Set up the signal frame
...@@ -1132,13 +1137,18 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs) ...@@ -1132,13 +1137,18 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs)
handle_signal32(signr, &info, oldset, regs, &newsp, frame); handle_signal32(signr, &info, oldset, regs, &newsp, frame);
} }
if (regs->trap == 0x0C00 /* System Call! */ && if (regs->trap == 0x0C00) { /* System Call! */
((int)regs->result == -ERESTARTNOHAND || if ((int)regs->result == -ERESTARTNOHAND ||
(int)regs->result == -ERESTARTSYS || (int)regs->result == -ERESTARTSYS ||
(int)regs->result == -ERESTARTNOINTR)) { (int)regs->result == -ERESTARTNOINTR) {
regs->gpr[3] = regs->orig_gpr3; regs->gpr[3] = regs->orig_gpr3;
regs->nip -= 4; /* Back up & retry system call */ regs->nip -= 4; /* Back up & retry system call */
regs->result = 0; regs->result = 0;
} else if ((int)regs->result == -ERESTART_RESTARTBLOCK) {
regs->gpr[0] = __NR_restart_syscall;
regs->nip -= 4;
regs->result = 0;
}
} }
if (newsp == frame) if (newsp == frame)
......
...@@ -13,12 +13,6 @@ ...@@ -13,12 +13,6 @@
#undef EDEADLOCK #undef EDEADLOCK
#define EDEADLOCK 58 /* File locking deadlock error */ #define EDEADLOCK 58 /* File locking deadlock error */
/* Should never be seen by user programs */ #define _LAST_ERRNO 516
#define ERESTARTSYS 512
#define ERESTARTNOINTR 513
#define ERESTARTNOHAND 514 /* restart if no handler.. */
#define ENOIOCTLCMD 515 /* No ioctl command */
#define _LAST_ERRNO 515
#endif #endif
...@@ -23,6 +23,7 @@ struct thread_info { ...@@ -23,6 +23,7 @@ struct thread_info {
unsigned long flags; /* low level flags */ unsigned long flags; /* low level flags */
int cpu; /* cpu we're on */ int cpu; /* cpu we're on */
int preempt_count; /* not used at present */ int preempt_count; /* not used at present */
struct restart_block restart_block;
}; };
/* /*
...@@ -37,6 +38,9 @@ struct thread_info { ...@@ -37,6 +38,9 @@ struct thread_info {
.flags = 0, \ .flags = 0, \
.cpu = 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) #define init_thread_info (init_thread_union.thread_info)
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define __NR_restart_syscall 0
#define __NR_exit 1 #define __NR_exit 1
#define __NR_fork 2 #define __NR_fork 2
#define __NR_read 3 #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