From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ak7BM-0002nn-Gd for qemu-devel@nongnu.org; Sun, 27 Mar 2016 05:40:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ak7BI-0000vA-4P for qemu-devel@nongnu.org; Sun, 27 Mar 2016 05:40:28 -0400 Received: from out11.biz.mail.alibaba.com ([205.204.114.131]:44895) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ak7BH-0000ua-EA for qemu-devel@nongnu.org; Sun, 27 Mar 2016 05:40:24 -0400 Message-ID: <56F7AB79.8010403@emindsoft.com.cn> Date: Sun, 27 Mar 2016 17:44:25 +0800 From: Chen Gang MIME-Version: 1.0 References: <1457992308-2136-1-git-send-email-chengang@emindsoft.com.cn> In-Reply-To: <1457992308-2136-1-git-send-email-chengang@emindsoft.com.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] linux-user/signal.c: Generate opcode data for restorer in setup_rt_frame List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: rth@twiddle.net, peter.maydell@linaro.org, cmetcalf@ezchip.com Cc: walt@tilera.com, qemu-devel@nongnu.org, Laurent Vivier Hello All: Please help check this patch when you have time. After this patch, we can let gcc testsuite cleanup-10 run successfully. Next, I shall continue to implement floating point instructions: remove (u)int64_to_float64 from fdouble implementation. Thanks. On 3/15/16 05:51, chengang@emindsoft.com.cn wrote: > From: Chen Gang > > Original implementation uses do_rt_sigreturn directly in host space, > when a guest program is in unwind procedure in guest space, it will get > an incorrect restore address, then causes unwind failure. > > Also cleanup the original incorrect indentation. > > Signed-off-by: Chen Gang > --- > linux-user/signal.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/linux-user/signal.c b/linux-user/signal.c > index 919aa83..0e3b1c6 100644 > --- a/linux-user/signal.c > +++ b/linux-user/signal.c > @@ -5566,8 +5566,13 @@ struct target_rt_sigframe { > unsigned char save_area[16]; /* caller save area */ > struct target_siginfo info; > struct target_ucontext uc; > + abi_ulong retcode[2]; > }; > > +#define INSN_MOVELI_R10_139 0x00045fe551483000ULL /* { moveli r10, 139 } */ > +#define INSN_SWINT1 0x286b180051485000ULL /* { swint1 } */ > + > + > static void setup_sigcontext(struct target_sigcontext *sc, > CPUArchState *env, int signo) > { > @@ -5643,9 +5648,12 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka, > __put_user(target_sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size); > setup_sigcontext(&frame->uc.tuc_mcontext, env, info->si_signo); > > - restorer = (unsigned long) do_rt_sigreturn; > if (ka->sa_flags & TARGET_SA_RESTORER) { > - restorer = (unsigned long) ka->sa_restorer; > + restorer = (unsigned long) ka->sa_restorer; > + } else { > + __put_user(INSN_MOVELI_R10_139, &frame->retcode[0]); > + __put_user(INSN_SWINT1, &frame->retcode[1]); > + restorer = (unsigned long)frame->retcode; > } > env->pc = (unsigned long) ka->_sa_handler; > env->regs[TILEGX_R_SP] = (unsigned long) frame; > -- Chen Gang (陈刚) Managing Natural Environments is the Duty of Human Beings.