From nobody Tue Nov 26 20:24:13 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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1704612025; cv=none; d=zohomail.com; s=zohoarc; b=Y6uByjeQa8Tl79ZHywwLFFdoZjgMC+yElcTwM5eI1IL6GcYBPiMhKOQFhwLVADFZpvSGIyH/p+DNtxNPrEvaB0ytAqWAEMuxAeUbUvKDp6QsS4uuJnLdPbaCyZ/qEiIdAVzVhg1BumB7Wl2x8DGF5h58ixHy6ZTaoD/tbL9a6jg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704612025; h=Content-Type:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=a7UgO0zv4kCdsO8O+oOmlivEZPSTuXfgM1PLEI/MpQo=; b=dpVbvZCF+DIp9VzWgH8dgsyyeAefdmDeh0BEctZIZoSX8fMGCQMWio8jol9huAynd7kPW16v75LtwxPW0qOLu4aT4sm/SRkBOHVVZ568fXpUlVzeV6Rlg1/KsVUcglMpjNjYqC5zjFfXtAyjWGk3nXO3zOZMkE56y78al0sH7ss= 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 1704612025081199.59323934394388; Sat, 6 Jan 2024 23:20:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMNRM-0002s5-Cd; Sun, 07 Jan 2024 02:19:24 -0500 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 1rMNRJ-0002r0-UC; Sun, 07 Jan 2024 02:19:22 -0500 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMNRH-0002Vx-Tz; Sun, 07 Jan 2024 02:19:21 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id CA891CE0AE8; Sun, 7 Jan 2024 07:19:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B233C433C7; Sun, 7 Jan 2024 07:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704611948; bh=Bh7liYiHeIx3Vq6CFHeTZMdj0GWBysbr/3QXwBI9eg8=; h=Date:From:To:Subject:From; b=BeKZjLa6fSxcHsx6wAtabayxlu07/zH4MRP8cbRIpFBoZjhPT9lCLvaAMaG72WFeU IRz1VYL7mxNIqLdxvHhLcK3GJRKW2NgO5VOUmIHldW3A8DK87GdMA7SahGhObeTVOy QU1gUIdRCz0CrbVJfZpnzSp4yt29gz/dVlMVW3YceDJ0jgzpGZD1viCqwSeL86E23H 9Tc5swWvkk7MZCItEaqj4Zd4+D/pUlhjRGvqOzKzF7O7TT1kCw2p9ZnvpwzZnc0Adu 6mSFwLz3uPtchXoBd/O2QmHll4O2mfhw5/Kdi6gJAXv2GjdD4tfLQNjGWFE/VYV/Jk eieGd5Ulqml0w== Date: Sun, 7 Jan 2024 08:19:03 +0100 From: Helge Deller To: Laurent Vivier , Michael Tokarev , Richard Henderson , qemu-devel@nongnu.org, qemu-trivial@nongnu.org Subject: [PATCH] tcg/tci: Fix TCI on hppa host and update TCI test matrix Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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=2604:1380:40e1:4800::1; envelope-from=deller@kernel.org; helo=sin.source.kernel.org X-Spam_score_int: -69 X-Spam_score: -7.0 X-Spam_bar: ------- X-Spam_report: (-7.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.54, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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 @kernel.org) X-ZM-MESSAGEID: 1704612026796100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update the TCI interpreter test matrix for big-endian hosts with big- (hppa, hppa64) and little-endian (x86,x96-64) targets. I used native ppc64 and hppa hosts for those tests. Starting TCI on a hppa host crashed immediately, because hppa is the only archive left where the stack grows upwards. Write-protecting the stack guard page at the top of the stack fixes the crash. Signed-off-by: Helge Deller diff --git a/tcg/tci/README b/tcg/tci/README index 4a8b5b5401..0c1e50779e 100644 --- a/tcg/tci/README +++ b/tcg/tci/README @@ -72,16 +72,16 @@ host and target with same or different endianness. | host (le) host (be) | 32 64 32 64 ------------+------------------------------------------------------------ -target (le) | s0, u0 s1, u1 s?, u? s?, u? +target (le) | s0, u0 s1, u1 s2, u? s2, u? 32 bit | | -target (le) | sc, uc s1, u1 s?, u? s?, u? +target (le) | sc, uc s1, u1 s2, u? s2, u? 64 bit | | -target (be) | sc, u0 sc, uc s?, u? s?, u? +target (be) | sc, u0 sc, uc s2, u? s2, u? 32 bit | | -target (be) | sc, uc sc, uc s?, u? s?, u? +target (be) | sc, uc sc, uc s?, u? s2, u? 64 bit | | =20 @@ -110,6 +115,10 @@ u1 =3D linux-user-test works A cross compiled QEMU for ppc host works at least partially: i386-linux-user/qemu-i386 can run a simple hello-world program (tested in a ppc emulation). + The big-endian tests were run on native hppa (big-endian, 32-bit) and + ppc64 (big-endian, 64-bit) machines. Tested target machines were + x86 and x86-64 (little-endian, debian install ISO) and 32- and 64-bit + big-endian hppa (NetBSD and Debian install ISOs). =20 * Some TCG opcodes are either missing in the code generator and/or in the interpreter. These opcodes raise a runtime exception, so it is diff --git a/util/oslib-posix.c b/util/oslib-posix.c index e86fd64e09..e378b71641 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -585,11 +585,8 @@ char *qemu_get_pid_name(pid_t pid) =20 void *qemu_alloc_stack(size_t *sz) { - void *ptr; + void *ptr, *ptr2; int flags; -#ifdef CONFIG_DEBUG_STACK_USAGE - void *ptr2; -#endif size_t pagesz =3D qemu_real_host_page_size(); #ifdef _SC_THREAD_STACK_MIN /* avoid stacks smaller than _SC_THREAD_STACK_MIN */ @@ -619,7 +616,12 @@ void *qemu_alloc_stack(size_t *sz) } =20 /* Stack grows down -- guard page at the bottom. */ - if (mprotect(ptr, pagesz, PROT_NONE) !=3D 0) { + ptr2 =3D ptr; +#if defined(__hppa__) + /* but on hppa the stack grows up, so guard the top page instead */ + ptr2 =3D ptr + *sz - pagesz; +#endif + if (mprotect(ptr2, pagesz, PROT_NONE) !=3D 0) { perror("failed to set up stack guard page"); abort(); }