From nobody Mon Nov 25 02:55:57 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1718650970; cv=none; d=zohomail.com; s=zohoarc; b=C6pnDVvhRqkP0/HFC+SOIbl5C2OorbhUGCMpGcdKybJGI//zbTWHAg8P0l4SK1jwOvDN+3NKYtq5PoJHWN61OfPQGNvcd3dfcxKn5AtXbewkc4Ybh/iLPiMFkcEmKN+6VIIwKtEbDrNo4FTcEK70N3/voAbMOTaDZnKwkrsHx3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718650970; 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=/fzCyFPBesaMQSSyYvgJsbwN+BoXVnIEOpNMGEgrfSA=; b=BU/s/docqMhSH8HyJjhFBEoXFKz27AcJH0UBS8/hxf6AwOYX/nRReuNSCcF56ITnbFDUbXrDkAvy3XP29Ir4Aq5X0dmrNJIx+ZpCNkH17S4KjxhAJvr7Cl9y/2KgWNzbZs6vu9XoBOADP4zQC+KRy8aJB5fjLCGu/MzwahwELWU= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718650970900494.3749519213259; Mon, 17 Jun 2024 12:02:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJHZK-0006ob-Jg; Mon, 17 Jun 2024 14:59:06 -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 1sJHZI-0006PC-1p for qemu-devel@nongnu.org; Mon, 17 Jun 2024 14:59:04 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJHZG-00052S-5x for qemu-devel@nongnu.org; Mon, 17 Jun 2024 14:59:03 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-704313fa830so3580891b3a.3 for ; Mon, 17 Jun 2024 11:59:01 -0700 (PDT) Received: from localhost.localdomain ([106.222.222.115]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ccb4aa4fsm7660637b3a.131.2024.06.17.11.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 11:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718650740; x=1719255540; 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=/fzCyFPBesaMQSSyYvgJsbwN+BoXVnIEOpNMGEgrfSA=; b=cOJVpLSf4tHTxdk8R0MeulafszTUDb6PhKpzy6kzmqhiEERVoeo/hE/ZvsBmjsC9sZ mY3/lW+mtgNWlYqu7aJTc72mV9/YGYuGduejpfTTV1QxP4ADnbQ2pFLMXjpiggWa0NfS Sduw+CJIC1MsLDvQHK7BfjQb3l7+Xh1A/Y23GiKj4SOe/CXQY+mmt3N3h/6VEkO8aMiZ AtVgI32USGVYuglne8y+ThRPRNuw9Juvapia4pIr89t4WqC6u52AkhqpGAa5xLaA7JAI 17WZqp6IVHgXSIZ314TKkImISEcJEl6hsMVgybfajlGalJ+ho8NsFcWZfAw3GiP1fvAd gTEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718650740; x=1719255540; 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=/fzCyFPBesaMQSSyYvgJsbwN+BoXVnIEOpNMGEgrfSA=; b=GrO9XLVtHin2j+Bq4XNp69ActFOkEEMpaepA9fkBqo6r/WDkQjXd4iUH2F+TEfPoGY DkWaDOGpKZ99Ckt3+ysgQbwk1avHYt4LH4NJO9if4pneAX2ttUzNlMcPtvSXpHrk1h99 KZjfK2wFCj/wIkS95s0yObxycuJ6qYNgfZoXI/Ms1M9Tn9w8A9MfKdnOSwF3c3K4qEKJ RTlA0zSDbK0IrstJpPn4wqqSBQuSB/20Uv3hCe+zNlPFV5BCNI55k/U9Ihkw1jqYPwI6 Yq65dFBy/yOKHi7JNFyfb57V/EipMdRHMljpREpZDayTw4y504+QDnbE1BxBtaF7P4Vw 8oqw== X-Gm-Message-State: AOJu0YyEGQ6cXctnR/nAvwyqM1GpXAhaDNGun3LfGFlxCwdvc0xNF7dr VpqiVRv9PIxGXyjZGGJIG5JdS/CRTWvjZJF+BxkzZnbXWsUrIW4eahsYTTKPzn0= X-Google-Smtp-Source: AGHT+IF6tGJ9xx3DM92CnTu3HnUjTzh/CkVIZXgzKdcEiMU9asbEsj7uVr4kPJO5tMp1CK/HIHwNSQ== X-Received: by 2002:a05:6a20:2584:b0:1b7:8fe2:439f with SMTP id adf61e73a8af0-1bae828ee1cmr11545410637.38.1718650740317; Mon, 17 Jun 2024 11:59:00 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Ajeet Singh , Stacey Son , Ajeet Singh Subject: [PATCH 19/23] Add ARM AArch64 signal trampoline argument setup for bsd-user Date: Tue, 18 Jun 2024 00:28:00 +0530 Message-Id: <20240617185804.25075-20-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240617185804.25075-1-itachis@FreeBSD.org> References: <20240617185804.25075-1-itachis@FreeBSD.org> 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: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x42e.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, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1718650971433100005 Content-Type: text/plain; charset="utf-8" From: Stacey Son function to set up signal handler arguments it populates register values in `CPUARMState` based on the provided signal, signal frame, signal action, and frame address Signed-off-by: Stacey Son Signed-off-by: Ajeet Singh Reviewed-by: Richard Henderson --- bsd-user/aarch64/signal.c | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 bsd-user/aarch64/signal.c diff --git a/bsd-user/aarch64/signal.c b/bsd-user/aarch64/signal.c new file mode 100644 index 0000000000..98861f9ab3 --- /dev/null +++ b/bsd-user/aarch64/signal.c @@ -0,0 +1,53 @@ +/* + * ARM AArch64 specific signal definitions for bsd-user + * + * Copyright (c) 2015 Stacey D. Son + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ +#include "qemu/osdep.h" + +#include "qemu.h" + +/* + * Compare to sendsig() in sys/arm64/arm64/machdep.c + * Assumes that target stack frame memory is locked. + */ +abi_long set_sigtramp_args(CPUARMState *regs, int sig, + struct target_sigframe *frame, + abi_ulong frame_addr, + struct target_sigaction *ka) +{ + /* + * Arguments to signal handler: + * x0 =3D signal number + * x1 =3D siginfo pointer + * x2 =3D ucontext pointer + * pc/elr =3D signal handler pointer + * sp =3D sigframe struct pointer + * lr =3D sigtramp at base of user stack + */ + + regs->xregs[0] =3D sig; + regs->xregs[1] =3D frame_addr + + offsetof(struct target_sigframe, sf_si); + regs->xregs[2] =3D frame_addr + + offsetof(struct target_sigframe, sf_uc); + + regs->pc =3D ka->_sa_handler; + regs->xregs[TARGET_REG_SP] =3D frame_addr; + regs->xregs[TARGET_REG_LR] =3D TARGET_PS_STRINGS - TARGET_SZSIGCODE; + + return 0; +} --=20 2.34.1