From nobody Tue Feb 10 23:14:00 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=1567022228; cv=none; d=zoho.com; s=zohoarc; b=i3NwTM7J412q0TPEbSLFJEOVur9Oo2cgbHkekyxWKXgAcODcwOoCK2eepqmFt0P1oYVOyeCGdjgBtVattf7Q1m/nWBi4gUisgbayP78XDV/zdnFcHO7VBfD5eARvuHwxVrCXqWtAxQJ64Ivy0t5JavreySbEihT1GyPbNjVjPUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567022228; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Zg8dzU0/CFYfa/kdfJbWaGoOPylTikiwN65K71SZiLc=; b=K4va/7Y15pIUhSyxcHVFA22T0X6mV1Cl1Ysll9ryDv5dUFWtTkj352DNg4F3pSC20b5T+Su/EzelytVO8Z1aH0Ppivski10Csa5jmzRnKuIkhUDkSUSPxxOe7NP/49FH870hY4wWlgl/WVTIisL9iyXxxuvqvEuuk4Si3iHF4BQ= 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 1567022228717344.07320191169106; Wed, 28 Aug 2019 12:57:08 -0700 (PDT) Received: from localhost ([::1]:41812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i3443-0004mi-8V for importer@patchew.org; Wed, 28 Aug 2019 15:57:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38920) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i33Gz-00041W-E7 for qemu-devel@nongnu.org; Wed, 28 Aug 2019 15:06:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i33Gu-0000l2-Rm for qemu-devel@nongnu.org; Wed, 28 Aug 2019 15:06:23 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:39448) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i33Gt-0000iv-Id for qemu-devel@nongnu.org; Wed, 28 Aug 2019 15:06:20 -0400 Received: by mail-pf1-x42a.google.com with SMTP id y200so390956pfb.6 for ; Wed, 28 Aug 2019 12:06:18 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id f27sm2967944pgm.60.2019.08.28.12.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 12:06:16 -0700 (PDT) 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; bh=Zg8dzU0/CFYfa/kdfJbWaGoOPylTikiwN65K71SZiLc=; b=uKQHazugJxEVXAFBp+BiR4/sgmEW8QSorrKeZ3Yx2yLLK2xwROlnI+wVUtKN/TVEcp bnH4EhcPwQ3RixW0GhMFALQKMo5BN77kFGvP6M/igpGBDvIQAmb9k6DHWVlJyKKwrLU3 Xs+jUFddsX3OTH16kbVnFS4vB002s/BZIm9mVwMis9Urie68HkNYUDCKS8rzB/rYK8pi Z02WsIG30NfYrlgyP6WLBrd6Vbun8dhMFnmR4CYCxUL1FuFynjo2UnaNQUv54v8Ajnzk zdgE8qAqTgs5rBIeOF/GjBVMGaW8vGRAPygFLWMOL8ZUkxA13GeKOok+SNhaGP6HgBYo RbPQ== 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; bh=Zg8dzU0/CFYfa/kdfJbWaGoOPylTikiwN65K71SZiLc=; b=TK7ka90ep5P6YWjZO+3gXfVO6sqp1noQA4x1l8iAVTtoBfeoyMIOUdW84raUrVoAln 6Qj5wL63oUBpLTkV7eH3TTov53tvqY5gMAOZhPx5xIprsOS1n5ez2dB1pyAidKhYLty2 J2bHg6GprT8oo/hdogx/iP2ucgCqTQnogyOu+/tLTpKKTKWKaVZkv+EZKmpsC6zYPTQO lJpTT/PfOiKqAsBaCXEklAcnMs2Uukuv6YdcBS3ddhSXCPCGDCzVcCejiXW6aReff7zg yzEOUZpCjcjNa54uUQSGYE50z2Rd3bPtqMVhx0VkfTSXy1hHN9bcuHGBXlE5VbwxRuHg eolQ== X-Gm-Message-State: APjAAAVkCROqPdfH+Sfnoy3CK/12pBXiCCxmMF5sE/TNgvGoOBYChQrj Wx4PofoJFq8Ghy9nHSLAbhYPLDMMk2E= X-Google-Smtp-Source: APXvYqzWWT+x1KVF+KeBlpIAeF8AHxpkNBPFKPF2QIEAEywdaKurEwAhxLdPSY0WKFFY/G/3ydhVJQ== X-Received: by 2002:a62:7996:: with SMTP id u144mr6564180pfc.228.1567019177273; Wed, 28 Aug 2019 12:06:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 28 Aug 2019 12:04:48 -0700 Message-Id: <20190828190456.30315-62-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190828190456.30315-1-richard.henderson@linaro.org> References: <20190828190456.30315-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::42a Subject: [Qemu-devel] [PATCH v3 61/69] target/arm: Convert T16, push and pop 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: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate.c | 83 ++++++------------------------------------ target/arm/t16.decode | 10 +++++ 2 files changed, 22 insertions(+), 71 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index c7d7834440..5ee4dfe3a2 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -7490,6 +7490,16 @@ static int t16_setflags(DisasContext *s) return s->condexec_mask =3D=3D 0; } =20 +static int t16_push_list(DisasContext *s, int x) +{ + return (x & 0xff) | (x & 0x100) << (14 - 8); +} + +static int t16_pop_list(DisasContext *s, int x) +{ + return (x & 0xff) | (x & 0x100) << (15 - 8); +} + /* * Include the generated decoders. */ @@ -10690,7 +10700,6 @@ static void disas_thumb_insn(DisasContext *s, uint3= 2_t insn) { uint32_t val, op, rm, rd, shift, cond; int32_t offset; - int i; TCGv_i32 tmp; TCGv_i32 tmp2; TCGv_i32 addr; @@ -10763,76 +10772,8 @@ static void disas_thumb_insn(DisasContext *s, uint= 32_t insn) goto illegal_op; =20 case 4: case 5: case 0xc: case 0xd: - /* - * 0b1011_x10x_xxxx_xxxx - * - push/pop - */ - addr =3D load_reg(s, 13); - if (insn & (1 << 8)) - offset =3D 4; - else - offset =3D 0; - for (i =3D 0; i < 8; i++) { - if (insn & (1 << i)) - offset +=3D 4; - } - if ((insn & (1 << 11)) =3D=3D 0) { - tcg_gen_addi_i32(addr, addr, -offset); - } - - if (s->v8m_stackcheck) { - /* - * Here 'addr' is the lower of "old SP" and "new SP"; - * if this is a pop that starts below the limit and ends - * above it, it is UNKNOWN whether the limit check trigger= s; - * we choose to trigger. - */ - gen_helper_v8m_stackcheck(cpu_env, addr); - } - - for (i =3D 0; i < 8; i++) { - if (insn & (1 << i)) { - if (insn & (1 << 11)) { - /* pop */ - tmp =3D tcg_temp_new_i32(); - gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); - store_reg(s, i, tmp); - } else { - /* push */ - tmp =3D load_reg(s, i); - gen_aa32_st32(s, tmp, addr, get_mem_index(s)); - tcg_temp_free_i32(tmp); - } - /* advance to the next address. */ - tcg_gen_addi_i32(addr, addr, 4); - } - } - tmp =3D NULL; - if (insn & (1 << 8)) { - if (insn & (1 << 11)) { - /* pop pc */ - tmp =3D tcg_temp_new_i32(); - gen_aa32_ld32u(s, tmp, addr, get_mem_index(s)); - /* don't set the pc until the rest of the instruction - has completed */ - } else { - /* push lr */ - tmp =3D load_reg(s, 14); - gen_aa32_st32(s, tmp, addr, get_mem_index(s)); - tcg_temp_free_i32(tmp); - } - tcg_gen_addi_i32(addr, addr, 4); - } - if ((insn & (1 << 11)) =3D=3D 0) { - tcg_gen_addi_i32(addr, addr, -offset); - } - /* write back the new stack pointer */ - store_reg(s, 13, addr); - /* set the new PC value */ - if ((insn & 0x0900) =3D=3D 0x0900) { - store_reg_from_load(s, 15, tmp); - } - break; + /* push/pop, in decodetree */ + goto illegal_op; =20 case 1: case 3: case 9: case 11: /* czb */ rm =3D insn & 7; diff --git a/target/arm/t16.decode b/target/arm/t16.decode index 5829b9a58c..55fadce223 100644 --- a/target/arm/t16.decode +++ b/target/arm/t16.decode @@ -221,3 +221,13 @@ REVSH 1011 1010 11 ... ... @rdm # rest of the space is a reserved hint, behaves as nop. NOP 1011 1111 ---- 0000 } + +# Push and Pop + +%push_list 0:9 !function=3Dt16_push_list +%pop_list 0:9 !function=3Dt16_pop_list + +STM 1011 010 ......... \ + &ldst_block i=3D0 b=3D1 u=3D0 w=3D1 rn=3D13 list=3D%push_l= ist +LDM_t16 1011 110 ......... \ + &ldst_block i=3D1 b=3D0 u=3D0 w=3D1 rn=3D13 list=3D%pop_li= st --=20 2.17.1