On Thu, Sep 10, 2015 at 08:12:21PM +0100, Peter Maydell wrote: > On 6 September 2015 at 00:57, Timothy E Baldwin > <t.e.baldwi...@members.leeds.ac.uk> wrote: > > Signed-off-by: Timothy Edward Baldwin <t.e.baldwi...@members.leeds.ac.uk> > > --- > > > > WARNING - NOT TESTED > > > > linux-user/cris/syscall.h | 2 ++ > > linux-user/main.c | 6 +++++- > > linux-user/signal.c | 2 +- > > 3 files changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/linux-user/cris/syscall.h b/linux-user/cris/syscall.h > > index 2957b0d..29218e2 100644 > > --- a/linux-user/cris/syscall.h > > +++ b/linux-user/cris/syscall.h > > @@ -44,3 +44,5 @@ struct target_pt_regs { > > #define TARGET_MLOCKALL_MCL_FUTURE 2 > > > > #endif > > + > > +#define TARGET_USE_ERESTARTSYS 1 > > diff --git a/linux-user/main.c b/linux-user/main.c > > index a59907e..a9eb15c 100644 > > --- a/linux-user/main.c > > +++ b/linux-user/main.c > > @@ -2878,7 +2878,11 @@ void cpu_loop(CPUCRISState *env) > > env->pregs[7], > > env->pregs[11], > > 0, 0); > > - env->regs[10] = ret; > > + if (ret == -TARGET_ERESTARTSYS) { > > + env->pc -= 2; > > + } else if (ret != -TARGET_QEMU_ESIGRETURN) { > > + env->regs[10] = ret; > > + } > > break; > > case EXCP_DEBUG: > > { > > diff --git a/linux-user/signal.c b/linux-user/signal.c > > index e17514e..3741517 100644 > > --- a/linux-user/signal.c > > +++ b/linux-user/signal.c > > @@ -3761,7 +3761,7 @@ long do_sigreturn(CPUCRISState *env) > > > > restore_sigcontext(&frame->sc, env); > > unlock_user_struct(frame, frame_addr, 0); > > - return env->regs[10]; > > + return -TARGET_QEMU_ESIGRETURN; > > badframe: > > force_sig(TARGET_SIGSEGV); > > } > > Looks OK, but this one I'm not sure enough about the CRIS instruction > set and the surrounding code doesn't clarify. Edgar -- is the CRIS > instruction for "take linux system call" always exactly 2 bytes long? >
Yes, those are always 2 bytes. Cheers, Edgar