From nobody Sun Nov 24 07:47:21 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=1724838867; cv=none; d=zohomail.com; s=zohoarc; b=oCCPfjCT2gKFblsUxS3ENH23TE5/2sGt+z5XgRdjP5ITR4tBZACtvQYo5f/meVx081nUpIpY5o7GCfudJWYIsos7hNg7uaQ0Djyj7DObnsTroqDGooo667A5y4CshJvUlSwcEwbp7zBedXmM7/hsQu+ixcD9D7fiCCH1m/sDoak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838867; 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=WFvdTr8ItVOjTzK94rYNt0BNQVSxcF+DNvHDFPsSwO0=; b=MlLP9PJtjwiHAV72etoxlxxSdSh0yD5zf/RdNFypAk7ujC0NeCwqlF8uMAiE+yyPDVu0I6Y4rSxk7md7+txJDyuWndzN8DJmG3i7I8eJMkcCFyLejk4y5gm0ExsyW9mIKkxaFxR9ZUWDoC5DN4GMkAsOY4FTtHFmDGdAagk3GRk= 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 1724838867098900.4547736082704; Wed, 28 Aug 2024 02:54:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMU-00020i-QW; Wed, 28 Aug 2024 05:53: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 1sjFMM-0001vd-R0 for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:04 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMJ-0001nk-97 for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:02 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-7148912a1ebso1995089b3a.0 for ; Wed, 28 Aug 2024 02:52:57 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838776; x=1725443576; 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=WFvdTr8ItVOjTzK94rYNt0BNQVSxcF+DNvHDFPsSwO0=; b=dVDDhgjUPOWayHSa03rvAVcPseBIQB7KYhoRsxIsL7y0XmDOvPlFKxOEfE8teGR8DF 8ifpwdBznLjFzSVszrRQ4fxC05kr0ZBDFSORieGcO24LUCjqn7qWz8iN4rpuo+qhi6hH dIh/6aa26uisotXGiXNF8N1ZqQB/1tPsLgMp2zkbBudVL3bOlKam7uvJ3YSNJ4phOSPz spqYms/eMtg6cZOdnk0fpx5g9n1FOuYYDzsG2o49zReZRhfU8HftxgK0NylkQPwm1mFc N2XnLKeV3sMJeUtPgvqLSWx/7tv0/tdF+MlsL9tbYepdSDU7TEuPSPdMlImpvGf+ML4e ZFSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838776; x=1725443576; 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=WFvdTr8ItVOjTzK94rYNt0BNQVSxcF+DNvHDFPsSwO0=; b=Ote3I9lclI6W7SUo/6pwpUbIfyO52Lb7YPWVeinHV/nO0jhkaqvSJov0FkurGne+tn VErFwDHFzsKcE+KbipWtMK407CPN5+ISLAWzcvSjhD3aLMXWycsZylRhUCTNHUdFRzCm lpjCsFYPX4YdlPzIsmR9KJHY+jsnycDmElrt8CoqAKHens+6oZ+MlpcmivwD5eXqZvQN g4gW83MKyLX20UI5gtjtZsXyOLlbZk8flaglr8gvsYOqQaEzP4zrosS/tTigWBL9ORfk ALAvyqTzXCsHXZcW9m+tDcs+AjdIAxHPUfkHDRX8nWEzbjrtHneJ+dGkJk1roaye0amk LHAA== X-Gm-Message-State: AOJu0YxQHImoSxg2jfZl66jhDFmFjZ2X474pjlJ1ADu8qEAlKfFqLBl1 /s+ILLQsrETOCz1V/72s6D2bkqySJJvNlVMWJ2UnUtXdOWTBQYFqzSV0MlJA X-Google-Smtp-Source: AGHT+IHaEhCfXVcHUIE0CKEsGvpB4sBt5EkRPs8D/AUi7ZOKtswjyGsu4CINsETScm3hYeldvFD6jg== X-Received: by 2002:a05:6a00:84f:b0:714:2a0f:29e8 with SMTP id d2e1a72fcca58-715d10be868mr1650514b3a.10.1724838775922; Wed, 28 Aug 2024 02:52:55 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Jessica Clarke , Richard Henderson Subject: [PATCH v4 01/17] bsd-user: Implement RISC-V CPU initialization and main loop Date: Wed, 28 Aug 2024 19:52:27 +1000 Message-Id: <20240828095243.90491-2-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::42d; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x42d.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: 1724838867788116600 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 Sun Nov 24 07:47:21 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=1724838869; cv=none; d=zohomail.com; s=zohoarc; b=jXasB2+64C/ahO6aqF7Xfr+hW2f6CPSN6x/C8Fz7s8S6LMpxqTB0Zbo7lD5sTSsOwCpGqrvQAexVEiSMYybDKXTlmWNFjdoUOeGaT48Se0cacnIZTD7VJDuC1C8IrGiUHx+kb/6Rs/jSrKVl8A3vSpxDZQD++tD6uyJYjcpq2M0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838869; 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=Ea8ovjK2oeupU9Y/oJRULt03XSKHKyefcQa3mNq/zsw=; b=QWiUEN3qYQ4NQEi5rzX5MeJ58vWYZXmz9RF2Omcdj7NJDd+Yby/abgOPxtj2hfURW+PEHZOmktBwt0c2jtlPoCicHdmFVjeqD6ORxTKpjcgt4Gm0+FXHlNNYkGlZViJ8tdS09jzF6ivaxi7T+KhtNNJ1wQV1f3X2X9QMX3TXuT4= 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 1724838869840144.88704293841306; Wed, 28 Aug 2024 02:54:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMU-00020o-Qi; Wed, 28 Aug 2024 05:53: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 1sjFMM-0001vc-Qh for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:03 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMK-0001nq-Np for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:02 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-7142448aaf9so316332b3a.1 for ; Wed, 28 Aug 2024 02:53:00 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838779; x=1725443579; 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=Ea8ovjK2oeupU9Y/oJRULt03XSKHKyefcQa3mNq/zsw=; b=kMZ1rcs5PKdGVIpFyASkOPvxGcgLZYLXWqnVdpcMTxuu4RDT8bzurduTWTJjMRzOW+ CQo3bOMCRRTmFKClBwbgxgzzpMp5ySALry2uWoUAAcrmaPuaUy48KVE2sD45r8mrPCWz m5ckvUpSnRAwTWAzbhI1ol+q9B4OQTArJfDQV/Z1W4+ylNDWxmzDuIHe98AV8XztBnnI rCcdW9TO6wqrbZp92wly1DH7dhHGZWHjWUndwgccsto7IgGQn7WpaAyuH8tHWHYK2ZS4 dWo4Kv2sS7KzSsHEJnci1BG3FiXg1nXBVeMT5pRnpIuALQG4+WRPyb7D8rsrX9ymYQC5 HXmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838779; x=1725443579; 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=Ea8ovjK2oeupU9Y/oJRULt03XSKHKyefcQa3mNq/zsw=; b=f/JwWj6pHTWUnbRYDN2N+H878WVIGnwjdwd9E0XYgVXytP4ZKgLcwq5FvKlh3gTz6v sfe+cN1h71DecQdTIrrSBPYi0BFHudv1hWhW16ROlPI4TOoBa9mT7vCA1fcWGwJKnJBV 5aUKzcVhKzhWW+nvMylEiyKz9rIvwMLBoRHHmBxwz+1P/1f/eBAwNLrFT72A5W1WlFA4 gBQlyoJTPi7eshuK7pkpLd9scIEtNoeHPD79W56zdsy3JrJWj6BJI+AbalSfe2PnyRzf oMcZQMnkuXY4f+BSidIvc0EmE6KsAc5ieyqLAI3DH0xDimQIZNl9WjWs7SWn3O4BoVIK OC4Q== X-Gm-Message-State: AOJu0Yy4NRZBUmzTynYgdwgAetl8s/ImvlBwTaOlr8F9Ip8X23vCHAdt c3VpY+kkDTWEhE3D2xy3j7Nx20zgumGH0ZT9bJ5xO0jrn5dD5oYyY0SICzuI X-Google-Smtp-Source: AGHT+IH0AQRPFgL9dAcobhunXaLuMIt7QmPPoAGPCON3Qz4yZ9ygm79S59HGYez5pgCy5xmjTJHflA== X-Received: by 2002:a05:6a00:9196:b0:714:2371:7a02 with SMTP id d2e1a72fcca58-715d10be662mr2331015b3a.5.1724838778885; Wed, 28 Aug 2024 02:52:58 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Jessica Clarke , Kyle Evans , Richard Henderson Subject: [PATCH v4 02/17] bsd-user: Add RISC-V CPU execution loop and syscall handling Date: Wed, 28 Aug 2024 19:52:28 +1000 Message-Id: <20240828095243.90491-3-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::42c; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x42c.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: 1724838871841116600 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..ba589909e2 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];=20 + 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],=20 + env->gpr[xA1],=20 + env->gpr[xA2],=20 + env->gpr[xA3],=20 + env->gpr[xA4],=20 + env->gpr[xA5],=20 + env->gpr[xA6],=20 + env->gpr[xA7],=20 + 0); + } else { + ret =3D do_freebsd_syscall(env, + syscall_num, + env->gpr[xA0],=20 + env->gpr[xA1],=20 + env->gpr[xA2],=20 + env->gpr[xA3],=20 + env->gpr[xA4],=20 + env->gpr[xA5],=20 + env->gpr[xA6],=20 + env->gpr[xA7] =20 + ); + } + + /* + * Compare to cpu_set_syscall_retval() in + * riscv/riscv/vm_machdep.c + */ + if (ret >=3D 0) { + env->gpr[xA0] =3D ret;=20 + env->gpr[xT0] =3D 0; =20 + } else if (ret =3D=3D -TARGET_ERESTART) { + env->pc -=3D TARGET_INSN_SIZE; + } else if (ret !=3D -TARGET_EJUSTRETURN) { + env->gpr[xA0] =3D -ret;=20 + env->gpr[xT0] =3D 1; =20 + } + 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 Sun Nov 24 07:47:21 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=1724839067; cv=none; d=zohomail.com; s=zohoarc; b=WB/sQr61drzvqEvbM1G3sHkn4LtEC7448vXUcPKBAj8c504BUsrxL1gHFr6C4im/fXMxvKcYWRCJ+JZX8+SGNircYQ7wyEAIIv3t7lztuBgOBW4YveZ4mCQl4IBN+rULT9mvK1Yp1ls24cBBz8mdbfyXSomLMd6TwupMVqFfaL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724839067; 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=T71bAWZ5le2Naj8DZ0ljjvL8S+u/egKAPUIr3/tluJ8=; b=jsGv2GFpSVhlwnMXwBm5THJUMMhtenmupy6Yu4tCjVr3NVULdeKVw0fusLe8Es59aJ3n9tR/q9XDgtSUTjJL+mAvoYx/bpW2o/S40koTZ/Qedt2aqLVsrfhsTHya89bPC0y2niXTwOtFoPlPjnajU70IJ3/aCc/xRVRizkMJYfY= 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 1724839067697533.0393615841422; Wed, 28 Aug 2024 02:57:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMZ-0002Gl-4a; Wed, 28 Aug 2024 05:53: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 1sjFMQ-0001wv-Q7 for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:07 -0400 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMN-0001o9-5u for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:05 -0400 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-5dcd8403656so3324196eaf.1 for ; Wed, 28 Aug 2024 02:53:02 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838781; x=1725443581; 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=T71bAWZ5le2Naj8DZ0ljjvL8S+u/egKAPUIr3/tluJ8=; b=NZTs+2EUVNqwBJ1RC8t1MOPCEz3GYbOeqQQvc4UKtHWLksPZjHgh6m9A6Dz8btDyYX lhT3joER4YcN8tS3niwM3Lj433QpOjrkZBVpOCB67cXBvCncy5B6P4LzVhf6z5aBjwSI 9HDOYiQl7TGd+0c22BDknHZYjkzsWIrOEFtQ3reK4LNntirpjkejM7Fmoi3QKljsV989 wDAoT9A8p67VX5/GOKO0u85i2CCCI4rMAEESlIYMIfd6AOQxRIWHw44kCtnWqWhBwISM UZKR0xXX8EvUrbYf8cRTmiwKvI74hHP1Pr/+Gf22dgBsJ8Q7n6UKjQECn1XcZLeylSwN XvOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838781; x=1725443581; 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=T71bAWZ5le2Naj8DZ0ljjvL8S+u/egKAPUIr3/tluJ8=; b=C/lIhaJZAo5ww+jZ8P2/PML+ILKk63wCKfaau+6stJrAZTU34gD8T8bSBIuIZ+Nvx4 CH/UyxdAxRyhC4IOKXsT1r/2z6GUy5Bro/gFJlpi/kiUeG8wh5LDGBlpBtOGtaOQmDyx be6DvF967YbVzV7yJsarUbCwDVqtYlLVG1O++9kTC7tR5pfLnw8cNeOBdEJzDWK360Tt hs/L2Yvx976YOwMdj/RDfUHPUJmp9mcb9FXxp+RjBi3BoUdoK73jp92e3CcTx3XDS/aO j71Cr08ZHKMLbYhN+Q4cE0lY/zSEOZPP7AmlqNVCxTrvDePg3V4gsZIfB/3jLdTL/Jke rZTw== X-Gm-Message-State: AOJu0Yya+7g2jvJH9ha+NJpJc4zGB71GbMU+FHoUyky00mxHfmd2roaL wvMyrCSqu5IvvFiKdyOBO7oNpQsQOH529WFGdW0CqFAIHVosHf6aROvDwWef X-Google-Smtp-Source: AGHT+IH4OD8zAfPcwO53guP+mNee6d6qN8ggHvB5WTMqp92jh4ZTGGGSlERXbhhlQrsS0DBfHwEUzQ== X-Received: by 2002:a05:6358:109:b0:1ac:f2a5:e79e with SMTP id e5c5f4694b2df-1b5c215c92bmr1934193155d.16.1724838781428; Wed, 28 Aug 2024 02:53:01 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 03/17] bsd-user: Implement RISC-V CPU register cloning and reset functions Date: Wed, 28 Aug 2024 19:52:29 +1000 Message-Id: <20240828095243.90491-4-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::c34; envelope-from=itachis6234@gmail.com; helo=mail-oo1-xc34.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: 1724839068264116600 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 ba589909e2..b1575aab20 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;=20 + env->gpr[xT0] =3D 0;=20 +} + +static inline void target_cpu_reset(CPUArchState *env) +{ +} + #endif /* TARGET_ARCH_CPU_H */ --=20 2.34.1 From nobody Sun Nov 24 07:47:21 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=1724839018; cv=none; d=zohomail.com; s=zohoarc; b=i5vGxu82qUacQw2R+K5F6HRqobrByEUs0JazW7hqafYBFu+8Ki4lL6Yrkt7Lx5hdUdTMvqcOqNi1Wc1yPfF/jDVZYf3idd3UsDVyhzNc2yCNvXjkQJq2cwdoPfRD7SS+REUXSPp88B4zzm8VsGIkyhHiaW8RBKu6XjUuc6XYde8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724839018; 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=I6iq/inebMMvzbCl6reDAVTeAptuXE2GZZlesJt/XLMVYM8k5GdvsbCvXyKumaeLMX+SZmofhKT99v9Rx6CgDGxY/zNKpMBaXrGWkqN70y/TIeN3b4sORGjJNZQTQgJOSyxbianmKHoFB93g9xWKECEYfG+ZQOHoFCdvMU27Z7c= 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 1724839018220649.8183659379057; Wed, 28 Aug 2024 02:56:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMV-00023V-G9; Wed, 28 Aug 2024 05:53:11 -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 1sjFMS-0001xp-Dl for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:09 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMQ-0001oN-IU for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:08 -0400 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-656d8b346d2so3921405a12.2 for ; Wed, 28 Aug 2024 02:53:05 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838784; x=1725443584; 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=nipOaqizqXm11mnpxNboXbor4g8QTL2gb8cvF+QoxZvzpbylFWx12eDVx5+byx3OMx QWMYhl8/klIsYLwTqJDvdfmVvA0CayeB6ZWH4y+M6GXGeBw+vD0K0ZBVSlMwXjXR4Qxw hH4/YrEDvv0RIeoI5LM8j2KfqHcdrh8EnUr1w9WnuhluXlP7Qf0lIF/s9ozEDKkox3Y+ TfHpTuirXU/ziOuZ7X4Y9Ss7mLIIpn1CEuz74DjundQqwxYNytidhuJlxSBHxMgnfhDa 9po71w1GeK8SWmHkIqFiwFYO+MrMaI8pPlEuXHrTIj9pzvA73zN1+dd+LJA8T47EYIb7 2zXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838784; x=1725443584; 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=WjlIEREJnSPNQGzGnCC1xUe2ia3gpe1+ccxgXcfaun2+L43m1ZAHzfh7fDAzCqHOHD He39WpFMN2oMy3YC6b/BlzXQvVkwJEmlv9hzW5F2wpJj1S/lEn4uyPbu7eCASs0H7oEH O7bslyWR5Ps9XI8An6JvaiEru5FQM4br6n3AlfY7GipVTD/nzkeour5YSEtW7Vos4SE3 0gBp5GcSO545xbU8qQ50psKHpblNeCBPxe71vxr0K1xU2dLD1lZUHaQYbzzmqnHn/TeR X/viuM0yZtIsl/d3nYFkSV+JO3Ns42Do4M+UcjG1uh0bEpx0ru8Wc+dJ2IfGl+ZnqsCC FgKw== X-Gm-Message-State: AOJu0YxjZ63KlWSjCgSZlsB6pqB4rM2tFwAuaGiXLpNySq/G9CZjIZ7a JJ0eMV0aZgvDVKJSybuwPo+me+ghYe7YH+MQ6fPFS1RSooGOrHgvooHZup8z X-Google-Smtp-Source: AGHT+IHE7ZCAZdcCsTYcgpVVGoE19yB+ZVfV1AbPLA61aNJH4aSfN3AI0BltMdJB5IENWucm7JzCeQ== X-Received: by 2002:a05:6a21:1584:b0:1ca:cbf5:5b0 with SMTP id adf61e73a8af0-1cc8b459221mr15988881637.21.1724838783884; Wed, 28 Aug 2024 02:53:03 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 04/17] bsd-user: Implement RISC-V TLS register setup Date: Wed, 28 Aug 2024 19:52:30 +1000 Message-Id: <20240828095243.90491-5-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::536; envelope-from=itachis6234@gmail.com; helo=mail-pg1-x536.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: 1724839020150116600 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 Sun Nov 24 07:47:21 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=1724838869; cv=none; d=zohomail.com; s=zohoarc; b=hjCevrd9g/p/UJU+pXFLMVtPACzz3GyxD8HIXc1mz0Pp8xmRmsbZmJ/eBKuNDQF12Fxsd0WhmFmaqGpb4p35ywVko2FvvPb6VHlL3awyr9yZtdYXltHfiU+AeEtuBttRHBkoy8zV+14SxBkZjHuiBRHaEvSlWgQt032rUOSNdSI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838869; 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=Sgd3mE+UGLCFBg9awJL/ILrbbacZQq9ZW/pP96sReu8SZZeKZMRju2sD+DfRKrqkmtyH+0v/a9PzQXLHGDEg4AG8o6jEtqXqiRUkSs/wacuE3stKLT1jVCrVLMwBGNVMSDGhgOo0TJZhuEEyngL2/seJVB/yi7dHbSRFTeQTqmM= 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 1724838869824227.34969031638536; Wed, 28 Aug 2024 02:54:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMW-000260-4c; Wed, 28 Aug 2024 05:53:12 -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 1sjFMT-0001zc-VN for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:10 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMS-0001od-8r for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:09 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-7142e002aceso5313711b3a.2 for ; Wed, 28 Aug 2024 02:53:07 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838787; x=1725443587; 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=d+LpRhdoODUr6dH0yRiIbYS8+U9RKvwf2A2NaNgftxSE6CXDf3jym46GZyJedfjF08 vx+wksINRpT4NHU4cjMTJkjr7+u4fdTuDxJBW492tqb6BLcDwkZMXalDgRDmRU1XaAet uD4drloJ2Zsh3ooYCkaSp6yCGZuyAj/dTs0QyHJaVk97DuqZ9PHwhouc2vpek5tbPKXQ Ijg4vK0ZexkwViGAXVXDqF3yYnjNLM9SJKWhGhJ//lwqmdjw76WuOvs6VVaEcF+j7WlX jBX/xwwvs/sTj8X7EMyoDaZIBkhzUDYlzor+swMVp/nZG4EGPcta1vP08Esj4yRg2JPU MLrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838787; x=1725443587; 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=Ut2LxMqoSZzw6F6ERJtF0uOWkjc82MziHXVK++JzpS3puHzARwRcW9s+GOplN1ZQnT efLOIlEXuFTArs+30KyWwKgLH0lM/+mdca9VuQ7eN5n6Hp4YiF5KRfqEPedEY+NAHtkD mg7gWwG3MRX9DtiexIYdPNTTTBHuTOls35cUPtajiFRCzXgf7UZ2SSViPVt1fnUaDA/g z/SaEFxKgooe/tnnGEIpyF/KCdrqWnsAtqiD+q9W2CCpyRDwGARX2lc5Ndh2OfJa4Ris CuenbRVridD4PBmbqMHV4xef3ZIJf6hAvrNlYG50PS4vvslcIkwTkl13DVUFUND3r7H9 sGdg== X-Gm-Message-State: AOJu0YyBc2kSucGU2CRRu7+1jUUhtltqM/oDkSuz/IxwjCv2qySoFWCm jhIDNS1nB/buG28u5BYio9i98WYnLTa6baxNaFm/CfnDynsvp0rcex40e/hP X-Google-Smtp-Source: AGHT+IEskS5wugh01RHkDYqs6hkB0X0lB4wI8izTQKz/6rOfKnUIixQVtVDCmaXNk63iCJHipMLqsA== X-Received: by 2002:a05:6a00:194d:b0:706:6c38:31f3 with SMTP id d2e1a72fcca58-715d10c19fdmr1547352b3a.8.1724838786539; Wed, 28 Aug 2024 02:53:06 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Kyle Evans , Richard Henderson Subject: [PATCH v4 05/17] bsd-user: Add RISC-V ELF definitions and hardware capability detection Date: Wed, 28 Aug 2024 19:52:31 +1000 Message-Id: <20240828095243.90491-6-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-1-itachis@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1724838871807116600 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 Sun Nov 24 07:47:21 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=1724839031; cv=none; d=zohomail.com; s=zohoarc; b=fnSuKws1sML2HW0CNtRBBnPhPbl7QCD3QuIHpg15ybTvlNItBz2TGbd3WHoc84zv4OBq612mhtTdKRi0u7SIHOt4Ws1EEHcwEXN0hSik/xGXavhMUDhTFw0gnTVR0aAQ0EhJQkfxRL374IeeNC1UMlmRV48EM2mHG4EfB10yDM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724839031; 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=iZljydcM+1vcUMrV9tFHRF3s8Jidu3kl3tpp/5SNkNzeJm5zSXDL7oKF4uadwRMrNEtaUx9szS21gSomeeUDmAIk2TjbqAxnTHsFqEkSOB+8tt3JcQniRopyjHC/syWUUBjjiYMwI1bpW9H+Z8FyJ6sokOnacHvLPO4fNLQxpjE= 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 1724839031321303.02413723292136; Wed, 28 Aug 2024 02:57:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMZ-0002Hv-6i; Wed, 28 Aug 2024 05:53: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 1sjFMW-00028Q-NG for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:12 -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 1sjFMU-0001oq-NQ for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:12 -0400 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-5dc93fa5639so4846348eaf.1 for ; Wed, 28 Aug 2024 02:53:10 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838789; x=1725443589; 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=HxqKT21iD3bknQ5yTO/MUvJ4Yv7obeAaz+wAUBsPz7bO8B4vZQnkEf+wB69st4PR9o bNbEgjOQG0vWQDFTC2U28dpYAV9aAzxObBelIoCup9xFNTZ/Rw2EHGBo0I7kOL6tw1CS UvRFaU0cscoEoKaZVkzJYyiI5R5l/9k+4h1MnB4lmlY/N+eN9q4FOhQD50t7r62pIn4s WsLqwkbwsIusOIrGS0P5xO+5L90ng/mEhYMP8xKHNDY3gcfY0LgSsHKiOVkEHcENH8b/ Q39j1gG/qI/VHtDITbLyim5nBoPzgegGY4RdfFSwvz3BccP7BGLJTFSuJqeM7NBNmSOk nkvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838789; x=1725443589; 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=ee4O0s1q1Cpb7TVWOup5pd8qV1VL1W8+OOVgoJdng9MVv3nTuQ6U2J2FQs/NLlJdDy eTkaDnOKlEh92QOHEn3hgBhwwkHQ4LsVA5r7Z7Ni92o1Ut6db7Q7IeYWxUN8VxAm6J0x oxOKNfiPKd0UI5Y0E7cGKl+BaNmI+KJJHLgpe8l2hZGdTX0fW8bLklXB6kxjoCnhM8L/ coCR6MGmQvyRWtcfTn0r8lEgxbJxfdnShvu6gCjV2TZyP4nqMLCnzYEUWEvp7LHhPhJg dU/j/o+QRBl2YXqnzQRYrrJLQ9RQ/l29BQhIalhaqfn8wf3MH7sa3ei7wC+vx/RfGGiv zjhw== X-Gm-Message-State: AOJu0Yz6s/1z+8+LQWgk71+7qb8FRxzzlz9SfxKcaL6hU1xdkV/0qXm7 FJBp/WhJjj2SfUAjP0384UOsGzf77YdL0e+oVg84PaSnNFJNmfxury2a3m5h X-Google-Smtp-Source: AGHT+IFeVAmuBlc8Lm+LPWhRzOKqi02uvzhAItRjpNJ2Bqtt8oZbOHVyOTNv0sSaDQLV3Qdr1zFb2A== X-Received: by 2002:a05:6358:57a3:b0:1ac:f109:e248 with SMTP id e5c5f4694b2df-1b5c3a458a8mr1878612555d.2.1724838789022; Wed, 28 Aug 2024 02:53:09 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 06/17] bsd-user: Define RISC-V register structures and register copying Date: Wed, 28 Aug 2024 19:52:32 +1000 Message-Id: <20240828095243.90491-7-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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: 1724839032267116600 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 Sun Nov 24 07:47:21 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=1724839018; cv=none; d=zohomail.com; s=zohoarc; b=BAybzgxLDkVB1ddvyO4QDq33sQ55LdWF/GVIfUm5Lb+ummZ2aFJOAD+D9G1Jlnr8copZ26y2CLSRF+2p8C8tNheK53dr3FuxyW1qggttVVfELrUnqGykw6SIaMDHGBnW3nmHQb6R7lKv9PXLpRjMOiwF6KzGuHW4FkgCJhA7M3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724839018; 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=N3ufDgq5HJJpd7UC3ketlijFW/U6So3rRkEIA9Y4WvH14PAATXX/XSAEF5PP2BttpniZSeH2aLFM/Jha0aAWsGGlUOzQJ5MoQP6F3JzEo+XnGDBSxrhm/rdRuqzkXMxQ053g9zgCIbiSim9aZz4Sio1X7f0RZA4OvLVd2fAYA+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 1724839018222437.4671699905747; Wed, 28 Aug 2024 02:56:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMa-0002OE-Dt; Wed, 28 Aug 2024 05:53:16 -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 1sjFMY-0002HJ-Rx for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:14 -0400 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMX-0001p3-1E for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:14 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-2704d461058so4490188fac.0 for ; Wed, 28 Aug 2024 02:53:12 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838791; x=1725443591; 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=K7FX7Gt2n7Yao//0xJXu/zTrGHvJswwg3G+JgBNpN1F8S3zh/Iwefyf4xAtYFA7dpe 4GAx1wWy0ltm4Lmq15VYpasbRA3pj3AaMVqPpfXxYypWYO46jT4zZPW/B+LGeoU7+kjD pzErsSgsxtw4HjSJF79t7BYL0E6/din7FAnWrOAfmICOgdgMnWXV2To9X1QoZ8Q7xqWn upKKxio2ZJoHiIRu2XvGLDJtmPmTD6wF5ZkNHB48GOEF9igcn1Lz7j+fPqOFxfdD8cGh CZwosXKLp7+ubKUhhQX67J14W73FJ+aDL0lbv0DPYI1y2PgIEiTVSp6rkE+exlVXV3aB Q41w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838791; x=1725443591; 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=XpF02S9W4fwP9UmLynjf6OFBDICx9AcPPk0tXBsLo7hPgpOqkbW69F6966kvxpASav yrJjqEwnyHpYED+qz77LI3IFNmmUk3wF2PYwbdS0EeDMBgI0U7scVDsajE3A1p788GLN oq2xN4HdBisket7IS+h0UmS0/5osgtOXfpIeKDBESrEWix7zkHc07g/XD1m+gA/HV3v4 Nkjrky0CK+llKZzfdVdAyuYXqbSV9roiW7aVtaSOcBJx0tBEhPuv/eE7+UylO3UR5UaG OfiK7SdOfknUEhbSEtdZ2c3ml1POyysOHoop3WV4RfEUnR3wJZHKFNnHlJ07P7hKEIFl Xq4w== X-Gm-Message-State: AOJu0Yx19l4OxwcYLiGMzZ44nh0BHOyaP/Pnw2JS2+UZAiuDn40XV7L2 EGxPZexfySJbo6P0ph6bFO3XvjCgS9YgQyqL2sbCYXf/tCr+QwN71rgi9Ylf X-Google-Smtp-Source: AGHT+IEBYdz0kwr9sC/X0GP0Yi1PlyHTXTgcSqIleC5qpHghXH4OkPjles+onTsrHFn601Q/h5mmTQ== X-Received: by 2002:a05:6870:8286:b0:270:130f:cee0 with SMTP id 586e51a60fabf-273e661aeadmr17559877fac.39.1724838791525; Wed, 28 Aug 2024 02:53:11 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 07/17] bsd-user: Add RISC-V signal trampoline setup function Date: Wed, 28 Aug 2024 19:52:33 +1000 Message-Id: <20240828095243.90491-8-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::36; envelope-from=itachis6234@gmail.com; helo=mail-oa1-x36.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: 1724839020130116600 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 Sun Nov 24 07:47:21 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=1724838865; cv=none; d=zohomail.com; s=zohoarc; b=BHGAPmJV3xcMYOuzvDtzMWhTSZ6z0HnNl5CJHNlwM7UoMt4h9gBFvKQmxOYfhS0Fk/RRNgZoQ1UfX432KmzSNo4ucSxcnEuC46fr6N2K4D9KA/1UQQ6zW4vQHogyPiLmuFJFOJKdzuerkIT82Ikxa7d2LNVjfUx98nU2r0bQ7p8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838865; 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=L/DnGcvKE71UIz1m9IcfpSTRIihM0xNKNYQKo1j4sWiKHG5WT+vVJKNkEkWc1hZBGIkpzFXCDVG8lYsUYFDV3GzLdzTO6tP6t+yzcauCAR0J84GyZcOfudkvmyovlfjfztdfPm62NlOoH8YQcNUB3TLhxG6Luc+SBsHVAsY1VAs= 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 1724838865339298.069956350605; Wed, 28 Aug 2024 02:54:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMc-0002YB-VF; Wed, 28 Aug 2024 05:53:18 -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 1sjFMb-0002TZ-Pc for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:17 -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 1sjFMZ-0001pR-VV for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:17 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-714263cb074so4582625b3a.1 for ; Wed, 28 Aug 2024 02:53:15 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838794; x=1725443594; 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=llhVpMTwyi5fIKhoIWso8dS0jOShUQiF1/J6k/Qc4zRWdlrrEfRiZI6oY8UZfnI6Kp qYkIUSIMwFoprj0OrJGkR0ORgVxMk4b0MWx8zrWsQKw8ioYPCp3ZAiESy1FTWnFhG5QW aRNl6WhPRlh7WktJWTqDL2jh8Z7uVV7ljWwN2B4j++lxRPJbsGSfSKdQ69yNaDu1hGWU ia5GBxxcdMmqjoTH1LvqM4AEEYORvWOREbg/5HEalRFz1BwnOdObSo2GCY94EwwgwxSF FQK97Zl0sfuih6SKx/ECrxMSW69pJz4Ut7gXUQMlEiOGJQ2C5hnnnj8Cqgsy76QkbtEy YAjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838794; x=1725443594; 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=l3BJp5FJxLQAz10EyoPrpkO0i85rt/K08GJvxG9qx5tFTepkSDgViLJ0MpoMvb1MDM LraCtSpVcg74IaFFL+K7bOcQPWRoQgUOKRPgOY6W3zC1ki8wm6/qu7+AFShiaKWLZXs1 8WogBaup1bxNG0e79YWqaaqUFIbSI+JwPlc3jV3aNPcv4ABXBLoS2yXehXQ3zuO7JyfA 6TJa3rtU003/vlhNZhMUcWY6NjgfO0KDSNKMIH+JD6DZRJiY6mNkB80SCx8OOo6LChaC 2ea0ts6XoENrzuHR80g29Td//WBH3SHtTXWTthsEv8sIQAXXMRpVqrlDShfvwkBGfKYz 3Ejw== X-Gm-Message-State: AOJu0YzXo9NSigzG6G4M3fi2MGefm+AZwIQKdspXwo5PZ4lzidNE6cLu 4ooqsIYiiywcrG82LZu+XrjexiwXFZR1asffH4IHux1fmsw/fiTnoUtoVf16 X-Google-Smtp-Source: AGHT+IFVjTkPABRcen2vD9SFbYT8xn3QHxTxCXUnNlNVkvIR0zaWzJ9pAJPb6lkYsyT1L4glcIi9jg== X-Received: by 2002:a05:6a00:841:b0:70d:7547:90f7 with SMTP id d2e1a72fcca58-71445d4eec6mr17327240b3a.12.1724838794031; Wed, 28 Aug 2024 02:53:14 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 08/17] bsd-user: Implement RISC-V sysarch system call emulation Date: Wed, 28 Aug 2024 19:52:34 +1000 Message-Id: <20240828095243.90491-9-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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: 1724838867770116600 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 Sun Nov 24 07:47:21 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=1724838869; cv=none; d=zohomail.com; s=zohoarc; b=e+pPvQ0R3xxUwrM+cXEpWhfXURyK5ghE42TtwPO4qxJQWu/3W9A+qZYcJi6xMnV9VUNao4IrC+PT2Fw+jTqrui9Q1WvjghvevhvBfhhN9pfl9fkL3l3ElvwS5NelM8sLAyGqkB/ZjhbHhnk10H14zrjn3yuPoxlZSdzFp9U31Ms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838869; 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=aPq6C7QoOX3nfkGLM/R7pqXc/B3Uq/1K4kEgtZxBVyo=; b=Mpft5Ic/KJGRcchuhcV1tmnoRW5+sMduDokO/0zMmCetujIwGDIEp7bVog/X8/YJ1JY6PHv//ycapXDmsYuM81TOaMPOsK8IDTYWTvEKoqGBIHXy6QGTSqyaD+OkJe68ZwO1wpNpE05XU10kYrKl06Kje2+rseBxSkaS9OCT/s8= 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 1724838869268838.3301767329655; Wed, 28 Aug 2024 02:54:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMh-0002qu-GX; Wed, 28 Aug 2024 05:53:23 -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 1sjFMg-0002ls-9l for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:22 -0400 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMe-0001pl-72 for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:22 -0400 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3db1e4219f8so1039622b6e.3 for ; Wed, 28 Aug 2024 02:53:19 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838799; x=1725443599; 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=aPq6C7QoOX3nfkGLM/R7pqXc/B3Uq/1K4kEgtZxBVyo=; b=e7osteoyyAX4ITPQ2oaW1GxPJiyjPRBDKz3qPpl3BjD9wBLuTrDNTdG3Slf42WhIPP HkT9cUqmflAZD2bhhxkRae4WRJjFlRlMWvLxuJob8KAfFD09mtU+S4ooSQ3vgq4z6zNK DhBgegADeYOmfhDJj/UP1NR9i7SNHLQ++p6wWV7yjleooBONE64EJBE+VTWr3rbGf3ue 0yJ99NBcaOKyFfgU6eLrettEMCEamSXXr+rNr70/GOwR51Y8LxT7I65b3nYFSRIIrBOd ps1DZQdUuU5BdBPBQGxAThu0g9hiUtJYI21BL7bEW5gUSeOPJWfEe8PmHUahZ13K68Bg mIcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838799; x=1725443599; 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=aPq6C7QoOX3nfkGLM/R7pqXc/B3Uq/1K4kEgtZxBVyo=; b=c+PhG7FHhu2jcaEKpF6oD3vv+N+8KYt0nNQPpsLbt5kUIGsrqlZK5s5AyO0emGs5Iw DGPgoay29u0x/jvffeXlDT2n7Q4mi/bRYSjI9xerDVsGsgCzlmIgaRQfqpCiwqtnWvb2 US1O7TV97PB2475+fuqwys6Iy2pnzaBNxrOEjjp4sPcMOdMFqwTBDy5IwVKuRaBEBgQS +TZbKWhOhtlej9nqbg4PY4ucqaPSj944q2rYqiS6/6e/+35GFCbdW5j4MO71ZCQK5wLn yL/ak+IUJ7eEw+AMDCSzXWZZTEy+xYouRcA63E7pAIvDoGycN8A+AiFb2rhbLuOdthIl 1X0A== X-Gm-Message-State: AOJu0YxqUkB6URzbblsrtnVCgkF5m9qys5b5ZJLO8il0ix1n6tF/VQUX +cIAYl4BLqm0OKxkGHSKGGDXHzor9oQIzDnx9tuC60wSdi/hkRtbInmvb9Bt X-Google-Smtp-Source: AGHT+IHH5SQPjDOWMAEw23Z2mhEvqhRxVbVyav43MXN79zxxTrU20Yqgu7eJ8BdHmkvBDVbmiBnuVw== X-Received: by 2002:a05:6871:3297:b0:261:e19:458d with SMTP id 586e51a60fabf-273e646d7b8mr17435410fac.4.1724838798470; Wed, 28 Aug 2024 02:53:18 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Jessica Clarke , Kyle Evans , Richard Henderson Subject: [PATCH v4 09/17] bsd-user: Add RISC-V thread setup and initialization support Date: Wed, 28 Aug 2024 19:52:35 +1000 Message-Id: <20240828095243.90491-10-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::234; envelope-from=itachis6234@gmail.com; helo=mail-oi1-x234.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: 1724838869783116600 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 Sun Nov 24 07:47:21 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=1724838897; cv=none; d=zohomail.com; s=zohoarc; b=MyLUK9EX/sTjay5aje3vnOhP4jfluNX/C+qt8MhQztjicRTHmj3033xxdkHbX0lxEYf6b2HBPHVUbHnr3RcMadAngQnyCUIViE110NYY39levKxAqsjq5vLyvezxf5SKLmHL/aUgZzoSEjG5ApAN1qbX9sd0psQhTdmOGCk/hJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838897; 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=TxMMMUnppBrGFsfwrBSJIh0qjyX/R1o79TzrnXWuCpQwzaqvwEL+bzoi6l70xzenlJslssLw3Mf+lRAk2MJoQvnkcDlpvszd7qa1hlgDdo/DIjHWrNGdRZu6Lnjej1a001K8cE3piAMStsaxnsW322BGVVHB/8/tAHfwbef4R44= 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 1724838897654439.8800274245194; Wed, 28 Aug 2024 02:54:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMk-00031B-0L; Wed, 28 Aug 2024 05:53: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 1sjFMi-0002vB-Hp for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:24 -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 1sjFMg-0001pq-OW for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:24 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-7141feed424so5323179b3a.2 for ; Wed, 28 Aug 2024 02:53:22 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838801; x=1725443601; 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=d5TRUFbK+IU+gqx8cVYTHPOY/XI3eIzSs72IOcV2qv9vz2ywiL9VwltHaDOeTgmfbJ Wb9ilrtJudhA4I0H3HgDSzInwbpNGj70AyadD0ybWOVDxQ+VzFSy5frxXUV8R+eBo7tY Vm3yNsKdOOwxxLaB3jIRSg+9/3RN3ByrJdtrEymcQ2by3KsPaJxyGWFihbqi0sqWD3YF t4MUMqmkZxC/P28rcZNKHLKLuWgpfOn7T0TzGic5NP0MPSo6dGJMlUpYT++16Gg6Cp1A YtSp+zlDLz8KiGllfDePZCbpD7/1NJwy/H7yjyetKTVb9MYFSo2F9aEiwzpozwRYIObb z3lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838801; x=1725443601; 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=ktysV9iGby3LMY6cIAH6dQhPbONmMuiCVAjLOkg0VNp3CvmHwOr+c1WDXvM9JWQgoe lfQ7HCTY+zh1lXRvWZYHUGbWDid3MEVNqGehtdjTO4+ewsMG0vIGx9QXKOAE8ioJ3zZZ tS+hq+OBkCjDtHf7Th4QA/rjoCxkkyhnq+dg5OxVHZAShrHG+1AF/qanUHXexjztfB9s 23JydTwlR4jkfEWyOA11rFYiBG1XS/+r31cmU6ouMRrBIhuQjXESH6LVzgYDyW0Tvi8C s9/h3v5lio0BCjrg0em77dzLxdt3uVhLTaqXLRNGE56up310CNQ9kXLYujQbZol47Hft phuA== X-Gm-Message-State: AOJu0YztQKnPMs8kL87s/TljY+fMGEx0/44Va+B6tvqmXpBi6kqVUHg5 m/1PAdqNCuNbXOzxyTXGlh4iHVqNk+7X2Qn0EZRX4uuAFWMir2cJJbxsn84U X-Google-Smtp-Source: AGHT+IG4Kclq6hG4tVOJZn+Cct1B5OYHSFdWtbKuKX1RGO9T1luIHpIZMa02UA770z6vG5L372nAgg== X-Received: by 2002:a05:6a00:3ccc:b0:714:1bd8:35f7 with SMTP id d2e1a72fcca58-71445d5a9a7mr15839261b3a.15.1724838801016; Wed, 28 Aug 2024 02:53:21 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 10/17] bsd-user: Define RISC-V VM parameters and helper functions Date: Wed, 28 Aug 2024 19:52:36 +1000 Message-Id: <20240828095243.90491-11-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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: 1724838899654116600 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 Sun Nov 24 07:47:21 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=1724838893; cv=none; d=zohomail.com; s=zohoarc; b=jx47sJdthxQUBHeKysyAZ6MjBAm86kgAvdJMwfcfKW8ROrkOTN0fWQD1Bc5JclT2klb022ccTRYllGiCCEagPcCBcFok68kwV9nVgNCNuhqiGXjC+6QgGm5CLiDdoQctWjFq0aephJ9/6wTXj3VrtcxdI0X3M+duN8ZScKUxTXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838893; 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=fS9t4rj35tw36tVvRM+BfbLJQ/SmJItvbCchDKmkF0y2Wlh58L1jh1yKvFmfIP2IbhL9iZiRbWJ59nmwRajCF8qxeXr6xcCh5LUzr8jycoMTQ33+MGkrsZH76piaavomR8m9H/+d2suUn9tL0J0tpuYQulHd4rrHY5stuUczEsc= 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 1724838893285644.1884882181362; Wed, 28 Aug 2024 02:54:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMm-00039M-46; Wed, 28 Aug 2024 05:53: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 1sjFMk-000355-VY for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:27 -0400 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMj-0001q4-8T for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:26 -0400 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-5d5f9d68805so4552044eaf.3 for ; Wed, 28 Aug 2024 02:53:24 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838804; x=1725443604; 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=Gz66pF9/+2vxWohpdiXkaP38CaKmbvX2kpWAuF9znhbesCp8/RL7b+AsbTfdoWIxGQ fHnTChb15sJTY7//h5R31v8UJNJr4TTCuw0ujUQFXWf5alaS9iSTRwsvaMBIYoCb8DW2 4hbyB1AZheoRqnnEeyP7VZWmy/wLEccIw4LigryOqKM6vkl5DgNJbaYJXdvgCRUwJzj7 QFRAsbSFs2iJsmv5Vyw0gHBB8NA5xv1zyBvOaT+7aV0l3tiDrvJBz/+8iv+HDTmaxaeR i08CE48KlRIulj/a4lG3o6BM3ddsSDRQNyk90RqrHO1XcHzGGGjw0mPNs6uoed10eYJv GXDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838804; x=1725443604; 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=TyJKrDK2G/mWz+JOrPWruy9Zm36Cj8qwhLpnbzGjOXfm1PS3p6ojQEKe1e8/H0Wfdb P7UXl9JZzaxlGazqp8HykYxPT0Ya2/iuS6rtf/r+4OMwJnfLpD+CZfPCiHh6Ah+ZpYuy ntz83QFlNMbCYt1/4zPpT/t7QJvtvDssMnBfRljgvnC70OWoDDIORoxM86KVV8ppgDhH XN5p8qD7Q5lmGPgX/g1NSIzRVw5LN59DifXsewC9D8UfT7v+XssOrR41IpVDtDjIEEHw p9k/aXAWiyl8e2xzUhvG1vSzunZ42NPy6HiOPdns2f4txOM5k8NoSt/rdeTPJvwznFvV OkMA== X-Gm-Message-State: AOJu0Yzy3TZLg5hmkCUlAexU2Ljp2xh/5GE/NiteTWPoYSlCAjGtBKHR v5E/DUAFN68Z5kaYDQgxw0HhzdhF8lqV2PYSgIZrrs0rPLzWe9G4W2lee6bb X-Google-Smtp-Source: AGHT+IGQ/XJ80Lf93JxE0kRt3TnA67ZSEepVtk1q49ndXJ937X+G3WiwquUu3FmLUy3JkIIT/CcV4A== X-Received: by 2002:a05:6358:9494:b0:1b1:a8b7:2d03 with SMTP id e5c5f4694b2df-1b5facdab69mr185350755d.13.1724838803786; Wed, 28 Aug 2024 02:53:23 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Jessica Clarke , Richard Henderson Subject: [PATCH v4 11/17] bsd-user: Define RISC-V system call structures and constants Date: Wed, 28 Aug 2024 19:52:37 +1000 Message-Id: <20240828095243.90491-12-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::c2b; envelope-from=itachis6234@gmail.com; helo=mail-oo1-xc2b.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: 1724838893616116600 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 Sun Nov 24 07:47:21 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=1724838839; cv=none; d=zohomail.com; s=zohoarc; b=OptduMXf0keY+F91qvMvly7Uo1UBMrvWFqXkX1+cr5KoDemTSOnfuaQBOlyhOCPceIDLTq+JuOIqIbJtms6j3zM1/+lfy4leQqFAbnbp72VlShUCBfLgE9TpwD+KsILpvkQE+/+whKiRM/xGoHDNxYQbhhkXsYBR43Os3d+w4kk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838839; 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=WUvaGeIFBS9IKnpsDS8hWZAhzSraIvZGdNqSz7sL9N+t7Rxr5beQwraSF5As0L5mTDhw2l2l3z2oZeJEunvJbC60FSNHG37+kXHkxyzyr+xSisPECM3zHHhgetWcvOmjkZT04gaRmtMgb8wp00t9VAN21aEzfiwypWmeUIERrkA= 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 1724838839527691.6939300386158; Wed, 28 Aug 2024 02:53:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMo-0003JZ-Mw; Wed, 28 Aug 2024 05:53: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 1sjFMn-0003Ef-ED for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:29 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMm-0001qG-0N for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:29 -0400 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-7bb75419123so4141104a12.3 for ; Wed, 28 Aug 2024 02:53:27 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838806; x=1725443606; 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=hRiymZlaADkZjhZaEKFtixZjgrkJ8SSf/hhlWnfsyMRzVMvbY6rFjrRQb16B81t+tM I4X/EPVxA6DUsz2YTw2ZYFTMzVnFQJqwGiq+YzZXaqMZvQaPVvcLX1apmtlkxfswvswm tpdwXRWyYRb7ADj/ojKI79hYxKvZzr3jSmoEWcAx3Yb7Usp+HjyBGC7zHMTJuqX8DKWA pr6wn4pCPrwmooodI6nQph1XqihGIaoNkVtDL515KAWZxE6bnKXu7Ei1c9swYdIQ0QJA u6/x6CntVcMCqY7j4Vajx213EZNJSWE/FcYSNRjN9ikk/2wQoTXirrs7gAciRCXuiSJS Ua4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838806; x=1725443606; 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=wckLp6jQo1OF0gfrwO1VZul1I8bmmukcYNHoFV1U8u09XLLhbMziGfmBjnpHAF17T9 i4V0ReqbtCWEbJoA6hiagHUUzyVwXWfdDKJM2qbi6wXm8q6/rNbIjgu4hwjaPbFF5GMt 9xLuMesrOSoG6SS8cSemlMssCjCKGLOjQGkUtket+EMKBo9GlLKbMEHb4XuLZLcDkotv T1nfqwtPKMkXohafClv7e+rdaqRJFqZICrMFrCruCDIS+yrcIQLldYRImJDICQ+5UNq9 8God9y9rQL+C6hsqioxbUqEU5JBrlEmJa+fFxtOor7FX4oFL6ubT9aIQoWhhVD3twQjJ s6Cg== X-Gm-Message-State: AOJu0Yxr3b4AJWnsxezAfISDVtjpfUeR1qDvoDTVH3YduOFhwL7k2J9h cq+kns6xyO3VA1LcYzvWT7A8DLXpNwi8zlnkEkEAgTW/xuCawTceww5MKdZ7 X-Google-Smtp-Source: AGHT+IFfPsDngfLDLrovXM/npkCM4SbchAO1MzqKzMXKjtda1CB5VJC6q2PLu2w7zNi6hV0BSdwtLQ== X-Received: by 2002:a05:6a21:e8a:b0:1c4:9ef6:499b with SMTP id adf61e73a8af0-1cc8b4bc8aemr15433478637.29.1724838806290; Wed, 28 Aug 2024 02:53:26 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 12/17] bsd-user: Add generic RISC-V64 target definitions Date: Wed, 28 Aug 2024 19:52:38 +1000 Message-Id: <20240828095243.90491-13-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::529; envelope-from=itachis6234@gmail.com; helo=mail-pg1-x529.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: 1724838842157116600 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 Sun Nov 24 07:47:21 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=1724838887; cv=none; d=zohomail.com; s=zohoarc; b=awXe7FfoXAQkaxRlldicwmGzAkM4xwQv5qds6fC4nCEMDfqY1/UZvvF50MBXZCIEdQw74iSlgNhNlgADUF3Of9qW2ASBLzyqGbfmAJ6+JCeGIjeGrRqNo24DSwgv5Evv/qx6LTatgtqwmvZ0Tnnf4IHA3p/dwcpeEnlddUa5hnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838887; 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=HX+mB5OPgVZfIY92n+Ogx3Hrr/utmFyOU0db5l3lW+XMkZ4xn5WEJVdne4tWbwVzqARc55L7/7UDElY1mGxUXFxR69HWuMaIfkCz7tFkRmpAkndZ/UsRl361NcI3F41iPuKUIK/Cy+5gdJ1LAA5M2AQD+43aMfgKQHcGmB+JcLM= 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 1724838887195612.7214815311227; Wed, 28 Aug 2024 02:54:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMs-0003Zq-QJ; Wed, 28 Aug 2024 05:53:34 -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 1sjFMr-0003UP-C4 for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:33 -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 1sjFMo-0001qQ-Jz for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:33 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-7142a93ea9cso4676513b3a.3 for ; Wed, 28 Aug 2024 02:53:30 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838809; x=1725443609; 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=VlE6cYJFOQhmp7SoDVN9agSH5p1RAqep/XY42v06kPhoGA4UZthopBK3+7ve+Fm0Ml blWoDD0PZRsVX6CaGEQBkt5teNfFh01wAoy4XFi73lwI1/W+2JSBpJ7hvjUd8RvH1JE0 yp2KYIbsVlbvGD9aOVpP980Au9liN1LcfO3/ibnt9VADkutfTSTgaAOu3Ag7HNBKZM0h F2vxUSiq9ilaEFXkk6xHagMC7W9oZKEraiZFOGVbeS2cGEFBh5xdH2cRvHFJ90FBjsm/ oYPZ8P0rYeVN+GOjWQAHYOLLlT1DCvwoolWipN72sA7ZkbssuZ1E126uGvhW5yLJr9wG Ns5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838809; x=1725443609; 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=Nhaoywfh6+HRER+XUji6m5SS4MtSmARbkepqJjmHQhwwrvlTa9wOStio4n4ENzX7xM qjKk2XnhU1o7C8pUNP/G92f9hixPya1XAscgwCN1GM/8MyCXdiHjcrsi3jv0ncUG43rf CFW9RuoSLn+W7CiLUBC6ZCGhkmpgSGz7Q37/42hZaGDrjHzHedm9WVaLEecG6Fp6IY7P dzpJgSBXUUzLTjzpGogyVCC5SfczHv9XEkYTKdQXIAm3U1diE/kBM21pIv4hGmoJl31A QfWd5PmRHLz/VAUhSD9C5LkvlwF6Q5E6V/FGxotDjySEADjvibivTRuCgYKg3bsJ5xKG 7G8g== X-Gm-Message-State: AOJu0Yy+ZzPIxZvs/D+m2cyzYQqeXCpHiz0Q7wm3bsTeqCnXV1IMn7Pk 2vh/HSPruiVZgUAbU4u4Yn6JHDEmzdpZ5X9PQlj3c7IM5J+kjKZb4oyJu1VE X-Google-Smtp-Source: AGHT+IF4aqeaZBaKfaGCEPmVNhVUX0bEs4Yb6HLzPOVUBGbAGWe1I4ZiPMSFic1OdwvvAo8s4RDEXw== X-Received: by 2002:a05:6a21:1507:b0:1c4:8da5:c665 with SMTP id adf61e73a8af0-1cc89d29c87mr16704229637.11.1724838808730; Wed, 28 Aug 2024 02:53:28 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 13/17] bsd-user: Define RISC-V signal handling structures and constants Date: Wed, 28 Aug 2024 19:52:39 +1000 Message-Id: <20240828095243.90491-14-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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: 1724838887659116600 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 Sun Nov 24 07:47:21 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=1724838892; cv=none; d=zohomail.com; s=zohoarc; b=AbuGJgD5gxgSezyVT2fdd2IXMowo9l5AvFO/ANtIvG7COA8lNLM8GPOJltPcm6YV/2YjKYWpjg8CJH7vzLv1Aouu9E0ucD1Gv1jIH8cQrygs2JJE8A8kZQhFYsdBLOWLOMprf9rxyhUv6CqkvZ4xMFuEcl++J7MW0nLRbrcDMQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838892; 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=C83CUT2BvAZrhnU4NJEGR+IvCGeBrIjbldTpXhNU+mZGonryrqTBS84Uc7A//FZ8+VRTVqU3FsUT1Jw4ihiQ4+s1mRGTwjuhV/CSPxI90uGkezGaLKLKblnqPDwAYsv+8yet9qgXUd8nd4gA/yXbBWadPWf294mXZWVug6GLds4= 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 1724838892534132.74393266328457; Wed, 28 Aug 2024 02:54:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMu-0003eq-03; Wed, 28 Aug 2024 05:53: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 1sjFMs-0003Zd-Nc for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:34 -0400 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMq-0001qU-TY for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:34 -0400 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-2704b6a6fe6so4568623fac.1 for ; Wed, 28 Aug 2024 02:53:32 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838811; x=1725443611; 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=bJps8pEpdV0oHR75mMx3QvDdgs4XT4QbhqANuRR6QlTmhMZD7/QbalcngVKmZflo2c hPXHyMEbR7hvAeRZ0cghboKSyR13BHkBJF626qCx2FiBIio+TudAgqY1XqPMHM9rSZXG n52AI8oH3LzW8gKzgsnie2Mo19MGpOAp8i/0VazcpTc4SAzmBtfKMDA4rXLAr4xqdQF8 TLIXiNrBABDxekKC+NHJCncnpwUdFzWKEOZZNk+rj8vCMfNBNs1myvwHd6LNaLeuW5/U MOCagjJ84ScVUBzHxkoK5sT/xqIcwHNQ8NIBeeN/9sIC1SfyGInGnHfRcbGPSWbSFyeO zCIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838811; x=1725443611; 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=dXzS0X3FKw34b4MYTDIa2eMoKnjp1lU/HJwxJyGA2wv5V9y0OoZvYZA92LpItTgL5c T1PpekLkyTxlLu/8NUi0jpwTBHiwx72aoIvRXxUgIDj0kGTJ3DBOa1y+Cd8wCRXtdoy6 pe8lEyXNQvr+Z63qzMGKFUCZmZJLBtJzjmcAFXcEb3A/mr1llZhHzYbn5RCRNJP4zT9q ++eW7VSJe3QouL6D0qYtp1hz2h6V5zj/uVmdfCcjfryOnih0SrXXOOlGKf6Yh64aBIbg yxTsg/jH3wuMvY0AfQIDhys+ozCXY3miKo+Eggsnou8buXpBICKRTpQzkXlCrDl0ee54 NHdQ== X-Gm-Message-State: AOJu0YwgREKLoahs05wz2elLM7lUqB8ZVsL8XRqA9OKToRPVXq9VJbd6 tMN5zC+R+sGObkSi+lNaaUVlnHMDnRDqowjm4UfG9m4CRvJpgev3a1zgjQ== X-Google-Smtp-Source: AGHT+IHqNlVZOqCxRnzo2RVFi3hVTav9vLjMGt3c7MZMTZbe6YXfscGuk8pabzxcHsgM7q5dCZTYAQ== X-Received: by 2002:a05:6870:858a:b0:261:908:5899 with SMTP id 586e51a60fabf-2777d14bc55mr1353411fac.10.1724838811211; Wed, 28 Aug 2024 02:53:31 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 14/17] bsd-user: Implement RISC-V signal trampoline setup functions Date: Wed, 28 Aug 2024 19:52:40 +1000 Message-Id: <20240828095243.90491-15-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::2f; envelope-from=itachis6234@gmail.com; helo=mail-oa1-x2f.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: 1724838893664116600 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 Sun Nov 24 07:47:21 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=1724838998; cv=none; d=zohomail.com; s=zohoarc; b=FwwAqpirSm9NSdVhv+SOX8Rf3dZHnJ1mwL29FlMEkQC+6fH4QU+9nzeU/v8iWJmFBwrhJ8DjqUMEw5oJ6dTzScaYpt1stqD27eYPLYXkyOAsrqynY1350aNGfPRb9mO38uYEPKpPTId6FGgAM01EX2aRj41mRBz4Iqul5smVVw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838998; 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=CTeXffKfx43WlgWsYk8WpE08EyitysAYRFAPdM4jFD9oO/yxIBZdM5i2O8G7XfYwTePHlX0/wCBrkhbFhKyJFbe7eHNsDNNxu7m0cWeuUASA/LtWGx9SN14NYlX0EzT4c1FlnPvXyjVZJvTAxC2wCGu8NCXiZiBQMdmVUT75AbI= 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 1724838998190976.3403457690835; Wed, 28 Aug 2024 02:56:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMx-0003s2-CI; Wed, 28 Aug 2024 05:53:39 -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 1sjFMv-0003jB-2J for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:37 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMt-0001qi-Fa for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:36 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-714262f1bb4so4804798b3a.3 for ; Wed, 28 Aug 2024 02:53:35 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838814; x=1725443614; 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=ghpbtg+egFMkAtoh6Slu7QR2fXV6vyQcvG7Xq6eYlDwisExVMKcn9w/o+24GByIvxn ZtEbLlU8YqRjSR82AXK72gmw6UB7NjFDrNGDXn4rQAdm3vZoJLqB2gVGxwnQ1uCEzhvi kNaFCIbzq+hrXXVTo8KErxWHlgdjLKYlhDhLiB3MGJlA2rONHK0W0psp8TyyKvi56omU 9jUaSR3rNR0tcuKQiFhozz8XC/TktaRh4nZUbGfA/0CnEUZDbqEqKduPW0/THy6QVPBH LrkGrhKOMPxqxV223K0cpKuHHE8obikkOlO1VnzfFyqwDTUN4I6l4nIQqpA3MWwQqAl0 K6Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838814; x=1725443614; 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=qoqm/9AWproTBDnehjKSHHcMqAL32zSZaYWSaONfDP0rPd3/jHpUxNyXfy+XTxZK7f jlYSD34wWAo58XlFufIthP0AgXloWEZZ44rIBMH2LReGZoZjpFOLTAxPNneQJyHFBHZW UY6Oj8HSTCo7DihLzLopiPiRHiPgPHEWefcTTJMSksaeeQXDHsJbraCUIrb2R4KiSPak HUrUc/G/lcvXlm56YT5zL0GvFpr8S+j9y6eBAC0qX7FD0Zg/Yv+naXJby1PoDbn1rw3e xV3YdOAGxdBGwnA6Kdy+iYGqftgYJexWsi//j57pOEk8x88EeQKUFn0BGrd8zUEN9YX8 cl7w== X-Gm-Message-State: AOJu0Ywnp01tHw3rc5qf5P9iyxGMGZYvlyUihZIVoZkQ4O313udyY8cu chVPqVvL55hSfUotTQw9QHIix9zElVJCWgR6tvrRcZTjh1eZFyHC0rDHTg== X-Google-Smtp-Source: AGHT+IFRCPZSwDfAN08AzcETmd8mcfCLQ3Fl93n0/EgbXbSaiKcpMZpSOCLs2ztQJFztONmSD233MA== X-Received: by 2002:a05:6a00:91db:b0:70d:311b:8569 with SMTP id d2e1a72fcca58-71445ed4f93mr14654698b3a.26.1724838813694; Wed, 28 Aug 2024 02:53:33 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 15/17] bsd-user: Implement 'get_mcontext' for RISC-V Date: Wed, 28 Aug 2024 19:52:41 +1000 Message-Id: <20240828095243.90491-16-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::434; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x434.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: 1724839000081116600 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 Sun Nov 24 07:47:21 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=1724838958; cv=none; d=zohomail.com; s=zohoarc; b=Q7NIUcyj9wVm2TvdR0zj8L0fkP7uBsFXoVNxUUwdhCcHkzjhK7r4RrWwtAyN9Y6dJ9Qhj7v0vYCxpkiLszuwg5l49MbsNRUelPbwHcfuRzMs7YtS15s6Ax20b5Hn13Uo9JwnPNCw8KY1AU3WWujoxpopQBfVdyQgWH6VFvcIRYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838958; 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=I0U0y/5GlA6NqLSbOmGQNLppAHXno8XvzMe4yROMO/O2Be65RZcmjES+q7ud9GsAJTwDGO1hjDUOzR7352NaO19PTfsWWkjfWOtooCfU5WqXhwik47MrDxu7rDb6TpY7anH/+zBekZFqAih5pwPTQOlorDJohMdTLUh2amV/KxQ= 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 1724838958674427.48391200142953; Wed, 28 Aug 2024 02:55:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFMy-0003xN-N3; Wed, 28 Aug 2024 05:53:40 -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 1sjFMx-0003r4-3e for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:39 -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 1sjFMv-0001qr-JU for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:38 -0400 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-5da686531d3so5092679eaf.3 for ; Wed, 28 Aug 2024 02:53:37 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838816; x=1725443616; 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=IKBsic42fRyfnnfVFwpJCQiyT3Cgizw8TBWnEEKl0TJ+xB0UBGEgv9x3RU/r+Zsovq pNOSDv8fjGW6piCXMuZYYt7r0pczQjIW3Q5Z/esbrOSFdv48QxxLmytn6IIcxIGyZJPE gfuLeQkUiD1L9KZ2q5ZASNwVi6VwDMLiy3weDWvSHy3wM4FUhR+LqgQ2HABGjTxn/i6e AgDgnQ30Ob+Vod55CCOFIhqaw2Em8frQK47HFD96mCtwgLjHf1xwNGOnbAOccDSKo3Wj O/HqPBjstQ4NMMC2+wmlfvLn3O0q4oAQW3FdDBszKjbHs4kaZAhe1v9lBEOHDWVT8LQM ielw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838816; x=1725443616; 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=GpCUNlW2lIbmaLmZk0QWKB12wa856rNOe+jVeB/Y+akU+sWrs774PMKYucmdK9lYhD IsonIYvcZjler6h842gJ209P+M9uve60KHfRh6ja6n2pWAGkNBdmw5DYqDKbfnOH+I74 nXeRB4w2oYe/vkqr5PWEYWmFxQ5MnAN5IGjh2yvtlubTpvEfDaQsD1MRuVmvjsMjGp4W TFkE8AY6WaSniTx1FzDBI4X3PvpGe0NdV//02GEzN6cMoLReZKzqVWXKnXu6qEBiEoGF Va0CnUIGXI4T+/23ssoVY6bGRI4JK75omKDRwBp9/6wtlJHqfrUkL5UqzmtlX2D3WJ8M Kp8w== X-Gm-Message-State: AOJu0YxzvtMhIycE4ur0qbBxepHdX2hxHxCOj0zlPCLSHs6DS13mIw3d o9fkkZAUJIV+U1sPB8vsV3W8pl/5O9CBTkJ4Z3d4omv/676yJd0j+HEmCg== X-Google-Smtp-Source: AGHT+IHR+mVWu+8f4uV9yDbglWqT0a7Hw5K/+g4Rp9SbCBYcuNeahjokD+i/+bfrKiTDqXgVcxAr9Q== X-Received: by 2002:a05:6358:d39b:b0:1b5:e9d4:66f4 with SMTP id e5c5f4694b2df-1b5e9d467eemr733723255d.9.1724838816173; Wed, 28 Aug 2024 02:53:36 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 16/17] bsd-user: Implement set_mcontext and get_ucontext_sigreturn for RISCV Date: Wed, 28 Aug 2024 19:52:42 +1000 Message-Id: <20240828095243.90491-17-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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: 1724838959900116600 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 Sun Nov 24 07:47:21 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=1724838900; cv=none; d=zohomail.com; s=zohoarc; b=crdDJbkLVM6+D8v+cx7VkG5y9TuRnRfVWW1Du87m0+dTZIqWG/aQTbHLpb75cBBVUVxy/CsjaHpWH//xyG9Ck7D75RRwMPeSAg93jmlA2cc+juFfSLHExkxlxpsHRwZnACj2luUU9WTWrCQwBOhqyP7UH+NgYrSeS+CuF5FUZyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724838900; 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=RumbAeK2NiDFA36/wFcgQCcf6PhzP0Sl7xauQhjGzoRGSv0BQv1zUkhgFejD/IZcCLz2nzrlokb0MG90rViWnGytUH2LEL1krd8KvRJHiH5WZ2p1XH9MFyYnazWFfI7PaRV+jgGqgu2lqlLE+ZkJrysaV22Ir0jFD9JkTHIP2f4= 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 1724838900078462.4690481205165; Wed, 28 Aug 2024 02:55:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjFN1-00047j-B2; Wed, 28 Aug 2024 05:53:43 -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 1sjFMz-000416-LH for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:41 -0400 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjFMy-0001r7-4s for qemu-devel@nongnu.org; Wed, 28 Aug 2024 05:53:41 -0400 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-5daa93677e1so4726124eaf.3 for ; Wed, 28 Aug 2024 02:53:39 -0700 (PDT) Received: from localhost.localdomain ([220.253.126.131]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143430f6e7sm9787508b3a.160.2024.08.28.02.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 02:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724838819; x=1725443619; 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=hi4EzJsZw/s03MO3qXHrRi/0YPt5wcRuPRpuYCZO1iS2sDmbKB+oAKkFlZgdVCml/g ls78gCFX89ltPNPHKf++Q/d3iAc4RuZ7sdqZfbblI54EaVP9PFFaQQ+c4ZfjdvjNd3kX 9Jtp9ayo09rV6+7F+de2Wj+x2INRrwgh8xtyA4zAt0MY6MdC1gT5ZAk2Ot+LPRfgL/J1 DTf5dEUnjsaeBx+LMvx4EqofmAVGwnC36EdG93uNtAViCTXWN1lNELaBVVRZdVqGoGMn OugfRquj3GHzW/kani9OYXf8FzsZ77EC2e04M6ucBaXE9rgik8ksy6IC8K5wefoA+NY5 nqZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724838819; x=1725443619; 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=OXSp56yCHDo9vSBMK88I89lJVDfxuA4P3LHPXBBo0uDkKV3fR2dSW8Lji/TDOGUeuc 9hSy/2LVCPTyqikJvMYJ3qzgJtvk72RjKRQq2jNeAHAdt3bG1iDFYjI9yPIozzicGEAn 6QsSE6SnlkFgjf/350v0dvecCjCVcxZsCxInhR7qcDEgPoFGlaxT5xaXWMa+1bMpTOae kZDKxymw171H1fttl82/YAAVdMwxtyeb7d2vVVyUqJFnwy9AxMTpxbM28X/bTUOrNzCG 2/m5RRcd2KrP9ti0NnbsVznoS3oKNugef3HaIRZ2M3L/IjYblawaa8FjbD1g4DgzcAJb OBNw== X-Gm-Message-State: AOJu0Yz+CBX9HHFeIkHKbKvo1IlTTkBtORyvAtnjZR9McWdZ/edxg++j nZivPiMeeoTk/AfqHaYSf/goGEvAbSgvWmZIxV8sOMJ6GkbJePRau66wdQ== X-Google-Smtp-Source: AGHT+IE2kyDCluBzV5FEkWR+vOYxoovDU8ixp0X+bmEQJ0Y5BhDSyhG0ObxU7J6jDGMRG9ZLjPM2mw== X-Received: by 2002:a05:6358:3413:b0:1b3:9f0b:89c3 with SMTP id e5c5f4694b2df-1b5fac8cc4dmr166192455d.1.1724838818636; Wed, 28 Aug 2024 02:53:38 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Mark Corbin , Warner Losh , Ajeet Singh , Richard Henderson Subject: [PATCH v4 17/17] bsd-user: Add RISC-V 64-bit Target Configuration and Debug XML Files Date: Wed, 28 Aug 2024 19:52:43 +1000 Message-Id: <20240828095243.90491-18-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828095243.90491-1-itachis@FreeBSD.org> References: <20240828095243.90491-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::c2e; envelope-from=itachis6234@gmail.com; helo=mail-oo1-xc2e.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: 1724838901700116600 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