From patchwork Wed Aug 7 04:53:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 170691 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp6619200ile; Tue, 6 Aug 2019 21:53:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfPTKkG7szPRTQ2EJsHl3PLX8/6KB2qbZWtRugOPcflStGtcZYqGZplFbgn2fg9LAA/GF8 X-Received: by 2002:a0c:b521:: with SMTP id d33mr6310465qve.239.1565153639865; Tue, 06 Aug 2019 21:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565153639; cv=none; d=google.com; s=arc-20160816; b=jJbo9qSmzHIb+68wstxLCUoGG1OouRBGTEucLimmACDoB72IQmgr+z03TsIwTguOgI t47TBHidJZCoJPMQXSKUJmS6MkYkUVEQ2m2o/Cjjh7fPQchWvuvbyf426PduMJs8LDCr vu7IA/Kbd4WD+Lm8hIKKlG4gZ28r3hpQsKb7W44rqEEBMcqcgQLFAjt+8lqVPs7UJM2Z SsEfwyhMyNeBysMr77zLL/CW7S+eRkJV8osU6K4rhulwL/fz0Y8MnCr7ILp2Oq26kCsj apea2zYUa1gE5N6uLk2FWVsT/aOWdng3BY5VjMQzn+B4fqfAaoCVbjUwc4H9WOnKSB9M vzeA== 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=sTmPUIypnziYaVGRFy0ALsWEJTPu9wrCWxAaqC9PPBw=; b=cj/7RivS5zkPPURezuJn27zWrrhXjZP2BpgG+mApKgxFv7/bRwfo55pcrXkXWr0aDT i9p225kU9oFTm0LvfM5RGJlq2b5OUhhzMqr78B2AcgoUDh2d3/+DNsVmbWkNahtlaPlC xnyIwJHCScAn8wdpXA3rDLVqoSbbjxCSkzAGyr/rS1gbN54QOH/ItJQZ8681VjuO0Ytx H05nfLvfaeD9KXDhXAgbnU3Ui+Q+own2ypgxTm8Y7hrFWUW6L5GWXL277c4t2AkXzsuO VVOhiP/mvOkkdB8wZ0tNa3Pv/7nRiavVm2bgngBm6ZZ+9dCJ3AuayXUOyz2/8TV71EPN cdMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=a7oeOzFR; 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=fail (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 g52si55799835qtc.130.2019.08.06.21.53.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Aug 2019 21:53:59 -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=fail header.i=@linaro.org header.s=google header.b=a7oeOzFR; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvDxX-00017W-Ej for patch@linaro.org; Wed, 07 Aug 2019 00:53:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40563) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvDxM-00012U-8G for qemu-devel@nongnu.org; Wed, 07 Aug 2019 00:53:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hvDxK-0004iY-EZ for qemu-devel@nongnu.org; Wed, 07 Aug 2019 00:53:48 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:41508) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hvDxK-0004hh-9B for qemu-devel@nongnu.org; Wed, 07 Aug 2019 00:53:46 -0400 Received: by mail-pf1-x442.google.com with SMTP id m30so42774759pff.8 for ; Tue, 06 Aug 2019 21:53:46 -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=sTmPUIypnziYaVGRFy0ALsWEJTPu9wrCWxAaqC9PPBw=; b=a7oeOzFRGXtuyzqaFWdbCMWvJXEENm+AagrmWV5f4ziqMOwceC8DCKliWoyOQN/wqK DyEybt0iOtL7E4bl6MgQSonlrbKd1cm9XH8uuFhwzzl3xTRhp5qD8LyV55UlntCMITWQ YGbgzwa+mj+PFWq1NSTnF7+SgWgOsZN8d0ciZs7dqTqxJky2iyvI2+2oHe9liYkjIyPE zvVHMu4gBHN/kjqnwQ65S2p4yniXLuLytHYn8qA8L8XsXtutSALGK9pBxscoCglFvI8e KyUfrk34QknjqIXIgiygCQzilJZssWbEsbm3VIj4GNlXN3ek1k64ZVzz5W3XXLuTQS5b 0u5Q== 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=sTmPUIypnziYaVGRFy0ALsWEJTPu9wrCWxAaqC9PPBw=; b=GfauLBSKHBXn69k8YU5V9YZFY4VZdRpAshWzkvrM0QM34Pc3z+3QGyst7r8//zzulc DQv92ud/efubb138dUEyiLHAn/5jSRXGt/1IMGLwF21BZL3DnxikOKvY0Mh4NI8lB+GI lPoFYS4/FztJ0yTkJTuIpY5ezeuvp2X3SKfI2HuE+RxvKYMyNJs3LSHtGidCoInRIV1w JWVphiYUGvrwyWYsLLlGersp2bcUpS2+6Xbrj034s0LjdLJLC7YVmqsYt/AtxGO0Kyhz M4fEkwGZtIvYp6JZk42iSEbaGbRTSpGdBLy/KzTqt/G1YVqMmku/QfNEk5UOihrPI8G1 5IvQ== X-Gm-Message-State: APjAAAU0vBE0CIkd3Ere0CnZJKrBLNKyuQAV2G68qC0U4aXcv83fJtEq 0GypipY8QIr8xigHPSKx2Rdn01/ZsHk= X-Received: by 2002:a17:90a:8d0c:: with SMTP id c12mr6350022pjo.140.1565153624961; Tue, 06 Aug 2019 21:53:44 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id t9sm24347921pji.18.2019.08.06.21.53.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 06 Aug 2019 21:53:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 6 Aug 2019 21:53:25 -0700 Message-Id: <20190807045335.1361-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190807045335.1361-1-richard.henderson@linaro.org> References: <20190807045335.1361-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::442 Subject: [Qemu-devel] [PATCH 01/11] target/arm: Pass in pc to thumb_insn_is_16bit 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This function is used in two different contexts, and it will be clearer if the function is given the address to which it applies. Signed-off-by: Richard Henderson --- target/arm/translate.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.17.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/target/arm/translate.c b/target/arm/translate.c index 7853462b21..1f15f14022 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9261,11 +9261,11 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) } } -static bool thumb_insn_is_16bit(DisasContext *s, uint32_t insn) +static bool thumb_insn_is_16bit(DisasContext *s, uint32_t pc, uint32_t insn) { - /* Return true if this is a 16 bit instruction. We must be precise - * about this (matching the decode). We assume that s->pc still - * points to the first 16 bits of the insn. + /* + * Return true if this is a 16 bit instruction. We must be precise + * about this (matching the decode). */ if ((insn >> 11) < 0x1d) { /* Definitely a 16-bit instruction */ @@ -9285,7 +9285,7 @@ static bool thumb_insn_is_16bit(DisasContext *s, uint32_t insn) return false; } - if ((insn >> 11) == 0x1e && s->pc - s->page_start < TARGET_PAGE_SIZE - 3) { + if ((insn >> 11) == 0x1e && pc - s->page_start < TARGET_PAGE_SIZE - 3) { /* 0b1111_0xxx_xxxx_xxxx : BL/BLX prefix, and the suffix * is not on the next page; we merge this into a 32-bit * insn. @@ -11824,7 +11824,7 @@ static bool insn_crosses_page(CPUARMState *env, DisasContext *s) */ uint16_t insn = arm_lduw_code(env, s->pc, s->sctlr_b); - return !thumb_insn_is_16bit(s, insn); + return !thumb_insn_is_16bit(s, s->pc, insn); } static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) @@ -12122,7 +12122,7 @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) } insn = arm_lduw_code(env, dc->pc, dc->sctlr_b); - is_16bit = thumb_insn_is_16bit(dc, insn); + is_16bit = thumb_insn_is_16bit(dc, dc->pc, insn); dc->pc += 2; if (!is_16bit) { uint32_t insn2 = arm_lduw_code(env, dc->pc, dc->sctlr_b);