From nobody Tue Feb 10 13:17:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1567011531; cv=none; d=zoho.com; s=zohoarc; b=lKuWWTlietvBxfIbnFFG/nymCc8SYnXbqpK08CsGVAFlTk563x6+5LwUNfDJMbLT2X6KJk9/4/h9p7SnSRPX02GQ3CyyxqTGOsk/Odv67NHzepDToXhaRFqfCeHBosrYdFWew945samyvMotdjCJq1sg/cMQYWByJaRF2QwhxpQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567011531; h=Content-Type: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:ARC-Authentication-Results; bh=AnLfjJ532pnrQLEmB2HlY+ej0qh5jfVOAVC2UPBUj4M=; b=bfUgAuNDahHPdOB81h8pKDQgCcOaIXj+G0+vIH+j5PTq1bjvcBdghUWoQJf1ri05OUiYeGW/aCyugVHEu5uD4GeWxlD3C/rYR87W7mNq1YcMpD+Ouxl221Dmdm4KIH7p6OrnIxaEEjAtai0NQb2oH1vlNjpaMBzo2lFo4U33spE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15670115310471003.1124383271238; Wed, 28 Aug 2019 09:58:51 -0700 (PDT) Received: from localhost ([::1]:38774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i31HP-0004wF-1h for importer@patchew.org; Wed, 28 Aug 2019 12:58:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42349) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i31C7-0007es-HA for qemu-devel@nongnu.org; Wed, 28 Aug 2019 12:53:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i31C3-0000py-FR for qemu-devel@nongnu.org; Wed, 28 Aug 2019 12:53:14 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:40179) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i31C3-0000oY-4r for qemu-devel@nongnu.org; Wed, 28 Aug 2019 12:53:11 -0400 Received: by mail-wr1-x441.google.com with SMTP id c3so510795wrd.7 for ; Wed, 28 Aug 2019 09:53:11 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id n12sm3391799wmc.24.2019.08.28.09.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 09:53:08 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 908201FF8F; Wed, 28 Aug 2019 17:53:07 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AnLfjJ532pnrQLEmB2HlY+ej0qh5jfVOAVC2UPBUj4M=; b=WfbUbqj16CnAz/CEkYfPWA1keOmaBBfTX527aWNTS/xEcaL+eD3EYrQ9F19uvOTOzV TbCT/0lqk0y1GvwYlFRJH5DxnZV3vLSNsg4od3tmoBWbxN2EKLLB7LL8Njy35/gbWY9E L7yF3+X3ViwEw9zgqX6/1TI3bG3mr1dY4PHcy1ako0BTgDu3GjpgL0xWde/e2VJcQX3D imJ3inP32Pzg8F2LQX55Yf+o7SrqGXKbNPOmxSZ3gX3/WAd7RT1bKQjIBPL8Mgn4XoAB FcRHoZkPtAtGqFTD2egFKK73uYhFDKaKOyQR1RDhmz1CraVk9EoeYIUsabELxkrzpkaJ OrZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AnLfjJ532pnrQLEmB2HlY+ej0qh5jfVOAVC2UPBUj4M=; b=PSrFxH1fwjZby6DjFO/DMFP1DYUBF9ek9jqCn2kXMJxzZ4+FsdqeupO2MIqmZssguM jvetFe33/NsK0pSmWwJEIQrH2P1rt0aN0sgm1Gu3XZZ6FxPooVZIY821tI0FuKebgYVn pAl19FgFUZc68kPb92Jf5B4Z2d4o9FBUvYc1T8APzrlnpD+0yCzRDQvH/RB9RQCCedSF ZQS3kNMekn58yju5+LxwhGi/O7N+12R3kQ+rPuGw/9xWpcBqdDmbUD0zfRGMAsu/7tbh 19F1N2AidHnxqEkJhJiaMR7VheFlMOHFZ5GZgb8St/jtFQ4xDomiup9aW0WFqsTTjNUl psTQ== X-Gm-Message-State: APjAAAXrtrZn201N6kEAr33nJ+vaDE5CGY9oksBGQlVhXQ3e4WduwIya GgmN3qlmK1rUr8cIurrz06I0GQ== X-Google-Smtp-Source: APXvYqxCAP62wNcILBT5WJZLrIKQRjeW0ovq81NK0fCq5HeidRyR7V2/L2jQkey/QlW/cImFYQ3uAg== X-Received: by 2002:adf:a415:: with SMTP id d21mr2253900wra.94.1567011190025; Wed, 28 Aug 2019 09:53:10 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 28 Aug 2019 17:53:00 +0100 Message-Id: <20190828165307.18321-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190828165307.18321-1-alex.bennee@linaro.org> References: <20190828165307.18321-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH v1 2/9] target/arm: handle A-profile T32 semihosting at translate time X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , "open list:ARM TCG CPUs" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) As for the other semihosting calls we can resolve this at translate time. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- target/arm/translate.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 259c4669b4c..6157e9f52fc 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -10907,6 +10907,24 @@ static inline void gen_thumb_bkpt(DisasContext *s,= int imm8) gen_exception_bkpt_insn(s, syn_aa32_bkpt(imm8, true)); } =20 +/* + * Thumb SWI. On A-profile CPUs this may be a semihosting call. + */ +static inline void gen_thumb_swi(DisasContext *s, int imm8) +{ + if (semihosting_enabled() && +#ifndef CONFIG_USER_ONLY + s->current_el !=3D 0 && +#endif + (imm8 =3D=3D 0xab)) { + gen_exception_internal_insn(s, 0, EXCP_SEMIHOST); + return; + } + gen_set_pc_im(s, s->base.pc_next); + s->svc_imm =3D imm8; + s->base.is_jmp =3D DISAS_SWI; +} + static void disas_thumb_insn(DisasContext *s, uint32_t insn) { uint32_t val, op, rm, rn, rd, shift, cond; @@ -11658,10 +11676,8 @@ static void disas_thumb_insn(DisasContext *s, uint= 32_t insn) goto undef; =20 if (cond =3D=3D 0xf) { - /* swi */ - gen_set_pc_im(s, s->base.pc_next); - s->svc_imm =3D extract32(insn, 0, 8); - s->base.is_jmp =3D DISAS_SWI; + /* swi/svc */ + gen_thumb_swi(s, extract32(insn, 0, 8)); break; } /* generate a conditional jump to next instruction */ --=20 2.20.1