From patchwork Wed Apr 24 22:51:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 791535 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:346:15ad:a2a with SMTP id g4csp1091715wrq; Wed, 24 Apr 2024 15:52:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVY0PB5Tzist1CHigYSn6uvZ+EWy/Qu8hVeXEeJ32sFubnQRIGzOb3gpIoXp1UqIYL1LqOuGWqcL0pMqCtEwCTD X-Google-Smtp-Source: AGHT+IEp6ZcwLqsUck625zGHw3FUU/bvwTlMQLAjq/QaYNs6/cB9gje1PpTRCGUi6c+YV3gobGTK X-Received: by 2002:a05:622a:11c5:b0:439:b6bd:ccb3 with SMTP id n5-20020a05622a11c500b00439b6bdccb3mr3746308qtk.0.1713999146934; Wed, 24 Apr 2024 15:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713999146; cv=none; d=google.com; s=arc-20160816; b=kVSKHB4r9zlZ3evZFEpiiNe5Jx/3Zgxdif12dUkPs2m/O+NgtVUmxnoYzby71zyvV4 Dd0fjvriVf4y5WeCxEDhvL1xXx6e86U/nynmqGgLLA99dTgI6IkU2xApuZ52Ggcg7QVP lxEGY8TzZqGvFQA3GlfKWxIbV/RIJgMlRj6FOlzpOIoiabmYcRc3h2jwsdBYMQdeA18k wP4+Jmht1+MVVYQp5GEgJf7ENH9lwbi+z5HqUMhU5cG1wBuUcyEKOIcFcxIayXLEcjw2 Y2q0DpomtoIAbJ3fm6vjtCzsZzFRR/Kh4z1qxoYHZstl+XrqdXsYtVH2RWTVa0AJRRBF hn2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G1KuH29eWKziwjTP2PdMM65i8n1Oaouq5HMuEevb+aM=; fh=LEzS/2znb383K59gW/mE4txfpskH6W/tMhITWj/DbfA=; b=Z0KpFcHImOGJpr0Y7NFMIApieDYvhCma6FFQ5jwLYn5YYBn3b0sTjwx6HHl8oTx8KM S4jCP7+0Z7nG1Y4yaaXFimRWjXBJf9EA59dAdJTig5il3inOeHeUkjFf3wOzdQBkYZqm 3wmJafh/q+S3nZNZWj//ixzEFVQ+0j7c06OcUKHpiFA0G+Be3hFoaE0LEU3C81LKyBWr rHuzt/PmRrZE7NXrsCzzSNEuVjVpKK/aS7iefb4+wC+qtu8fY8fpJ4rwiTOG3UEClafL HFRt5cMn2Zwo7g+gm0QBBh4evqwU4+5MNaAyZ68tAZTKgKnnqxeEgIyP3+3Pk70yUAj/ COqg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xv3f/LPj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fy26-20020a05622a5a1a00b0043a42fc50e2si446465qtb.365.2024.04.24.15.52.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Apr 2024 15:52:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xv3f/LPj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzlSk-00070m-2C; Wed, 24 Apr 2024 18:51:38 -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 1rzlSj-0006ym-4S for qemu-devel@nongnu.org; Wed, 24 Apr 2024 18:51:37 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzlSh-0006hO-K9 for qemu-devel@nongnu.org; Wed, 24 Apr 2024 18:51:36 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6f043f9e6d7so447750b3a.3 for ; Wed, 24 Apr 2024 15:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713999094; x=1714603894; 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=G1KuH29eWKziwjTP2PdMM65i8n1Oaouq5HMuEevb+aM=; b=Xv3f/LPjN1GU3fW0+zrMz3qZ4OtqiYKtMU2D7gVofRX6fb/oDDyMyOWRQAOAQua4On A+H1glALATjfCPHIIW0H4fkOowie/yfHmnZ+bDjvXDMnuhdUT7s2ahxIZdcQFq2FQgOR LFdLGAW7YKP4vBPIm0hAd5Is5I5ifDSJwimHmfI3izEuOReAhYaNtys4dRmgxXX/jYTO ujZoDswmUKpG7ZI+Ye2cCU3GyAsr+tm6ulQX0bXJi8mxwGXjCabnaDenf7Aq5AnEGsCC e8VftJYdFtdZ7oukl29jaMHxT3VfyDY7rAPlImz7Mm6qVfox4u7wxqajJruLbiqr7LHb Ps4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713999094; x=1714603894; 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=G1KuH29eWKziwjTP2PdMM65i8n1Oaouq5HMuEevb+aM=; b=Ip3b5h8H8V35KcG/fuHvcgb4CMH78iNa3+wpP3idd0BHGu2LTj+zuKVHKJ1wVHbnLJ fImWQMTSThb017JW/OghLzgNzpTxEBj/kfkk6HLi3eUWGdZzTeXJVQhN5fYdWMClDDW+ hvAlda7hmtaFTsxis5lyGDbGmJt/ByetVQXlHZ1yIoJDvWdHybE6PWOx7LxSzUJmGbwt lapi4ZSbVsL1I8L6C30fe0IjiMVVPqb+cdY8Ifaa17BYicLT99c8ToUP6iGUzPpWGh8c jezRxQOJMA9QBoXlhAhy3+eR2xtSeU3PCMvR6LYcoYcCnz46tNl8Z54B3hJ8j1kJlfs0 drvA== X-Gm-Message-State: AOJu0YxaJE54pg5mLCDjSA8zffE6dxOCtzcU8uwp+KwN4AmhDQW2P25G XcGiM1m6m3n0hpda7aySIzljywS6alFY31tVp5jwHuxPJV2WdQ+Oa8xDIqTVoYciyivqUkvSw7q S X-Received: by 2002:a05:6a20:3d88:b0:1aa:340e:237e with SMTP id s8-20020a056a203d8800b001aa340e237emr4626663pzi.59.1713999094263; Wed, 24 Apr 2024 15:51:34 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id it12-20020a056a00458c00b006ead792b6f2sm11960864pfb.1.2024.04.24.15.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 15:51:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Keith Packard Subject: [PULL 9/9] target/m68k: Support semihosting on non-ColdFire targets Date: Wed, 24 Apr 2024 15:51:23 -0700 Message-Id: <20240424225123.929152-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240424225123.929152-1-richard.henderson@linaro.org> References: <20240424225123.929152-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Keith Packard 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. Signed-off-by: Keith Packard [rth: Use semihosting_test()] Signed-off-by: Richard Henderson --- target/m68k/translate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 647bd9d9be..169927552a 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -2646,6 +2646,11 @@ DISAS_INSN(bkpt) #if defined(CONFIG_USER_ONLY) gen_exception(s, s->base.pc_next, EXCP_DEBUG); #else + /* BKPT #0 is the alternate semihosting instruction. */ + if ((insn & 7) == 0 && semihosting_test(s)) { + gen_exception(s, s->pc, EXCP_SEMIHOSTING); + return; + } gen_exception(s, s->base.pc_next, EXCP_ILLEGAL); #endif }