From patchwork Mon Apr 8 17:49:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786944 Delivered-To: patch@linaro.org Received: by 2002:adf:fb4d:0:b0:346:15ad:a2a with SMTP id c13csp1771wrs; Mon, 8 Apr 2024 10:55:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVE5a/FE6DZSzA2uFukjxsIykfV8dpyP+awzw9dlle76jnf55tjEe+pelVi2iyOMOCuwdbOjARJI58aRIbUH7nB X-Google-Smtp-Source: AGHT+IEr1y3A/MGK+zl5Yx05jg3Qd5sTjtBmOOTYKmJRKz4GpD0DhcvNLXeaSRnWH1iA/GZx/5f/ X-Received: by 2002:a81:6e43:0:b0:609:8ed6:c491 with SMTP id j64-20020a816e43000000b006098ed6c491mr9043024ywc.26.1712598935451; Mon, 08 Apr 2024 10:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712598935; cv=none; d=google.com; s=arc-20160816; b=xhKt9T8dDwxDllpISP2pDftVCXIykUp3vBB/hrH+SitMGkDODcHNorMmjQKo8VSqzT 8p/5CT/KXIuVnRi9HdTZsv9QTWRA12pRV06XxrKvK3WSuDk7fUMfK7+mjOKa22Tcrzz0 61LQNiDrJlMwklXz75+EIR+YovkoB9gLAUH83o/64glAaCkqzhKr5C/waVCRkRSnPCL/ d0Wbm1eN6bBVb/rg8DVXsL3xLr90On6+g7wIFACjL8vZ+9vHg0rNVmbYFHYfOuZ3jkrW gjevQYnmx14yE7D2Z8Ucyzi37W/E3xVn1eryi41XKsSt8y02QR0+ps5tZGCw8SRMduO4 kBng== 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=k+ZfX4LwKFG2ttcKfBo5ylpdxbdzoWL4e0yutHC0vAw=; fh=LEzS/2znb383K59gW/mE4txfpskH6W/tMhITWj/DbfA=; b=keINo7C1BAQ3nnZfnrEPI3m3o1QTjzebpLVG1ysKYgOV4EhHJEICgINJXr5BiEeP4+ 2UzDv5A7z5gWENM/nqaFEXLCdrgvYfvKGiebNBfNhJqwhhAk4VsidyGkAMT8CX2PHFeZ 51vjcLj9MwwH+o2yMyrPnTGZBuLJKRNBGe+gqCS1MA4iF8hbMAuL7AnRdTM78fdhKOCs glWAHb+GdlOWUjivi7Ogph0IcVb1bVUZospO6ARgLcW5OMXxf1ROp0IEtfbY/ulrbrgy NpSuIsQaGM0R1ESKmigrw0Mau/cS2JzS6N9X1j56Pm8QF6Q7O5YtGel5XU3BuRsQSz/0 /wBQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qkUGBiTI; 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 k18-20020a05622a03d200b0043497e1872fsi3223307qtx.249.2024.04.08.10.55.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2024 10:55:35 -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=qkUGBiTI; 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 1rtt87-000246-8U; Mon, 08 Apr 2024 13:50:03 -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 1rtt84-000234-UP for qemu-devel@nongnu.org; Mon, 08 Apr 2024 13:50:00 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtt83-0003gi-F3 for qemu-devel@nongnu.org; Mon, 08 Apr 2024 13:50:00 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2a54fb929c8so445000a91.3 for ; Mon, 08 Apr 2024 10:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712598598; x=1713203398; 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=k+ZfX4LwKFG2ttcKfBo5ylpdxbdzoWL4e0yutHC0vAw=; b=qkUGBiTIVoMMWc2uXRdFJV+eM9Dsy9Pnpm37uC8bErrzGtsRuCiai5pZwPYmrCc+pC 4nJs8UrbxxuaaKr3OIaCKqDIrsudoKLZzAHJA4hiUDIKihuq94WEm+WLZgXiFemPaM/k 6/8dY6U6KswealyXgvbNea+JgDcX2R3zt7PRMNFrogC1SMLexX9nlenBCmr8aA4M8AHE Nld+JOqT5RLhEYtDHC9bHH5WgRKHZknFHd7wN3bh+s9XaHO7xrw62nAbygIpmENSlqde DQyBEfaNTM8HdqxnazMASBaskQVUizi9OpcIwesjPbUBWw4xIifjNE4iAjFKBUzvAme8 tS4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712598598; x=1713203398; 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=k+ZfX4LwKFG2ttcKfBo5ylpdxbdzoWL4e0yutHC0vAw=; b=QevCJkNl306icA/soUe6RUfcouARO6NpHtSu7M0f4cSLABVaIQKgzdfogaHL4Zku8J /CVB2m9MEH58CbXI8FtPS6U211VM9ZVaEWf/jHz1wLZ8iZY1Jzr0YzTPJhAuaHzck97z X29ZhKtjpm7OTQY4yv+5tEf6qCCTyIpNWWvzuL6rrYiuJSEd54p/q+bYUxuMU9Li7gIt 3uP2HYsXCS9l5oTFDyxNOsl7CNwayckTx3duVU/l13vbhT4l/q56C5UzzBttssbokViy UH2oY6peCmmtQhJ1FBq4hSI0bStw1UEIa1m15hPINl7tzO/YPKZwPNb0Dd1XvsWdFg/m MvLg== X-Gm-Message-State: AOJu0YwO7osU6zmetcSRLfHZEcyve1qk2l+FPCHUexzZ8YI9Z2lZL3mP YbDdosFqX614CGoKICMZEPFXLWSv4JB90eODd5iDyzYC4HdOhYrffQr+tCY1sn4ga+te7liMFT6 p X-Received: by 2002:a17:90b:1943:b0:2a2:c127:5aed with SMTP id nk3-20020a17090b194300b002a2c1275aedmr10438332pjb.0.1712598598262; Mon, 08 Apr 2024 10:49:58 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id ga15-20020a17090b038f00b0029c3bac0aa8sm8658432pjb.4.2024.04.08.10.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:49:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Keith Packard Subject: [PULL 18/35] target/m68k: Support semihosting on non-ColdFire targets Date: Mon, 8 Apr 2024 07:49:12 -1000 Message-Id: <20240408174929.862917-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240408174929.862917-1-richard.henderson@linaro.org> References: <20240408174929.862917-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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 8f61ff1238..659543020b 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 }