From nobody Mon Nov 25 03:07:04 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=1718650990; cv=none; d=zohomail.com; s=zohoarc; b=jhhMsEJMn7QAR5STXBxUndkCJQzL7td193PRWVWbKLam/YuVqZ2mjvspj1l743RuXcsgwO/AmIx5gHOE29fI7g3L8GWTA4/YrOQQ1LRAhXayecg9sW44AOn2cqvB/Y88F4Gw947WpB1uk/e08WTjKWCK3gkb/tttFyBMX2gi86k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718650990; 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=bzNcNJmcxrM8qrvXWwUv5T4AhCFaFoLPFz7e7Bb3WVY=; b=HzxTg1TvwwiLoa0Dst5dUV7praok+DmisW4QscO7U0/gtZr+jIyK9gjTd1T2s3ciEzQmm+ZcnZd/wzUc3gayHIQeq5Hhft9oEStxdhckIexuiCwmY1M8FbMflyBwMNhyW4qMaQFnFs8SVAqE+9uOeYRsZxVrnXhojst+qOJf3vE= 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 1718650990143967.7906045947507; Mon, 17 Jun 2024 12:03:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJHZD-0005c4-I6; Mon, 17 Jun 2024 14:58:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJHYy-0004ju-BM for qemu-devel@nongnu.org; Mon, 17 Jun 2024 14:58:47 -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 1sJHYw-00050R-Hs for qemu-devel@nongnu.org; Mon, 17 Jun 2024 14:58:44 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-70423e8e6c9so4092860b3a.0 for ; Mon, 17 Jun 2024 11:58:41 -0700 (PDT) Received: from localhost.localdomain ([106.222.222.115]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ccb4aa4fsm7660637b3a.131.2024.06.17.11.58.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 11:58:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718650720; x=1719255520; 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=bzNcNJmcxrM8qrvXWwUv5T4AhCFaFoLPFz7e7Bb3WVY=; b=AyCRXuhbDPtECBCyEtb96Yk/+EPvkAv62BFu5b/jY+M27mA6Jh73FOVdvXVNP3Kg5e 8rlsszRnbfkEEykVknJKiEsus4IyTBh0TniSEJizINODJeQGVurb1L9Kwol7wxt2e09w vclqYNJ41nJoJ5KSOOe872qsZYxdcBYhZ754g2hXJFsJOGvWthAN1q+fHts5boRB16dO PeZIyLANDTaEnAja9eXtZZhTvolbiSxjgA4pHNtcJ49/rAmr8Bwx8fAeRncu1e6+jzvc LtJTP5PIhE3P5ViHsePfeJpaxLkKW1QKJPS0+gzJR31znHJWBJFd2t3IKpCmHUnGbGWs tr3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718650720; x=1719255520; 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=bzNcNJmcxrM8qrvXWwUv5T4AhCFaFoLPFz7e7Bb3WVY=; b=NjNaIwu4K/VBL4p4Dk83lv4vfROIIEzMg2DluC1A7xIUcO3mdxYrlsGqVJF6aogE3m BJ4jzYQLp3rd023BGOlvGZaMTNHr+hKs4S+JEzGHvzVrJgJq/ValLNbWynohYwQwnr3f Y4hz2JOHjDa5jXrwVW6l9aTn8pnkVZjXZCv/g0wJgPkJeIWpUNXfKafWNIWI8X5k51RE 6ThbSfedKfsfdWLke9rcaLHG2jzeCwJQaGWdodotjq+NTxK+bCMHS19neIQNWWGK9WZc X5RQdePk0XECHXx1frWFWOOi6RJB7gOV046uLoyTMUNiKflnCOc+K3PHDUxhl9KadLcL Gc2g== X-Gm-Message-State: AOJu0YyiawcnqUIn+WNj0fsXUznIgduy4tWUiFIPMbcYA48I0Z1ezofL PEJ8lfP0b62UeIEgXAcqasNWLgtrUnttjIqPICU4jrAb7A1XikpYsvNbGFW8ynU= X-Google-Smtp-Source: AGHT+IHlNMDpZ/3SvXQxrUSYTW3x5sB9I83m8tDse7ckkDNvuGf1DVXq2GPJanDwmYAOQoadSpH+Ww== X-Received: by 2002:a05:6a00:1310:b0:705:dddf:bb46 with SMTP id d2e1a72fcca58-705dddfbdaemr9720103b3a.14.1718650720045; Mon, 17 Jun 2024 11:58:40 -0700 (PDT) From: Ajeet Singh X-Google-Original-From: Ajeet Singh To: qemu-devel@nongnu.org Cc: Warner Losh , Ajeet Singh , Stacey Son , Ajeet Singh , Jessica Clarke Subject: [PATCH 09/23] Add thread setup for BSD-USER Date: Tue, 18 Jun 2024 00:27:50 +0530 Message-Id: <20240617185804.25075-10-itachis@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240617185804.25075-1-itachis@FreeBSD.org> References: <20240617185804.25075-1-itachis@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::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: 1718650991312100001 Content-Type: text/plain; charset="utf-8" From: Stacey Son Function for setting up thread upcall which will add thread support to BSD-User Signed-off-by: Stacey Son Signed-off-by: Ajeet Singh Co-authored-by: Jessica Clarke --- bsd-user/aarch64/target_arch_thread.h | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 bsd-user/aarch64/target_arch_thread.h diff --git a/bsd-user/aarch64/target_arch_thread.h b/bsd-user/aarch64/targe= t_arch_thread.h new file mode 100644 index 0000000000..d2f2dea7ce --- /dev/null +++ b/bsd-user/aarch64/target_arch_thread.h @@ -0,0 +1,45 @@ +/* + * ARM AArch64 thread support for bsd-user. + * + * Copyright (c) 2015 Stacey D. Son + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef TARGET_ARCH_THREAD_H +#define TARGET_ARCH_THREAD_H + +/* Compare to arm64/arm64/vm_machdep.c cpu_set_upcall_kse() */ +static inline void target_thread_set_upcall(CPUARMState *regs, abi_ulong e= ntry, + abi_ulong arg, abi_ulong stack_base, abi_ulong stack_size) +{ + abi_ulong sp; + + /* + * Make sure the stack is properly aligned. + * arm64/include/param.h (STACKLIGN() macro) + */ + sp =3D (abi_ulong)(stack_base + stack_size) & ~(16 - 1); + + /* sp =3D stack base */ + regs->xregs[31] =3D sp; + /* pc =3D start function entry */ + regs->pc =3D entry; + /* r0 =3D arg */ + regs->xregs[0] =3D arg; + + pstate_write(regs, PSTATE_MODE_EL0t); +} + +#endif /* TARGET_ARCH_THREAD_H */ --=20 2.34.1