From nobody Sat May 18 15:08:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1690993238; cv=none; d=zohomail.com; s=zohoarc; b=iszD1IXS1TPll0NApsEhV9PegM37KgYIi/NWHqbf44bMOw4UnRoD2nPl25lZxEOi+pp70bvRSqgoLBkjxJzfXM+IfgMm+v/FXmrxtO90WxT2rliFcydZ+uFhT8VvQQrNbFomifzpViCXC8u1NAm2pKR6FT6gWy2nW/wNt/wE6Xs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690993238; 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:Reply-To:References:Sender:Subject:To; bh=omat1qR1//li8jhCaUty3REFoMGdDhzneZ4xHQNFwno=; b=j7at7bSmGj3JA+WXNURQjBZMh97AFbA4GtJarcab+EVRq11/jeeNlsiMkyEhUTz5upbz5jkIvQrzQefNYEzQBr+ziUAZ3IwiyxvYJJYalZvQ9ueuPwSw161WONhVi/r5u7BnCkHeqWwis8s4VA4BUlsyJqNdEJ6yitbzc1dTWtU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 169099323854884.40120027968021; Wed, 2 Aug 2023 09:20:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qREZN-00063P-5J; Wed, 02 Aug 2023 12:19:29 -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 1qREZK-00062K-Sk for qemu-devel@nongnu.org; Wed, 02 Aug 2023 12:19:26 -0400 Received: from home.keithp.com ([63.227.221.253] helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qREZH-0006Fb-Kw for qemu-devel@nongnu.org; Wed, 02 Aug 2023 12:19:26 -0400 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id A61D13F21D93; Wed, 2 Aug 2023 09:19:19 -0700 (PDT) Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavis, port 10024) with LMTP id Jbfzdi1Uda7k; Wed, 2 Aug 2023 09:19:18 -0700 (PDT) Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id DCA853F217BF; Wed, 2 Aug 2023 09:19:18 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1000) id 712FB1E601CB; Wed, 2 Aug 2023 09:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1690993159; bh=k8aWFrRyWz0HU2RDbR8GK1/MnJ0Zhzfz8Edrrl01Q2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jqAgh9SNUm+BUIRdYxTLR003/7UBqUIuMpPmb2wIkoNc9bGkaC8hqTTqE3Bjkl+/B DbaDjFDcKw25pixulAbHBqzaEMUA1glKCsuQKcnYi7Gbo+Mtq8VH/H52YveEkWRRJS kHsHcP6VU9oGIxPPPmMJvmiKM7IuSXVOUashf+9xfPJF4jaTWNbgyg4JchjiZWuCh3 PfDKXsHxpIEcGo/pRXWKzOWw6wSJxlzt0xHKQ1Wp+ZpbjEYDadK/XasB6dd+DsXkMN 3P+yWPnc6RxJr8dOeClDXGCy/iHTXtoljJSCQO17PmOPDrlu1ZQ9JXAkx+OfpMBUWh 0QSVLU6/QbtdA== X-Virus-Scanned: Debian amavis at keithp.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1690993158; bh=k8aWFrRyWz0HU2RDbR8GK1/MnJ0Zhzfz8Edrrl01Q2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ar3mq9SETzq7yAFGIQUG0dca9yhCA8xJERHH+B+iTMEbAz6Qf3ruqO911FmjBfhe0 LPabTFT15bIVWAVrsL4UKq6Q3hncdGHy1+pfICaCcatnPy+uLRIngoaLSyBeKqtSYm t+uz/BwTmvRMo1HFWSUt6HjDwSSlcnBr9II/a669UG6SEP1q+q3pLn9ZWMq+mqvMUI WEQsyIkz2Kxi0CUd/I/6BsGhmY36dl74TPzjfC9kWe4Libqi3H+Qj/A13wh3cLrBKZ tdvSXBcQu3tPy0djLPJ0Bh8poYcUVsCbsYwX2bOXN7DNHmGn3QU1+SP7j1m3qdgFa+ 6SVVBT/5p4U9w== To: qemu-devel@nongnu.org Cc: Laurent Vivier , Keith Packard Subject: [PATCH 1/3] target/m68k: Pass semihosting arg to exit Date: Wed, 2 Aug 2023 09:19:12 -0700 Message-Id: <20230802161914.395443-2-keithp@keithp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802161914.395443-1-keithp@keithp.com> References: <20230802161914.395443-1-keithp@keithp.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=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Reply-to: Keith Packard From: Keith Packard via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (found 2 invalid signatures) X-ZM-MESSAGEID: 1690993241656100011 Content-Type: text/plain; charset="utf-8" Instead of using d0 (the semihost function number), use d1 (the provide exit status). Signed-off-by: Keith Packard Reviewed-by: Peter Maydell --- target/m68k/m68k-semi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c index 88ad9ba814..12235759c7 100644 --- a/target/m68k/m68k-semi.c +++ b/target/m68k/m68k-semi.c @@ -130,8 +130,8 @@ void do_m68k_semihosting(CPUM68KState *env, int nr) args =3D env->dregs[1]; switch (nr) { case HOSTED_EXIT: - gdb_exit(env->dregs[0]); - exit(env->dregs[0]); + gdb_exit(env->dregs[1]); + exit(env->dregs[1]); =20 case HOSTED_OPEN: GET_ARG(0); --=20 2.40.1 From nobody Sat May 18 15:08:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1690993238; cv=none; d=zohomail.com; s=zohoarc; b=WwHReduRwhnpRQ/oaGpU+VWIsX+weZzPptwO5tuGo4MrOblh8Vx43pruDnE36L8XSdY3fPbGCfxQ7r+p1F+Jdq3y5ksTkQyU+Q/RGti/RKlEqoGPxRYU5yJMNceZai66DGe8bzlVCgz1kwek2XmhzgAlVaj+Jh+Xg59sY+Nb/ig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690993238; 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:Reply-To:References:Sender:Subject:To; bh=szJDGoaTe4WEQmpsvs8SO/kWeFKX5HzwL0bTAwlafzc=; b=ZZs7dCERVQj2BquOcqQFVTtxmwkSC9PQena0Hfp5FZn9JwFXtSSiNl1uTK1HRmMoabwSqiqKHJwUNA9hOq+yphTl2Nc1Qt2LaJnObR9V5HUDE+8qFitYzSnzJbTmLCGvi4TU8LBPB8kgYWRSjnMse9/j3I1qCPP/kC/CYOEeFI4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1690993238967921.0898798621405; Wed, 2 Aug 2023 09:20:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qREZL-00062d-AZ; Wed, 02 Aug 2023 12:19:27 -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 1qREZJ-00061z-MT for qemu-devel@nongnu.org; Wed, 02 Aug 2023 12:19:25 -0400 Received: from home.keithp.com ([63.227.221.253] helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qREZH-0006Fe-Kt for qemu-devel@nongnu.org; Wed, 02 Aug 2023 12:19:25 -0400 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id 5930B3F21D87; Wed, 2 Aug 2023 09:19:20 -0700 (PDT) Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavis, port 10024) with LMTP id obvMjmvgwiWO; Wed, 2 Aug 2023 09:19:19 -0700 (PDT) Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id DCB4E3F21CDB; Wed, 2 Aug 2023 09:19:18 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1000) id 756AF1E601E9; Wed, 2 Aug 2023 09:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1690993160; bh=FWaOaA0shu6E5Xxbp65+bl2i5eQeXmUhJ2RXCEKKVAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PGy9toFROtXX41tzZIedJtWuZScvPIFpszKD3H5zNJ5OkwHVZT6pNscoBhpNORTV+ UmmQKtFVpuv3B+xKZIjHMNxQBbFVx6d0D0DkHRz27WLMgROk6UruzNy1DS76j1ShIX tkXl0tm2Kx35sfEOktMu00irinksdHzc65PkTujTHiNMkW/Qg2LbFVqLmpMceZxoLS sAVGWQuIvgYZS+GEOHCbp1Y7Kpoyg1F/0BhdqCI12bWHUP0vHWeT4/WsEGxQvauHzr 0FlXJJMFr38zkLKXzsgHrWoYzG9mUix9YWeWKmxxmXIvv+weC35AENlj/sNv/iv1Yr 8eDD5/EPBU42g== X-Virus-Scanned: Debian amavis at keithp.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1690993158; bh=FWaOaA0shu6E5Xxbp65+bl2i5eQeXmUhJ2RXCEKKVAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AALJz+Q19qlswWaLcPmiFcngJ8NpYS1YSX3p8F5/TBdLwFstWobH7FSe7vR176NMe KOOe5sKBYY/Qt6m6YKeLhduaLb8iGqZw8RuJpdljFzYJSxCX2ARTHTy1fZripCJrEo +B9pSHVP/v9AHL/dWEM6QkfukS8vXgX0b9KCeMflpZREFm/Lry4Vo0jH+D7cyKs1OT AcQ8NUlgwcAqJxSxXzXHy+cR4VrxNxcUZ5FTitlIbaFRml0v1D1KTUPDsxVpnL1nMD 60trsAJzuMK+H47TWCVMNyu3rQ+qqS/S0GhV3xvvm+8Q3qqjY2lhjYwszhDuV/DPo5 gawlPDoPuyCig== To: qemu-devel@nongnu.org Cc: Laurent Vivier , Keith Packard Subject: [PATCH 2/3] target/m68k: Fix semihost lseek offset computation Date: Wed, 2 Aug 2023 09:19:13 -0700 Message-Id: <20230802161914.395443-3-keithp@keithp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802161914.395443-1-keithp@keithp.com> References: <20230802161914.395443-1-keithp@keithp.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=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Reply-to: Keith Packard From: Keith Packard via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (found 2 invalid signatures) X-ZM-MESSAGEID: 1690993240027100009 Content-Type: text/plain; charset="utf-8" The arguments for deposit64 are (value, start, length, fieldval); this appears to have thought they were (value, fieldval, start, length). Reorder the parameters to match the actual function. Signed-off-by: Keith Packard --- target/m68k/m68k-semi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c index 12235759c7..12179bde38 100644 --- a/target/m68k/m68k-semi.c +++ b/target/m68k/m68k-semi.c @@ -166,7 +166,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr) GET_ARG64(2); GET_ARG64(3); semihost_sys_lseek(cs, m68k_semi_u64_cb, arg0, - deposit64(arg2, arg1, 32, 32), arg3); + deposit64(arg2, 32, 32, arg1), arg3); break; =20 case HOSTED_RENAME: --=20 2.40.1 From nobody Sat May 18 15:08:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1690993236; cv=none; d=zohomail.com; s=zohoarc; b=NFEvfPWGODALy2V10rvgTFaMdb1WFfzEtnVTX/WqQHgv+6YLQ7OhAdkOo/MfzYZnRzTh1TjJyn6VfqmeMT/4hjJuOPNPl47Bvy0szndrPsaMDYNlGIqPqtFES+nP3KP6FO67Ok5EeGWUG9dec0tt35S8Gg+G3BnS8H5hx3ylvhk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690993236; 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:Reply-To:References:Sender:Subject:To; bh=HCE6u4xNghvBGvA5vFecaGOKnk644GmKVQxFDxRPbj4=; b=gylYvT/ZEp4+cAwsR66lAa6vEGU4CD7pVVlkgCgQQkVbMkkrDz+jLuJWbGA2VFzBlhGRDHBZYc2lMNRljjjdV2xctA8UK/FRn4rW51Nd8BWGP6HiTwbe4kZtIIkd0Gdqg7xYd7NDve3JoAfcjIbh8Gk07H+stzO7a+nfyrHX55o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1690993236345828.6075054329533; Wed, 2 Aug 2023 09:20:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qREZN-00063O-4c; Wed, 02 Aug 2023 12:19:29 -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 1qREZK-00062O-UZ for qemu-devel@nongnu.org; Wed, 02 Aug 2023 12:19:26 -0400 Received: from home.keithp.com ([63.227.221.253] helo=elaine.keithp.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qREZH-0006Fi-Kj for qemu-devel@nongnu.org; Wed, 02 Aug 2023 12:19:26 -0400 Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id F0F9F3F21CDB; Wed, 2 Aug 2023 09:19:20 -0700 (PDT) Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavis, port 10024) with LMTP id PEK-f0SzJfPB; Wed, 2 Aug 2023 09:19:19 -0700 (PDT) Received: from keithp.com (koto.keithp.com [192.168.11.2]) by elaine.keithp.com (Postfix) with ESMTPSA id DCE963F21D80; Wed, 2 Aug 2023 09:19:18 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1000) id 793291E601ED; Wed, 2 Aug 2023 09:19:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1690993160; bh=3o4KTXUsdRZ10iRrqw3JujvQ853pCrOkKE3TdB5CjFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wO4vkd1pvV3L3lEgr29TxiAppmcf0kcySj3QH/1r8v9Ikpfolkd5gHpEfl+zIS/Mv C8WfjlOvwBps2+v2j+TqdrPVsPiGXLlhTey6VqrpdDQup+53/Kb+Z7Ng1JIRpRe9Gj 54LAHLiWV+gEvT3GPg/ak8XlT9ztHhyEtU438ckbc+k6oA7pHYGUMdmBz4ixWQjybI LbKiMkgDDPvSboPcelmJx7QXMxky2/XKUJL4Eq1Er/wCAl+AUiN19sHfAi0hDul7E4 yFD9qICyrWIt19VgP5yX2Ifj62dUnyG3HfFA0IyG+bEFgPm+7IVCspSSX1gz49scQ+ fOt0nyByt7EaQ== X-Virus-Scanned: Debian amavis at keithp.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=keithp.com; s=mail; t=1690993158; bh=3o4KTXUsdRZ10iRrqw3JujvQ853pCrOkKE3TdB5CjFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hk2y0ChPyWgDAZ5CsWtYwgyBFiG21Hr5c7XufiGKIWMdNO9ldjcZH4LlbuNMyzj6d 3b3aveDY+evPolev5DDPjjDKwpJ+W7z9vBs2zZFc5dd0zUV+uM7ri1h78C9P73dRPg aFyp8eZrApz3i9GfoCnpojz1oAPVyxQ0toD66z7+tdRNNfjxH5AvGLlrxn+/RpCKh4 +iZ6Rc6+O4+XX87bWZECLG7y3SjQc2fieOcEIj3w+7H3cX+NQv4SebXhXQ/pW8xpxD D0dGXNnStZlfxKHl6xhoXH0+LBoZA7t3ymfmtwNaDOAO2jqC68wGNP2K51/43fdW8q En9HAOa1/xxJg== To: qemu-devel@nongnu.org Cc: Laurent Vivier , Keith Packard Subject: [PATCH 3/3] target/m68k: Support semihosting on non-ColdFire targets Date: Wed, 2 Aug 2023 09:19:14 -0700 Message-Id: <20230802161914.395443-4-keithp@keithp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230802161914.395443-1-keithp@keithp.com> References: <20230802161914.395443-1-keithp@keithp.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=63.227.221.253; envelope-from=keithp@keithp.com; helo=elaine.keithp.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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: , Reply-to: Keith Packard From: Keith Packard via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (found 2 invalid signatures) X-ZM-MESSAGEID: 1690993237834100003 Content-Type: text/plain; charset="utf-8" According to the m68k semihosting spec: "The instruction used to trigger a semihosting request depends on the m68k processor variant. On ColdFire, "halt" is used; on other processors (which don't implement "halt"), "bkpt #0" may be used." Add support for non-CodeFire processors by matching BKPT #0 instructions. When semihosting is disabled, convert those back to illegal op exceptions. Signed-off-by: Keith Packard --- target/m68k/cpu.h | 1 + target/m68k/op_helper.c | 16 ++++++++++++++++ target/m68k/translate.c | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index cf70282717..b741c50a8f 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -67,6 +67,7 @@ =20 #define EXCP_RTE 0x100 #define EXCP_HALT_INSN 0x101 +#define EXCP_BKPT_INSN 0x102 =20 #define M68K_DTTR0 0 #define M68K_DTTR1 1 diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 1ce850bbc5..2d89db6dde 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -295,6 +295,22 @@ static void m68k_interrupt_all(CPUM68KState *env, int = is_hw) /* Return from an exception. */ m68k_rte(env); return; + case EXCP_BKPT_INSN: + if (semihosting_enabled((env->sr & SR_S) =3D=3D 0) + && (env->pc & 3) =3D=3D 0 + && cpu_lduw_code(env, env->pc - 4) =3D=3D 0x4e71 + && cpu_ldl_code(env, env->pc) =3D=3D 0x4e7bf000) { + env->pc +=3D 4; + do_m68k_semihosting(env, env->dregs[0]); + return; + } + /* + * When semihosting is not enabled, translate this back to + * an illegal op exception. + */ + cs->exception_index =3D EXCP_ILLEGAL; + env->pc +=3D 2; + break; } } =20 diff --git a/target/m68k/translate.c b/target/m68k/translate.c index e07161d76f..d037c57453 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -2640,6 +2640,10 @@ DISAS_INSN(bkpt) #if defined(CONFIG_USER_ONLY) gen_exception(s, s->base.pc_next, EXCP_DEBUG); #else + if ((insn & 7) =3D=3D 0) { + gen_exception(s, s->pc, EXCP_BKPT_INSN); + return; + } gen_exception(s, s->base.pc_next, EXCP_ILLEGAL); #endif } --=20 2.40.1