From patchwork Fri Dec 14 05:23:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 153762 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1682135ljp; Thu, 13 Dec 2018 21:43:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/VvyUcj4KbrhheE1ja+/Mta0P0zeu2HZZwmUYc4oPmxmQnmOSTkw0jp21LXybEXwIbKgsxo X-Received: by 2002:ae9:e901:: with SMTP id x1mr1343089qkf.332.1544766207949; Thu, 13 Dec 2018 21:43:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544766207; cv=none; d=google.com; s=arc-20160816; b=PxWIS1V4CEDKPYkO35mBHmMehsVu+BOAvDEa2/6lzMJWX49xEEw/GrrcM0bud5R2uQ mOrSkF0hIxy9oOdneobk3RQY3vnlzUh6XWSII2c0G0wUnKgAveTcxlMbe42qB4WFZKyr 5Ftc+ws9p5IjpOOuUBEqWge0LTSeYC4H8YCZOawYZCNqcq29MF2hLTQI2uPtA9cE9Tli 7Q0hjY/vCPi7Fwr269oYm0dm6doQcKHKokEn7YKkFg40MR6xRc5xluSqEbI7524xS18l 5Wn41iSkhdNZSl0i5+D902+MLF2mKBCUnlV8MiXOzjayB6Qaw8AKupLvbPUXj510UECl s7wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=TE8VOypuQUDbWa3+Ubc18uXhs64MyfV6eA+ZOdyUpNU=; b=Lbe6m2GthXG9CFlzf6zr38SBsHl9aR4RzEYSy6R6ovW8IVLGDgBet6/zcj5ylovi14 VzSm8/7p/bwXgaqKoLhgUm5jRy0AAc2YcUKgXlcwd6zLgxCf5EKFAOtMDIJIxCxkcBg8 vz3YXf7ILNO4Dco+Fg30M25pHdAw+VePymwApek1rUuMyPYJTQG5ZTw88hQK9NIFPNR2 y3UEUp5SueC/T5h5MDcvn0VM+KM/TsZFBtOdJGUSgVKlGQHS/L7JqNiJntSphrY3EkwZ P1xQgQsYdTsIvDHS8N6XpZ9mtnHdu2HoLBiArI3NMofIUHK9vO9CCEm+tpg/NIepuPUP E5IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dk7ESbae; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id v7si2359434qkv.68.2018.12.13.21.43.27 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Dec 2018 21:43:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dk7ESbae; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXgFz-0003ee-E7 for patch@linaro.org; Fri, 14 Dec 2018 00:43:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXfxi-0004TR-Fx for qemu-devel@nongnu.org; Fri, 14 Dec 2018 00:24:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXfxb-0005OO-6a for qemu-devel@nongnu.org; Fri, 14 Dec 2018 00:24:32 -0500 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:41640) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXfxb-0005O7-1j for qemu-devel@nongnu.org; Fri, 14 Dec 2018 00:24:27 -0500 Received: by mail-oi1-x230.google.com with SMTP id j21so3624660oii.8 for ; Thu, 13 Dec 2018 21:24:27 -0800 (PST) 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=TE8VOypuQUDbWa3+Ubc18uXhs64MyfV6eA+ZOdyUpNU=; b=dk7ESbaeLmAVrGd7YmMhulTT67BAUSSA883+EAlffgfNxeEACPZObzbEJju0td7yvR yjsH5eOm1oBW5EUT/J9hVKT0cjwhxyvHLRVR/7ogslTIoD4O0fEky4/iZOECBhhVyv0n JExmNSMHZ/dXA87dh6RP3hqMaq8AHEXYRKmIc= 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=TE8VOypuQUDbWa3+Ubc18uXhs64MyfV6eA+ZOdyUpNU=; b=QvLuPpHScKSPPIdDAiM2TlsEZepgb1CYlmoYFBTgNj6ugDuVs9ywirfGs9G/NOn+ZH g2srbEO9OhcdHrbwa6LHCZtQE8IHeF9NpvTh0omur9YFRu94u0+jzv0g7KVvrKINQP6t 7Uq/ggaZl49QbuAX2OqsAzB8eBHUUDumkfHtC+iyB5bQJCb0tNR5zGmPAe1IrB3eoP9C RsNewigAFTnDVzUXMBgcSjXYWN5/KfYTo3cBJzmrZDPKC2UZmn38ULk36q4GisinSF2h t9ahaw4emXi5HvoHZ+6qtLwy5+S5r4wsfaWqo19EYn/HgzyXzctvDPVoYKDt4qs3R4uX KSXg== X-Gm-Message-State: AA+aEWZjOG+NKW0hjCkrvjvbf4uULs6w7XJQS/KM+7TFNCUp2+s73Q9I CIYMBXzaU9C47vsHnHUZMP8X3Uns/ni6fw== X-Received: by 2002:aca:5e85:: with SMTP id s127mr1009157oib.181.1544765065953; Thu, 13 Dec 2018 21:24:25 -0800 (PST) Received: from cloudburst.twiddle.net ([187.217.227.243]) by smtp.gmail.com with ESMTPSA id r1sm1845379oti.44.2018.12.13.21.24.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Dec 2018 21:24:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2018 23:23:54 -0600 Message-Id: <20181214052410.11863-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181214052410.11863-1-richard.henderson@linaro.org> References: <20181214052410.11863-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::230 Subject: [Qemu-devel] [PATCH v2 11/27] target/arm: Rearrange decode in disas_uncond_b_reg X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This will enable PAuth decode in a subsequent patch. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 47 +++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 11 deletions(-) -- 2.17.2 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c84c2dbb66..30086a5d7f 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1989,32 +1989,54 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) rn = extract32(insn, 5, 5); op4 = extract32(insn, 0, 5); - if (op4 != 0x0 || op3 != 0x0 || op2 != 0x1f) { - unallocated_encoding(s); - return; + if (op2 != 0x1f) { + goto do_unallocated; } switch (opc) { case 0: /* BR */ case 1: /* BLR */ case 2: /* RET */ - gen_a64_set_pc(s, cpu_reg(s, rn)); + switch (op3) { + case 0: + if (op4 != 0) { + goto do_unallocated; + } + dst = cpu_reg(s, rn); + break; + + default: + goto do_unallocated; + } + + gen_a64_set_pc(s, dst); /* BLR also needs to load return address */ if (opc == 1) { tcg_gen_movi_i64(cpu_reg(s, 30), s->pc); } break; + case 4: /* ERET */ if (s->current_el == 0) { - unallocated_encoding(s); - return; + goto do_unallocated; + } + switch (op3) { + case 0: + if (op4 != 0) { + goto do_unallocated; + } + dst = tcg_temp_new_i64(); + tcg_gen_ld_i64(dst, cpu_env, + offsetof(CPUARMState, elr_el[s->current_el])); + break; + + default: + goto do_unallocated; } if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); } - dst = tcg_temp_new_i64(); - tcg_gen_ld_i64(dst, cpu_env, - offsetof(CPUARMState, elr_el[s->current_el])); + gen_helper_exception_return(cpu_env, dst); tcg_temp_free_i64(dst); if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { @@ -2023,14 +2045,17 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) /* Must exit loop to check un-masked IRQs */ s->base.is_jmp = DISAS_EXIT; return; + case 5: /* DRPS */ - if (rn != 0x1f) { - unallocated_encoding(s); + if (op3 != 0 || op4 != 0 || rn != 0x1f) { + goto do_unallocated; } else { unsupported_encoding(s, insn); } return; + default: + do_unallocated: unallocated_encoding(s); return; }