From nobody Fri Oct 18 06:15:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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 ARC-Seal: i=1; a=rsa-sha256; t=1721858840; cv=none; d=zohomail.com; s=zohoarc; b=GxAfGWXgZ7WIakhBHl1IuDy7bl7tI/Zg6ZKdy/IebJEuQ7wMDHSTzTVFyfYR4/1lVsV8rJEe4f1CJA2DDqNogWPfkVC8NX7kXl0fn4iiQp7VZmxqwrLtURaizB+6Z2AVxV931qsLaOHiD4jcnnnmGHKGjBzpeZLVY0Tbqqgxfyw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721858840; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6l2giQ2DgrY0GVfdS/Z1DlHyLIcTuXalMYf+UrzR91E=; b=bvYmVXg40k8QGfa7akg+zLJnIaznNIjT/vG1nwghGBX3Bj3TuerkP1+my3RnioF83FGhqZl1mKt3X1b0XHYnnxZu+wlVf+DwE0rUfF3lQcE8tsgq7WBHgdisarKKcyxQZYN43t8gRFQu82/ulAwEnM3v8EGoJZJ+pZ6B+fUTK7A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1721858840165949.4723745277485; Wed, 24 Jul 2024 15:07:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sWk7z-0000QZ-Hh; Wed, 24 Jul 2024 18:06:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sWk7v-0000Gy-KW for qemu-devel@nongnu.org; Wed, 24 Jul 2024 18:06:27 -0400 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sWk7s-0006XJ-GH for qemu-devel@nongnu.org; Wed, 24 Jul 2024 18:06:27 -0400 Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-7fe8d029fbeso13825339f.3 for ; Wed, 24 Jul 2024 15:06:23 -0700 (PDT) Received: from dune.bsdimp.com ([50.253.99.174]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4c29fa983f8sm10086173.47.2024.07.24.15.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jul 2024 15:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1721858782; x=1722463582; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6l2giQ2DgrY0GVfdS/Z1DlHyLIcTuXalMYf+UrzR91E=; b=nQjP9orQDkXDCkAcCyRhkMCucwO+Zf49vf2d5bmVyyi/Lj86D8xH2AzrWb4rwpshaT oZA8uKepPeIy+LxSnMvCLCetIGz1bppjs+rTdCiAdGzP2BPPJpUSVDxFl9DRE911+tew /9yGmvlp5hBWwIBrpOM9011byLgwQtfihg2QZNr98siU5XE+uRePhNT9PwUlEtnNBn8C XB9Txhmh3YD8+l3vcHIpi6lsR5sM09mZXuhoMkpaQrd7F2rzmWiIWxe3+EzwhCoYkMac qltaZ5+CgVxIaiSPzRsIUaEa8Gs6mVeaaby4wPPinUUDSIBGX/c3q4yn80G4F9jxeGIQ IKyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721858782; x=1722463582; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6l2giQ2DgrY0GVfdS/Z1DlHyLIcTuXalMYf+UrzR91E=; b=eLZtbbgmUlJtQIkjauT28ZPYXT3Gg+0lGN0eu2bT3TrknPyFSQotSqysOoGWGyelTJ DhfRjT1/Czat2t62sTK+ReAbLKJLKA1N1RV51Fv1FOJuAESjwFVPxvlILbu6XirmjCLY fzvWxBJ388HIwBq9cKM3rnTV6Biae3POQPa8nzNFyzwJYJbC4kF2nphQh7TYGmUJ2blR tziEzSt0JAtv2iaFmY5WtbF2RAROE+I2MfiYBPcqvVrnKcj63DgbIOXvLOk8bCZp5wn7 J32SauabQwIb4CYE2FQmoXNqBkyfCCzzqIXRU+hzdyEPJzfMCBrZD/oGYM62DdBHqxMf UTEg== X-Gm-Message-State: AOJu0YywjPX/TPHsqSCphZCYpgbdCjISaaAss4oQ3PDPQl4YoaeLZAcL awnL0KtmsH+x40obOFPGwHrjDfkywMuQ7iDb9s60GNE/ei/B95uB1d+czcr224hTWPrzX5K63V4 zKmI= X-Google-Smtp-Source: AGHT+IEEoCtFtIWCxg561LR9tjLLb/W50MzyrgCLTgyq70R0c4sy14UBWgoRxlgVp0A2thHeLsUvDg== X-Received: by 2002:a05:6602:1695:b0:7fa:56f0:ad87 with SMTP id ca18e2360f4ac-81f7e430a4bmr16774839f.10.1721858782394; Wed, 24 Jul 2024 15:06:22 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , qemu-arm@nongnu.org, Peter Maydell , Warner Losh , Stacey Son , Ajeet Singh , Kyle Evans , Richard Henderson Subject: [PULL 05/15] bsd-user:Add get_mcontext function for ARM AArch64 Date: Wed, 24 Jul 2024 16:04:38 -0600 Message-ID: <20240724220449.10398-6-imp@bsdimp.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240724220449.10398-1-imp@bsdimp.com> References: <20240724220449.10398-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::d35; envelope-from=imp@bsdimp.com; helo=mail-io1-xd35.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=unavailable 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @bsdimp-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1721858841732116600 Content-Type: text/plain; charset="utf-8" From: Stacey Son function to retrieve machine context,it populates the provided target_mcontext_t structure with information from the CPUARMState registers. Signed-off-by: Stacey Son Signed-off-by: Ajeet Singh Co-authored-by: Kyle Evans Reviewed-by: Richard Henderson Message-Id: <20240707191128.10509-6-itachis@FreeBSD.org> Signed-off-by: Warner Losh --- bsd-user/aarch64/signal.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/bsd-user/aarch64/signal.c b/bsd-user/aarch64/signal.c index 98861f9ab3b..ab3bf8558ab 100644 --- a/bsd-user/aarch64/signal.c +++ b/bsd-user/aarch64/signal.c @@ -51,3 +51,33 @@ abi_long set_sigtramp_args(CPUARMState *regs, int sig, =20 return 0; } + +/* + * Compare to get_mcontext() in arm64/arm64/machdep.c + * Assumes that the memory is locked if mcp points to user memory. + */ +abi_long get_mcontext(CPUARMState *regs, target_mcontext_t *mcp, int flags) +{ + int err =3D 0, i; + uint64_t *gr =3D mcp->mc_gpregs.gp_x; + + mcp->mc_gpregs.gp_spsr =3D pstate_read(regs); + if (flags & TARGET_MC_GET_CLEAR_RET) { + gr[0] =3D 0UL; + mcp->mc_gpregs.gp_spsr &=3D ~CPSR_C; + } else { + gr[0] =3D tswap64(regs->xregs[0]); + } + + for (i =3D 1; i < 30; i++) { + gr[i] =3D tswap64(regs->xregs[i]); + } + + mcp->mc_gpregs.gp_sp =3D tswap64(regs->xregs[TARGET_REG_SP]); + mcp->mc_gpregs.gp_lr =3D tswap64(regs->xregs[TARGET_REG_LR]); + mcp->mc_gpregs.gp_elr =3D tswap64(regs->pc); + + /* XXX FP? */ + + return err; +} --=20 2.45.1