csky: Use in_syscall & forget_syscall instead of r11_sig

We could use regs->sr 16-24 bits to detect syscall: VEC_TRAP0 and
r11_sig is no necessary for current implementation.

In this patch, we implement the in_syscall and forget_syscall which are
inspired from arm & nds32, but csky pt_regs has no syscall_num element
and we just set zero to regs->sr's vector-bits-field instead.

For ret_from_fork, current task was forked from parent which is in syscall
progress and its regs->sr has been already setted with VEC_TRAP0. See:
arch/csky/kernel/process.c: copy_thread()

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
This commit is contained in:
Guo Ren
2019-03-30 23:44:34 +08:00
parent f335b10f3b
commit f4625ee0e4
5 changed files with 22 additions and 20 deletions

View File

@@ -224,7 +224,7 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
* that the kernel can handle, and then we build all the user-level signal
* handling stack-frames in one go after that.
*/
static void do_signal(struct pt_regs *regs, int syscall)
static void do_signal(struct pt_regs *regs)
{
unsigned int retval = 0, continue_addr = 0, restart_addr = 0;
struct ksignal ksig;
@@ -241,7 +241,9 @@ static void do_signal(struct pt_regs *regs, int syscall)
/*
* If we were from a system call, check for system call restarting...
*/
if (syscall) {
if (in_syscall(regs)) {
forget_syscall(regs);
continue_addr = regs->pc;
#if defined(__CSKYABIV2__)
restart_addr = continue_addr - 4;
@@ -249,7 +251,6 @@ static void do_signal(struct pt_regs *regs, int syscall)
restart_addr = continue_addr - 2;
#endif
retval = regs->a0;
/*
* Prepare for system call restart. We do this here so that a
* debugger will see the already changed.
@@ -304,7 +305,9 @@ static void do_signal(struct pt_regs *regs, int syscall)
}
no_signal:
if (syscall) {
if (in_syscall(regs)) {
forget_syscall(regs);
/*
* Handle restarting a different system call. As above,
* if a debugger has chosen to restart at a different PC,
@@ -333,10 +336,10 @@ no_signal:
}
asmlinkage void
do_notify_resume(unsigned int thread_flags, struct pt_regs *regs, int syscall)
do_notify_resume(unsigned int thread_flags, struct pt_regs *regs)
{
if (thread_flags & _TIF_SIGPENDING)
do_signal(regs, syscall);
do_signal(regs);
if (thread_flags & _TIF_NOTIFY_RESUME) {
clear_thread_flag(TIF_NOTIFY_RESUME);