From nobody Mon Feb 9 16:45:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1635894861100672.102903568051; Tue, 2 Nov 2021 16:14:21 -0700 (PDT) Received: from localhost ([::1]:50166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mi2yu-0007fG-4k for importer@patchew.org; Tue, 02 Nov 2021 19:14:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mi2f6-0007co-L7 for qemu-devel@nongnu.org; Tue, 02 Nov 2021 18:53:48 -0400 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]:42806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mi2f2-0002t5-LI for qemu-devel@nongnu.org; Tue, 02 Nov 2021 18:53:48 -0400 Received: by mail-il1-x130.google.com with SMTP id y17so641528ilb.9 for ; Tue, 02 Nov 2021 15:53:44 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h14sm205427ils.75.2021.11.02.15.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 15:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+r01BN2RKWDgyocvJBPU5Kji19m/VGVQeGkX/VmFsS8=; b=JStp4w00RfzOkx0uDorl99c+l/aYTj4LwDf6dNSwDDneQhTGojjqE1yXijXgX+wCJ0 X8TXMuIHzC1ICNzuBwmUNXvygyzs1ZDt9vX0jBl7OG289nbSuhEsg+hC+d9Kr77GbDSy kdrSVSARdIITrmiwvo9jQ2nK3ZzBKK4dkDFAqUv8UnDYmR9fLZcoRERxgaeTPFbttBUK jZtC7nCMR+PV0dOBoed/FJ1YJfSLcUg8PP0LecUnkEnrMTx66DxEFebutsogTx2j2AfE QbotXse/bw39ZPARZJO7WkBZbi3NLj959DYzHIcAnLekR3hR9SEAD0fOOWYEZdrJSUUb IQ2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+r01BN2RKWDgyocvJBPU5Kji19m/VGVQeGkX/VmFsS8=; b=qg9iyRLsyl/qeLDV113kfSF5UgIJ7qQ1eDKvs4y6xw9I+MrkLwTVnSsLuZ5HmEtbnd YluudnKEIBo59hzlujZ1lHy1juuw7fqy5O5xkhVbc/g+xoU8pyrvge+IP1nr8KZvw8NJ IxD+3Bsm9leUhnkc9S1SAR6JmNvZwu7+oM3LxBvulL2FL3hpafxaqZyhqLP1tnefX95k W1iKkJaubhqpWZJXe3JegQ5FC9y/eUA6GRh0zz+J8nbZ5ShVU3ShxGo3W22qEFg9DYU/ E8aE209dwM0EUZFQ7JVwJfLF/mCkOlt5WTWaAu/tVLpd6+2o6aMk8f/mhzoyl1+/djh6 Olsw== X-Gm-Message-State: AOAM532vPT3v43tss7Thi2ZscZQFdmFXn5xpfCpAVFxiGBtR/v7PRIBR sRGJ9+xYUaslaFbwaPuYyS/LP080IwLHKw== X-Google-Smtp-Source: ABdhPJy4eWfcJATw1ghGx+/PutfwVFhsLhZe384iRFNY7TFxO5VgJv3sqH6MPm9N4Mbqx1GXub/k8w== X-Received: by 2002:a92:cda2:: with SMTP id g2mr17147699ild.2.1635893623411; Tue, 02 Nov 2021 15:53:43 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PATCH v2 23/30] bsd-user/arm/target_arch_signal.h: arm get_mcontext Date: Tue, 2 Nov 2021 16:52:41 -0600 Message-Id: <20211102225248.52999-24-imp@bsdimp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211102225248.52999-1-imp@bsdimp.com> References: <20211102225248.52999-1-imp@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::130; envelope-from=imp@bsdimp.com; helo=mail-il1-x130.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stacey Son , qemu-trivial@nongnu.org, Kyle Evans , Richard Henderson , Philippe Mathieu-Daude , Laurent Vivier , Michael Tokarev , Warner Losh Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1635894863431100002 Content-Type: text/plain; charset="utf-8" Get the machine context from the CPU state. Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/arm/target_arch_signal.h | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/bsd-user/arm/target_arch_signal.h b/bsd-user/arm/target_arch_s= ignal.h index 61440b51b4..b42d08402f 100644 --- a/bsd-user/arm/target_arch_signal.h +++ b/bsd-user/arm/target_arch_signal.h @@ -129,4 +129,54 @@ set_sigtramp_args(CPUARMState *env, int sig, struct ta= rget_sigframe *frame, return 0; } =20 +/* + * Compare to arm/arm/machdep.c get_mcontext() + * Assumes that the memory is locked if mcp points to user memory. + */ +static inline abi_long get_mcontext(CPUARMState *env, target_mcontext_t *m= cp, + int flags) +{ + int err =3D 0; + uint32_t *gr =3D mcp->__gregs; + + if (mcp->mc_vfp_size !=3D 0 && mcp->mc_vfp_size !=3D sizeof(target_mco= ntext_vfp_t)) { + return -TARGET_EINVAL; + } + + gr[TARGET_REG_CPSR] =3D tswap32(cpsr_read(env)); + if (flags & TARGET_MC_GET_CLEAR_RET) { + gr[TARGET_REG_R0] =3D 0; + gr[TARGET_REG_CPSR] &=3D ~CPSR_C; + } else { + gr[TARGET_REG_R0] =3D tswap32(env->regs[0]); + } + + gr[TARGET_REG_R1] =3D tswap32(env->regs[1]); + gr[TARGET_REG_R2] =3D tswap32(env->regs[2]); + gr[TARGET_REG_R3] =3D tswap32(env->regs[3]); + gr[TARGET_REG_R4] =3D tswap32(env->regs[4]); + gr[TARGET_REG_R5] =3D tswap32(env->regs[5]); + gr[TARGET_REG_R6] =3D tswap32(env->regs[6]); + gr[TARGET_REG_R7] =3D tswap32(env->regs[7]); + gr[TARGET_REG_R8] =3D tswap32(env->regs[8]); + gr[TARGET_REG_R9] =3D tswap32(env->regs[9]); + gr[TARGET_REG_R10] =3D tswap32(env->regs[10]); + gr[TARGET_REG_R11] =3D tswap32(env->regs[11]); + gr[TARGET_REG_R12] =3D tswap32(env->regs[12]); + + gr[TARGET_REG_SP] =3D tswap32(env->regs[13]); + gr[TARGET_REG_LR] =3D tswap32(env->regs[14]); + gr[TARGET_REG_PC] =3D tswap32(env->regs[15]); + + if (mcp->mc_vfp_size !=3D 0 && mcp->mc_vfp_ptr !=3D NULL) { + /* see get_vfpcontext in sys/arm/arm/exec_machdep.c */ + target_mcontext_vfp_t *vfp =3D (target_mcontext_vfp_t *)mcp->mc_vf= p_ptr; + for (int i =3D 0; i < 32; i++) { + vfp->mcv_reg[i] =3D tswap64(*aa32_vfp_dreg(env, i)); + } + vfp->mcv_fpscr =3D tswap32(vfp_get_fpscr(env)); + } + return err; +} + #endif /* !_TARGET_ARCH_SIGNAL_H_ */ --=20 2.33.0