From nobody Thu Sep 19 01:09:36 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=1721758264; cv=none; d=zohomail.com; s=zohoarc; b=URHCzdH0aiLlE9G/ONv9qsLWykQ2+XmYhoRa+OKTfCenH2a8tecZu3oRUFKC+D3iTI9Sh5SIuDffRClpZ9KkpZXw3tKJulE8SpqEYhSGQZbX9rocbwZCk/PMsSZW8rJIjVXa1OwW4sAQq7+lo8HdSlo9nv1ivvGBu4Nnp9MR4xI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721758264; 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=htzmk2/K+pRyHcINVlqMN9Cf2KcnbziuOXxz3Bx5eFI=; b=bivMqWi3OXs3+e33mgFv93YVgnC0XSQQnplyfc2eixmpr/ZJrRJBCy1la/plllahhTnSKM83dg7LUqw12/xTEkz5MVC/q5kztPmcxjscm69hS8ZN6oZcS6vhjiw7Cf/yAZ/YqSUgyyVyOLkP/d98he19JDQP/ZkJHODtXxk8V9A= 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 1721758264404210.15883600465975; Tue, 23 Jul 2024 11:11:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sWJxZ-00036C-Eb; Tue, 23 Jul 2024 14:10:01 -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 1sWJwv-0001Ho-FI for qemu-devel@nongnu.org; Tue, 23 Jul 2024 14:09:25 -0400 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sWJwp-0001Cs-NC for qemu-devel@nongnu.org; Tue, 23 Jul 2024 14:09:19 -0400 Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-397052a7b63so23538045ab.1 for ; Tue, 23 Jul 2024 11:09:05 -0700 (PDT) Received: from dune.bsdimp.com ([50.253.99.174]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-397f7a2827csm33361775ab.53.2024.07.23.11.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 11:09:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1721758144; x=1722362944; 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=htzmk2/K+pRyHcINVlqMN9Cf2KcnbziuOXxz3Bx5eFI=; b=o2U4dMg1+GveMy9MhEdt78KLhkPo/a4tguwZT2ZH2yF1mJnpiIvCoo8M676Ws0PEGe qfWkm00XjyNOoVnSL25XjqpLNvwz4V7VZzL4ME7zOBq+9pKCfysrhVPAmz+2GtZjAD7F OYH9xjp5mPNYpDosRVDiPMTe+q+a1v3YGMIV8WDsVmlx+3854ATi4liS7U5PT8tUvEOp I5SbUVJ+YDX9tSAROPe0xpy5zHfzy/SKxUohOeu/WjRGJE9aDCk+ArPMetrR9zuGUGPd kUG2uLY5tYdvMEK0pHXBUQ0wrpecrdjTbWenLbK++6Uy8k3W/PW5ZQ5q2O5w3xAqdPzb zVFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721758144; x=1722362944; 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=htzmk2/K+pRyHcINVlqMN9Cf2KcnbziuOXxz3Bx5eFI=; b=uf8wqLEIJIZJIaEwNykM1KzAGS0yKwCQ8RhQ+gIiLf/bZyS+0fq3tMJU7UMRwLL7PO fZUGLLCkZ6rszlPRccZXQq3xofU3NshTv83tGOX0w4P6kLsgVAWbIbiMnRw7paiRknjt HUp4tDc3ZMJ30WwXeAmsZkpwwF0OyiNLcCt/yUFZUvXkzLDn/QSXDamt2nQHbwS0rHyS +w520mYW6kGQhfwfKYO0LOkSPUmviTcPA0I6iuNOxfkoKNRdl7sWZ6U5N5GthRVKSK/W T4Db93KaGqGVVvgEIXONzm1PIpEiOh/lQS1EICPsUya8Fm5KdWkURnVS5XHo3o0qlQIc oBHA== X-Gm-Message-State: AOJu0YytgXDnsZa+3EBFK2e8AX4FAawqM3S1AQVe3CsG/Zixc3pJ3hJx u29s2UJuPWQk4jImD2M+u8jpO59C2ZWuYp/3Ifj4io4jFkn9R/TWmQGqmp04YiI97RCzs9K3zBC A0Kc= X-Google-Smtp-Source: AGHT+IE5XUB9i4eIXYNDVS0qvWcmdwoDTpT6VVhIWa81qGwd8+A+8hnysZMLVGGzR40Ontl/qzc/bw== X-Received: by 2002:a92:c56c:0:b0:39a:16c0:4bef with SMTP id e9e14a558f8ab-39a16c04e68mr9278115ab.23.1721758144376; Tue, 23 Jul 2024 11:09:04 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Warner Losh , Peter Maydell , Kyle Evans , qemu-arm@nongnu.org, Stacey Son , Ajeet Singh , Richard Henderson Subject: [PULL 07/14] bsd-user:Add set_mcontext function for ARM AArch64 Date: Tue, 23 Jul 2024 12:07:18 -0600 Message-ID: <20240723180725.99114-8-imp@bsdimp.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240723180725.99114-1-imp@bsdimp.com> References: <20240723180725.99114-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::136; envelope-from=imp@bsdimp.com; helo=mail-il1-x136.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: 1721758264958116600 Content-Type: text/plain; charset="utf-8" From: Stacey Son The function copies register values from the provided target_mcontext_t structure to the CPUARMState registers. Note:FP is unfinished upstream but will be a separate commit coming soon. Signed-off-by: Stacey Son Signed-off-by: Ajeet Singh Reviewed-by: Richard Henderson Message-Id: <20240707191128.10509-8-itachis@FreeBSD.org> Signed-off-by: Warner Losh --- bsd-user/aarch64/signal.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bsd-user/aarch64/signal.c b/bsd-user/aarch64/signal.c index 43c886e6036..13faac8ce60 100644 --- a/bsd-user/aarch64/signal.c +++ b/bsd-user/aarch64/signal.c @@ -95,3 +95,25 @@ abi_long setup_sigframe_arch(CPUARMState *env, abi_ulong= frame_addr, return 0; } =20 +/* + * Compare to set_mcontext() in arm64/arm64/machdep.c + * Assumes that the memory is locked if frame points to user memory. + */ +abi_long set_mcontext(CPUARMState *regs, target_mcontext_t *mcp, int srfla= g) +{ + int err =3D 0, i; + const uint64_t *gr =3D mcp->mc_gpregs.gp_x; + + for (i =3D 0; i < 30; i++) { + regs->xregs[i] =3D tswap64(gr[i]); + } + + regs->xregs[TARGET_REG_SP] =3D tswap64(mcp->mc_gpregs.gp_sp); + regs->xregs[TARGET_REG_LR] =3D tswap64(mcp->mc_gpregs.gp_lr); + regs->pc =3D mcp->mc_gpregs.gp_elr; + pstate_write(regs, mcp->mc_gpregs.gp_spsr); + + /* XXX FP? */ + + return err; +} --=20 2.45.1