From nobody Tue Feb 10 15:01:06 2026 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=1682096329; cv=none; d=zohomail.com; s=zohoarc; b=S8tzeFXQSd8R41gi7+05QSetTHbbx30QoCB3pfxuSCWlU74+hcN7wJk6fMO5NOXxL5E12eSyX7XUIZB4+uO3rkdip/2m5VilYJ5NPFIBm1/s6m0ff2H1sMaR84yapgce1DgNxmjujOi8sC+8nPrkT8ho1o1XYIiVX9r8Jrrmup0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682096329; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FcKaqIO+2yqGM+rJOuBgSU4ZMdY5iMgVYPogZXLQ3NQ=; b=R8mrlmrnMor+YfKldTPJ8qs3OB6vcLLLKc80bilLI9ZiwDhPMmjyofE3IbVE540L9lmjS5a7Ng9V/LhF0jqsGKoaHhJZVQPhGiSgozSJEnekBHgtUt+aaoorf2RBXnF4GejCHepnXIB3rzDRFTOI8plceZkyVJ51rlamW6Ezfqk= 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 1682096329850704.2751748143905; Fri, 21 Apr 2023 09:58:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppu4m-0000Ll-O8; Fri, 21 Apr 2023 12:57:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppu4l-0000Fo-D1 for qemu-devel@nongnu.org; Fri, 21 Apr 2023 12:57:35 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ppu4j-0005VI-Qq for qemu-devel@nongnu.org; Fri, 21 Apr 2023 12:57:35 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-2f625d52275so1895057f8f.3 for ; Fri, 21 Apr 2023 09:57:33 -0700 (PDT) Received: from karim.my.domain ([197.39.145.151]) by smtp.gmail.com with ESMTPSA id e5-20020a5d5305000000b002cf1c435afcsm4820581wrv.11.2023.04.21.09.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Apr 2023 09:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682096252; x=1684688252; 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=FcKaqIO+2yqGM+rJOuBgSU4ZMdY5iMgVYPogZXLQ3NQ=; b=X4dkG0+1SawOj83+wi/ZWE57unyToakduhMEe/PEIczfn/HCGKsOtKubwO36IoD74z X2hJaIfXNEznDbKf0dQX/8Ow6DtJwprbnGQNNLzkA90NouiKXLVmsGdBPyfgMNcwOpai uk3Z/g7W5ykf4i8w1E/wvknKXm4e6b9OlW9E3nEne7zi+E9bDsC2MYTELWSCoQGKGyPK yXd01/QlUe40ZQWjyN7VdPn/d1gUQqRL2BzwEW0znBpXIKkizBUx5yf/Xp4pDoNsqQ+M sX3fmc4ijNmPw1LX9VzZXt6pMr+4pUppa2rKlijJQ+gR6M1mpNL1S75IDl1aoQbemZZ1 MB6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682096252; x=1684688252; 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=FcKaqIO+2yqGM+rJOuBgSU4ZMdY5iMgVYPogZXLQ3NQ=; b=MYEV/kFB+RIwRB9It7i6fPqHE/HwdbVoiqvPHT6ZLegWreS8HsPNTBJRXPZqFNGaYW tMQ7xOCTfjDJ3BYCyhtBPMzeOCI2lhSG8LefMFsJo9ckEMXd8wazXBZJI2uLTas5CLaR +fWVUKBD3tjYyg7YVAhgYxCbhCcUhJ5iCJvuA+uSH5CrA6H/JTiBgX7gVEtZXt3Puzr4 h5ZLitoaVupfRwkhgb0Z+B1yIhJabOVnubeVuydrbR7GbLTIc/+SEdNdcjTDOASbjzwz pB4UFIZke57y3Qg6EYFxE4O3co4ZqrmmKcbuqMYvu90peXGG3CQQo4ER7EKWAEsk/j5o /Veg== X-Gm-Message-State: AAQBX9f75RYbHlRxsvFwvAJzGFwCwE7ejzjRyPwts1MBWm7354SKtsDP j/3G5nZo/vY03azYPisy7cZ1mYPpoII= X-Google-Smtp-Source: AKy350auggM/D9AoklobN9zMdyADHU9v8N66TxFcSY2h70nr0bqXe3280ZnApTWlRlWX3vqKw7bwrw== X-Received: by 2002:adf:cc88:0:b0:2f6:25a6:9788 with SMTP id p8-20020adfcc88000000b002f625a69788mr4176132wrj.35.1682096251930; Fri, 21 Apr 2023 09:57:31 -0700 (PDT) From: Karim Taha To: qemu-devel@nongnu.org Cc: imp@bsdimp.com, Karim Taha Subject: [PATCH v4 01/11] Signed-off-by: Karim Taha Date: Fri, 21 Apr 2023 18:53:41 +0200 Message-Id: <20230421165351.3177-2-kariem.taha2.7@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230421165351.3177-1-kariem.taha2.7@gmail.com> References: <20230421165351.3177-1-kariem.taha2.7@gmail.com> 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=2a00:1450:4864:20::432; envelope-from=kariem.taha2.7@gmail.com; helo=mail-wr1-x432.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: 1682096331849100003 Content-Type: text/plain; charset="utf-8" From: Warner Losh Intialize guest_base in bsd-user/main.c. Allow guest_base to be initialized on 64-bit hosts, the initial value is us= ed by g2h_untagged function defined in include/exec/cpu_ldst.h Signed-off-by: Warner Losh Signed-off-by: Karim Taha --- bsd-user/main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index babc3b009b..afdc1b5f3c 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -50,8 +50,22 @@ #include "target_arch_cpu.h" =20 int singlestep; -uintptr_t guest_base; + +/* + * Going hand in hand with the va space needed (see below), we need + * to find a host address to map the guest to. Assume that qemu + * itself doesn't need memory above 32GB (or that we don't collide + * with anything interesting). This is selected rather arbitrarily, + * but seems to produce good results in tests to date. + */ +# if HOST_LONG_BITS >=3D 64 +uintptr_t guest_base =3D 0x800000000ul; /* at 32GB */ +bool have_guest_base =3D true; +#else +uintptr_t guest_base; /* TODO: use sysctl to find big enough hole */ bool have_guest_base; +#endif + /* * When running 32-on-64 we should make sure we can fit all of the possible * guest address space into a contiguous chunk of virtual host memory. --=20 2.40.0