From nobody Fri Oct 18 13:20:40 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=1724475496; cv=none; d=zohomail.com; s=zohoarc; b=iJToPIHbnVbRrPk4ne2yp0AYQld6C7sltON13Xzu6I1KxwkEJ9o/i7XdBQHG2MwE/t8FhkxEwDOhAekg9HUwCt1kQuATD3cNp4EcKLVWfQQ3DJUX2zeKoBraw3O0pl7aaUQQm7wLLXViyiYsvdMmNfADa9aS5mzxcqJdbyW/sdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475496; 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=vomkfUtAllK0ojM5LRPdvdVvl+rjfsjudu3AMP3f7gI=; b=k2GzcSzfGnBiCrSpbnrfgiyA/yR34t8RTDXD8M7A9DvSXWvSN33Z9BiZGanizM646aTCABoOboVTCt0a40qIdbAdn9yuN+0HcKPtbJ4GfQAZhaHXFWqKGBlQ05CbDugupkx0bTFV1+BPq49FvLgzOzwWh3gYu6uEMSboPwibdbo= 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 172447549685873.51292196547831; Fri, 23 Aug 2024 21:58:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shipa-0005xd-J7; Sat, 24 Aug 2024 00:56:54 -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 1shipZ-0005x9-EC for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:56:53 -0400 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipX-0002EQ-PQ for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:56:53 -0400 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-70b3b62025dso2192422a34.0 for ; Fri, 23 Aug 2024 21:56:50 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:56:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475409; x=1725080209; 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=vomkfUtAllK0ojM5LRPdvdVvl+rjfsjudu3AMP3f7gI=; b=UiEyRrqluZpgh5syvXwTRYg4zFPEne9F+nXfQCNyCUEkjTJ6+YMdowtxlGUxx4epwp fHWjlJHknZzeQXIwMmfCiBGNkdwjIdNwSXdtaQexegfhcUykNXwrgmSGV/4zCFEOtuSa YUEpyMptf0KsJlRSPuiBlhiWEzTheiQ2SSXzXNtTk9sCpOgNvsGhrOgXULkq2l7CUaCp dqxbL6mJihyLyOVWAdPsAokdSTe292ez6rQ2jaMP2xAqNHT8syOpHFK3ewEBulorTkUq ve/TXQdOvXC306wwfvD7fscKHHQ40SyoigFo3ww3Srejc3Op4A+X/6fJXlHZyS4wSD1T JRag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475409; x=1725080209; 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=vomkfUtAllK0ojM5LRPdvdVvl+rjfsjudu3AMP3f7gI=; b=axnC7Jw+k03gdAzYdTPmyK5fmG3cO24536LDi7FEZPTnlA0RcBYW5+fuC/wRKtkpUU i9B0hs+ccB9yt0lV3GxGfS+r6VpoF2foEpi/V9RRMeUwfnvuw6fgx8c+SoPiHjUW3UmV 88IhsWqJRYl9Ni86hyXG2JSJMrdrIysbCtO62YxNZ4vAcjXAM/OsB90vjBhRdeH/UfY3 8GksG0gB7a46qKVhFID/yeaMku3AIcYUb/FqzhVdqobOPnpBlQAqfFYIO7i0wTbw60Bf IrsErAGalJI9ENhEpKgSh5EnXCmdehFT7chOpK7/7EuBxpfntd8H7N8RPbxsr4yNbKQf X6tw== X-Gm-Message-State: AOJu0Yz5Zm2Z+5YEJ9zwkU+E2vNw8jDi9+RNEM8i419CBd5+tivlvyBk 1lju7X17Ny0voewMEWl0a/xOtQU0od3jKyzLJwEh2T7gPt1sDzSnwMlfX8UXMDE= X-Google-Smtp-Source: AGHT+IFLdgBz6q0Mx+RG80CGDPINpdCR3FA/QoU5tRtjoh0ihEWOf9wYtyQEhxvqaGpf8WUbc4AUkA== X-Received: by 2002:a05:6808:bca:b0:3d9:e22a:97a4 with SMTP id 5614622812f47-3de2a8e1762mr4913264b6e.36.1724475409103; Fri, 23 Aug 2024 21:56:49 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Jessica Clarke Subject: [PATCH v3 01/17] bsd-user: Implement RISC-V CPU initialization and main loop Date: Sat, 24 Aug 2024 14:56:19 +1000 Message-Id: <20240824045635.8978-2-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::329; envelope-from=itachis6234@gmail.com; helo=mail-ot1-x329.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: 1724475497370116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Added the initial implementation for RISC-V CPU initialization and main loop. This includes setting up the general-purpose registers and program counter based on the provided target architecture definitions. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Co-authored-by: Jessica Clarke Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch_cpu.h | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 bsd-user/riscv/target_arch_cpu.h diff --git a/bsd-user/riscv/target_arch_cpu.h b/bsd-user/riscv/target_arch_= cpu.h new file mode 100644 index 0000000000..e17c910ae9 --- /dev/null +++ b/bsd-user/riscv/target_arch_cpu.h @@ -0,0 +1,39 @@ +/* + * RISC-V CPU init and loop + * + * Copyright (c) 2019 Mark Corbin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef TARGET_ARCH_CPU_H +#define TARGET_ARCH_CPU_H + +#include "target_arch.h" + +#define TARGET_DEFAULT_CPU_MODEL "max" + +static inline void target_cpu_init(CPURISCVState *env, + struct target_pt_regs *regs) +{ + int i; + + for (i =3D 1; i < 32; i++) { + env->gpr[i] =3D regs->regs[i]; + } + + env->pc =3D regs->sepc; +} + +#endif /* TARGET_ARCH_CPU_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475496; cv=none; d=zohomail.com; s=zohoarc; b=nkkV0otcbWLJwq+k0Wze3mG4oHyFDGFJaUDfaVdK9sNJhHWTSLSNX+VxyzTYjf2kW+7Ggf2z6RAVKjqYbqSddMaBWcWTj5Ed79rLP476krOYwcJjBp6H4Z3C+RQzMvxgvx3B6RFmHGu5AWvz8/wjHGKmkjB+lFPNef4UTDVCoeU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475496; 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=WHayX5ojJN5/ahyBORPFkIjjx3JTNZK/Yv3Y1gMyMGw=; b=bJq1USalHe4YRIlOI/44fk50GYw3cBYx2p17pSoIu/6ZGYOU+LvM5sEx4BcHBj6whyLszdV9ksAi7VWBGd5WVjc1eh2I/aclYXiqjFKJT6sJ2Ftch/YdSYA9b8mqfL2AoDq9OkJQw//ZrQLDRTyMEhB3U2fBCZVgXPLV4pQbDLY= 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 1724475496335679.026072527803; Fri, 23 Aug 2024 21:58:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shipd-00068J-EE; Sat, 24 Aug 2024 00:56:57 -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 1shipb-000622-M9 for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:56:55 -0400 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipa-0002EX-3L for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:56:55 -0400 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-5d5b850d969so1918308eaf.0 for ; Fri, 23 Aug 2024 21:56:53 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:56:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475412; x=1725080212; 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=WHayX5ojJN5/ahyBORPFkIjjx3JTNZK/Yv3Y1gMyMGw=; b=A6KqbVz3xd253HtSiKjauQyqZg0MlX1r8y4IOFsNPqc8l+LGO6vYfhsLpJuqU3+qio jdOofypMsHPXg96kWAVtkEu0UOnQPKdM75h4M8W03a6UueAWbymlMKryX/yEX9gleopT 853zj/ynVfXvMX0PpsKJ5P11z7kKqvmwCRAIKmIDFZi9FNt0Fmz5t2Dg+0I+5WjLBtyQ bv7estiAj7WSVOpx2l/o8njfwpaQ3ava/kaEemOxTbb6JA9LodCJmpoNJeuVR8JnErb7 y/nJ2oe27DM2ePbAsND40p5o8JFWt+bjEcFDr3JXBn+Re7f2oN3QwHe6BCfce/Sy/3j8 5G9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475412; x=1725080212; 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=WHayX5ojJN5/ahyBORPFkIjjx3JTNZK/Yv3Y1gMyMGw=; b=GbOBoUJeNt3D9IELma0WDdVl6Y+jRASmusZS6BzmmNn+Jf+UTN0wUFerofIXuHJMs4 uOQvQGfWqZAIREo7B6+/hcW6qrfB8TdwFGrPXb/1UUdqTlEuLGeeT0QpQiPA78ROlTKL iJdXphsQbZMPdq70Yj4c2kJ8h+waPgyZidCDG110fkHITdjIZQzzwfNbFBxcavm3eXwg O0Wq56QVDp2QwoQCit+4NfC02AGPDNnFEmoFCbJPdSpqls4Vwk1IvYqGHkeubnDTBm2l Y937EooGveA900YD0RwSPtyoTeptN574OtjfuoWi6si566+PV08Fb3dYP3wLnJWdzYGp E3Hw== X-Gm-Message-State: AOJu0YxR8kGby8qsPSTxDzKo9TT07HXmKdHNyNmTv9IK233MCfuwLgMO egM/gNaU7jNWBQdomsl0/pnLRIu+pt5gLtyY3T+1NOdSJopZQ6NooqMUbg+2PSU= X-Google-Smtp-Source: AGHT+IEj/RAL1erF/4+uqPWjU2yLO6irBlqlEoQ5ZAXbSfyCVtKoaGRngg+60On/7cgTQLpatj7C6A== X-Received: by 2002:a05:6358:948f:b0:1a6:799b:b06c with SMTP id e5c5f4694b2df-1b5c21ede3amr580932055d.23.1724475412244; Fri, 23 Aug 2024 21:56:52 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Jessica Clarke , Kyle Evans , Richard Henderson Subject: [PATCH v3 02/17] bsd-user: Add RISC-V CPU execution loop and syscall handling Date: Sat, 24 Aug 2024 14:56:20 +1000 Message-Id: <20240824045635.8978-3-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::c2d; envelope-from=itachis6234@gmail.com; helo=mail-oo1-xc2d.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: 1724475497378116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Implemented the RISC-V CPU execution loop, including handling various exceptions and system calls. The loop continuously executes CPU instructions,processes exceptions, and handles system calls by invoking FreeBSD syscall handlers. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Co-authored-by: Jessica Clarke Co-authored-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch_cpu.h | 94 ++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/bsd-user/riscv/target_arch_cpu.h b/bsd-user/riscv/target_arch_= cpu.h index e17c910ae9..eb37b062a3 100644 --- a/bsd-user/riscv/target_arch_cpu.h +++ b/bsd-user/riscv/target_arch_cpu.h @@ -36,4 +36,98 @@ static inline void target_cpu_init(CPURISCVState *env, env->pc =3D regs->sepc; } =20 +static inline void target_cpu_loop(CPURISCVState *env) +{ + CPUState *cs =3D env_cpu(env); + int trapnr; + abi_long ret; + unsigned int syscall_num; + int32_t signo, code; + + for (;;) { + cpu_exec_start(cs); + trapnr =3D cpu_exec(cs); + cpu_exec_end(cs); + process_queued_cpu_work(cs); + + signo =3D 0; + + switch (trapnr) { + case EXCP_INTERRUPT: + /* just indicate that signals should be handled asap */ + break; + case EXCP_ATOMIC: + cpu_exec_step_atomic(cs); + break; + case RISCV_EXCP_U_ECALL: + syscall_num =3D env->gpr[xT0]; /* t0 */ + env->pc +=3D TARGET_INSN_SIZE; + /* Compare to cpu_fetch_syscall_args() in riscv/riscv/trap.c */ + if (TARGET_FREEBSD_NR___syscall =3D=3D syscall_num || + TARGET_FREEBSD_NR_syscall =3D=3D syscall_num) { + ret =3D do_freebsd_syscall(env, + env->gpr[xA0], /* a0 */ + env->gpr[xA1], /* a1 */ + env->gpr[xA2], /* a2 */ + env->gpr[xA3], /* a3 */ + env->gpr[xA4], /* a4 */ + env->gpr[xA5], /* a5 */ + env->gpr[xA6], /* a6 */ + env->gpr[xA7], /* a7 */ + 0); + } else { + ret =3D do_freebsd_syscall(env, + syscall_num, + env->gpr[xA0], /* a0 */ + env->gpr[xA1], /* a1 */ + env->gpr[xA2], /* a2 */ + env->gpr[xA3], /* a3 */ + env->gpr[xA4], /* a4 */ + env->gpr[xA5], /* a5 */ + env->gpr[xA6], /* a6 */ + env->gpr[xA7] /* a7 */ + ); + } + + /* + * Compare to cpu_set_syscall_retval() in + * riscv/riscv/vm_machdep.c + */ + if (ret >=3D 0) { + env->gpr[xA0] =3D ret; /* a0 */ + env->gpr[xT0] =3D 0; /* t0 */ + } else if (ret =3D=3D -TARGET_ERESTART) { + env->pc -=3D TARGET_INSN_SIZE; + } else if (ret !=3D -TARGET_EJUSTRETURN) { + env->gpr[xA0] =3D -ret; /* a0 */ + env->gpr[xT0] =3D 1; /* t0 */ + } + break; + case RISCV_EXCP_ILLEGAL_INST: + signo =3D TARGET_SIGILL; + code =3D TARGET_ILL_ILLOPC; + break; + case RISCV_EXCP_BREAKPOINT: + signo =3D TARGET_SIGTRAP; + code =3D TARGET_TRAP_BRKPT; + break; + case EXCP_DEBUG: + signo =3D TARGET_SIGTRAP; + code =3D TARGET_TRAP_BRKPT; + break; + default: + fprintf(stderr, "qemu: unhandled CPU exception " + "0x%x - aborting\n", trapnr); + cpu_dump_state(cs, stderr, 0); + abort(); + } + + if (signo) { + force_sig_fault(signo, code, env->pc); + } + + process_pending_signals(env); + } +} + #endif /* TARGET_ARCH_CPU_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475459; cv=none; d=zohomail.com; s=zohoarc; b=Er18qJh5PEcLR4DUkI0WiQIpLmcX4XlKb0UhZreLEKBrEk9aAh97w9luO0d3fHBBeZ56l7vgLEPW4OqdLYtvLGtBRmnJxQyq+AmQzoSk1dt8PxzeWyIYOTDn0qcTGFi225cA3PDJAJ/3lk/mK21JRasOxg9kyJtuczYzJCnpiFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475459; 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=rHt6pbRW07xJLDMoO5UcezJiyi3YHPjGjTmMqWnnjc8=; b=kl/XWw1FOfAIWoHDe5/S3M4Im05RWVcVqouegl2sFLM+VBvanPAabxIfroPOLK2ZOasMQ/Dtw99YdbOGDZimqHPdgsAE0WL4PFu110RxS8ycCJwHXrAJuh2M5EfjTtFrqpuLSVkRx/k/kDT+6QtwWbKgSiC72o27EOHiQ3oB/+Y= 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 1724475459693638.8562806134597; Fri, 23 Aug 2024 21:57:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shipf-0006Hz-Sq; Sat, 24 Aug 2024 00:56:59 -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 1shipe-0006BY-9h for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:56:58 -0400 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipc-0002Er-Re for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:56:58 -0400 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5d5bb03fe42so1901848eaf.3 for ; Fri, 23 Aug 2024 21:56:56 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475415; x=1725080215; 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=rHt6pbRW07xJLDMoO5UcezJiyi3YHPjGjTmMqWnnjc8=; b=TYKjv787HMBohoFXQIvSH3e7vWsSYiZb39lfob0KDWvAecIWXKCRl4sjFzXpJAfGuf Bep55a3yWnZumxKmZ4THhVydxHCi9jf0cQlAQBYDKuHcD6GB7tp1+7YJf747+cpdu6Fl f6ewSxUvzvdTEJZowAq+wxZsCK266qePeIlfAcXhS47nCEKi3NILBYLL5rMmGgaD3/8/ GBqX3vVdnz8RySLokLDyKIzZBYvnZ7lh2z7IhGvq2LS9jucind9Bxt7AX8+NvN+XV0X5 KrCXMaKh+iCa2L4mOy4wK1ToGsSCN+hU9pIcTOHumWQsV4Ew5CChLAM6fj1xGmIdeIYf lrSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475415; x=1725080215; 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=rHt6pbRW07xJLDMoO5UcezJiyi3YHPjGjTmMqWnnjc8=; b=qTmtggyrT7cjlCQ5RyM9bQXZgsTb+b7k/eoT0HKMbfcL6Ei9eUFhTwdPBU98bVPAT8 In+FrowO7WKO5kvlhhN6ISl4feMsBJTqWpXlPa6Vm7wUxWydkDCZoyJ22lUyi4UWfFNA 8Ql1Is6tsVXN4LbriHL0DrIT8XfQHhpnnu70dNmo/Jjb5CGel/+rvoTKSS6iYEnl98Hy G7jALSPo5o+SPQh6WQjRQco9RYcmFG7qdLe3GB3V4g5ZZUWmVCPrMlqwLvDQxkwRDny5 V64PVmobjYH+asa/RVakimebmyoJnb+QwiRlHZPkzIOE3t2RtipiuQmtL16bdD2Stn0Z B7vA== X-Gm-Message-State: AOJu0YzsrZa1pJEKRF7F7+ngFUSZZgHlCHljuTg47/nvN9ZpvBrnJtMG Il+nii9aILru3DFC66l3W1VY22d5jmgYh6Weji/2vuRRjWG2DaYdb0b3bd1eRvQ= X-Google-Smtp-Source: AGHT+IEMPz2UEANsPdLwkbUgr0pLrGSu8dDju7pQJF68wDnwnXAjK6WmM7RnfvAa7/QiT/PXZv+hhQ== X-Received: by 2002:a05:6870:ac11:b0:270:68e:34c with SMTP id 586e51a60fabf-273e6552b54mr4849141fac.26.1724475415458; Fri, 23 Aug 2024 21:56:55 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 03/17] bsd-user: Implement RISC-V CPU register cloning and reset functions Date: Sat, 24 Aug 2024 14:56:21 +1000 Message-Id: <20240824045635.8978-4-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::c36; envelope-from=itachis6234@gmail.com; helo=mail-oo1-xc36.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: 1724475461448116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Added functions for cloning CPU registers and resetting the CPU state for RISC-V architecture. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch_cpu.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bsd-user/riscv/target_arch_cpu.h b/bsd-user/riscv/target_arch_= cpu.h index eb37b062a3..522cfc099b 100644 --- a/bsd-user/riscv/target_arch_cpu.h +++ b/bsd-user/riscv/target_arch_cpu.h @@ -130,4 +130,18 @@ static inline void target_cpu_loop(CPURISCVState *env) } } =20 +static inline void target_cpu_clone_regs(CPURISCVState *env, target_ulong = newsp) +{ + if (newsp) { + env->gpr[xSP] =3D newsp; + } + + env->gpr[xA0] =3D 0; /* a0 */ + env->gpr[xT0] =3D 0; /* t0 */ +} + +static inline void target_cpu_reset(CPUArchState *env) +{ +} + #endif /* TARGET_ARCH_CPU_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475528; cv=none; d=zohomail.com; s=zohoarc; b=lQtwXm42gVok3uiXZkMw/CsLJuI+SciLuY+nhLh9SzrvuEMKzklK05FfUmYmE2fmnPdN1wK/4UxcQTxsElHmOMIu9wKst274o+uOK+VaTZ9B/x9CvJUq30SR7kbhiUwR9RwTjdyUUqFpWa4U0xWg4CMVf0mDxtZMfbp4ni/xKmM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475528; 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=Q8SeRNxqA0kdGYXuMPPKRU3j4MVX/4+712bEYl1oABA=; b=ZsowwD8ImDfs/9wiCG99EUXERHR3N4JWtVbaeI5/uzC327ZCpPyfsP6ApbalqHITGsRfDX4L9u1kuzv5/FVPNLafWJ+gEglMblKhX130KeTxoCAAZlvjqWhJ4xHI/fEoHu1k3lTyUkAPI2LnZ+qJRdplEKFHwnV5P+NE98JLLeY= 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 1724475528960990.1191801093274; Fri, 23 Aug 2024 21:58:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shipj-0006V0-G3; Sat, 24 Aug 2024 00:57:03 -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 1shiph-0006Pn-LP for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:01 -0400 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipg-0002FC-0m for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:01 -0400 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-5dca9cc71b2so1889951eaf.2 for ; Fri, 23 Aug 2024 21:56:59 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475418; x=1725080218; 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=Q8SeRNxqA0kdGYXuMPPKRU3j4MVX/4+712bEYl1oABA=; b=TkRmMzNMaK/2rBtB88m1V+WpQR9XvMmoBFDDzEJ+/wbjhMNhxz1+534jusz1I8P9G9 LPt/6r+/lxZ7qi1J+hzwn91gLzCMyHemHLY7CRS/CIAiBr0ZgZhU+0cfmzqRoKcq/yCa BlPsTx2wrSLyMUWY0C8fNor2AkhEv9liBBSFRTcTTo06AMMWAVC5VFtC+j84VF6lBXY0 2KZ8LMeJ8G8kTWjsMFGDHQ+9pChS+nQxdhbfF8XeQYkLc14vod956jKML3zl5Y7zejHi mnJHqgWuvMWDzec5LPJsoigvNH+Pq8JptZ+nvDRioXnx62evnP8a3aZnMm/ITzkOHdWK 0lew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475418; x=1725080218; 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=Q8SeRNxqA0kdGYXuMPPKRU3j4MVX/4+712bEYl1oABA=; b=F946qzewvG2MBx5g/wtaPe5hUnef/qvQ80RmFmKtoC2tkObAlNEDVhJUBZ2OaTurqj qCZoyog4l0lAv5Xjt3pR0BWFWCAEci/zDIJskJQxavQpxM10H20m8P7XJ8ymFBwrxyzQ GHq1Qlkqx6WxEZDHWnFLjGCGmG3E/rHARiSlwfLmw4EgzEdZiJy64jHb2zLWjqAC+O7y tJOW+BbE8C7lesWWJpZkOb6hyzPCz2zVYzVCfEsqJYyh5x4761kLzQfq9Puk68vLqihJ g3Az2ft3TTG6YiOwGjweC3Pk4+STS/Vht/LB4kA4obyhE8IbiD6C6gnxayCaXpn02Xuw kRzw== X-Gm-Message-State: AOJu0YyzYXU2g4W9x77D0jCx8g2oXZWzzllurqvuBVhodM1AfEC7fqLG j1tScnGwIknuzplnU/PmROd6X1P6RQfP7MduQqXaaPquYJk+d/ijNu/3hIs6uvU= X-Google-Smtp-Source: AGHT+IFTeZ9CLa/lZJpRSjrvpKue5t9QJa5YqYVz1J9IntD/mgLut8Y8Ij7aXYahJbrEwjQBIyhGWg== X-Received: by 2002:a05:6359:4124:b0:1ac:671a:f39f with SMTP id e5c5f4694b2df-1b5c2140578mr512613255d.11.1724475418349; Fri, 23 Aug 2024 21:56:58 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 04/17] bsd-user: Implement RISC-V TLS register setup Date: Sat, 24 Aug 2024 14:56:22 +1000 Message-Id: <20240824045635.8978-5-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::c2c; envelope-from=itachis6234@gmail.com; helo=mail-oo1-xc2c.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: 1724475529312116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Included the prototype for the 'target_cpu_set_tls' function in the 'target_arch.h' header file. This function is responsible for setting the Thread Local Storage (TLS) register for RISC-V architecture. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch.h | 27 +++++++++++++++++++++++++++ bsd-user/riscv/target_arch_cpu.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 bsd-user/riscv/target_arch.h create mode 100644 bsd-user/riscv/target_arch_cpu.c diff --git a/bsd-user/riscv/target_arch.h b/bsd-user/riscv/target_arch.h new file mode 100644 index 0000000000..26ce07f343 --- /dev/null +++ b/bsd-user/riscv/target_arch.h @@ -0,0 +1,27 @@ +/* + * RISC-V specific prototypes + * + * Copyright (c) 2019 Mark Corbin + * + * 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 . + */ + +#ifndef TARGET_ARCH_H +#define TARGET_ARCH_H + +#include "qemu.h" + +void target_cpu_set_tls(CPURISCVState *env, target_ulong newtls); + +#endif /* TARGET_ARCH_H */ diff --git a/bsd-user/riscv/target_arch_cpu.c b/bsd-user/riscv/target_arch_= cpu.c new file mode 100644 index 0000000000..44e25d2ddf --- /dev/null +++ b/bsd-user/riscv/target_arch_cpu.c @@ -0,0 +1,29 @@ +/* + * RISC-V CPU related code + * + * Copyright (c) 2019 Mark Corbin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +#include "qemu/osdep.h" + +#include "target_arch.h" + +#define TP_OFFSET 16 + +/* Compare with cpu_set_user_tls() in riscv/riscv/vm_machdep.c */ +void target_cpu_set_tls(CPURISCVState *env, target_ulong newtls) +{ + env->gpr[xTP] =3D newtls + TP_OFFSET; +} --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475585; cv=none; d=zohomail.com; s=zohoarc; b=lY+a5DT1/HGQULOBwLnMKTKkXlQII5Kzia1zewde8RI2OC2z6Uq53wKjiNqCjE6nzbwlJU7Yq9E7MPFvCSw1H7XEMPCcYNHe8N0aKzfg3cBJFWCHODMWKCku8VCJ08gcPmKuhXycF1YXd3LBUSBwXRHEmPnk+WAvIgZkTuxi8rU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475585; 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=g4MfaAoEg0D4PG1s02DK0HI+nWn0NbjMokYUO+miRKs=; b=E/nmEDamHmgq6otR3XiaSZjBQen14tToMFDRFlLHqVpI7Tg4k+czgKISGfwwwGUu1FbypG76Kl69LoOGhZiCcuMEt7jf6bIjnJoiDNJJFsotRIidMPBUQoe668Plh9tdSJ4kUuWiJYBVMyhJYXuJCCBFN/lZNQbcclqc4b7L9Kk= 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 1724475585117554.7390134927781; Fri, 23 Aug 2024 21:59:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shipm-0006eO-0y; Sat, 24 Aug 2024 00:57: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 1shipk-0006Zh-Ma for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:04 -0400 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipj-0002Fe-0t for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:04 -0400 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-70e00cb1ee7so1955806a34.1 for ; Fri, 23 Aug 2024 21:57:02 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.56.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475422; x=1725080222; 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=g4MfaAoEg0D4PG1s02DK0HI+nWn0NbjMokYUO+miRKs=; b=cKdP30AxvTK8EfFWnZVNkOWd5iUyz4STMPomUTSEw5eKFn5+sGzIyO0/x+YEIW828v JrEdoiFB4zGz6dV6FxmEAfzLCjrY/7rNejWQ+6cF8B9Np2NvpkgUMLR/1L7h22PY6c+I LOVe6y0GaaVf/hhoMMg8eFh63dt0a/01fMuU3uMsLyo8h69QZH/apkw2NAp7bDlyiRPC oyiGylOF9VvvTH/Ak0EVhCrBV1HCwdLb6VL3Wzc5q5xVD/9UjeArLJTjqIJtjNBOpJAO VBfQ90lV5rMvdjhGfATNmCLOq/K3O7WT92Hr2iBZy0wFUMxTZg3FkBh2umrZ13OdPQw6 AQwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475422; x=1725080222; 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=g4MfaAoEg0D4PG1s02DK0HI+nWn0NbjMokYUO+miRKs=; b=Wwh9F0mvSeZlkGF/OwbPkW+SNDgBwDfncIjBJa9nM68KI3WrRywzLoB9gBR3gnlQ5I +tKupw3Gisx0YZorJ1GYEUhqGyHmJxP6+AVYxU+qn1gkeV25SarQOoVB/+aCiZ12KCjF pylHEQldA7KIii26L48fFq29e4uwiszhNby+1h++2f1UcJlvf4E52Uf5vvXTuIjlwLWY dHnoaCe3pDN5eebAzHEmJP4iDAcKQX+57uCFtp5OmANK4/vSy6kfKEOdyDpkE8X6Hl11 tHZaErimANmHRmQHSTmTn5vqyhnCNZ0wVSDE1B57YxmFbeDL2xOXUTgHaHtPwLgJaLx5 Z4SQ== X-Gm-Message-State: AOJu0Yy83zctNOLp2mGLAIB6QVFW1zkkWE6ekJhSDSCg+2fnUwCalwgf DgieZm4LiQg9JrjTgWF6RaPNOq3pYoBVuFlWNL9gq2/5ad28QQ+x8DnI+WzcpSw= X-Google-Smtp-Source: AGHT+IEqZcgyHVjVo+1w4UmF1l00liOLIPcRToP9E2K9wxf3BOYPMJ96AizawETjTR22XtxS6JADWw== X-Received: by 2002:a05:6808:22a5:b0:3da:b335:538e with SMTP id 5614622812f47-3de2a84071amr5193978b6e.8.1724475421599; Fri, 23 Aug 2024 21:57:01 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Kyle Evans , Richard Henderson Subject: [PATCH v3 05/17] bsd-user: Add RISC-V ELF definitions and hardware capability detection Date: Sat, 24 Aug 2024 14:56:23 +1000 Message-Id: <20240824045635.8978-6-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::335; envelope-from=itachis6234@gmail.com; helo=mail-ot1-x335.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: 1724475585388116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Introduced RISC-V specific ELF definitions and hardware capability detection. Additionally, a function to retrieve hardware capabilities ('get_elf_hwcap') is implemented, which returns the common bits set in each CPU's ISA strings. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Co-authored-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch_elf.h | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 bsd-user/riscv/target_arch_elf.h diff --git a/bsd-user/riscv/target_arch_elf.h b/bsd-user/riscv/target_arch_= elf.h new file mode 100644 index 0000000000..4eb915e61e --- /dev/null +++ b/bsd-user/riscv/target_arch_elf.h @@ -0,0 +1,42 @@ +/* + * RISC-V ELF definitions + * + * Copyright (c) 2019 Mark Corbin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef TARGET_ARCH_ELF_H +#define TARGET_ARCH_ELF_H + +#define elf_check_arch(x) ((x) =3D=3D EM_RISCV) +#define ELF_START_MMAP 0x80000000 +#define ELF_ET_DYN_LOAD_ADDR 0x100000 +#define ELF_CLASS ELFCLASS64 + +#define ELF_DATA ELFDATA2LSB +#define ELF_ARCH EM_RISCV + +#define ELF_HWCAP get_elf_hwcap() +static uint32_t get_elf_hwcap(void) +{ + RISCVCPU *cpu =3D RISCV_CPU(thread_cpu); + + return cpu->env.misa_ext_mask; +} + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +#endif /* TARGET_ARCH_ELF_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475546; cv=none; d=zohomail.com; s=zohoarc; b=NH50R/EjMnrBak6SOF1nnOfqgUFU/p2bnONJVMEOWiaCI+Z7M/kOmCyuZOTZQjRNwfqR16LKa+BzPFwpcsW5Sftzql3PBmKqCh6n2n+OjZrlfW2Zc/e5nTx0AUQceaIj0TXeBNca2uFUz0HL+ZNf/TVwWw40cbR3eFx5ShgGdYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475546; 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=a+NCEiOZJzboz9w1INUibK6hoUbq+IVFPstbDaWXows=; b=oI0dLOKdBBgcuOOBz3xbyjJ/j0Rt33H07e9cJhpQM/XJS8d1ym6/JNObYprle3tinxn6fPcuzP6W2muwiTWJk0qReSpR20t3fyUFTgmkjqPeaiOuKuA82GZFgfXCdzGNPFr5eoBKlYagg6x8MtuDBessRiQkoEsYnYQuAtTj1dA= 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 1724475546672801.0590114923397; Fri, 23 Aug 2024 21:59:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shipq-0006oO-5Y; Sat, 24 Aug 2024 00:57:10 -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 1shipn-0006lg-Rs for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:07 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipm-0002Fq-3l for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:07 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-7142a30e3bdso2670208b3a.0 for ; Fri, 23 Aug 2024 21:57:05 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475424; x=1725080224; 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=a+NCEiOZJzboz9w1INUibK6hoUbq+IVFPstbDaWXows=; b=delHw3fAlpp2BkL4WFwr3t9OnDndCEoPtu3e9N4+vv0yuWPxDAyFQVAuABk165gGGl CjMHm4HCcTWFuo8fR+LnI5IAHxWokRAjj1Zs9i1R7YpSlbyI9VnOOjRzzTjS9BhiAVwd apcJbYaUuW553rRFxqERkwzyoYBf26GI9xz6pbinzMG4FbVTetVgpzAxPpQzoRo/VRjh mWpiIDkTJh3qJl5cnvE6XozHz3PNixzD5+rcysUTI47D032xyGBlOHxTSPwvx1GSWAhj IcmP/392karpJbAu/IRQ/0IBLQ0KWiHl9Zck9ccZ3uJbkkdEspo6YaAco09xtp1oD+gf hwIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475424; x=1725080224; 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=a+NCEiOZJzboz9w1INUibK6hoUbq+IVFPstbDaWXows=; b=NbDX9YiCt03N1gI4gJ5wuC9MYb84jXCB+FlbzUo1kGPav5uEW+gufzlkSQBQVDMXjd But3s+NUycSeAgtbsiaDIbdLWDCzmBEifYDJZWKMkjOfGuSpiHqWtaE61CPHS09TBC4F WzO0fbIKClpMrGCYPM5TPx86Unf9phTw+ojIjsOUIRv9YyQWd9xavbAbXVcjjZP9MsDV OOnw4Jh+qAx6hXYzJBO17nWAqGliOr0cEIr/Y6z8s8eC2HOA7F9A4ZGu6lZYSlnemDGE 0B+SCVpAv37Z02A3yi31G17dRTV7ji2UbczhdA5DJgj35SzhZXPIB1hTNF+i2BsPchBk 5llg== X-Gm-Message-State: AOJu0YxR5VKpr/WqcN8drCpVePlXfdWsvfCrATezEo4Z94PTxKYlhmqI 4GvmuSXftOpuexQ4a3TzDJy6y6rAL4H7UzX5EwthDL8TEzlYmp+SZ4CH4sJNIoc= X-Google-Smtp-Source: AGHT+IEV1x+3FxHtELDFDb+R93sm3yvxKWcAWHwrbgS+KZy6gHi4y+eFOG/jxfOfknD8UvmOIqWn/A== X-Received: by 2002:aa7:8244:0:b0:710:d294:a2b with SMTP id d2e1a72fcca58-7143176773amr13918589b3a.8.1724475424246; Fri, 23 Aug 2024 21:57:04 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 06/17] bsd-user: Define RISC-V register structures and register copying Date: Sat, 24 Aug 2024 14:56:24 +1000 Message-Id: <20240824045635.8978-7-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::435; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x435.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: 1724475547275116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Added definitions for RISC-V register structures, including general-purpose registers and floating-point registers, in 'target_arch_reg.h'. Implemented the 'target_copy_regs' function to copy register values from the CPU state to the target register structure, ensuring proper endianness handling using 'tswapreg'. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch_reg.h | 88 ++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 bsd-user/riscv/target_arch_reg.h diff --git a/bsd-user/riscv/target_arch_reg.h b/bsd-user/riscv/target_arch_= reg.h new file mode 100644 index 0000000000..12b1c96b61 --- /dev/null +++ b/bsd-user/riscv/target_arch_reg.h @@ -0,0 +1,88 @@ +/* + * RISC-V register structures + * + * Copyright (c) 2019 Mark Corbin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef TARGET_ARCH_REG_H +#define TARGET_ARCH_REG_H + +/* Compare with riscv/include/reg.h */ +typedef struct target_reg { + uint64_t ra; /* return address */ + uint64_t sp; /* stack pointer */ + uint64_t gp; /* global pointer */ + uint64_t tp; /* thread pointer */ + uint64_t t[7]; /* temporaries */ + uint64_t s[12]; /* saved registers */ + uint64_t a[8]; /* function arguments */ + uint64_t sepc; /* exception program counter */ + uint64_t sstatus; /* status register */ +} target_reg_t; + +typedef struct target_fpreg { + uint64_t fp_x[32][2]; /* Floating point registers */ + uint64_t fp_fcsr; /* Floating point control reg */ +} target_fpreg_t; + +#define tswapreg(ptr) tswapal(ptr) + +/* Compare with struct trapframe in riscv/include/frame.h */ +static inline void target_copy_regs(target_reg_t *regs, + const CPURISCVState *env) +{ + + regs->ra =3D tswapreg(env->gpr[1]); + regs->sp =3D tswapreg(env->gpr[2]); + regs->gp =3D tswapreg(env->gpr[3]); + regs->tp =3D tswapreg(env->gpr[4]); + + regs->t[0] =3D tswapreg(env->gpr[5]); + regs->t[1] =3D tswapreg(env->gpr[6]); + regs->t[2] =3D tswapreg(env->gpr[7]); + regs->t[3] =3D tswapreg(env->gpr[28]); + regs->t[4] =3D tswapreg(env->gpr[29]); + regs->t[5] =3D tswapreg(env->gpr[30]); + regs->t[6] =3D tswapreg(env->gpr[31]); + + regs->s[0] =3D tswapreg(env->gpr[8]); + regs->s[1] =3D tswapreg(env->gpr[9]); + regs->s[2] =3D tswapreg(env->gpr[18]); + regs->s[3] =3D tswapreg(env->gpr[19]); + regs->s[4] =3D tswapreg(env->gpr[20]); + regs->s[5] =3D tswapreg(env->gpr[21]); + regs->s[6] =3D tswapreg(env->gpr[22]); + regs->s[7] =3D tswapreg(env->gpr[23]); + regs->s[8] =3D tswapreg(env->gpr[24]); + regs->s[9] =3D tswapreg(env->gpr[25]); + regs->s[10] =3D tswapreg(env->gpr[26]); + regs->s[11] =3D tswapreg(env->gpr[27]); + + regs->a[0] =3D tswapreg(env->gpr[10]); + regs->a[1] =3D tswapreg(env->gpr[11]); + regs->a[2] =3D tswapreg(env->gpr[12]); + regs->a[3] =3D tswapreg(env->gpr[13]); + regs->a[4] =3D tswapreg(env->gpr[14]); + regs->a[5] =3D tswapreg(env->gpr[15]); + regs->a[6] =3D tswapreg(env->gpr[16]); + regs->a[7] =3D tswapreg(env->gpr[17]); + + regs->sepc =3D tswapreg(env->pc); +} + +#undef tswapreg + +#endif /* TARGET_ARCH_REG_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475523; cv=none; d=zohomail.com; s=zohoarc; b=VvERP8JCn2rt4Eqj+x664coVxjCUSxkfVfUU9iMaSDRhTH1XwXyz1u4OI4KVNK8uzCU1yzAP2kp0sRGxinXQxcNBioglVNFYxk6iI8nAvH7CwGdBPqpC/Vm8nAjC/dTM7LJqMYK38mgGoAvnXOeHIQaXRRBQ8EegNzQ88dAB+7s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475523; 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=mQk2A/hTjmVjUN/uDmSNUdNIQXXqerO9SIB89nvt1XM=; b=YQVsRtISn5d9YwaqoP5ZItXlUg83VaJVn697qCSgg5Mk2d/IFZB29KJbShBU6+JvBH36WDH7IhYHFBUawQ/ozEfOxlp/lTZQRMy12J9UU/QCaTCZnq4mQo37guHJE8vtoBnroTaRlZXedMxWwWB3GnABz125gGIpqsAzz/a0X9E= 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 1724475523696261.61750869875334; Fri, 23 Aug 2024 21:58:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shipv-00072j-V8; Sat, 24 Aug 2024 00:57:15 -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 1shipt-0006yI-Ux for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:13 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipo-0002G2-Q8 for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:13 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-7141b04e7a3so2177676b3a.3 for ; Fri, 23 Aug 2024 21:57:08 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475427; x=1725080227; 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=mQk2A/hTjmVjUN/uDmSNUdNIQXXqerO9SIB89nvt1XM=; b=Fa8TUqpeOWYkDLdslzQEW38B1wRWL/O+F83Bbo30muZIhe8uhuxEvN7hqqEy8IL2g0 f76sJubxoekLcs2dkZTEyjeaf7SutmmWbOjkPxN7LcYLmCf783nV29DMoRPIUjeEFx/o S/E6JKtJwGrOgts37ZOMP6pFSDnPO06R6pS7NIC5R70tjPkND4zna9F4jK80tRf+mU2k 3GsDhhL4mVjFXlDBe/vvhEf2oReVvp5W3TJj8tSCZLyaqZXwYpfDLtyD67qrvBZDXndl aqTQB20CvwTYc9JP/8+2TbEX4D6CyQuOaoVIIvJmxTC+JgiGvzG4QbnzRZpTE/GrOIEE Rf6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475427; x=1725080227; 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=mQk2A/hTjmVjUN/uDmSNUdNIQXXqerO9SIB89nvt1XM=; b=daza2MDj+rhHkB9Ie5TikFcJdX83WtuIDQPFhXFcBLNraFT5WOCWWJtUQrQR0UJVR8 XgRRR7Qfjj70SAyBVAxgIgSsdfPI+fU809WXNsZi0FAIuYKMNCfBt+GXcQutiSF3ar6M CAmeU9l7RJVy2DShukMTywlbdf64pmRjPydGhcXTyyd7nGydflP+o89iCsQO3jrEh2PB J4xort5AoKGJP1yuGlSOwccd6Xj6vYLsYBPVDSTXsDeHNJ0LS04c7KsOvSFCvgklo/5v D3LDPczYVz27DlSXp2lxAN4D8m1F3EVgK2kW8248zlr/g89AztrLSc/Mt1SaG4AFOTJX BReA== X-Gm-Message-State: AOJu0YwP9vDuJv29wEf1xd7/0HQfBz2dEmI/Kuz2iQH08PviFF7S8EkE cdizS6NNdzzmR9t1o9trYQn/vhG9ze0vkdG9yR4pGKaA4QdMl2YRs4aNyYdyJLY= X-Google-Smtp-Source: AGHT+IEmOTWxABknFe6oZKdoovk5E3S46arAmDl6ZB6OQiotsJmdKWO08HkTz7A0UFERX7d1RQGunQ== X-Received: by 2002:a05:6a00:a13:b0:705:6a0a:de14 with SMTP id d2e1a72fcca58-7144573cd1fmr6115765b3a.1.1724475426984; Fri, 23 Aug 2024 21:57:06 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 07/17] bsd-user: Add RISC-V signal trampoline setup function Date: Sat, 24 Aug 2024 14:56:25 +1000 Message-Id: <20240824045635.8978-8-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::42f; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=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: 1724475525397116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Implemented the 'setup_sigtramp' function for setting up the signal trampoline code in the RISC-V architecture. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch_sigtramp.h | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 bsd-user/riscv/target_arch_sigtramp.h diff --git a/bsd-user/riscv/target_arch_sigtramp.h b/bsd-user/riscv/target_= arch_sigtramp.h new file mode 100644 index 0000000000..fce673e65a --- /dev/null +++ b/bsd-user/riscv/target_arch_sigtramp.h @@ -0,0 +1,42 @@ +/* + * RISC-V sigcode + * + * Copyright (c) 2019 Mark Corbin + * + * 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 . + */ + +#ifndef TARGET_ARCH_SIGTRAMP_H +#define TARGET_ARCH_SIGTRAMP_H + +/* Compare with sigcode() in riscv/riscv/locore.S */ +static inline abi_long setup_sigtramp(abi_ulong offset, unsigned sigf_uc, + unsigned sys_sigreturn) +{ + int i; + uint32_t sys_exit =3D TARGET_FREEBSD_NR_exit; + + static const uint32_t sigtramp_code[] =3D { + /* 1 */ const_le32(0x00010513), /* mv a0, sp */ + /* 2 */ const_le32(0x00050513 + (sigf_uc << 20)), /* addi a0, a0= , sigf_uc */ + /* 3 */ const_le32(0x00000293 + (sys_sigreturn << 20)), /* li t0, sys_= sigreturn */ + /* 4 */ const_le32(0x00000073), /* ecall */ + /* 5 */ const_le32(0x00000293 + (sys_exit << 20)), /* li t0, sys_= exit */ + /* 6 */ const_le32(0x00000073), /* ecall */ + /* 7 */ const_le32(0xFF1FF06F) /* b -16 */ + }; + =20 + return memcpy_to_target(offset, sigtramp_code, TARGET_SZSIGCODE); +} +#endif /* TARGET_ARCH_SIGTRAMP_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475611; cv=none; d=zohomail.com; s=zohoarc; b=VB1n4OoZag7gT/Yrscredpfa4qewZY8A9Oa3qio5jf0653wAWHD3fFbLIVEzv2Jg7vobxCtjau+LY/8ItSD948Ys9oFxSB03JJqrQAGi7vZgcFU2MDyxoDZzYPe6hPo2l7S7f9TP+WGBXugz8xzpk+nQ0a0j/mDO6NfZ1eL16WY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475611; 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=lfzjBG7+9yzLMDJFHDoCCaXekwfn4Gr8dayPzH/NfvM=; b=QjK6oan6Q//4HR7HpFhggFUu5KEU2g8y5aqllGUzfi84FNqTgJeuvULg3wPk3s9cyWc7ykVPl7yNaBVDS4YzTylzRKmgye67Gx1ILLQF0YL6oHhKsEd/aFyF+HOmjJg0/BnDNhLfpEVIxjJJfgocWO9ZNZQDd5OnUR2tz2nd+Jo= 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 1724475611400770.9878303685744; Fri, 23 Aug 2024 22:00:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shipu-0006ym-Jm; Sat, 24 Aug 2024 00:57:14 -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 1ships-0006xj-RP for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:12 -0400 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipr-0002GB-3z for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:12 -0400 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-7094468d392so2088291a34.0 for ; Fri, 23 Aug 2024 21:57:10 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475430; x=1725080230; 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=lfzjBG7+9yzLMDJFHDoCCaXekwfn4Gr8dayPzH/NfvM=; b=N8yCVZkEseS6QNSBHW8iMr1DmfFN9+gxdbpdkja2bGPpLxEL6zCyrDYMZo7bf+7e/s iTEOMECGSW+DZVqZxdCGnIbUSLQBQGFsZTohX8L1h/LtL8y4huIbZMWS3Ckwy16gqj6c Ke8tbEBVG3oJikLyj6robdBU7VrKD3cvHSU58TxQz+I/dkQ8PZCekHYX82NmINkvz3Pa H8rz/SgC7bMBTMjfAylDwh4HbOBWQx+ztVFse7bhiWAF+IKFD/PY77JPNl1ddO8MJ3LF wNVkNoB96scHcSxAFmFv+9fZWFJOuEOj2/LipgbFQlR2VeHvD+v1u+RgBdeHnhyxx1+B c5gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475430; x=1725080230; 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=lfzjBG7+9yzLMDJFHDoCCaXekwfn4Gr8dayPzH/NfvM=; b=bNSv1/Hxjdtgvxp99G5NjsY4pW1uhiN8UK5xyBYOGPYZ8ozTbqzIVbgUu+PNPiqHYZ udZNqfGv2ZXUM+HMVB0iqHcJoXD7y7hy9Z24n+2fPzGfQBO+m77B3tsHfIoprdtw0Xbz LnY/i8aOENWct1juKime4CBnodKgfrzw/+5a0u3K4Vf2Sd4MUYAYwW0MfnTgpADOk+PY NKE+UMLg1bQPcaslrdZnKZ5K82HhByOcWfs852p7LXm8fcYBsfGjB1bEAT1H9f+ZKbGz m6wK8g0w5dQv657UhSDZt2S+aKYHBwC8dmPiJ1v4xRvsjN270IR40cisAp4Pvo13XgW6 USHQ== X-Gm-Message-State: AOJu0Yzw0xbtfwaYiHzwXDxscvW78TwN/PI+GP/N7w7Ts6dV3HcRXp28 /YZD6puYbNwL82enrBZeZ6rlCgfB8kL1BEyGeCVHPiH5suNiUSk0wxTxFOcEUys= X-Google-Smtp-Source: AGHT+IExXbXm8FMEONRLKtS9EAe9eVMQlhuo6t51Og0h3F2ogSQ5CDRYSnBY8jl9rT0/y+qlAJXS9w== X-Received: by 2002:a05:6830:348f:b0:701:f6c9:f607 with SMTP id 46e09a7af769-70e0eae5d09mr5205724a34.5.1724475429665; Fri, 23 Aug 2024 21:57:09 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 08/17] bsd-user: Implement RISC-V sysarch system call emulation Date: Sat, 24 Aug 2024 14:56:26 +1000 Message-Id: <20240824045635.8978-9-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::32a; envelope-from=itachis6234@gmail.com; helo=mail-ot1-x32a.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: 1724475613550116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Added the 'do_freebsd_arch_sysarch' function to emulate the 'sysarch' system call for the RISC-V architecture. Currently, this function returns '-TARGET_EOPNOTSUPP' to indicate that the operation is not supported. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch_sysarch.h | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 bsd-user/riscv/target_arch_sysarch.h diff --git a/bsd-user/riscv/target_arch_sysarch.h b/bsd-user/riscv/target_a= rch_sysarch.h new file mode 100644 index 0000000000..9af42331b4 --- /dev/null +++ b/bsd-user/riscv/target_arch_sysarch.h @@ -0,0 +1,41 @@ +/* + * RISC-V sysarch() system call emulation + * + * Copyright (c) 2019 Mark Corbin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef TARGET_ARCH_SYSARCH_H +#define TARGET_ARCH_SYSARCH_H + +#include "target_syscall.h" +#include "target_arch.h" + +static inline abi_long do_freebsd_arch_sysarch(CPURISCVState *env, int op, + abi_ulong parms) +{ + + return -TARGET_EOPNOTSUPP; +} + +static inline void do_freebsd_arch_print_sysarch( + const struct syscallname *name, abi_long arg1, abi_long arg2, + abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6) +{ + + gemu_log("UNKNOWN OP: %d, " TARGET_ABI_FMT_lx ")", (int)arg1, arg2); +} + +#endif /* TARGET_ARCH_SYSARCH_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475575; cv=none; d=zohomail.com; s=zohoarc; b=VO2ylrYfbjaEL28my+YkAcR+U8g+atJ9jeYIRK2cZBs7IEXF09iOpc1YsNE54BGfCqbisxTDaa16I2ShvGahgQpunSCDShZ/RaFglzCDRDYWGdN3/IRwRJ+qXQxljmh0R4TVIKZfNGpRV+Zx6b5E25iMR4pbEVHJ16q3toSDktA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475575; 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=lh8KOQwJMj+hbdZDJmsAuuccSG6XdRdYqvYltME6/k8=; b=aVK9jkuM9xBY6xh1FludmMUcuwO1R612zul/10kmrtVn98iX8TVJoGvRmvey6wI2rvsOjw6kImFhbd3ZuZusv9Y1vfaV+EgO4EELej1G7dGkxp9wOzXKI4LtKKX/i0m0aiuYw2OfRZX72dr2Zq+AQTL/C+UbUEcS3ulHP19kghs= 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 1724475575404493.1617127528949; Fri, 23 Aug 2024 21:59:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shipx-00078i-6L; Sat, 24 Aug 2024 00:57:17 -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 1shipv-00073N-Pk for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:15 -0400 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipu-0002GU-4q for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:15 -0400 Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-70949118d26so2465987a34.0 for ; Fri, 23 Aug 2024 21:57:13 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475433; x=1725080233; 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=lh8KOQwJMj+hbdZDJmsAuuccSG6XdRdYqvYltME6/k8=; b=HVSgsSiewx57ea8OauCF9763hKW57R6A3AxChR5HTkr9Qys/xDCeaf/ULV0b8cfUC4 xM7MYX8FvfQBa8ihO7km2+8Vlc8JhOQDmQ9hTyurzKJZnWMMDoCur31Lo/r1px+mSeFN XXUKG6nl3aWGp7QsyEA9Ov2Lsd3HcR5tN+gFqhc2qWpnNGA4W1PsT8b71XTK6oGEEvmD 2M4u248oezOEVn84CLxE0lamtFVTCLCGZ43QQt8IIcnhhXT2PbD3kGdqovXVW1SIQwxA aQ4WBmxb9qpTFz1j7/akxcyi1j3byWOvGqK4S5+z9mCYlDWWm8E6u4KlPCPNEyYb4cK0 d0ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475433; x=1725080233; 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=lh8KOQwJMj+hbdZDJmsAuuccSG6XdRdYqvYltME6/k8=; b=prJ/JKR96PWCBx697qQE3/pnoLM1zcEtfaU6Kh435v6XKUYeZCQsXzqiH1FXuVQMzE aYC+OZkvw9BIsDiqWCPKtyjGX9lf0DZ+vMlf3qEzXXKRBX1UEYQIyuanpVjMwGMnOSTo R+iRFCVQApA7i+ngz4ByLSHdmN9rD5JFleJwBxPFvL49Adnz9zb0u149LTU3TJsZizzD th1v3/xjT2YzzD5hy+qa0L0uGMWbdzfy59TtqFoY/rYIRqNM/u+Q5xsjVS/lBT7SyMve 247Cc9efWonFBq8nmqBhKVcrsUHxmZ7ZeuAKzWMLGRtfSTDJ5o1tPspaB0xxvEKv/ubM 78Qg== X-Gm-Message-State: AOJu0YxD9dbSoCL+2xKujSfoZnW+ivnmLxYLvZGSG36S5D/Bz4srUZSc i5qs4Jk9Os2dZ38x+c9KGblRxTMsKsigPfyeEtpNRu5miKw3Tn3j1DPkvSe+mWk= X-Google-Smtp-Source: AGHT+IH8Jk34/i/Y/t8CeVyVP3fRCUM/J/MBSPgh954fOBCJOhuAGCp2zKRd2WQljIOLEbBdzQMNFA== X-Received: by 2002:a05:6808:150b:b0:3da:b35d:52e0 with SMTP id 5614622812f47-3de2a8d671amr4980815b6e.43.1724475432650; Fri, 23 Aug 2024 21:57:12 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Jessica Clarke , Kyle Evans Subject: [PATCH v3 09/17] bsd-user: Add RISC-V thread setup and initialization support Date: Sat, 24 Aug 2024 14:56:27 +1000 Message-Id: <20240824045635.8978-10-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::336; envelope-from=itachis6234@gmail.com; helo=mail-ot1-x336.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: 1724475577616116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Implemented functions for setting up and initializing threads in the RISC-V architecture. The 'target_thread_set_upcall' function sets up the stack pointer, program counter, and function argument for new threads. The 'target_thread_init' function initializes thread registers based on the provided image information. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Co-authored-by: Jessica Clarke Co-authored-by: Kyle Evans Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch_thread.h | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 bsd-user/riscv/target_arch_thread.h diff --git a/bsd-user/riscv/target_arch_thread.h b/bsd-user/riscv/target_ar= ch_thread.h new file mode 100644 index 0000000000..db0f9eb52c --- /dev/null +++ b/bsd-user/riscv/target_arch_thread.h @@ -0,0 +1,47 @@ +/* + * RISC-V thread support + * + * Copyright (c) 2019 Mark Corbin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef TARGET_ARCH_THREAD_H +#define TARGET_ARCH_THREAD_H + +/* Compare with cpu_set_upcall() in riscv/riscv/vm_machdep.c */ +static inline void target_thread_set_upcall(CPURISCVState *regs, + abi_ulong entry, abi_ulong arg, abi_ulong stack_base, + abi_ulong stack_size) +{ + abi_ulong sp; + + sp =3D ROUND_DOWN(stack_base + stack_size,16); + + regs->gpr[xSP] =3D sp; + regs->pc =3D entry; + regs->gpr[xA0] =3D arg; +} + +/* Compare with exec_setregs() in riscv/riscv/machdep.c */ +static inline void target_thread_init(struct target_pt_regs *regs, + struct image_info *infop) +{ + regs->sepc =3D infop->entry; + regs->regs[xRA] =3D infop->entry; + regs->regs[xA0] =3D infop->start_stack; =20 + regs->regs[xSP] =3D ROUND_DOWN(infop->start_stack,16); +} + +#endif /* TARGET_ARCH_THREAD_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475501; cv=none; d=zohomail.com; s=zohoarc; b=mTVaxDz6Iw1KG3ye9BpfoJvwaSSU6ML2uRGo6yP1G5BKVPWQlSKyB0v6snCikrPZB6XBLqpAVWXfnzloQ524WxT86RLA6kFSGVg7iYGlIeD1n5V7L83fntiK4zTpQhkXyrTK/H7Pm2tA5Z/VdBDQvoJoqo4s3+415UxbPY8w0x0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475501; 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=BISuETtEj/uI6CddQsRG+h5xaQo8IxKpbRWv0bTNq7U=; b=QfsjbmNaDK8ZMZlOe+zL5XddD6LT4ysnwYvlwqbi0Ut9/UYkP5ZI94uXoCpq2TJHFb7q38LMTMRsm87AYgtIBPE7SJtpefARm/CAJrL6BLeNSCI4xtS2HPBuyX886P8BOR3udH/iaWawcZrnGzT/JFTbzj8IdoMdSZwmeik2Lno= 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 1724475501839624.6579535583671; Fri, 23 Aug 2024 21:58:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shiq0-0007NK-PP; Sat, 24 Aug 2024 00:57:20 -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 1shipy-0007Ft-UU for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:18 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipx-0002H3-2i for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:18 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7142448aaf9so1856069b3a.1 for ; Fri, 23 Aug 2024 21:57:16 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475435; x=1725080235; 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=BISuETtEj/uI6CddQsRG+h5xaQo8IxKpbRWv0bTNq7U=; b=ictB9zrGVnf2Dw9yXd5hCrC4nJRFbJXYLEpqtD16KIcrSfHbIY/cv4G80syY0r+nky Pprqf4YJMygxocqwDuVnYJc+2+wvojF+i9NR7gX3WQE6Doz7cb4bu69B3ONp/aGi0OQs +nAnhDe4w2lZ8mhSALWE/BOd8AQX9lMhzfs4wvP7HETijlT1uYaFIxhHSsx61LXJ8bs1 2PDCV0PT9Npnw1bQ1FC0xsrTaW8DhAtOi9Uc7dEqbqgvMHLgjZYKdzAwo1DZtysRSmGn JWXRQdG15UjVEybChU0wSSpHbEa0rR/LL6oq4q9ynPr0jvstpj1F64tTDqdTgPlJBUZI zX0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475435; x=1725080235; 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=BISuETtEj/uI6CddQsRG+h5xaQo8IxKpbRWv0bTNq7U=; b=jMd2DKY8p8CznxCx2DDdzywTR5+98wYpmRR5mgjXvrisT2ELXL+DNKJKKTLdok1VnE ltcYJ70C013N3DzHLT7rCjxrNTpxKG+NPB0R/80PMo2UGAYzPgyNynmQTNg2W6Sgckjk hJh8pG4pBO45iScBkHr0pBbhY87PDZmiCkZTvWmTbxcaTH4YKWPNEn3kWq72+3ZletzN EqIcva1mq0274vo47oORaM55w2SVzVNwFnTkldg4vhj92wqaaDOOyrV8lhJaLIrzvOSe HI9qB2m4NYpukhQsrQnhtnbZ5DTqEjeuOoIajaLN/61CLZRdzjshSFx4q/vFz/Cw+uht lpoQ== X-Gm-Message-State: AOJu0YxmbdKsBHnegME1PpAxRZO+YvVSlssnHCwuys/INFO28YEKz3La hXnLl/cRj2/Vs/VOlUp/lfoR8OX7GdEPFPiKFe+iv33lvCZGyTbj1QxjYrtNtCM= X-Google-Smtp-Source: AGHT+IHSiQOiOe0f0SHqwKimEgHPHAzUWZaQ0rlpI/31PLNRYgzJUXIoOV/TlJ9t38EK/mkvh5mLKA== X-Received: by 2002:aa7:8244:0:b0:710:d294:a2b with SMTP id d2e1a72fcca58-7143176773amr13919289b3a.8.1724475435260; Fri, 23 Aug 2024 21:57:15 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 10/17] bsd-user: Define RISC-V VM parameters and helper functions Date: Sat, 24 Aug 2024 14:56:28 +1000 Message-Id: <20240824045635.8978-11-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::42a; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x42a.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: 1724475503159116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Added definitions for RISC-V VM parameters, including maximum and default sizes for text, data, and stack, as well as address space limits. Implemented helper functions for retrieving and setting specific values in the CPU state, such as stack pointer and return values. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch_vmparam.h | 53 ++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 bsd-user/riscv/target_arch_vmparam.h diff --git a/bsd-user/riscv/target_arch_vmparam.h b/bsd-user/riscv/target_a= rch_vmparam.h new file mode 100644 index 0000000000..0f2486def1 --- /dev/null +++ b/bsd-user/riscv/target_arch_vmparam.h @@ -0,0 +1,53 @@ +/* + * RISC-V VM parameters definitions + * + * Copyright (c) 2019 Mark Corbin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef TARGET_ARCH_VMPARAM_H +#define TARGET_ARCH_VMPARAM_H + +#include "cpu.h" + +/* Compare with riscv/include/vmparam.h */ +#define TARGET_MAXTSIZ (1 * GiB) /* max text size */ +#define TARGET_DFLDSIZ (128 * MiB) /* initial data size limit= */ +#define TARGET_MAXDSIZ (1 * GiB) /* max data size */ +#define TARGET_DFLSSIZ (128 * MiB) /* initial stack size limi= t */ +#define TARGET_MAXSSIZ (1 * GiB) /* max stack size */ +#define TARGET_SGROWSIZ (128 * KiB) /* amount to grow stack */ + +#define TARGET_VM_MINUSER_ADDRESS (0x0000000000000000UL) +#define TARGET_VM_MAXUSER_ADDRESS (0x0000004000000000UL) + +#define TARGET_USRSTACK (TARGET_VM_MAXUSER_ADDRESS - TARGET_PAGE_SIZE) + +static inline abi_ulong get_sp_from_cpustate(CPURISCVState *state) +{ + return state->gpr[xSP]; +} + +static inline void set_second_rval(CPURISCVState *state, abi_ulong retval2) +{ + state->gpr[xA1] =3D retval2; +} + +static inline abi_ulong get_second_rval(CPURISCVState *state) +{ + return state->gpr[xA1]; +} + +#endif /* TARGET_ARCH_VMPARAM_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475496; cv=none; d=zohomail.com; s=zohoarc; b=l06TfTZf86DREepNhjv9wuhsxtlWrHFTLy+PjOXkUW2XkiTDaWosRO722xoe3RVtw0xCXCWAS/JxOWm8XJpbDG8nZuCtPl4OzwajanaEuoXUbIJ4um6KkVWy6P1vKMahsxq/Yzsu3M8hzqaHHQA3ig/T76RxH22C0DZB7GOhaIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475496; 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=/upld7cTqaC/atkB+nu7yGsbOxCVGK3zsoQHBJP0niw=; b=L6hgrLrcTO+IYHv0ZkY4GUn5fadmAKPVd2hE6H40bXXHte+75o8z7T0Qj8xOeeLyWZ9AchcfAmkxKR6s/JTqzU6JlR7zeJCcUQzuX86rwMdTO2p3EKtowyych9PQ/j5dgId9JdiuyiUNkwb8VrTUu+Zhch3QSVGWl7WzUZeJtbs= 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 1724475496200657.3802977952429; Fri, 23 Aug 2024 21:58:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shiq2-0007UE-HL; Sat, 24 Aug 2024 00:57:22 -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 1shiq1-0007Og-3B for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:21 -0400 Received: from mail-yw1-x112b.google.com ([2607:f8b0:4864:20::112b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shipz-0002HM-Gb for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:20 -0400 Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-6b6b9867faaso23981997b3.2 for ; Fri, 23 Aug 2024 21:57:19 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475438; x=1725080238; 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=/upld7cTqaC/atkB+nu7yGsbOxCVGK3zsoQHBJP0niw=; b=T6Nc/922P//KcFdJ+iVPgLOcNp4MBopiOt9PHkHUZuM++BqGENDos2kKeH9NHniuA8 dE1A1h/dqDuo4OoNcGKminElQnnM0f4EFJgNWePuVySGMdKlkenNSZkHi0SzzBUiQskc m9+UlXljLH1fO0cplJ1rzRZDOetMqY4u9HethddJPT/qF+3L2l3kEvKr03cMS2NW3cgv FwDgJ3x51UcRvb/C6lswxmrxRahLN0dZeYDD1PW74FlJfAldm6KGQnz3e5ui1L2e9D12 WGoPOyVg+cLibI4Re57V5PWAGd+QL2IaXOldE3EarC7pvpFl+S+xqO9RCrbRCERCNtSi 0mMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475438; x=1725080238; 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=/upld7cTqaC/atkB+nu7yGsbOxCVGK3zsoQHBJP0niw=; b=JwlMLwfcOLwknq4CV+Yhb+VU1356iTPPwUg+ym7a70KVc6IPxrvhofmJH1GLElPuYJ akxmf67fp9QUzO4J8XjJ783guZ5FF10SAz/6/mYDmpQ2VT4L+mtj37NPr6ShcB+Rjkvi d/6mrFSLfjqhWbmOlSgdszOFfDyOby/nJcDtI5bynKWhOLjwo+JaPFQaXX6gtm3M7efj hXIrf6w9OCEbwbTYrhKWpMOSCmRP6Nwn13vkARj/1T/VMBMdXwxTGIWZo3ZlCi7Oda9O XstuOoOgSrpu6P2srdYlwUE4BxxvW+A4nzCnjyxYpCfsMzV3TK8KYVeAbUflovO7B3We y3Fg== X-Gm-Message-State: AOJu0Yx/sa2vstdx8Zu99sA6H/QO+sFM0q1/s8kPcFfV9xth2uS8YH4j 4j3e97C3xR1RNME/q1rnmgsHNscIQhFwmMoTYGlL9bjL5jDXCNExfGrU00xL7lc= X-Google-Smtp-Source: AGHT+IGaBxQ6bkLnL4caHXe3j0+ZoN5xUbF7CQYKE7saUJIIERhDr/6uUQIiZhNPrUioj97t48zKTg== X-Received: by 2002:a05:690c:250e:b0:6af:b0cc:abda with SMTP id 00721157ae682-6c62906581cmr41205277b3.40.1724475438259; Fri, 23 Aug 2024 21:57:18 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Jessica Clarke , Richard Henderson Subject: [PATCH v3 11/17] bsd-user: Define RISC-V system call structures and constants Date: Sat, 24 Aug 2024 14:56:29 +1000 Message-Id: <20240824045635.8978-12-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::112b; envelope-from=itachis6234@gmail.com; helo=mail-yw1-x112b.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: 1724475497372116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Introduced definitions for the RISC-V system call interface, including the 'target_pt_regs' structure that outlines the register storage layout during a system call. Added constants for hardware machine identifiers. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Co-authored-by: Jessica Clarke Reviewed-by: Richard Henderson --- bsd-user/riscv/target_syscall.h | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 bsd-user/riscv/target_syscall.h diff --git a/bsd-user/riscv/target_syscall.h b/bsd-user/riscv/target_syscal= l.h new file mode 100644 index 0000000000..e7e5231309 --- /dev/null +++ b/bsd-user/riscv/target_syscall.h @@ -0,0 +1,38 @@ +/* + * RISC-V system call definitions + * + * Copyright (c) Mark Corbin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef BSD_USER_RISCV_TARGET_SYSCALL_H +#define BSD_USER_RISCV_TARGET_SYSCALL_H + +/* + * struct target_pt_regs defines the way the registers are stored on the s= tack + * during a system call. + */ + +struct target_pt_regs { + abi_ulong regs[32]; + abi_ulong sepc; +}; + +#define UNAME_MACHINE "riscv64" + +#define TARGET_HW_MACHINE "riscv" +#define TARGET_HW_MACHINE_ARCH UNAME_MACHINE + +#endif /* BSD_USER_RISCV_TARGET_SYSCALL_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475533; cv=none; d=zohomail.com; s=zohoarc; b=gA2zIrzp40FXux65wRCALDFrSQkoZMTC/GBMFOVZWbAqYt/vUn94H4SPVnOL7uSmRKJnhiDOg6i/YYuybAwBtOhlsBLzqB/li2RypOSM7ebiYiTR188kXDT1lGevI8lXGv4Mi5KPYBLWJsMfgY0hRDMEbUtt4v+uiBW8zRfRV/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475533; 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=cjm2NL6Wgqty15f3ap7G8BavBfHkA8e5dbFy1QdhwG4=; b=ThePq66yRoDEHfJqRgtlrs+qug9hKiRajEGzHWzFW/V5h506/areckFcVfkPfm6hV039oOMfb6mNTcoUnV480GO6SMNZGSJRQdJgtXUipLSKiL40DXz8qG/2z0R3Jlhv5amJvfXdjxbCRe8+u+wm3IOocRCrO32R/jlVO4zpoFU= 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 1724475533970978.1407065001722; Fri, 23 Aug 2024 21:58:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shiq6-0007jl-2P; Sat, 24 Aug 2024 00:57:26 -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 1shiq5-0007dw-0W for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:25 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shiq2-0002Ha-Fb for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:24 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-71446fefddfso998588b3a.0 for ; Fri, 23 Aug 2024 21:57:22 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475441; x=1725080241; 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=cjm2NL6Wgqty15f3ap7G8BavBfHkA8e5dbFy1QdhwG4=; b=j4e1LQlPWJElDKbNFPcgDbWaactb1mwdfTC1Ak5q2t9b4IAs5cqJw1T6uWRO3Ke+U9 ttShE8aBFwEcCYtzmqPg5CuR0pTIcYzSkSu16Jy+Us95/iCleOp9s647uVY2CNS+QbYG VxiZvDkRgNdb4O5nU4N9mx9ksTB1QAclOM0pqXP3j4fVeMOQ5gUIz4txVMFMctAy8WOy fEEDbvlkt+pmOxipySo00l5cAEd8nM4kTBiQmIuVPIQcKs1zWaFdZOCSerHSBAMwPS3p BkKVZY2OT3FlXDTTSotqHmymOMlUfY1QXONrpiC/+EFiv1VtSxcQqMUanrXxyB6v27kU +AWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475441; x=1725080241; 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=cjm2NL6Wgqty15f3ap7G8BavBfHkA8e5dbFy1QdhwG4=; b=quwh6pP7mv0/DRqXAv1MTWFCy1c3MopEYipnoW7l054FW9438p94kfHIxp91azjzfV F/byTXF/Uzf32hpRrkRP7+qGuayH4WMMji5b3eYjHCQzgfz2btFHbY9PASjpPJB3TlGC n7rzuaomw6rlfqbKrdJVIo4AN3yqk7giqwsDOl5JKJ3SGFpU5ykpsfXVRpfxQtcuPYp1 Ibgrz+wHfM3eo8BvFucgRqQigFHQElKjY0K+8wPs2mzCoVqpRRJYpsO6M8jS7nSQTaNY YJFFuHoQrH+yWSDgFWN3C6hJqOdiRKziNvT77viiYAQ24DWlW/5BrtjbHCb8Mgs/BiFr AI1w== X-Gm-Message-State: AOJu0Yy0yJQTP1LqeNdYt1YL59InfxDqb/cEDrFfgU3adGEYMjO5ZOIi nlqkKPUCEIo9dPD0MhTSkbrPIlSrmj+x/tVwQMkuuSIR4zidE7OHOaO3XykcPQA= X-Google-Smtp-Source: AGHT+IHfVAB2t3Mj2+tavke9V4E+h8VwIRn8eoD+rx0IBp3tDmhUmYWZaffkopxKAzOkp009QPrOaQ== X-Received: by 2002:a05:6a00:18a3:b0:706:34f3:7b60 with SMTP id d2e1a72fcca58-714458acb5cmr5310024b3a.23.1724475440812; Fri, 23 Aug 2024 21:57:20 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 12/17] bsd-user: Add generic RISC-V64 target definitions Date: Sat, 24 Aug 2024 14:56:30 +1000 Message-Id: <20240824045635.8978-13-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::42b; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x42b.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: 1724475535218116600 Content-Type: text/plain; charset="utf-8" From: Warner Losh Added a generic definition for RISC-V64 target-specific details. Implemented the 'regpairs_aligned' function,which returns 'false' to indicate that register pairs are not aligned in the RISC-V64 ABI. Signed-off-by: Warner Losh Signed-off-by: Ajeet Singh Reviewed-by: Richard Henderson --- bsd-user/riscv/target.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 bsd-user/riscv/target.h diff --git a/bsd-user/riscv/target.h b/bsd-user/riscv/target.h new file mode 100644 index 0000000000..036ddd185e --- /dev/null +++ b/bsd-user/riscv/target.h @@ -0,0 +1,20 @@ +/* + * Riscv64 general target stuff that's common to all aarch details + * + * Copyright (c) 2022 M. Warner Losh + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef TARGET_H +#define TARGET_H + +/* + * riscv64 ABI does not 'lump' the registers for 64-bit args. + */ +static inline bool regpairs_aligned(void *cpu_env) +{ + return false; +} + +#endif /* TARGET_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475542; cv=none; d=zohomail.com; s=zohoarc; b=B7m4rCx3hSTcgQSUOj42K3z5Bn+eW3v7GjzXRgRnxlF5x4qqWxUff4upfGy0OVljhypVbqFUt6R/e4Pz+NuXZg9K2GceACADrL3IrgGbv1CyUhyv/cylzPKCSMBKYmXt8NPvB6hgrllHp8xy3q0gtDKbEU5etCJICeoS9NvintE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475542; 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=voYN43OZ7lwbwneNl7z2eHNOhROV9NjNWmAvKPq1wXw=; b=Mo3nJOVhBtX2p8aRT7jkbR5ksnC9WfBmsP4pvdtBqZerEpyPjel+/Wq6z8Y2qvFqLiu9usTlNgjgJMaS2mdGCGt8Li8i7QROZQitn1Fu5dEOqdPPfWvQfVancAVYcgawsCbIQ/mrfLCBXe9SuIP7Y/N01IVie4gC1E2fs8NuzvY= 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 1724475542724162.22412563861985; Fri, 23 Aug 2024 21:59:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shiq8-0007u7-Lt; Sat, 24 Aug 2024 00:57:28 -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 1shiq7-0007o5-40 for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:27 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shiq5-0002J9-9g for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:26 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-714287e4083so2368446b3a.2 for ; Fri, 23 Aug 2024 21:57:24 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475444; x=1725080244; 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=voYN43OZ7lwbwneNl7z2eHNOhROV9NjNWmAvKPq1wXw=; b=Lucoro+7NaVFOxZdTkeZm/665q4lVc6MbrJK4jEcjYg2AHvfwob3yH/1WGBu43i0fX k4axOMb6zgMaHlKiJEnIWQ4Gm5V70KwBRj+yWB+o23sSv82gyeaUl8bEkByZNy/sxcjZ yVWfZs9D5JEm+I+1MNfAvk0HLLfldnk95a6+tJ/YdIW6wURQBvngsrxBNjasCmOHqH5h Yh16WSsZnjA2smYJshU1c82iUSD9cPX1APz1wcXg7sdDlYOK70QxaEbHUoGj8AVZizoI ZJsopIxni1ySgXALY8oxjsUDQpWnSKVa9UN+t1C3ZshKa70QrPiZSbVMt28sgepFnVZD 4bCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475444; x=1725080244; 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=voYN43OZ7lwbwneNl7z2eHNOhROV9NjNWmAvKPq1wXw=; b=wfZ9TYwtwhlTkeIgGmOiAX5QXaMyDiJ9LRXi4Imo0Dr85MjdUiuRc21BSyPzI6rFeM vcAo6l3r8j0YhSXXDXulW85EhxsCEjy0tKHzug/BG+jD+YNEXdUVq2pCIDJn1tQoLox8 UaUXJmXVBOUETx5NZnLazIADUdKK1jRVT6Sx4/af+4DJTyeljGDXVP1oVbaVAbM+LC4l I2epzRpLBHxK+eA7hhDVVVMYeYvy3/y5XFTZACukhMmiqb80EclFXUB43XZabE5WNvU9 HUt6CVtlsV6PKmMScknn8ne2/zy63xqRH0+3Y1Yn2i08FiK8bhY1sCM6F9aDt+ITyQCN B2BQ== X-Gm-Message-State: AOJu0YwDItRQky4jVp4ZXUUqE9qF5fxFKT29qYhuh2ySw55MqsJVs3dI SvCHI0qmRreMn98Ph7NT2Vje1nIBPMHsJUsN++b8hgOGoaiNNCyj+97OOT32sTo= X-Google-Smtp-Source: AGHT+IFhYZi9qd/4Qr8VFlsZLYNLu3ju11bYXGK3oqDpEgW73j6sGkFBjt5qzlWzknx3+2D+4elZmA== X-Received: by 2002:aa7:88cf:0:b0:714:147c:1377 with SMTP id d2e1a72fcca58-71445ce3f8dmr5719988b3a.7.1724475443486; Fri, 23 Aug 2024 21:57:23 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 13/17] bsd-user: Define RISC-V signal handling structures and constants Date: Sat, 24 Aug 2024 14:56:31 +1000 Message-Id: <20240824045635.8978-14-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::431; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x431.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: 1724475543272116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Added definitions for RISC-V signal handling, including structures and constants for managing signal frames and context Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Co-authored-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/riscv/target_arch_signal.h | 75 +++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 bsd-user/riscv/target_arch_signal.h diff --git a/bsd-user/riscv/target_arch_signal.h b/bsd-user/riscv/target_ar= ch_signal.h new file mode 100644 index 0000000000..1a634b865b --- /dev/null +++ b/bsd-user/riscv/target_arch_signal.h @@ -0,0 +1,75 @@ +/* + * RISC-V signal definitions + * + * Copyright (c) 2019 Mark Corbin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef TARGET_ARCH_SIGNAL_H +#define TARGET_ARCH_SIGNAL_H + +#include "cpu.h" + + +#define TARGET_INSN_SIZE 4 /* riscv instruction size */ + +/* Size of the signal trampoline code placed on the stack. */ +#define TARGET_SZSIGCODE ((abi_ulong)(7 * TARGET_INSN_SIZE)) + +/* Compare with riscv/include/_limits.h */ +#define TARGET_MINSIGSTKSZ (1024 * 4) +#define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768) + +struct target_gpregs { + uint64_t gp_ra; + uint64_t gp_sp; + uint64_t gp_gp; + uint64_t gp_tp; + uint64_t gp_t[7]; + uint64_t gp_s[12]; + uint64_t gp_a[8]; + uint64_t gp_sepc; + uint64_t gp_sstatus; +}; + +struct target_fpregs { + uint64_t fp_x[32][2]; + uint64_t fp_fcsr; + uint32_t fp_flags; + uint32_t pad; +}; + +typedef struct target_mcontext { + struct target_gpregs mc_gpregs; + struct target_fpregs mc_fpregs; + uint32_t mc_flags; +#define TARGET_MC_FP_VALID 0x01 + uint32_t mc_pad; + uint64_t mc_spare[8]; +} target_mcontext_t; + +#define TARGET_MCONTEXT_SIZE 864 +#define TARGET_UCONTEXT_SIZE 936 + +#include "target_os_ucontext.h" + +struct target_sigframe { + target_ucontext_t sf_uc; /* =3D *sf_uncontext */ + target_siginfo_t sf_si; /* =3D *sf_siginfo (SA_SIGINFO case)*/ +}; + +#define TARGET_SIGSTACK_ALIGN 16 + +#endif /* TARGET_ARCH_SIGNAL_H */ --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475590; cv=none; d=zohomail.com; s=zohoarc; b=EP9HabasEser246ky2pTolsgWXHOcqavUYwHrEAR+VYkh5DgEmqNUMwWHe6YGJW9NIKQcPKx6e/lFAG1FX7WSHyqsj4BdJxrZsFkYzzufs5gnj4YCsBKYb8DYz9mMXfVMl0vpHZ97zeGTl+mdcb37PK7zPPDSJgxfFT0X7EeRLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475590; 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=7+bsO6A/4UIjh+UAI8JcbcWlILl99UyeWUeQ1BHs21E=; b=A+9njuEJ1vcjD0o7mJRGgz3CywWaOT62idhr71BhK+zuP5o26D/GF5NVG2tTp83PDkuqOmyQfCmuOGgxR82pHSaseICmsMpq0sA0qjtyWKT1KwJQ8stGcesOIufCOeggaaCd1qOffYqAGBLBgayaTGrTO86s65rbFm0DUU1wQXU= 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 1724475590254340.67170939719847; Fri, 23 Aug 2024 21:59:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shiqA-00080x-Gw; Sat, 24 Aug 2024 00:57:30 -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 1shiq9-0007xh-Gr for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:29 -0400 Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shiq7-0002Jb-OP for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:29 -0400 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-5d5cbe88f70so1877749eaf.0 for ; Fri, 23 Aug 2024 21:57:27 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475446; x=1725080246; 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=7+bsO6A/4UIjh+UAI8JcbcWlILl99UyeWUeQ1BHs21E=; b=aPkcLfYPnabFub9OXg5gLpxRTxiDVMKbZ69gdvPy0jqW/EjSc6nKH4swMHfgn3mDJg /qGfzN8Apqw3iAmpcw9bPDBm5VNZ5crMRmuWNJhEi5/LbCcIRLp1tTr6o+GO9PaW5CGg sComs5F8cJJsAnSCbFp0SHqLGbakvp3RwouV4jK5KjpbUvR+cHJjIXiJx2dL/zGscuEV ucIPMcJC5KWBWecGbDTt/CWNnftL7LB6e6kN/lB5+pu80FqPGV843JjPKG4TzfiGMuxB 6CJE4Z0ZhmgxwidzrkJ3b9GsuqbY71uwjW9g5hmb/JoQYuX+ps72wBN80qfqordH38Jn fcTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475446; x=1725080246; 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=7+bsO6A/4UIjh+UAI8JcbcWlILl99UyeWUeQ1BHs21E=; b=pm/2/cGDp/mZC24+kKzOrN6BfFG5vY2tfhXYiDFNXb0JgN7A6o8gDhBAJSOxE9zXW4 cZF2fNpu+mPP75sVqsZXOQN+46i7skARx+TUaYy8xIqw6o6rLRlaiAbLb5YhAPU+NGbU 9hKxfbziaLqUP2SLaMR9yh4wZmwRqUzTWQ3OAedb8GzGnO+Z+ChbzpSttdzH8Q3vmsMk VoCVLFMTgF5DZt6F84aDmBz0qKyFoDFacw2Ux1Eb9S5VIdbU3wz+ASxWSbAo7X/eS9PL FfZyhH4cVJZDQC/7Z02d6ZvktqAfoNzrMW0dMwztna1z9F/4VzPolUUUScRcVGS3gbQC Hm/Q== X-Gm-Message-State: AOJu0YwBzwClZ6aBF+Ha6W8WumuzWvXBQ+q6YUs3W/5Z7gtb0aqfXk5i 4zmK4S6tMLivs+XHZb7ajv0h9alibcTAi2dxIO7HyjBE/BW/Hm77MktuJPMDetU= X-Google-Smtp-Source: AGHT+IGaa4p4vmbOztc3a7HKebHGsiTpajJnIc/4hBwa8mr3Fz99YGiwCjHdJqMPintLLxnGiOJceA== X-Received: by 2002:a05:6358:948b:b0:1aa:b9f2:a0c4 with SMTP id e5c5f4694b2df-1b5c3a4ea37mr492822455d.11.1724475446153; Fri, 23 Aug 2024 21:57:26 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 14/17] bsd-user: Implement RISC-V signal trampoline setup functions Date: Sat, 24 Aug 2024 14:56:32 +1000 Message-Id: <20240824045635.8978-15-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::c2a; envelope-from=itachis6234@gmail.com; helo=mail-oo1-xc2a.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: 1724475591437116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Added functions for setting up the RISC-V signal trampoline and signal frame: 'set_sigtramp_args()': Configures the RISC-V CPU state with arguments for the signal handler. It sets up the registers with the signal number,pointers to the signal info and user context, the signal handler address, and the signal frame pointer. 'setup_sigframe_arch()': Initializes the signal frame with the current machine context.This function copies the context from the CPU state to the signal frame, preparing it for the signal handler. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Signed-off-by: Warner Losh Co-authored-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/riscv/signal.c | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 bsd-user/riscv/signal.c diff --git a/bsd-user/riscv/signal.c b/bsd-user/riscv/signal.c new file mode 100644 index 0000000000..2597fec2fd --- /dev/null +++ b/bsd-user/riscv/signal.c @@ -0,0 +1,63 @@ +/* + * RISC-V signal definitions + * + * Copyright (c) 2019 Mark Corbin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +#include "qemu/osdep.h" + +#include "qemu.h" + +/* + * Compare with sendsig() in riscv/riscv/exec_machdep.c + * Assumes that target stack frame memory is locked. + */ +abi_long +set_sigtramp_args(CPURISCVState *regs, int sig, struct target_sigframe *fr= ame, + abi_ulong frame_addr, struct target_sigaction *ka) +{ + /* + * Arguments to signal handler: + * a0 (10) =3D signal number + * a1 (11) =3D siginfo pointer + * a2 (12) =3D ucontext pointer + * pc =3D signal pointer handler + * sp (2) =3D sigframe pointer + * ra (1) =3D sigtramp at base of user stack + */ + + regs->gpr[xA0] =3D sig; + regs->gpr[xA1] =3D frame_addr + + offsetof(struct target_sigframe, sf_si); + regs->gpr[xA2] =3D frame_addr + + offsetof(struct target_sigframe, sf_uc); + regs->pc =3D ka->_sa_handler; + regs->gpr[xSP] =3D frame_addr; + regs->gpr[xRA] =3D TARGET_PS_STRINGS - TARGET_SZSIGCODE; + return 0; +} + +/* + * Compare to riscv/riscv/exec_machdep.c sendsig() + * Assumes that the memory is locked if frame points to user memory. + */ +abi_long setup_sigframe_arch(CPURISCVState *env, abi_ulong frame_addr, + struct target_sigframe *frame, int flags) +{ + target_mcontext_t *mcp =3D &frame->sf_uc.uc_mcontext; + + get_mcontext(env, mcp, flags); + return 0; +} --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475575; cv=none; d=zohomail.com; s=zohoarc; b=nzNZ5Jjq+9PFjkxM3gVSH9wGRNvd9kVAFX4GhSpk+bJV1GPx+tjoLiz7OQlOJLGL7xmS/IjPR8N9Ss7Z95Yl4SjeScYwZgzmaHJPChXyBNeyPZ/x1S66UnRgtwAeBridf6fkXlCbu3yFkQqpzv9mETxCsajmDScuMgnDgwgy5cA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475575; 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=gy74LlRTmtwc1XLq4kdnjaS7OlYM0YhDmnWN/nXgpX8=; b=lQHy1p/D9PDBQISAp6PXxl3wOqbsQMbYPBTpVNe8k1F6SReKT5S6SDuRHnBFZq1EvxVhVacY6Xi1MHi8va3crtwvYJJHiHPGARWHhBD4QnX7jmqhhxySG+F/in7agIXxbdyJdaVJU28eCYpjksDTMZL6rFoRXIctEdqfhWju1RQ= 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 1724475575474643.525853085914; Fri, 23 Aug 2024 21:59:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shiqD-0008Bu-2h; Sat, 24 Aug 2024 00:57:33 -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 1shiqC-00088X-8F for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:32 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shiqA-0002Jv-LS for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:31 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-7ae3d7222d4so2032103a12.3 for ; Fri, 23 Aug 2024 21:57:30 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475449; x=1725080249; 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=gy74LlRTmtwc1XLq4kdnjaS7OlYM0YhDmnWN/nXgpX8=; b=Z0ew2y1VYKoO2fK1JoLhj7f91gY+eCheSN5JBcm3hd+5Zm9+udsYCr9+GWxaY4/YdS 7wkZbl/8wICAwU1p55q3syvvjahxNKmwITNovSPEox6b/NvVSoMaUn1vYDJ+2v8Wu2AN FQqS4haZ9tvrLzOgX5l9SJIKlE6s/4FoFbAF4aA2/CHlPt/JpC4+0AcIxfu9CwS6UZ2h KR0ED28JLXw7roDTi9EpF74eiRxLjHELWMcyOlXBjIKtgOV33QH9lTh5bKdoudYfwgvt F0xlRZYF5tTocgW2M7RGbphAUSUyq3gvHxpg5AsNGJ0vb0qKSUwRnVXeH5tNSnA1mess nqoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475449; x=1725080249; 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=gy74LlRTmtwc1XLq4kdnjaS7OlYM0YhDmnWN/nXgpX8=; b=CsGvcRHi9ViI3i0xoxdOPxzxunOZuvm775wg/mHx1SUqBF18SMQmXGyHmJLea3AOqd 3suO5dRXA0t1V7cSZu08P0m8mFK5pq3syh7wXfwv2QqnxkkX8GVoR5WHfX8V+47eK7Dx gESK4UMrRfyuZEXRWvkb4sI74BtEuoMWPvRtjSjWlLIpP4XVykVS63Vc2ZmItSnCurZ5 DegBN8uBWi/lxzAdjZFCcNkPuNb28uOY04t7mtSDdhxCxcvW6Txdi8A2RyYgOg/duVYV aZwqkM34Uf3Q/li4dgAhNCOz3ij02r2oKYaH/bWiUit6WDScq6qFV/0KDPUXDy1JLEAt CafA== X-Gm-Message-State: AOJu0Yw1PemOXKjUEPg6BHAKXWoeD2gYkFSpUtKhhXYDXsLXpvJwTyJx N3GEfAh0j6K+asOqDy/lXjR4uSMjd5Qc465O33R6aPw4SEmerSAQtnrxAwwd0Rw= X-Google-Smtp-Source: AGHT+IFyxPUYlHI3xS/YjJZDrRleUz7aEDBblDydhhul4BucuARAUME7BCy+/I4wkxJ0/4UwXnGhDg== X-Received: by 2002:a05:6a20:af1f:b0:1cc:9f25:5ae5 with SMTP id adf61e73a8af0-1cc9f25605fmr62380637.30.1724475448748; Fri, 23 Aug 2024 21:57:28 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 15/17] bsd-user: Implement 'get_mcontext' for RISC-V Date: Sat, 24 Aug 2024 14:56:33 +1000 Message-Id: <20240824045635.8978-16-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::532; envelope-from=itachis6234@gmail.com; helo=mail-pg1-x532.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: 1724475577659116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Added the 'get_mcontext' function to extract and populate the RISC-V machine context from the CPU state. This function is used to gather the current state of the general-purpose registers and store it in a 'target_mcontext_' structure. Signed-off-by: Mark Corbin Signed-off-by: Ajeet Singh Signed-off-by: Warner Losh Co-authored-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/riscv/signal.c | 53 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/bsd-user/riscv/signal.c b/bsd-user/riscv/signal.c index 2597fec2fd..072ad821d2 100644 --- a/bsd-user/riscv/signal.c +++ b/bsd-user/riscv/signal.c @@ -61,3 +61,56 @@ abi_long setup_sigframe_arch(CPURISCVState *env, abi_ulo= ng frame_addr, get_mcontext(env, mcp, flags); return 0; } + +/* + * Compare with get_mcontext() in riscv/riscv/machdep.c + * Assumes that the memory is locked if mcp points to user memory. + */ +abi_long get_mcontext(CPURISCVState *regs, target_mcontext_t *mcp, + int flags) +{ + + mcp->mc_gpregs.gp_t[0] =3D tswap64(regs->gpr[5]); + mcp->mc_gpregs.gp_t[1] =3D tswap64(regs->gpr[6]); + mcp->mc_gpregs.gp_t[2] =3D tswap64(regs->gpr[7]); + mcp->mc_gpregs.gp_t[3] =3D tswap64(regs->gpr[28]); + mcp->mc_gpregs.gp_t[4] =3D tswap64(regs->gpr[29]); + mcp->mc_gpregs.gp_t[5] =3D tswap64(regs->gpr[30]); + mcp->mc_gpregs.gp_t[6] =3D tswap64(regs->gpr[31]); + + mcp->mc_gpregs.gp_s[0] =3D tswap64(regs->gpr[8]); + mcp->mc_gpregs.gp_s[1] =3D tswap64(regs->gpr[9]); + mcp->mc_gpregs.gp_s[2] =3D tswap64(regs->gpr[18]); + mcp->mc_gpregs.gp_s[3] =3D tswap64(regs->gpr[19]); + mcp->mc_gpregs.gp_s[4] =3D tswap64(regs->gpr[20]); + mcp->mc_gpregs.gp_s[5] =3D tswap64(regs->gpr[21]); + mcp->mc_gpregs.gp_s[6] =3D tswap64(regs->gpr[22]); + mcp->mc_gpregs.gp_s[7] =3D tswap64(regs->gpr[23]); + mcp->mc_gpregs.gp_s[8] =3D tswap64(regs->gpr[24]); + mcp->mc_gpregs.gp_s[9] =3D tswap64(regs->gpr[25]); + mcp->mc_gpregs.gp_s[10] =3D tswap64(regs->gpr[26]); + mcp->mc_gpregs.gp_s[11] =3D tswap64(regs->gpr[27]); + + mcp->mc_gpregs.gp_a[0] =3D tswap64(regs->gpr[10]); + mcp->mc_gpregs.gp_a[1] =3D tswap64(regs->gpr[11]); + mcp->mc_gpregs.gp_a[2] =3D tswap64(regs->gpr[12]); + mcp->mc_gpregs.gp_a[3] =3D tswap64(regs->gpr[13]); + mcp->mc_gpregs.gp_a[4] =3D tswap64(regs->gpr[14]); + mcp->mc_gpregs.gp_a[5] =3D tswap64(regs->gpr[15]); + mcp->mc_gpregs.gp_a[6] =3D tswap64(regs->gpr[16]); + mcp->mc_gpregs.gp_a[7] =3D tswap64(regs->gpr[17]); + + if (flags & TARGET_MC_GET_CLEAR_RET) { + mcp->mc_gpregs.gp_a[0] =3D 0; /* a0 */ + mcp->mc_gpregs.gp_a[1] =3D 0; /* a1 */ + mcp->mc_gpregs.gp_t[0] =3D 0; /* clear syscall error */ + } + + mcp->mc_gpregs.gp_ra =3D tswap64(regs->gpr[1]); + mcp->mc_gpregs.gp_sp =3D tswap64(regs->gpr[2]); + mcp->mc_gpregs.gp_gp =3D tswap64(regs->gpr[3]); + mcp->mc_gpregs.gp_tp =3D tswap64(regs->gpr[4]); + mcp->mc_gpregs.gp_sepc =3D tswap64(regs->pc); + + return 0; +} --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475516; cv=none; d=zohomail.com; s=zohoarc; b=KwIf+hmRqJJfBWKbqsGyrJH6ED2ivwIRUSobD4WHKSISj9ClPxfrPrG65ZiQp0v8+nuNC5aDp6zl+9oZ+9AEODDPqyZcJnTbQSmXx36TaatH77F3iCpSLtup90dTIcx8dh7epvKRvLolFnnscsLh4igfRkuvc37h4Pk/x+eKZic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475516; 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=9FVE9uwE5SGNsSu9ob6L64WLDml4rbiZ/hyx7tyV/IQ=; b=jVo338FVFUmSxg2Rq6OKWNRtLGrk5a7nxWoPofkj+k9noRc0ug3mKW+9OuWLuNgfh00TkUiHn84PtAQSONSIDE2JC7es8g5490AFzVkLBTiGs8471JoH6s8m0SnnrZXeCwXdR6YSpg91NPBKvYq+s+W6FAsfHvE3TrFpJ4FhJWI= 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 1724475516785565.1171535627137; Fri, 23 Aug 2024 21:58:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shiqG-0008On-86; Sat, 24 Aug 2024 00:57:36 -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 1shiqE-0008Hc-Ew for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:34 -0400 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shiqC-0002K4-VB for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:34 -0400 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-26fde6117cfso2040668fac.1 for ; Fri, 23 Aug 2024 21:57:32 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475451; x=1725080251; 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=9FVE9uwE5SGNsSu9ob6L64WLDml4rbiZ/hyx7tyV/IQ=; b=HBveA9HR89dzAdmLNGGCih1TYzzp+ahXTDrxSQcRf0l6tZ/jdil/V20qC01RPYH2y0 dsrl712pCxozaFCK6uFIb2DXleWP6spNSr/wJTNQ0T6+0X2V048BiR1k/v5Awq7kTkej f3Zv97gtVXnzlW6WTAeQkrFG9qhOWBzzEbIlKfKmLkI6AIVAUCj9tPLq00K0LrYRov+u C11UrpDhY4tlTmE86Td1xJI7Pu87WNehJ8lUaDApFawLOAnhB0ZqkgziztCbVWFWwqi+ fGZ7i72TBUwLcsNNsll7pU9GTFShUYfXbp5828P5SgnwIBHxWGuyMihJAmKwn3Pwb3Vj UOrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475451; x=1725080251; 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=9FVE9uwE5SGNsSu9ob6L64WLDml4rbiZ/hyx7tyV/IQ=; b=wWQfwD7pIwx1AM+vp0PQP00U9wkfLBqxHVHQ1hSahbF46FiBZ+FZUf7SVtxNkfGr2y HSb2ThZs7n+u7KwYyLkBnpR3ekesNgU5XU6tMgzDoHCMqmf0EBIIuYGjnPlxXoPy/rkG 719oxxRCk9tvsTPtjR48tnVxvGo0d7hT623m3AdvKqaELisljlXmMFxS1QeGDJz0RiGP PSeExoFRdzsWcRBlAO+9EAjQodOMD0XdjuftOjrnZPtqFe537dFRReVdxJOmoObidpS5 2kMfR1KDFXO9wRzCAHi6cf3g0kAk1BoHTUqHr1dYnIOZmMFSAInkoA49F7Fm6k2v4l2B PdlQ== X-Gm-Message-State: AOJu0Yy7NqNP5q5iam1JeYVtSau8n8N8qYFR/PDdmr40wiTSLK3VxH9v FytStTRbqk+iIEgoNtwolGeOvlsubfEnqNDmYxnL3KQ+iYS6Kq+7j+BHlQjshhY= X-Google-Smtp-Source: AGHT+IFIdxD8Agzgja6YuScIQ4Xmtv6kFGqmjFMpf6Xctb07loH/sIG4TzDTeoVj0NfYJObE3AW+QA== X-Received: by 2002:a05:6870:c6a1:b0:260:3c34:bc60 with SMTP id 586e51a60fabf-273e64e6b16mr4887547fac.17.1724475451363; Fri, 23 Aug 2024 21:57:31 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 16/17] bsd-user: Implement set_mcontext and get_ucontext_sigreturn for RISCV Date: Sat, 24 Aug 2024 14:56:34 +1000 Message-Id: <20240824045635.8978-17-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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=2001:4860:4864:20::29; envelope-from=itachis6234@gmail.com; helo=mail-oa1-x29.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: 1724475517337116600 Content-Type: text/plain; charset="utf-8" From: Mark Corbin Added implementations for 'set_mcontext' and 'get_ucontext_sigreturn' functions for RISC-V architecture, Both functions ensure that the CPU state and user context are properly managed. Signed-off-by: Mark Corbin Signed-off-by: Warner Losh Signed-off-by: Ajeet Singh Co-authored-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/riscv/signal.c | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/bsd-user/riscv/signal.c b/bsd-user/riscv/signal.c index 072ad821d2..10c940cd49 100644 --- a/bsd-user/riscv/signal.c +++ b/bsd-user/riscv/signal.c @@ -114,3 +114,57 @@ abi_long get_mcontext(CPURISCVState *regs, target_mcon= text_t *mcp, =20 return 0; } + +/* Compare with set_mcontext() in riscv/riscv/exec_machdep.c */ +abi_long set_mcontext(CPURISCVState *regs, target_mcontext_t *mcp, + int srflag) +{ + + regs->gpr[5] =3D tswap64(mcp->mc_gpregs.gp_t[0]); + regs->gpr[6] =3D tswap64(mcp->mc_gpregs.gp_t[1]); + regs->gpr[7] =3D tswap64(mcp->mc_gpregs.gp_t[2]); + regs->gpr[28] =3D tswap64(mcp->mc_gpregs.gp_t[3]); + regs->gpr[29] =3D tswap64(mcp->mc_gpregs.gp_t[4]); + regs->gpr[30] =3D tswap64(mcp->mc_gpregs.gp_t[5]); + regs->gpr[31] =3D tswap64(mcp->mc_gpregs.gp_t[6]); + + regs->gpr[8] =3D tswap64(mcp->mc_gpregs.gp_s[0]); + regs->gpr[9] =3D tswap64(mcp->mc_gpregs.gp_s[1]); + regs->gpr[18] =3D tswap64(mcp->mc_gpregs.gp_s[2]); + regs->gpr[19] =3D tswap64(mcp->mc_gpregs.gp_s[3]); + regs->gpr[20] =3D tswap64(mcp->mc_gpregs.gp_s[4]); + regs->gpr[21] =3D tswap64(mcp->mc_gpregs.gp_s[5]); + regs->gpr[22] =3D tswap64(mcp->mc_gpregs.gp_s[6]); + regs->gpr[23] =3D tswap64(mcp->mc_gpregs.gp_s[7]); + regs->gpr[24] =3D tswap64(mcp->mc_gpregs.gp_s[8]); + regs->gpr[25] =3D tswap64(mcp->mc_gpregs.gp_s[9]); + regs->gpr[26] =3D tswap64(mcp->mc_gpregs.gp_s[10]); + regs->gpr[27] =3D tswap64(mcp->mc_gpregs.gp_s[11]); + + regs->gpr[10] =3D tswap64(mcp->mc_gpregs.gp_a[0]); + regs->gpr[11] =3D tswap64(mcp->mc_gpregs.gp_a[1]); + regs->gpr[12] =3D tswap64(mcp->mc_gpregs.gp_a[2]); + regs->gpr[13] =3D tswap64(mcp->mc_gpregs.gp_a[3]); + regs->gpr[14] =3D tswap64(mcp->mc_gpregs.gp_a[4]); + regs->gpr[15] =3D tswap64(mcp->mc_gpregs.gp_a[5]); + regs->gpr[16] =3D tswap64(mcp->mc_gpregs.gp_a[6]); + regs->gpr[17] =3D tswap64(mcp->mc_gpregs.gp_a[7]); + + + regs->gpr[1] =3D tswap64(mcp->mc_gpregs.gp_ra); + regs->gpr[2] =3D tswap64(mcp->mc_gpregs.gp_sp); + regs->gpr[3] =3D tswap64(mcp->mc_gpregs.gp_gp); + regs->gpr[4] =3D tswap64(mcp->mc_gpregs.gp_tp); + regs->pc =3D tswap64(mcp->mc_gpregs.gp_sepc); + + return 0; +} + +/* Compare with sys_sigreturn() in riscv/riscv/machdep.c */ +abi_long get_ucontext_sigreturn(CPURISCVState *regs, + abi_ulong target_sf, abi_ulong *target_uc) +{ + + *target_uc =3D target_sf; + return 0; +} --=20 2.34.1 From nobody Fri Oct 18 13:20:40 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=1724475559; cv=none; d=zohomail.com; s=zohoarc; b=GpxZ+WiZNlECP8rvBdbc0AYv5ZhzXVSDIlSae4KzmxcCATu3+k7UtPfU2cM595qlsw2lT8zeHyl4FBmRb8AXRd35C6z/5RtDAMa3tmEqMPMTkmxeZLc0ueu2w2lo87TeGr5SfcxrV2V5grenWMFArs+15YSxPQjxBhMVYAsyzdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724475559; 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=yaqkhcr8XXVjz3AUT5s3kLltD+ErMtVDTb6FVMqoohs=; b=Tp426GF6Zxw/KL/IlZYGMEp1XyFvOF7IjyMML5qfVNgu63S4gkfSfTcFz3XZcr38tu2vV0K0Z2R9ow9AA6JynKYjcK6vN47G4lw265+MlUrB2tQjoMe2FDkm5DAHzyTp+4AF5VntqwK6OjkhJ0OCOG0HXqGfBhH/i1cI+IiCoY0= 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 1724475559008570.0840858440731; Fri, 23 Aug 2024 21:59:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shiqI-00009T-Qb; Sat, 24 Aug 2024 00:57:38 -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 1shiqH-0008Vp-VJ for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:38 -0400 Received: from mail-oo1-xc35.google.com ([2607:f8b0:4864:20::c35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shiqG-0002KP-FU for qemu-devel@nongnu.org; Sat, 24 Aug 2024 00:57:37 -0400 Received: by mail-oo1-xc35.google.com with SMTP id 006d021491bc7-5d5e97b8adbso2179331eaf.1 for ; Fri, 23 Aug 2024 21:57:36 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143422ecedsm3805934b3a.25.2024.08.23.21.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 21:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724475454; x=1725080254; 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=yaqkhcr8XXVjz3AUT5s3kLltD+ErMtVDTb6FVMqoohs=; b=JZypJInpXhZXa2ZQBbBl960duu6640MH3fEtRa6uf5dOLGNf/713oTmjiiPWjQYVaY R6IPWsq367KINwXpSR5A1gbOxZu0kpvufuyksP/DacgCQfGxBBrIBXYCvZEoYuIVL9K3 A4Ba6qkrryZnrrBYfE1x73KRqasAWff7ucDKJqhLziQnTTyLNhOuztyVkstWNYyVv6hz 9QI9Qt3ZWPYcGghfo5DGJagj0Os9TK5uukK9sQQg/oTHRVRhcmRBoxDJ9bt3SMN0w9bC SrN3gKyyCyM6FzYdDQyneOoGrHfFZm7coAPitMwYS0XpbqQf6FZkAsbtMnktu4Tv1Vq0 RLUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724475454; x=1725080254; 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=yaqkhcr8XXVjz3AUT5s3kLltD+ErMtVDTb6FVMqoohs=; b=Hq83ViyC2aaTGzSsz+XiMqPTV5RH48Xwi7d3Vb1WHc+L9FwRg2wMkB3s108LWmhY8E FBmQ1/L1mFkTb+9HkRixRPu9YK+CK5Y9UQ+ejypTqtxFsNt69+Xw1FJcMk4oVroSC/7Z xVs8Id408nUgcxOoHFl7a+/hr3fgq25k7cRejrRaIuto5YAfYl/edOqShQIo514opnxg ntHZgqjUz0B/Xf06zdhaJz3uyMNuUHOGM644G7TZg5Q24EyJLPTfLAqR+OGWYXOWZA03 RWRFZ1apIWxmxL/S6zREKkDRC8OTs5MfO79WsW/+bagm8eFWyaMe4kWEnw8zp+3b/Han ct1w== X-Gm-Message-State: AOJu0Yz/Hj6ReePBcXXlbycH37nw+wBIXLSGgAV/s5Q21osU0XW0B1YH orjyMIfrN7bXgQiX6Eob+12uIZRllgcT957LE7EYyjV1XyD5vyjYpNEXOr0djLA= X-Google-Smtp-Source: AGHT+IE+35AgkpQlQG3YkgB02rLXb0ZrTFB62eAO5VINgkswUXRn08sERGZyVIXapb5b9ZyQlL40YQ== X-Received: by 2002:a05:6870:330d:b0:261:9fc:16b9 with SMTP id 586e51a60fabf-273e6620ea8mr5520395fac.33.1724475454028; Fri, 23 Aug 2024 21:57:34 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v3 17/17] bsd-user: Add RISC-V 64-bit Target Configuration and Debug XML Files Date: Sat, 24 Aug 2024 14:56:35 +1000 Message-Id: <20240824045635.8978-18-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240824045635.8978-1-itachis@FreeBSD.org> References: <20240824045635.8978-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::c35; envelope-from=itachis6234@gmail.com; helo=mail-oo1-xc35.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: 1724475561303116600 Content-Type: text/plain; charset="utf-8" From: Warner Losh Added configuration for RISC-V 64-bit target to the build system. Signed-off-by: Warner Losh Signed-off-by: Ajeet Singh Reviewed-by: Richard Henderson --- configs/targets/riscv64-bsd-user.mak | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 configs/targets/riscv64-bsd-user.mak diff --git a/configs/targets/riscv64-bsd-user.mak b/configs/targets/riscv64= -bsd-user.mak new file mode 100644 index 0000000000..191c2c483f --- /dev/null +++ b/configs/targets/riscv64-bsd-user.mak @@ -0,0 +1,4 @@ +TARGET_ARCH=3Driscv64 +TARGET_BASE_ARCH=3Driscv +TARGET_ABI_DIR=3Driscv +TARGET_XML_FILES=3D gdb-xml/riscv-64bit-cpu.xml gdb-xml/riscv-32bit-fpu.xm= l gdb-xml/riscv-64bit-fpu.xml gdb-xml/riscv-64bit-virtual.xml --=20 2.34.1