From nobody Tue Feb 10 08:03:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508330226655218.098848644643; Wed, 18 Oct 2017 05:37:06 -0700 (PDT) Received: from localhost ([::1]:44441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4naa-0007Gq-P1 for importer@patchew.org; Wed, 18 Oct 2017 08:36:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4nXU-0005C7-Hb for qemu-devel@nongnu.org; Wed, 18 Oct 2017 08:33:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4nXQ-0003tU-6S for qemu-devel@nongnu.org; Wed, 18 Oct 2017 08:33:35 -0400 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:49430) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4nXP-0003t2-Uv for qemu-devel@nongnu.org; Wed, 18 Oct 2017 08:33:32 -0400 Received: by mail-lf0-x243.google.com with SMTP id w21so5625554lfc.6 for ; Wed, 18 Oct 2017 05:33:31 -0700 (PDT) Received: from berserk.kos.to (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id j71sm2590718lfk.6.2017.10.18.05.33.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Oct 2017 05:33:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bUXOiLG8Tv+ZHWbTyJCUj0N5aeCUWKqiqSz0cVZvEfs=; b=QkktoTJnsPxjdn619RDOksfDL4kYXwawZHriGHiv3RbGLEq9NipaaglUZJqzqdJBAa Lap2n6wx0hwk94jZwWD+qxMGhPLk585Ivi6tEghus4SELuv6mWMmeE42S4dMpkuvtuJn w+h/nndeoSS93IMXx+lJKSYQ5257Nli6cSH6c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bUXOiLG8Tv+ZHWbTyJCUj0N5aeCUWKqiqSz0cVZvEfs=; b=emjMJPia0UGvNQQiUa3MUBJ9k4ZbyHeGYcJpnrkZ97B+v69s6XMt8qOwTZDn1Dtm8s ARWviZGB0o4SIn5V6lCeOi45jFcIecauCd71qSa/tsKeSns5pz8a7JlxIr/BPGXG12SA /W5nCja9HfV9qLoN7pbiS0xGYYQcrmJVez3gIyRKEaXAbpFhS5mbyDl4V6iuBfXOScED +92lgszKts0jNDQfh1dfkzlxDsCbrx38Do5j+6l0nT2ov+Jr6QDenZH09XFz9QMvd8Y3 SYgdZtjo87Xnw6Ay+ZW191TsjwgI7I0eBUAqN8j7MO1B30OM/w2WHSOLtlMB0JOBVP4O i9Gw== X-Gm-Message-State: AMCzsaVIlFbsi2TIcj7FNAhWT04BWL6LrYG35htxXIKgwcECf9TniHbB b4bcjymUQ6ficcxnpL15Az0oHFc3yMg= X-Google-Smtp-Source: ABhQp+Qb5A4VCx6afPqRAaGjQ7FjzOEELCRQ9YVL4Uola/qVJ5twDeRGyAfRPFcVTEy6x9vVMakngw== X-Received: by 10.46.69.6 with SMTP id s6mr2327366lja.76.1508330010399; Wed, 18 Oct 2017 05:33:30 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 18 Oct 2017 15:33:16 +0300 Message-Id: X-Mailer: git-send-email 2.14.2 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::243 Subject: [Qemu-devel] [PULL 02/10] target/m68k, linux-user: manage FP registers in ucontext X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Signed-off-by: Riku Voipio --- 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); } =20 +static inline void target_rt_save_fpu_state(struct target_ucontext *uc, + CPUM68KState *env) +{ + int i; + target_fpregset_t *fpregs =3D &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 =3D 0; i < 8; i++) { + uint32_t high =3D 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 ta= rget_ucontext *uc, __put_user(env->pc, &gregs[16]); __put_user(sr, &gregs[17]); =20 + target_rt_save_fpu_state(uc, env); + return 0; } =20 +static inline void target_rt_restore_fpu_state(CPUM68KState *env, + struct target_ucontext *uc) +{ + int i; + target_fpregset_t *fpregs =3D &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 =3D 0; i < 8; i++) { + uint32_t high; + __get_user(high, &fpregs->f_fpregs[i * 3]); + env->fregs[i].d.high =3D 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(CPUM68KS= tate *env, __get_user(temp, &gregs[17]); cpu_m68k_set_ccr(env, temp); =20 + target_rt_restore_fpu_state(env, uc); + return 0; =20 badframe: --=20 2.14.2