From nobody Sun Nov 24 04:27:22 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=1725679229; cv=none; d=zohomail.com; s=zohoarc; b=QZJlMVvn8uQGV7TUA1D1MooLqHas7Ug4dM7CcgRjgNPEUFFodp45lJLpauj9j9GljixujW6K/VY4vUhV8fVtJLXGtcXXMfi9jJKV10lb8YlzeDjgOBiDa1N78pbwsoj9Px8/EDkyFEONYqt5A97P2BY9dNqLpxlgiYgeBj/TSNw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679229; 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=Swra84H/87ZZgIR1aYJaMgPw+oGo3NfcR3qWEuuwhR0+LVY+D4YlGHFLq8jzOaJeY5C8jtbteGDF+HQXht63EN73cUmiRNdKVtgAvJwqSy7n1FWI3txqcj5vBzHpqxz7hscY2xb5xP7Iv52rpNuvX2HJ6AcxzOdJxjhCHGeUVB4= 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 1725679229594489.1314269212414; Fri, 6 Sep 2024 20:20:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smlzJ-0002y4-Gh; Fri, 06 Sep 2024 23:19:49 -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 1smlzF-0002wi-GF for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:45 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzC-0004qW-PW for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:44 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20696938f86so25347665ad.3 for ; Fri, 06 Sep 2024 20:19:41 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679180; x=1726283980; 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=F/ngugUIyh4Qwfx0KCTh7w9+UyapXmlmGml2QB7gYJYSdcG5Sqb3kvmirKscLxypLK RMVZiOZsVu8oXCE97MvbkJRthpGZVhIga26MLkw8kHlJT9V9ZX870Aa6IWzIvfjRqlIn Uvhm2wOflFT4RduiBlwPjBUplkzTFod3gB9e2Y8BcTU40pxlnPBpTzzKHdx9A2FpXft9 QQogNt47YpxeqRf2wfOxt9W1pvg2tCblLONSsjxnSoHVmxvZUvN54zRvXw/suQZJ6nvL 4IIuoWW/FIp+c8sd1HG3+aoEF5Gl21hU8Wviw6P+YBsCJPbcgijLCVQ1wA6iuAUBTSix jWtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679180; x=1726283980; 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=J0dvg3VzueW7BqmoTNeelIKrlcx3UY/Rf3WmXwMlxcy3zsmblrMzrVT29N+6ZkJ0A7 NNtcI43s5sq7hcVmLKhHWube50fLBweY8UY0jxyAmkCP7nhVCZ0Q52/hZnvZeG0ipTSZ V6EM36M3hf8LbB6Qc6o8R1wF3TuRgpa0pYJ1ClxO+ySCYFBZuhOAzaeKuf6xaUj5Eiol 1ZL8OXi6uaSN2wJayLkMeNQMhvdjeBRF26q//BE/jYD40bMsrp5M0h1k2QWR+0j+7oWJ iYo7xyr/3LkNptvP7J35/wxSZcLjXcZERdgHE2LtxjcwB0GjP9o0kVK4zqP39VXDLIX7 fNaQ== X-Gm-Message-State: AOJu0YyyJftK18X/+9sXltXoasiy9W7sMwjBfcLqG0VtCCY4PcjZZeCf 5CVmLX7JBYJICR9jS8KgXthe3X/1yPEwH3/AYC5+fjxBWlgBscfoK/gGQw== X-Google-Smtp-Source: AGHT+IEyVziJZhjBmfDUXH5hcLiDJsDOU+q7+X89ET6HM/SxLsfdSDXpKxv5qWYH9MBB/2TwpnyPDg== X-Received: by 2002:a17:902:bd41:b0:206:b960:2e97 with SMTP id d9443c01a7336-206f0612ed5mr55560995ad.45.1725679179770; Fri, 06 Sep 2024 20:19:39 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Jessica Clarke , Richard Henderson Subject: [PATCH v5 01/17] bsd-user: Implement RISC-V CPU initialization and main loop Date: Sat, 7 Sep 2024 13:19:11 +1000 Message-Id: <20240907031927.1908-2-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::62f; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x62f.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: 1725679230812116600 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 04:27:22 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=1725679229; cv=none; d=zohomail.com; s=zohoarc; b=ObHGuBL5dO/rqAXM9aenPpw9ZwnSJKCXFnrVGsHZuQlC8VcJDeVWaLEtZJnzZc5VmjGHaiFjMxOM2PYEPvRNmpmspNPdeJkDvbB/zg/XT6pC3t3XKo85lB94uekxGUmkLVmfql4iV7sJMMVomhcB2NqIbJsON17+s0NSGbhkYCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679229; 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=qoqI+GcSD10KH5RTtszxpTTAXwPzAPqtWGKQJfPieeI=; b=D0Bjt4Rtw2PL+koESYA0COFuoRGBbC7Zmp/rOBDIn9ghjoix+ul3wEaOBgFnrUiESj/cIdWcXbrmi3o/+nWWGaXZgI04IIwEvBb8ht4DZzYOPzJRGmqRWjaTUOClNtqbGm3ZMFCohKrzneLrMouFfRs1MwiT5oK092LooDQuwjY= 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 1725679229595238.3167722780329; Fri, 6 Sep 2024 20:20:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smlzN-000398-Ld; Fri, 06 Sep 2024 23:19:53 -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 1smlzH-0002xk-CH for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:47 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzF-0004qf-EH for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:46 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2053a0bd0a6so29768375ad.3 for ; Fri, 06 Sep 2024 20:19:44 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679183; x=1726283983; 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=qoqI+GcSD10KH5RTtszxpTTAXwPzAPqtWGKQJfPieeI=; b=Pz7cBylT0LyCPEbwPSoqXDdVS+m/RaIYfcLC69kCqj5zjBqSOvUnzV6WUHt2gds0Fg Tw1MV0OaqkOuWBBOqcVdpeHrBr2wKraWshGLy/Kz11ahOX24u0edB9wuS5VtY6T4mkjd wDNsiQStNB/ALVpAgKsnIUbb1NAh+ReJcMhCb7lcd+K496fm2SK1VT7QW8o1mKkogK8o Z1g3ZZHqxXglnb6hBuLExO1TE1YEfocffY5PDj4ibDSdGfkK7dnJQZ6g5oqxLnbJBmoR jMuk4hfkQ81Je8PKcwg5YYv1sKuNeJ9NABX0zEyejo6eflkV2b/0Yq23R1oHdCIUTPE3 JQlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679183; x=1726283983; 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=qoqI+GcSD10KH5RTtszxpTTAXwPzAPqtWGKQJfPieeI=; b=Fd6J5mFzEUeSLqayiUJhKj3vivncd0qvKtl1EbHAqzCl2TFIdsQvjLZuUSoV3b0JVO rfj5iJ0m2LiNykI9jKnxp6h77wEyHmXbMr6rL7VYo1q7IBaL0e9idbhacm1g2LAF/fAQ YNcqNkLgdRT1K28iq5gzt8nl/JUssiNRWv2uObs8z5K9/Nmt019gCLeK/IQ76Hl4oOxB IORKsk9k+1EO9xUcXflPSL4WvFRHktTP0RvYCWKsr2waWd+FRnH2u9+WaFn4qye+0pdg +9vt+DNTvMEyh0p+0/Iaa1vb4MjTmAS/omUvRFFOcbTRp0kp2R42wigPq59Hi/A+Ol6/ eoBA== X-Gm-Message-State: AOJu0YwhC+M3Bom0woOxg38+cjJJo0QZQg8g0QTLD/TfYfHOV36axYN7 eGfUGB7cEqMbAeoq9aEx29B6/X/crPtVtnhMAuzA4FhJxc2hMiYqkR3eJo9H X-Google-Smtp-Source: AGHT+IEN+8AFlk71jBgNBcQtyEne8mptmnoBTjCRvrYTgw+a/DUOd2itX5oFmhdYiHSTHrsEQZeniw== X-Received: by 2002:a17:902:e550:b0:1fd:9a23:90cc with SMTP id d9443c01a7336-206f052e09bmr52678905ad.26.1725679182823; Fri, 06 Sep 2024 20:19:42 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Jessica Clarke , Kyle Evans , Richard Henderson Subject: [PATCH v5 02/17] bsd-user: Add RISC-V CPU execution loop and syscall handling Date: Sat, 7 Sep 2024 13:19:12 +1000 Message-Id: <20240907031927.1908-3-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::62a; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x62a.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: 1725679231336116600 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..ea2a8d1ace 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]; + 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], + env->gpr[xA1], + env->gpr[xA2], + env->gpr[xA3], + env->gpr[xA4], + env->gpr[xA5], + env->gpr[xA6], + env->gpr[xA7], + 0); + } else { + ret =3D do_freebsd_syscall(env, + syscall_num, + env->gpr[xA0], + env->gpr[xA1], + env->gpr[xA2], + env->gpr[xA3], + env->gpr[xA4], + env->gpr[xA5], + env->gpr[xA6], + env->gpr[xA7] + ); + } + + /* + * Compare to cpu_set_syscall_retval() in + * riscv/riscv/vm_machdep.c + */ + if (ret >=3D 0) { + env->gpr[xA0] =3D ret; + env->gpr[xT0] =3D 0; + } else if (ret =3D=3D -TARGET_ERESTART) { + env->pc -=3D TARGET_INSN_SIZE; + } else if (ret !=3D -TARGET_EJUSTRETURN) { + env->gpr[xA0] =3D -ret; + env->gpr[xT0] =3D 1; + } + 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 04:27:22 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=1725679239; cv=none; d=zohomail.com; s=zohoarc; b=C1c4NUyEMwEza47Tc4+U5Q/FhSwQQy9zMChz0717dxpc6dfpAIHW+8upyOUz/YFk8XCqy+eG66Dy+Bza8oXoGaX3PF2f1QRcWWgrOkevx2Ufb6qEpvi+DIi9k5GF4nBmqDvEgYe4gZf+1V80FyKdAuijHKIQkh+YtTjMjAwurM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679239; 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=eb2IXxxnHK/KXo5R/L/8Ek9ID/ZcfvZRBf6/jcc1+Bk=; b=N171PPsRUEz0AlQd9jHZjEgA2lxy20cwALSdAL2QEXTloArN/sIEwECmOqHjrXaQp+v2X1aZ3LRZRn+HLmB6zJAlaCAVKruG6kmngLzqI8h5M/k3MPnp4yi/1a0CSD2ZZkC6mQXUzRX1OqtZdNSUuWjXbWHgkdeHizo6xVIZchc= 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 172567923973246.61026469514297; Fri, 6 Sep 2024 20:20:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smlzc-0003Wi-F9; Fri, 06 Sep 2024 23:20:09 -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 1smlzJ-0002yI-5N for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:49 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzH-0004qv-4P for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:48 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-7179069d029so1966815b3a.2 for ; Fri, 06 Sep 2024 20:19:46 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.19.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679185; x=1726283985; 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=eb2IXxxnHK/KXo5R/L/8Ek9ID/ZcfvZRBf6/jcc1+Bk=; b=ITauzYvibaIMCFfzeUjT1FNRQxoHWBOEZayjkDje2BbeZPIGBTt+J3bVvdzad8QG3/ 1a93RjFoq5E1Ttn5FewUmCQRopZoM9byZ6ih2NiLrC79ts1qJ7SDCs917+/p0PZFpq2x BL3ym8kZ61c5Ub5jo9sx8NoZ7moeFTBqeTv6MB/cONiZzLLSFFuheRG0UzVzLfehD1YT TllKgeR2B/e5wJ0z5/h6eoY0uw7EKqo+1YXLbZPU6opFZ/f2Q5zRZwY1xT5zzVeR6Xuk cTMgCsHEFM1k2J8dzXqts9vjor5D8+w7RnJFSZUL91tKBcw6lh8TB8vh5NFSMznADzBH +ZTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679185; x=1726283985; 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=eb2IXxxnHK/KXo5R/L/8Ek9ID/ZcfvZRBf6/jcc1+Bk=; b=KzBOhkQYPnE1WKllMWHfTGlm2S7BE/sNJjxWJhyW7wFvrIWbD+WMkya16OUHddkVoA qXGDzrQjSj4quL68y7aNfk3UaVmwDDOsU3SyIUQZ6CX2UPTUbfDIVAYvr2uyxXYXlQ6W 7c903LnjTra0VMyvuZC35byWjy3ha2o9rRgpQQ8Rw5YBODZUTM2uB76rTUsdiGc6BAuc uUQI9fR6ZUpm55eLmSy5iPEJwT26Fi0vQheurg35YgPQsRLCr4i6TR4oeovuXkbpnHPM oBtJyAqofg1yk9wYzrQcI9tjqJ2ZjYMdSfK38DfCQs5AYpLnWS6pRU9gfy2DxZuCDw70 X/rA== X-Gm-Message-State: AOJu0YxMKRiwWIufdoUQTVAeLMna/9wZ8OzuRzlDkKIUMb2tB3OYqPIA HoKUkuSs6kDmJrv39lrRITtXR5Yk7pyVKjSxzTo/czGJTVjVQQzW9FUIfA== X-Google-Smtp-Source: AGHT+IHr6RAaEInDP6TWv3ArrXbxGFFqihr8ctTDhvQhJP+cKIVJlaSmksLkVF9mRlJaytrGxVGNXA== X-Received: by 2002:a05:6a20:6528:b0:1cf:215f:1038 with SMTP id adf61e73a8af0-1cf215f1adamr3478240637.7.1725679185332; Fri, 06 Sep 2024 20:19:45 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 03/17] bsd-user: Implement RISC-V CPU register cloning and reset functions Date: Sat, 7 Sep 2024 13:19:13 +1000 Message-Id: <20240907031927.1908-4-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::433; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x433.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: 1725679240439116600 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 ea2a8d1ace..57abfbd556 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; + env->gpr[xT0] =3D 0; +} + +static inline void target_cpu_reset(CPUArchState *env) +{ +} + #endif /* TARGET_ARCH_CPU_H */ --=20 2.34.1 From nobody Sun Nov 24 04:27:22 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=1725679240; cv=none; d=zohomail.com; s=zohoarc; b=PyQoKiJOFEu5n24SByO7RxXpVpx5pmaBM+WkhLDRxXtKsIryhXcvYe5dXV8Ohi44AgN2gVWrwvpL9V6zyz3UG/7aKXBUs6TceponEb2mgAj+nKJKLvMGo8l1sTJNKtvVMYrVOq7F2VkL0m1P2XYcRLa9nm/0VbNPsEdzK9jfuI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679240; 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=S9w7hqsEssvQIvP0QOgsCieTFLa0Xie0T2iO8wIW9GROgZSPn0KUmzMK9EOS7y7iaC1smP058Qxxe5J5CUuIVSvp8sIH/LSH/EPRzyzUYYJXCkN+AP4dOII3O4kn4S5GrkPqg1wmYzWSYWs5mSbmjhCItaepDUiRymBGZsYSG+A= 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 1725679240882197.54889297321256; Fri, 6 Sep 2024 20:20:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smlzb-0003WX-Ai; Fri, 06 Sep 2024 23:20:08 -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 1smlzN-00037v-Bw for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:53 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzK-0004rG-U4 for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:52 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-7cd8d2731d1so2029845a12.3 for ; Fri, 06 Sep 2024 20:19:49 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.19.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679188; x=1726283988; 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=Og5eTAW5uyMtQ7VxE5G6HY5SnKobbtffP7LNWjbelKgpr8L1b60ELn6UcXW7NGVI7f uAE6W+dyoMEHsMh9B7eErSTprVUbstBASYw7wwbLwhT8A3+WA1ymOk28BPoastqOfOYr /fV7RfScAFgI5AyLw5aTo9DpNmsCJ4BDReaspf9Owz8Sq0Ks5HJmoeSDF83zZvcoTnFT OovzpFbPWiaMMe2T+dGRF/WhnjbbLDtHfbT0Wn92k8MA2OJAZzbmWybCKbD7qySkMhqH HTgalZiBnUcj7EX346al+fiP211Hn8bVAv77ZBXA1HI+08GI5h51prLbWcPia69svEhX 4RIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679188; x=1726283988; 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=Y0kmyHplvWEOpz5qjaZZVnyvTzt6n6DSq3ExXbVYxAPsDoPYCcvx3zwH+jZyfjmaw4 OwUxCyHRNpSV4De5CIXtS3Lx6cvCjLh7bb6K+LH6EFOFS4FPQp9+QntN3fEd4I5q5EMK 73wRPZmC6I6B6mcUntljcTvsQu82hnCTqtqJxxj6Q0mNoS/xk04aUI5PQ5H/LDDDy3yG cU56lTMzGtQffXeZ6uuw9LIBgAE0EdRUUwauM2ZHiDwzClkmYrDr9V7vSK3Z8Lk9hDkO ZSHQXGn3ZJJS20cyX2ydbfYvfzIfK20h59gDC1+J5eLgEOIG/NVspEpB9VfhrEI0su+P 4Ffg== X-Gm-Message-State: AOJu0YwlKD0Kxl09P+CU3YfwsW4bPUl2fnSs24J1WF4pRKPngJ8jPnuo CGqK+14VqNy7FJnsBh11IXuH4iW09nV3f1Pg5LGzN+gBiomBuMrYNqRexA== X-Google-Smtp-Source: AGHT+IGG+sUJbGYq9NZ/S4VOpzdVfNd51bWx/3F/4gNI1C9rXjp68Fyry7pFPGEsfNr+KKnovNtNyg== X-Received: by 2002:a17:902:ce10:b0:206:96bf:b0cf with SMTP id d9443c01a7336-206f0358aa2mr57348135ad.0.1725679187833; Fri, 06 Sep 2024 20:19:47 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 04/17] bsd-user: Implement RISC-V TLS register setup Date: Sat, 7 Sep 2024 13:19:14 +1000 Message-Id: <20240907031927.1908-5-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::52b; envelope-from=itachis6234@gmail.com; helo=mail-pg1-x52b.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: 1725679242006116600 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 04:27:22 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=1725679262; cv=none; d=zohomail.com; s=zohoarc; b=Gme+hJGH78lWLbaTEKPzzZZWMnq4KXpZ+2elRaZx5a6c9EXg6wiTi56mru3obS12MmsHLQOWLzy7UuoYcjRoL9eBY6kAG/wxL9kImhjMQiYHrObZcMdd3OVA2byjpZ9Dr+5N6IiWl8hudGrPceH6N/LRuJOGzf8tTHhOhzdOV90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679262; 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=Z4XH3i8CFlFgae6C90gYlipG+nUeBgI4Tk5gEGN5xdTwV2tJhmmn3ctqhI0K8q0yKz3RzlJ9VLjn1He86+4RaD8/FZBCu+UmplrN+BLf9xVJq5l1UeLJ/DQqni/60Ck1T9KBdPgBm5NmJooGrDYuO+pLtLKfchCf94oqEm0262s= 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 1725679262880120.03687487924014; Fri, 6 Sep 2024 20:21:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smlzh-0003hE-8I; Fri, 06 Sep 2024 23:20:13 -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 1smlzP-0003En-1Z for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:55 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzN-0004rV-3s for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:54 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-205659dc63aso27854875ad.1 for ; Fri, 06 Sep 2024 20:19:52 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679191; x=1726283991; 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=VyFIHfk8uZ+7XyQ6F3in7K7dbr0ICc4j2aTIjkZzykzGUQZL+iaKFOE8p2ZBr77R93 L1LPOpcCwczbJ561BPIu8cc5IGQ7mscAAkE8iwMXddjuHbQD73owCvd5Sn2mY0lYxCsJ xIfOQREOk19eTFl49yeEWQaTPv/qZ3uObFqBh5QRKebxnrCN8IgfNdfpDiCW/UbCjoty R2rMeyXj6Zcai4bZtlXLty1cPCbY1dJlCxcXNFdJ6tWw6qOdc6R7DltA+2I57SlnnRm4 6xwSD8FWI/As9FYKis4yFeLd3L/1JkvfevVOkq65CcMLUtypGCA9CMZVax82YCGsW5eO A+UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679191; x=1726283991; 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=OZqy4oUVvT5uFww6uyK5Qqar46/HKSTbKNSgFstt87T+cQ8OVFHjct6YwmH/M1+R82 HbVq+i56VJ1NgfHWUMjUZx3NUftDEOV9Djq5RoLWMPc9e3UCK7kDKKxQYEhpdws/jVWX GW+xxJAIy2lGlLTuPyBZr/ePuJ3MSuQHjMhwEMoqdGrq1TSY5ImK7vMmub9ZEQkzEWvc uKSxr+mHFjWv7bAAo5gAUaRJ9RkBco2WdGzv+44bI59G3385+L0zvv1LHlrNbf8CC2El gevvMkmXssCW3yp8RFeM1vv2THsGGVEpXwwG7kvT8jNUZq8+uuQI1NqH1Lmx24c0X80l pdBA== X-Gm-Message-State: AOJu0YxuHV9bGTr77dQHQ7lkQkBaIgi+xMgFuH/zZEhAeNIj9DeZz0vH rpDghYd97QG5vrNs6IP40+vfYeoxgRK1GZWWEwppfp+zg/XyLsK3afL5suqY X-Google-Smtp-Source: AGHT+IGLKO+vkOqS3nX4jPxAsKf/07UdTLheLbJRCq+xlG8Ljp1w9E7SpSRJAf9thF5p9oRzrzKNQQ== X-Received: by 2002:a17:902:fc50:b0:205:4273:7d3e with SMTP id d9443c01a7336-206f064c443mr61078525ad.57.1725679190603; Fri, 06 Sep 2024 20:19:50 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Kyle Evans , Richard Henderson Subject: [PATCH v5 05/17] bsd-user: Add RISC-V ELF definitions and hardware capability detection Date: Sat, 7 Sep 2024 13:19:15 +1000 Message-Id: <20240907031927.1908-6-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::636; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x636.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: 1725679264216116600 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 04:27:22 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=1725679244; cv=none; d=zohomail.com; s=zohoarc; b=Wjg56kA00jYJuu7ev7SRuiBn/0mIrR6LZsuH8VUzToSr2s8Bsen0b8GVRMcezcIMjueCO8uPysryQpvo9Hf7/6v9JqnkN6ALHt9HMR8tjtJ8Zwb2DbP11yp/uwrh117riYC2pCrzUJaXvr0l+eIB6KCySLD733jPy/Iav59aT9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679244; 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=D0Lj5Amrw1UzfWeLYbLTolxpujoYK1/z57inLFRAXScXOuEJ7mYak79G0perIp44mUGYKeqCSYpySNP8AYVCjMI7xNaYSLtFCivFq8mi+CDPtTBdf+PHrCgFe89dKgO1GsvmD9Px0IOPZ0YELlp12YawRw+eMuDu6pOgIqj1ZGo= 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 1725679244126288.78602141593774; Fri, 6 Sep 2024 20:20:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smlzl-0003vY-IU; Fri, 06 Sep 2024 23:20:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smlzQ-0003ME-Nx for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:56 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzO-0004ri-WD for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:56 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2059204f448so23853655ad.0 for ; Fri, 06 Sep 2024 20:19:54 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.19.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:19:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679193; x=1726283993; 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=kboLiT2FoRKcK77x3L4MY3l5n9Dd7Ucd6xeLb8pJlLmvoJU20Z+CeA790B3lmWxpLM seZ6Y0miklnPvcsygChXg+qatV8k6ZAPeMCZt2K5XYVOfGyV1cxDhXzH6JpjMSHAoRsb PW0vMix5HPM+E8kToxjHOtEHcLm+Ymdw/Wt46oiBvI64dYTcRDQA33ywL/PEjVxAjGuY J6o9twz4rQ2SrvxyP8o+mdx12dZishEARYs5Nr/lJlCF5EFwx8Y3UNnlMHmBo9FbEJiR PcZu5BYqwxGq9KvjtPZ1WhF7QPMVkfVhTEzal5AQQ678C3nPPqPbqfUcXjk7QcsUMRD0 OJVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679193; x=1726283993; 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=GUHzufK7GkwRTCWlkxeiuurBWZ8WyCnb1zTbsPLJ/d8syz2Uyyni636QC+CNAzTN+9 yIKpHp4GZLzQ+OWY84UE5cu9UIQHGyXY75zx+w0Ht2+h3ZWh9tVq1XyXSdTyTlsSx3E3 0l0tAHDXS0YXSOtxlTRSmda9pjK15PzY3yFSCLG3Fw9pB3fuQHrEB+XBvsmWBojjRNuW jW9th78uejY/UlWgyYkIgs55yQmSa8JIpmuxkQsTyl5XaKdjLplpvrWgenedllSOCVkL 65urapCrt1KH0s1PKYNfwZBHqQeW+am5+KjSLFB3+I4fuTVgXtXxnKbJwup3yQwVpz8r hVXA== X-Gm-Message-State: AOJu0YwwWXDxkpWm1GTBX8Y/RM3qE4mUwWydpxcZoJBTw6R/yt8UR/2i aDb4zsuA34LPP59tpxCah8NBNYlfoi7igOIaGzHOmFFLuF+aOTTYp01yRA== X-Google-Smtp-Source: AGHT+IF16fnRSqNz/L7/cW9FB3G52QkdiEsZJVhX8MZvcqQqyisn03wiyMq3WYSVvEg+vJd5ofUITA== X-Received: by 2002:a17:903:22c3:b0:206:8acd:ef7d with SMTP id d9443c01a7336-206f0655fa9mr61271045ad.52.1725679193210; Fri, 06 Sep 2024 20:19:53 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 06/17] bsd-user: Define RISC-V register structures and register copying Date: Sat, 7 Sep 2024 13:19:16 +1000 Message-Id: <20240907031927.1908-7-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::634; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x634.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: 1725679246049116600 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 04:27:22 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=1725679434; cv=none; d=zohomail.com; s=zohoarc; b=EZ+Wfx/Ls+zV4OjvtTplSiB1bVa7/gt6WFm31cp+vq4CqS0m8re07MQLcgY4A3ygxt8byM1CZGSF/7kp0h+vzFdSsatjYkPOCclG1GChZaE+Otsg3tyuuIlEHkOAGpzwz9llLB2608X+GlTfogEp/6JcEwp6Z0Yur0xROYWEUTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679434; 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=6YK5+2cSUNU+r/xq/RK6bCUAfpXhMWvxKXFMLLDunoQ=; b=f0vJJzrguYzusuzbK611k66ySp/FCmUuAPVqdgZ4Cvt9ebVhQneIyirinHUo/elyyk0UwbXD2TEqTs7PyV2KPpbcnBmqhQGgALn9xwY8FbsP4YKK8EnC5Vegp4mRu4SxzBMOQGJRWMN9+A2lkr87OwUDokerX6GVYbZnCjYu82E= 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 1725679434709176.83927309062938; Fri, 6 Sep 2024 20:23:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm1M-000590-TY; Fri, 06 Sep 2024 23:21:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smlzU-0003SM-5r for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:03 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzR-0004ry-GA for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:19:58 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-2068acc8b98so25335315ad.3 for ; Fri, 06 Sep 2024 20:19:57 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.19.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679196; x=1726283996; 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=6YK5+2cSUNU+r/xq/RK6bCUAfpXhMWvxKXFMLLDunoQ=; b=H2hevY8INN8+/6+entI/UAdkRlp1spr5Hzc80qMqKLiElS8wUqT/q3ZrZvffi3kFDu LBOpY4lgG/B2e4SkhSxuZmeSdrf2Tkf+Wkl7ztaisKkPnCYT+MjJjSyg6gBumckKZXGB dBZHN0i4C8tHKKyiRG86tAIeU0FBSsEfcVbkgrlJiu72DCm3GlAllB4rTcqR6pCGzLwQ 4486n1hljC9tHIxSIT5fH1r67/wAktPtrCeIEPnjbUTGLMIYg5bZ6CRIu+tTGvGZtDpJ /Zv2j5RtZJvu41K9n0L6Cxrj7g+cW5iHOteFsKxRuQhjp0d2so0u3lx2/652jJk35+/D ZhpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679196; x=1726283996; 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=6YK5+2cSUNU+r/xq/RK6bCUAfpXhMWvxKXFMLLDunoQ=; b=YPALUcqVaL4KhQ39MD96vjQxPwsZ3GUXVY4aEH5G4fiDNQAZO5SHVAAmroGrbECWx4 9baSB0u2pJczDixxEbzcp2rvoSNaXzq8aT/ZpLe7nZ02yp8BCeOQ3j+YtdAGqlvXpOKA nWGPMt7C8CN7wyCEgW7ps80cVOi+34yZOqznIEXcK/4A3vLdQuFPiT2P8/1AAgKCSuBd O7Tb141EpZY924ZN/b7CJOslaY4AQ7rTVx3i1IEDYlt73oLjFKcWozC0v+auufjOKMz4 L+nvf11qK07w9gsfAtwSZlmVrtb6yd0yNVN6CB/CL2I4zNl15RD0fjdUMBzdtTYgCG6O Jbhg== X-Gm-Message-State: AOJu0YwkmlwRNETv8TJXTRXBaoQbgZyuQySVtuahhUCXd7ouAz8RqJyZ LJAuHdaIcTTvWeEGjhdg3CD1ArrZazcmuRXuXLxOkNWG+AORfRW+McCAgg== X-Google-Smtp-Source: AGHT+IF78gAFUphNEm0z48aKovg92vAfyhnJUehNSxc0uJjcTzN18X3f7uWIviHObxg0cG/TQlyvdA== X-Received: by 2002:a17:902:c949:b0:206:ae0b:bfb6 with SMTP id d9443c01a7336-2070c1967d2mr14078465ad.40.1725679195743; Fri, 06 Sep 2024 20:19:55 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 07/17] bsd-user: Add RISC-V signal trampoline setup function Date: Sat, 7 Sep 2024 13:19:17 +1000 Message-Id: <20240907031927.1908-8-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::62d; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x62d.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: 1725679436660116600 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..83345f3961 --- /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_sigre= turn*/ + /*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*/ + }; + + return memcpy_to_target(offset, sigtramp_code, TARGET_SZSIGCODE); +} +#endif /* TARGET_ARCH_SIGTRAMP_H */ --=20 2.34.1 From nobody Sun Nov 24 04:27:22 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=1725679502; cv=none; d=zohomail.com; s=zohoarc; b=NMeKn+pE9Z0PnO7GXtAom/vbtKgj3RCV0oKOWjg6VAnEZDoh/LMAaMll/HxxwJZDKLH7Nqi2hYiwLOio6iGOC70M9wyWSiIMF/eDV/V0ZDuL7Nsdx/al8vMVtR+ZD5E7sv802aC3otLAacsw4nNyFqumi6Cd8Ewdghue3XkhY0Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679502; 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=ijXJrzrvqT25lTKKyc4yCnCiMRjAgFLVAsIqx7lIsn/bXREyMxrmZflVOr/2WM22Rab8SjGnidIs8ltRcSdNFsg46x3JbzjaSI2eltUc8qE/ByEgqX0THZ2EMbNelEppHRfONQJsxI4LaeNGVtjguvImxyoJo60Uj3g3B0jYdp4= 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 1725679502533851.8634103830343; Fri, 6 Sep 2024 20:25:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm3b-0007aA-4y; Fri, 06 Sep 2024 23:24: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 1smlzW-0003Sz-Ha for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:05 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzU-0004s7-S2 for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:02 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-206f9b872b2so9372965ad.3 for ; Fri, 06 Sep 2024 20:19:59 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.19.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679198; x=1726283998; 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=lcNoGQFrW3gLbDUmbnbq7BYJ0WFzf9gfLqMtu/JOn9X5VHjQNktApWbUaiM1bUvSD/ ttuYvv0dvRbbS8CjqYx+6FTsVg0mqOLFDZTwzHLYo5Ssn+khPcgGZPPsq1wl7ohlnmRW DSjwDFImioo8gRteonpW3CYLvH6YDGBvTWueRrNMs2Mplgts6e+X12TbLHrmgecAnQGz V5JnFKCar167AJUnEQsgGI0NdOEq/fPv0M7+WeTiarOLZWeLhgJYUQ9uEMr7q4ASckKv VaX4gQw+/7YQc2AFX+BwDcsV46J5ue0ns99X71LwknuXJwPwH1Gg4oUwZGYrVDl+GR7K oCig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679198; x=1726283998; 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=szY/uAXFZZOMYUzaFp/OyVFeFPOho/avdZ/ZhufAffHfSZibdoIAv/nC+rzhafy9rC 1PxsOjqiV7+H8qoqoBp/yHF1rOyjAteCJ94AV/g1LZCGYZObare3Mhopgxp3roOKz3bx LxV9yeosvHe2zWz65842L5DhrDYqUt6/if+qqaMxr6r+xcahi4/u6x98GgsJmudhDWF8 Z1IqsojhRll39yF7DPLIXr6ZbkwjYRlWhrIw1bV4FSTIvEC/k1pdyzBKZMfae2eyPJXM Lt7pgfngwYPq9NQI3lk8zGG1eI5fJqvnjRH4xeXDaKmJrktGYQ44ermtRvT4JozBddBC cu9Q== X-Gm-Message-State: AOJu0Yzt4jE9Iav54UlOF+Z3Fq0nl8GAHhn5Ii5R09M3+rkiWlVLKtVw XjGE1HB9QBGEXsB9LwwBPr9yGCNuoXjrSOfzMxyiKSHgmNUcfJ1nqPEd0Q== X-Google-Smtp-Source: AGHT+IGSeYqIFIa4hrro7X+zn+FU2KWPVOF61BLwTRfHbF+DzhN/hcffOKZeZnDMZHMLDeysf+DwAA== X-Received: by 2002:a17:903:181:b0:1fd:aac9:a72e with SMTP id d9443c01a7336-206f05e782fmr53928005ad.43.1725679198243; Fri, 06 Sep 2024 20:19:58 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 08/17] bsd-user: Implement RISC-V sysarch system call emulation Date: Sat, 7 Sep 2024 13:19:18 +1000 Message-Id: <20240907031927.1908-9-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::62b; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x62b.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: 1725679503126116600 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 04:27:22 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=1725679481; cv=none; d=zohomail.com; s=zohoarc; b=damhhJ9920nmgLBC6mqAGEEVM2rkFxWJ7TKtPBGZZUfWJfEei97zcsuONDUwZh+8u/O4LA0FUUJANu9/F25bjBDUY7am2sek84djeVUvR3512OrtlujOAXpOoerZK3XuRtoOd/C+Lwn49ygULwQkFyct5oAXcjTUCfopt/WJ29c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679481; 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=UhgZSr77cs856626csVUMKafDNElH2DCETLtbp74JlY=; b=WfE9Y9WTJRydbciVnGdqRG8CqAA1T3BwSENdjAfty/vb8vgSlqv8Iat5S/2PrQ7iAuU2Wmos7c67wlMrqABM+l9/YSzrTCNdmiSBrsdw+iyGh8wgx5Uz78+Uo70wdk3dUNFqRe1CV0vXNy4ul6BPcT3Ny6tyIOOpAZTfEqUanN0= 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 1725679481437119.76391553032954; Fri, 6 Sep 2024 20:24:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm1l-000776-LK; Fri, 06 Sep 2024 23:22:21 -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 1smlzZ-0003UB-2s for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:07 -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 1smlzX-0004tR-5k for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:04 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-718d79fb6f7so1269130b3a.3 for ; Fri, 06 Sep 2024 20:20:02 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679201; x=1726284001; 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=UhgZSr77cs856626csVUMKafDNElH2DCETLtbp74JlY=; b=HIt7zlN9TwX9VNSZ9iXBxdku/wKcv5F1kBa+W/S7XJ2HScD1GAVNo9UMCvO+GK7ii/ BgMN0rhiXbHZ4gJ44YgX8hhBuQ5VyeeKYsLdR9skOCoYqhbQuupGQuxoLVsdmBI7PxGr 3fVVjXwEYsPPVusITgkuG3TGJ+1fly86VWWAjm0y6PSVIHlz09uLegmq02fv8l2X9H85 NSEskOTJIXp3c9FeDnHb5x9zyPsUpPoS6K3r8pjoLo5DFW/0kcZ8NNWNiDVGg2i7htY2 CW0ki/tUoWBLUfDX87twgMRcDJ9bO0jKDYw/UOVB5iXmqVqHCd9axrxXy6GSAiTcAvLu G7KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679201; x=1726284001; 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=UhgZSr77cs856626csVUMKafDNElH2DCETLtbp74JlY=; b=vxEv1EBEE+J0XdLr1QahdGN2zHN4RjXmc6dbFtVoJOTJwc9ztXuLeTXkGFRLn1jkmU NPq5e4jm1y4cRLA0r8E/fArbGP1AEDoG+sX4LCqgFvD70KaNtLOwJ4SitlkgWFtnIzKg ZdrmmXVF6/BbwjIKPWTvZTz/Y1WT1f193ucCmpHVoLPQFDDc6lVjU+SWeb0y3QbOU5pp HTrhIJXyxNrPV4p7uebGiDLcf3F1Rk9IwFNHvnP/Dm/CR11tZQLKiUz+bobOedWFGDOV OwiLcFBuORT9A6vFrSsVkxKIh/f2KH/DrE76o4TmpJHMGKPvlkNjzrPjkYXWm3j7LkfW oedQ== X-Gm-Message-State: AOJu0Yw43o4iXttaqwJyRtLNhtjfhf7xm6JRItknf8lr48h7I5feVo5Z +o9kgJNIKHFsG3hNYHys3IjYr6kzWNFAHMW/fksnl0hHf2eEHD9dQCF0/HSb X-Google-Smtp-Source: AGHT+IFGXLjjbfflLgm8LWYWRQa6AWQPNCfY9vh9gNK/nUCaaPDtT5MSQTeQ/dgnSlrxLYw5NuQHRA== X-Received: by 2002:a05:6a20:2d23:b0:1cf:2ba0:c36d with SMTP id adf61e73a8af0-1cf2ba0c374mr1142481637.3.1725679201242; Fri, 06 Sep 2024 20:20:01 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Jessica Clarke , Kyle Evans , Richard Henderson Subject: [PATCH v5 09/17] bsd-user: Add RISC-V thread setup and initialization support Date: Sat, 7 Sep 2024 13:19:19 +1000 Message-Id: <20240907031927.1908-10-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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: 1725679482849116600 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..95cd0b6ad7 --- /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; + regs->regs[xSP] =3D ROUND_DOWN(infop->start_stack, 16); +} + +#endif /* TARGET_ARCH_THREAD_H */ --=20 2.34.1 From nobody Sun Nov 24 04:27:22 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=1725679656; cv=none; d=zohomail.com; s=zohoarc; b=MJP8pc4mUwbIskELdEulMSet0CmiGoEtnKjZlTi6QcbDG9P8Vq+0iNAmZuXRLgPCfJ21hC7y7cqpQh8rbYYONwL/+kKucmymr150QLKfOCzqufK6WRGhuoDSf+r9E6YPGNm5LG9VB6UPYOA/1IjIr2/JGArVKOQ3NpmbrWzMrW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679656; 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=WSl3ZBu01O5rCtf4wN4kpnL/fGiPqGwjGAJ3f4YnqXAWbZzQ5uXe3ShAZNqW88k39ZwMx36fpsX5tebRS/1L8YavF8Ynkzp3BdTFKnmP3M2H7hyAVQfptscpVg85xLKwK5yyJgh6IjGiVBJ3y8yyOCmUa80M071THZFavoNlmkg= 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 1725679656182832.7563352207975; Fri, 6 Sep 2024 20:27:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm2K-0000Q0-0Y; Fri, 06 Sep 2024 23:23:00 -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 1smlzg-0003mu-23 for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:13 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzb-00054L-6O for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:11 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-7179802b91fso1628810b3a.3 for ; Fri, 06 Sep 2024 20:20:04 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679204; x=1726284004; 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=j1rAVeYr0tFqcYyeW/At05ZyyNj3ldetPuRwGZz4HMAi9dTKNVH24/EH34qkXcHx2v 9pWVq3iSBmIMFgU+PtPEj1QN8IkLanKKqDpU/NrmnaD55PAW189vTK9uZD6nNKwTM81p 9YcL2gP7HEuZ02Zz3OyK/TvWtc3eOsXcTGRHA0NttcQvLPnv/9hcgaWDd9dflpReXR1Y /AWQGL1Aid3gkmIty2CDP+s2ywxdPp+XFnFSqoqmqiteFVtMKwzJgDGx4PpiZ5S4iDFY 38AYNTBUcEkHRdBN8TVxiDG0b3p8QuQC2q6mg7R5AHwhyjZ1QdS1YJmlq/vVy0MbC4RW Cb3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679204; x=1726284004; 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=AgXXDC8bdb7fkAgyHygcK2eBvptx4Kx1LKV8WA4li2UFQ//yAgy3TmU0Cu7boYZ66X DXPjYV4cBnGKDoc/5e583KlS3ptzqNLNPVMdd4DbfJ48mycrp1/AJvK0A8zpjkOExOGq Dx+29BvDUbfXLSs0kz/IoLFpB4hWYLrmJYcvYWtqXE4mF6qBljPpwxiHdhxZJXEpF1m8 C9oj4zldZ8p2cqzOKKynOVoiMavSs8mQvTrQRuk02LzSngGUsPHqrWzQSJZ1pdXcdvGQ C+tqYifurYKB6bx9sYSh0+4JIDlNc0Tf3hb8RbAVtnLFg7adQmLF9hzFbvaQkbAWrviF +zZw== X-Gm-Message-State: AOJu0Yz917Tp8vWAvzt1Gm2el8AfoNdzP0X1e6RV/2Tu2GI42cZcCZ84 0pVZG5f1NukSuxCoaRl1LjvS/n4sqgyJZ37LrbYZPR1JSeyyRmIzLQdp+g== X-Google-Smtp-Source: AGHT+IHgL8LXtdHFAiqGBdj0bHsGt1p2NW3DT98vzodiC9Q3OWvlm4DcMeOmIgCnqIBTonBzc/ZcnQ== X-Received: by 2002:a05:6a20:d50b:b0:1ca:db51:85df with SMTP id adf61e73a8af0-1cf1d05cc9dmr4755661637.8.1725679203823; Fri, 06 Sep 2024 20:20:03 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 10/17] bsd-user: Define RISC-V VM parameters and helper functions Date: Sat, 7 Sep 2024 13:19:20 +1000 Message-Id: <20240907031927.1908-11-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-1-itachis@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=itachis6234@gmail.com; helo=mail-pf1-x42a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1725679657441116600 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 04:27:22 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=1725679326; cv=none; d=zohomail.com; s=zohoarc; b=W3oHF6NaDv3dztWyv7xw5B5+iWa9Q/FPfjkzoKmMUVqlCRX9L+RlH0TfJQFmLGn3l/Z2yMHnoC7M0aGSKouw01e8fVHH7hscMYKVRfkkkWxHrbmuNWx+mRJeqgl21biEpmRhgrQfBXgXHfRsXC6NRXP9FV+pEiq06gSIC59PaEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679326; 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=jAQTfRWJVzz7ltG6AdM1zL6YrIEGuzLEa8e/gLZ4tJ1rttbpyNM+kjRCgU6+gxJT01f8aESr5cPArwXkKLKxufq3ho11R3Sh7XlfYAuPjuAfCsvmth2XgQO7PQ0AzZrCdDyZwLhRqnFDO/08/Zl82jBD+V78LnxdEYF/yO7NH1I= 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 1725679326104326.9683997018766; Fri, 6 Sep 2024 20:22:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm0T-0004ZY-V3; Fri, 06 Sep 2024 23:21:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smlzh-0003oo-BY for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:13 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzd-00054g-EQ for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:12 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2053525bd90so25433845ad.0 for ; Fri, 06 Sep 2024 20:20:07 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:20:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679206; x=1726284006; 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=QYAW5wBcQ7oxEc7QHMFVZsuiHsW/JFJtAoFToz6l/1afmMZkLTHZlj9nfRPYr4qYmt uaujb78IsUa49Kxd+6aohGeV9JyYHXqIgIW0D/uTucsZj7zUXYy13XSxmFFsVjtesYm1 /+9wkASJx59K7pls3mRqRdjtBXnT3Q/hJ5Nbg9PL/DeBiPd48R/8gBKxZSsrBg7L2SEU zQbhWzG+8z/UQwjbZWxnv//wyvbDbulX1SouEl3nwo/U/+fEW+yB8AVr0yxZW3i3OU/z 5HGtgqM0N0kVH50MunebpnSLbBr/OpNg4/6bRYkBL13g7k7Cbgd4O/tI2WCVXVZ2ZXYL zRJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679206; x=1726284006; 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=Yl77tx/CKAaK2l5pG66CMUiPGCu9CevR81880QCAX50X7D9nMurbnuKjaVqll2UndP FQ3p4xFCd9ahYUQWINp1YzHgIYfq1YJquCCgKpuBzCw3hXeJxzrUH49Hr7xcXzOsUog9 5jCVS7lkj9glMS/j/r4pD8VpANSMHlGy7+mJO5X4HvxDXXodK2EiA0sKqHZXhVEna/Xs GRnC4amNOw19G5BDd5qnVNismPc9nVYIZ+CRpgcbwAGLl1XEq2tU6lNq6Pt2ZhwtPEyG ENwcedvCWX2L3U1eqpp5+O4p/FMhXnzIDfseblZ2aA8Kokh5BZHxOvZe3Z2iId7cFKV5 RShQ== X-Gm-Message-State: AOJu0Yw6aAR2IpobIAVmxposLJy22OZbjLgOnxj/L+PyKc0hgT1Yxgiy ZS0QlKqMhJ9wJ4eF6y6Vx0Dr8OgBt/PKmVWjyqiy3DNgL14vSw6utVTF7495 X-Google-Smtp-Source: AGHT+IGB7xNqc3MfaWGRRCOsaA/d3TWIQr6mHUy1htNj95nzFsdXUTEOEcLzMKPl3zhgZ8rZMD3QCA== X-Received: by 2002:a17:903:230b:b0:205:80e7:dcab with SMTP id d9443c01a7336-206f04e1b4cmr52801235ad.18.1725679206626; Fri, 06 Sep 2024 20:20:06 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Jessica Clarke , Richard Henderson Subject: [PATCH v5 11/17] bsd-user: Define RISC-V system call structures and constants Date: Sat, 7 Sep 2024 13:19:21 +1000 Message-Id: <20240907031927.1908-12-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::632; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x632.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: 1725679326313116600 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 04:27:22 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=1725679585; cv=none; d=zohomail.com; s=zohoarc; b=Ubu46kj6TfDv9e+425q9YkgTE0hwH/LtJMmY8u8w+RYHIg32eSRwUoW9M2CPs8ao3PaLF4KqykoikT3ZOHtjab6uTFJTss0gg+42kmxZUuf5pyH+Z0jtJ1DZJe7qC5y8lhfd/tCrgKG+uLJKvBePfjsoRrBlxyd/0Tlu1MNx7Ps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679585; 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=XQ4RALy2EL0q+7CyMYKb/BedfH/fDklDQQ/ESxnuBBvCcJAEUyD7bJhI9sv6JSFp9hizwgTzWEZU7hO4u4brCMKnvSvMPOto0DBGtGCc0pPDYb35ca97d/aXTQCnDkOx98uoOpMhpIg9JPh+hCE5+QHcLszo1opbjbrIl2pr3ho= 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 1725679585891485.5326295317727; Fri, 6 Sep 2024 20:26:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm3A-00049f-07; Fri, 06 Sep 2024 23:23:51 -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 1smlzh-0003or-Be for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:13 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlze-00054n-NS for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:12 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2068bee21d8so28854485ad.2 for ; Fri, 06 Sep 2024 20:20:10 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679209; x=1726284009; 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=eF+TAu71Yd3EMtYgov1UpmkBO3EXxsHidxQxBnlnQnVXLe4KTD8FsuuWphlPWcnQ+L fGN5MoYMrNZg4LTxxfhrn63GJuLjbUmtQL20iMfWi1jodH5pGrd1A2gLzabChhiJizBZ uKnrcKIEugh9xbmA07z2pzEuK2x+RwRmi2f5Uw9uwrYFZ2nc3tG86VgM62secwqmqRLO Wa+AkJ6iU/5hEsh4R8f633OKtInpl7vuPUpXhX+bBemprKOlkiNvNcSUMJ93fXMDFcKF LyJtUgMk4kvHvZ1p+2LOxGpY30TzmfvsbG917gxc/MXKfl7Q4ESPomLnpmNCXdsscbOJ O38w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679209; x=1726284009; 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=NGzMmnURr5sMLITgKKXRlRsVEFetNu4ASt3JoMan608MdF1cxZDKsJMOcJxT2JkEnc naGs6V4OUBw7vPkVdL9OgxU+xNePY0z4TpgdGM8HSy0NW5bp2SHqytelloPWyKxfqmfs 2SRLSyB+STG8t70zB7ZlF5AGmtIPOAZa8ubqXaTvbV6icsO5VcuZOWMK4Lgb8IvAE8sb ZquITnnBpKObLZAtY/cA59LdwrEA7xsf+8yacTLZA076WIiFPvA6U0b2TQcUei77Kd3C pfPzpokoyDYKzSrudPkZv+m+gXLvCYDu6dnsjHXUZNwF2o1w6kOBDdLLMkxUjPYLixjX 5v6g== X-Gm-Message-State: AOJu0YyEO3tCCINaR3uKDh5NQRaZcQzMPUIVh+w/lD2LyXBZMPG5dvCL 9KET/YP3XeErp9SzQ0SNI6o9vqLI8Sn7UdVvaDX/bfFM+ApCfVq/qRD+1A== X-Google-Smtp-Source: AGHT+IFBHWvl1QcceNo5pwo7NXDZ3vu7PzMKIptxtFd572G3+8yQhqRvBeNsCXvlNmn1XacBETvY5Q== X-Received: by 2002:a17:903:41c4:b0:205:8a25:904b with SMTP id d9443c01a7336-2070c1cfed1mr17256495ad.57.1725679209148; Fri, 06 Sep 2024 20:20:09 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 12/17] bsd-user: Add generic RISC-V64 target definitions Date: Sat, 7 Sep 2024 13:19:22 +1000 Message-Id: <20240907031927.1908-13-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::62a; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x62a.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: 1725679587115116600 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 04:27:22 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=1725679448; cv=none; d=zohomail.com; s=zohoarc; b=cngfKLUHlRZ6SpHuny1ABq6ftxYkBYQU3bOSSDj9zdCL6P4agneUM1NemD77YnnRG6zDSjO5zfl2BfC0jw0SaYnZYHo1OhkMAOQmmv3as8pHi4t7D8AHUWOvOBYVwXByW61mcLCFNAYOTLjemjL4v42W3IBYMruGPVQBq/+iYas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679448; 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=aNnLxKGJXvhOjlsxuxB9M7+k06p2JCrWdsadfSkpyTX13T5W+C+BlDztMCyOrZj2+W9yD9ZZ9wzbW9tmZ8TxE4Hn51/6zkp2JWQDg7Icfrq8xc9k43p8tDbWQcTf2IfAFxJq2cxtYqU6gIwnaWA6OlNsgiE2Pc6QyKTpMnDGCAM= 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 1725679448566254.7260832119141; Fri, 6 Sep 2024 20:24:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm2R-00012O-Nn; Fri, 06 Sep 2024 23:23: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 1smlzl-000428-SA for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:23 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzh-00055J-6a for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:15 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-201d5af11a4so27017455ad.3 for ; Fri, 06 Sep 2024 20:20:12 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679212; x=1726284012; 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=MQQNx/FQaY2xRkbOwfwSua4kLHgXxAvZ8RibOmvoTnnk9OAFMh/q5QWmrwrlcReo5Y 7D1ZP2yA8Mi4Fr88l5ycCWshKvBHnncAGJ7YRTR3jYvg9oIAxkQl0LOGRewzMPnueLBn 2BOZ2dezJPDvmOD+2C8SgU++3nkub1Qb3yItR41wdCGQOzabqY0F7L3uTplgn4Hi0b8v v57d/chC9yFc4WSbGgTpKH4fUkSYGFinUY0SrBxCLZyJzwBBzTzZmH6pINUtCeTrgPzs OrnY2GkutjFuKqLV1X7dyvUGIke/I5rJj72n9LgAz7CRSWvPD1GpC2frbnCYB560/Pn2 p2dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679212; x=1726284012; 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=KGzXIck2g1z/+ADif1+T6ZVg2aXwO3MX5sj8aQ4u2kyP1dAFkdU4Tg1vOcr2+xBTIl cVxHGv8VrvGSexs4zzKXxLHFEWiWD6l/+r2NmP4EgGdq5C86ybfdZNmOhrQaP4QWtU3e IFC6KsKRuay3liWfQU8aGNHarJegjldLBz8mSqQfgc+2r0hZ28KbLAN/etod00KmBddA Bf1I/KGmAaondV5AWOQ6xDRl9eJIL28TeAgLypHrm5RSmXfXI85Hb+1ClyfUmUanlW1e ulCEGCVteCkAiC9NmfLppLfZKUxIm7wc9GOi82yFzVwC1Zxt0vXsrJy4WMe7GfZworqS /AjA== X-Gm-Message-State: AOJu0YxihN3DpGtiOK/qYQObsn0Zvz/P+3ep0kIvTejCzuWVKxV+SsAz OHKEumk9nIHBemctK6d+drZ5xKTYr/BIF3I2T7dGQicD0gePsTZLDP7zIA== X-Google-Smtp-Source: AGHT+IGlgux1o5CaPCDcp8A4KKIlREAu3KrBIQYumhlgC6nDjFe8rMbxhTCjPkha/Q4++jkYCSRt6w== X-Received: by 2002:a17:902:dacd:b0:202:4cd2:d6e4 with SMTP id d9443c01a7336-206f0529937mr66241675ad.24.1725679211590; Fri, 06 Sep 2024 20:20:11 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 13/17] bsd-user: Define RISC-V signal handling structures and constants Date: Sat, 7 Sep 2024 13:19:23 +1000 Message-Id: <20240907031927.1908-14-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::62d; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x62d.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: 1725679450960116600 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 04:27:22 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=1725679382; cv=none; d=zohomail.com; s=zohoarc; b=gSKnKuZDY9Gx77MdZ4w6D/tDY3fA0Dpr3aRw8FlC3LKFNrEq77V+hvJ1fHWObDGMMftdtUVX2lNEre4V/f3c53caAiBbhOm/tL2/vpY6Epy+EV+7EITXk6kH4duyZXgcKsMmt7TrTYxcJPnKktnESB4JWgQDIOE/x44KXT3RKes= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679382; 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=dk+4IFdu4BJJnerE7fpkRo/MZymAA98ou6PZHZI6RAczYe0EFns4nto9CKyRuY9aBs3BIxMCu6AXC+TTRSdCv9eBhrCoq18rrFSXMe5kkW/Sfm3vuQAH8H7hj9lIk9Rzl/5qWDENUW39C0sVt1+cJBJDPX+DZvsNuKi4Cq5mf9k= 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 1725679382273282.71442991622246; Fri, 6 Sep 2024 20:23:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm1l-00079i-Pl; Fri, 06 Sep 2024 23:22:21 -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 1smlzt-00045J-1h for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:31 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzk-00055h-J8 for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:19 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1fee6435a34so24979445ad.0 for ; Fri, 06 Sep 2024 20:20:15 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:20:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679214; x=1726284014; 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=nCMfsn7AxDRj5Kr/Fzv2XBtRMTVE8zODKQl5uGHJ/miNVcdrZklfdfvqZERHdo2/Nn xl1Gw9xAkp+N5Lwi5U5PGXugYsURYlaqnGf0EnxLVaW2hYCD9tlTjA/ppaO/KXQqOdCV maFs3hBkZwTqFa730hMzJsghsYoex2/J/sPuOW6LgXJLJfx0Agii9OS8wKBLS67zSBgf +jl7lI8qnMga3yiVlQi+Kz7ZkMJeELnUv+XOJcyBNJUlU/g5RUhI7zgZKzXDwt3Cmhp0 FZY90e/DjWZ0ZtoSRYzil3wQWIToSWs0wFNosqWtRaibLZH6D4nJXnLEwV0xUWTCcLeB J4pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679214; x=1726284014; 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=FFJYoE4+rcVkqU1cuqrhC9vdOLXd5mIMgDCMM3yla1qXeb+6G3GytUuCV6e3jiy+Wq a4BBIQgtggWgB4nE8sTnD+Mqtl/GLpRWvgzxJByvKNz03zhepH265bdH1yOgANtZg1UQ BQhWwbwAZgSS6j2iCZn6vfdXoiYbdFnDAVNo0flltvMUVsPwoPlh4h9wOjNoVb8p1blM /QgBS83f1L4+9kLJAmw8FuNZwo+kdmAEP0Xw/f+swTTYOwS37jGlOWoR7MKGY04NGA8D bOvVFC5f4yg+CdiTvxr4NTvg7/cO78uOCN5oHBAyalZJAB76WTZvV7k68ybzIp3EIKkl mdqw== X-Gm-Message-State: AOJu0Yz6vCbOt5kLFHZu7Il4E29MFyU7vcTZ4cAw4ea8Y3Mqd7PsV+nL XSt68+SeW12Pt9elze7PVW6/IADH3/KUPzq6oFcuoUHbfAd+tShHgKBjfg== X-Google-Smtp-Source: AGHT+IEwsGaz9Z7qOId82Iuv1c7ez+ds6Smp1uwfYAK1bd9I2UVzrJkTPOpSEuwv6IZ9b3snINHfxA== X-Received: by 2002:a17:902:f78f:b0:201:f0c7:6a00 with SMTP id d9443c01a7336-206f062306emr55056325ad.53.1725679214089; Fri, 06 Sep 2024 20:20:14 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 14/17] bsd-user: Implement RISC-V signal trampoline setup functions Date: Sat, 7 Sep 2024 13:19:24 +1000 Message-Id: <20240907031927.1908-15-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::62b; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x62b.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: 1725679382683116600 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 04:27:22 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=1725679589; cv=none; d=zohomail.com; s=zohoarc; b=NtecTThDqKcigVqMVep+BpJyu0MOKoaVe7NXvbeNqUOkFACGRgeW7/kwiXN4Y6Ffqaarh4UECRh4U4b7KslZCZxWUV2pWqFv5EX4LNvqXT76mJOCSPzn0nTsd58YFW3hiXs7CVJQGdVe59jAgbUxe/K6X0VyrW/y7NBVW/IYYV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679589; 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=i9WdblgnrUVPMwB4cLjhphWFogZNonCm6qJ38mRWqLeR6KrEUGjBU7AMsYssOsO/U382Bb0SHibY4zFjOI+Tu21BN/yJu3XdJlftLQmUWA4FR0HnKuOZv5wKDiQV2u1f+l5xeljyFk9uyZ+t9H+gKBgjNLdGy9hp7VlAnop7Yy4= 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 1725679589744911.637359506023; Fri, 6 Sep 2024 20:26:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm3K-0005rs-Iq; Fri, 06 Sep 2024 23:24:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smlzt-00045K-2P for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:31 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzm-00055z-9V for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:20 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-7d4fa972cbeso2345308a12.2 for ; Fri, 06 Sep 2024 20:20:17 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679216; x=1726284016; 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=cyHApW9WXvxnTgEMYzhO45SyY0PjsYAR5Ud8bLhRLonROqy3nEMzM5zHgs3Jsb/+RW uf9oU93LUO5Jlr1irK7xccf+obLCUqqGDg5oCXsCBzrrv+zgVuZchcSbXqffl4dYYUQw YfK+HRDHj349ymA54rTLgVTWz6JDmLQdiuASmiNuO2j6tQGsv/Y/r1grhGAEP3rZIObp ybK1nJ2JbmoSupTQqDTg4QKqvHg3xZiXbHUOprhNv4FAqt2IKab2LxZz0Fg4eRe0DdNA Kb0gEEpqWJui7Pu7HRQz7PxfiOi6PyVp3bGzgFAIbe1lE9uihHR2+d6EOWBrbkXqEXMD YTXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679216; x=1726284016; 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=XNeq0bNWOZwYq91xYUymz8yLIspjYLYY1LLfwdYGkdydlIzjRI92sjObwGQdxdNVcJ YBnr6ZegMMqIjn8vk4KuoU8uNKHzl+hSniksxsknwetqu19FaM/tP5K4qikRa/ewXQiQ Stfk7eu1JKsZZPDdkRkuRrZy2F0Db2mJQkMMLFKTLjOxqaNk4/nsTPPSe7w7Y7w9uOGl XYjbFnzXjDWR+ItJ/WKsd8GtCoXh05f2+4om7JqG3+Gdoq9hoUghv513u0b+esHwVo8e ZdLzGrwq7NbX450GNMOhKiuf5ojKVk3xh2AHHCZWAJLJjM6nmaFAK0ERXls88OtNeJf1 Oavw== X-Gm-Message-State: AOJu0YwCWG79YU/Ju81z3zGDiRzLwLK6JHJwAN0qyHhCNdYfGkzWrOYD PnY2zdBEOD6xTQh4SLjN0AhMmt3LNNVFzRe3DNtMmUMxqj9/mtbON+JsOw== X-Google-Smtp-Source: AGHT+IGtkE+zlj86r0vToS4skCXEto0qt/uIG/uMrwycEPfLWJp7r6Yo28qsQLdKFX9Zcs2ZFwfBkw== X-Received: by 2002:a17:902:f606:b0:205:76f3:fc2c with SMTP id d9443c01a7336-206f05157bamr69164895ad.16.1725679216575; Fri, 06 Sep 2024 20:20:16 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 15/17] bsd-user: Implement 'get_mcontext' for RISC-V Date: Sat, 7 Sep 2024 13:19:25 +1000 Message-Id: <20240907031927.1908-16-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-1-itachis@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=itachis6234@gmail.com; helo=mail-pg1-x532.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1725679591500116600 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 04:27:22 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=1725679434; cv=none; d=zohomail.com; s=zohoarc; b=U/kRUO170qmljKgfwoXi3Yn7Y0SLtXQtWJBOe2T28S2X6LhHb6vqeyJVgDTRlPPKKpzJYRyjKosu/DJr+y/K5Pj36N+c10egcDYiCKdj1YNu9QRkVPWfNX4V2wVtMojBJTV+s6UmzW2qgOdH/2nKXfS7CrPiT7HZuLaVOedl/v0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679434; 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=gLmvNP49C5b/kT0V4XhI3r4sx3P+q2ZyUZTSiTzhXnZczW4pPOpTcH4IzVDhSW2ThwOeRVIO5lKQPp4kG+APaKwDFlKJxzDcxO3IRM9VH4UMSgsV/Jk9vxx5gjIX1CwVEcLFwinFhMc5Ecq+RaeR01H1yFK5fszMB5pJ95Am/3o= 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 1725679434716612.1882402283511; Fri, 6 Sep 2024 20:23:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm1k-0006sE-Rh; Fri, 06 Sep 2024 23:22:21 -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 1smlzu-00045O-Cx for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:31 -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 1smlzo-00056C-NC for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:26 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-718e482930bso156604b3a.2 for ; Fri, 06 Sep 2024 20:20:20 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679219; x=1726284019; 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=Jna+ysd5KOlghVrEiBvM40bFyRAORfnpETeWd6JmActI02m7EmAOGVUNHaQAh+bt1b cSKe18XL7Hagj6LiCjWEYtEM6BXXk5BD/oArGYPuuHqmbZkKiUAdpHymcaMKWwPx+6Hp kYXbHhIEigDYr4bUGmW5xYvcytLO8SHvyj0wSjbO7h7VjjC0rqLiM97ar50CsE6Hi3V1 xO/x/euv1ZLWpWYauQJ5vdPdpe6Yj7iZDXVe/Ruwonh9eFwhO74geJRrK9C6m74M4FDa 1i8iJa4jbpDqNwLcjGbtEoj6Iwto65RcFAlBiIlkVo1w8w3Wh0xB+2MSkLv34uLT88i8 /lww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679219; x=1726284019; 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=B9peipUvs/PkZc3H5O9rHsJv9liz2s2GFE9eVyOtFSt4Zk/sWmmqt6C+8nSKl645J+ gii6add8BgoPtKSpb000KoydCrArzCZZVhHGMDV9fjU7zsZ3QwrjJ9d0kE34rUKBHO4c am3ffnfXgQNFnxlxFDmtx3iSNnSAF5091rIM60fhOzv1iJPrR4cqS8QCzmhzZzx+8BLK 9oDRroFOp2r181ReC3wOfE+LI09MsCOWyPy+9SiU0GOWYcQnq3mdldiE8636r42l1mK1 avGP93cpdubZnHOJfaXxUIa+2I61WOnEsnsnqYMSQzvu50XLQC3P2H0fsb30vVV++GCu bBQg== X-Gm-Message-State: AOJu0YxBVhkDKhtz8Q2VPBKHzEucarwqT1CgvzkwMm5kH8mdoAut4RD3 CdFIns8kfitTB+AyFG2LwWOW+biEJTTOJO3t6NhnguR8eMWeaRSQKEVNEw== X-Google-Smtp-Source: AGHT+IHEVYGX6yWdt/WnKyBAsV1A9AGHbC3V9uiZXVIm2f0xT3fnLLra6KG8Qo3WiJhfRryRx7++BA== X-Received: by 2002:a17:903:2442:b0:202:32cf:5dbe with SMTP id d9443c01a7336-206f0673077mr66291785ad.58.1725679219049; Fri, 06 Sep 2024 20:20:19 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 16/17] bsd-user: Implement set_mcontext and get_ucontext_sigreturn for RISCV Date: Sat, 7 Sep 2024 13:19:26 +1000 Message-Id: <20240907031927.1908-17-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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: 1725679436697116600 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 04:27:22 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=1725679475; cv=none; d=zohomail.com; s=zohoarc; b=M5e5hButCPNrIITlTMG0DGGB7O7aJWZwisb+Wr6jT0nbrrvVwga1WiC1rVBX3pWyKFKTFSyMGGrpQKwDDj5UdYkqXq5kBntelj0D5z5fjy+RsNzQcViKqTPoDPxSdDwv4IYGZ0HfeNTN/Bqe+LwT2ZrsRK2fbcRF3CFj1LJ3lc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725679475; 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=feDxzSF3Gw7hvAuonDldPl316e9dPQ9MTI8oD0Bvbc7lFWjHr6zoZKPrmpqeeJNZJzmizgZLhQspD4m9Pmr6ewyzahKZjTlG92amSA4yjKnkfOB1f4gxzM1ZPf17ch4GVr+DNVHAQYOoXLLpilRhtpAlHsizTT8QeJ9jtjoI1Rw= 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 1725679475580425.77990211038707; Fri, 6 Sep 2024 20:24:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smm3F-0005kd-TO; Fri, 06 Sep 2024 23:23:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smlzv-00045Y-W1 for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:31 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smlzs-00056R-Rf for qemu-devel@nongnu.org; Fri, 06 Sep 2024 23:20:27 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2068bee21d8so28855175ad.2 for ; Fri, 06 Sep 2024 20:20:22 -0700 (PDT) Received: from localhost.localdomain (115-64-160-35.tpgi.com.au. [115.64.160.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20710f1d4c6sm1703745ad.187.2024.09.06.20.20.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 20:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725679222; x=1726284022; 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=HMzZB1a2akFzQ7pwRMTRFaghctca1ea3oHSxSjsKvfsKU7CAPUhUe6kiUABzVPROUY Y09fgsngMfOeqFw+9eY4OymiRecHAILdnmIZG+R9adGjV5So05pJW9Pgb6PAdXQb0Bv8 6NioB3N3fSuMWhgrPcuZ0viyh8zy4S4zskzm0vtge/xNnV9vivzfQPhu+l2I+2S65/5O i0Ui43mOcRxjZGG930XQpq9CjmUGR6pguBsLJBTFGGDAqhr+6tIe3jA/0FguXcDqiKt1 QZKH/DlDrqZlx6tMc8YLIkohWpHmSsXqCH31MROgEYH7Hqn5+C7abj8LpC8BkSYMC0y2 TDsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725679222; x=1726284022; 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=upLE1VfZyT8o4nKx5uf6/lVSPdAM5ivgcq/JyZoyanxqDGGjU/oXdKEivMGXSipZme 5gE3Xf07pgVXeGrdorNCqVgIEbAjCYj8UARDWiE2UWMhyxByUzNa6NdrmFV/TfM3mw0V 3Ffk3VhG+3H2Twbwhv/jZ4qV4CwlJUoxCZ9r1sYCyE6AWdl0eCR2n7gl7S2dGMsTv4Rg TlYvaEZpSJTn9ZgOCTKR67TSKcUKpLoRpXKJ/HBBadEDgDNO1QrVaV4joWMEGBufzPo2 MFBOLAci4r1VDa5tBdM+8FQFeGFDwSltq42ayj/eWN6qZVVsBdXGGFkxE4wLUyxM293x d4CQ== X-Gm-Message-State: AOJu0YxtlvK/Q97c/Q2hsgkwWpVxb9lUZhMCA4xqs9DDKrmiEtmjYAAE /vU62vNOhTlVk5T0ZZFeXydNlGb6VMO4tjZzqH8bD7O1iQuHua8nE7LBlA== X-Google-Smtp-Source: AGHT+IGUyBMcYb40djbR1sequ/+q/0Qj6iSvwbWh0IgiybVrIVuR4iceyYyDAU85+GDriSos2Bc5dA== X-Received: by 2002:a17:902:db12:b0:207:1570:13e8 with SMTP id d9443c01a7336-207157015e5mr377305ad.12.1725679221530; Fri, 06 Sep 2024 20:20:21 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Mark Corbin , Ajeet Singh , Richard Henderson Subject: [PATCH v5 17/17] bsd-user: Add RISC-V 64-bit Target Configuration and Debug XML Files Date: Sat, 7 Sep 2024 13:19:27 +1000 Message-Id: <20240907031927.1908-18-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240907031927.1908-1-itachis@FreeBSD.org> References: <20240907031927.1908-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::62e; envelope-from=itachis6234@gmail.com; helo=mail-pl1-x62e.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: 1725679476802116600 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