From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e44Uj-00009C-JJ for qemu-devel@nongnu.org; Mon, 16 Oct 2017 08:27:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e44Ug-0001V0-Uw for qemu-devel@nongnu.org; Mon, 16 Oct 2017 08:27:45 -0400 Received: from jessie.kos.to ([212.47.231.226]:52296 helo=pilvi.kos.to) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e44Ug-0001PO-Od for qemu-devel@nongnu.org; Mon, 16 Oct 2017 08:27:42 -0400 Date: Mon, 16 Oct 2017 12:27:38 +0000 From: Riku Voipio Message-ID: <20171016122738.GA1918@kos.to> References: <20170914163505.20558-1-laurent@vivier.eu> <20170914163505.20558-2-laurent@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170914163505.20558-2-laurent@vivier.eu> Subject: Re: [Qemu-devel] [PATCH v4 1/1] target/m68k, linux-user: manage FP registers in ucontext List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: qemu-devel@nongnu.org, Richard Henderson On Thu, Sep 14, 2017 at 06:35:05PM +0200, Laurent Vivier wrote: > Signed-off-by: Laurent Vivier > Reviewed-by: Richard Henderson Applied to linux-user que, thnanks > --- > linux-user/signal.c | 43 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 43 insertions(+) > > diff --git a/linux-user/signal.c b/linux-user/signal.c > index cc0c3fcee9..7a238aaea1 100644 > --- a/linux-user/signal.c > +++ b/linux-user/signal.c > @@ -5704,6 +5704,24 @@ give_sigsegv: > force_sigsegv(sig); > } > > +static inline void target_rt_save_fpu_state(struct target_ucontext *uc, > + CPUM68KState *env) > +{ > + int i; > + target_fpregset_t *fpregs = &uc->tuc_mcontext.fpregs; > + > + __put_user(env->fpcr, &fpregs->f_fpcntl[0]); > + __put_user(env->fpsr, &fpregs->f_fpcntl[1]); > + /* fpiar is not emulated */ > + > + for (i = 0; i < 8; i++) { > + uint32_t high = env->fregs[i].d.high << 16; > + __put_user(high, &fpregs->f_fpregs[i * 3]); > + __put_user(env->fregs[i].d.low, > + (uint64_t *)&fpregs->f_fpregs[i * 3 + 1]); > + } > +} > + > static inline int target_rt_setup_ucontext(struct target_ucontext *uc, > CPUM68KState *env) > { > @@ -5730,9 +5748,32 @@ static inline int target_rt_setup_ucontext(struct target_ucontext *uc, > __put_user(env->pc, &gregs[16]); > __put_user(sr, &gregs[17]); > > + target_rt_save_fpu_state(uc, env); > + > return 0; > } > > +static inline void target_rt_restore_fpu_state(CPUM68KState *env, > + struct target_ucontext *uc) > +{ > + int i; > + target_fpregset_t *fpregs = &uc->tuc_mcontext.fpregs; > + uint32_t fpcr; > + > + __get_user(fpcr, &fpregs->f_fpcntl[0]); > + cpu_m68k_set_fpcr(env, fpcr); > + __get_user(env->fpsr, &fpregs->f_fpcntl[1]); > + /* fpiar is not emulated */ > + > + for (i = 0; i < 8; i++) { > + uint32_t high; > + __get_user(high, &fpregs->f_fpregs[i * 3]); > + env->fregs[i].d.high = high >> 16; > + __get_user(env->fregs[i].d.low, > + (uint64_t *)&fpregs->f_fpregs[i * 3 + 1]); > + } > +} > + > static inline int target_rt_restore_ucontext(CPUM68KState *env, > struct target_ucontext *uc) > { > @@ -5764,6 +5805,8 @@ static inline int target_rt_restore_ucontext(CPUM68KState *env, > __get_user(temp, &gregs[17]); > cpu_m68k_set_ccr(env, temp); > > + target_rt_restore_fpu_state(env, uc); > + > return 0; > > badframe: > -- > 2.13.5 >