From patchwork Thu Sep 28 16:54:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 114462 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp970582qgf; Thu, 28 Sep 2017 10:01:34 -0700 (PDT) X-Received: by 10.200.36.19 with SMTP id c19mr1923329qtc.231.1506618094290; Thu, 28 Sep 2017 10:01:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506618094; cv=none; d=google.com; s=arc-20160816; b=ldOMyLVL/ejiawYK+3KIPGxgqmYg7vxQn76sIxMNGj/V6cr3+gl1linuBnuc0gkD6x UspyxKBMDxjTGJcRsF5zrnFN7lElq8gEl8braxeSBdM7bBc6BSqNDpciaHpalFqxudxy JXG9QqOjq5RqYtMuylWPN6hZbSKDpQc7axCZI4HTqqUjzXd4pWmxYZNeBUZDggwI8udu G0+WNRug3TnAvmKkb9HcKlguoL8W1499uxTlnTqCLyWxWkUAD0eI7UU41oX7UqjnYVvB 6nMpQvwS8+gq9JEKPbGcX9K5t+lKgG1hcr8svww0hbGE2kvsihJuTZ4R9oVVwWK+yfrG Bfow== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=iHGWhZ7FMiF/1t3mBnHk2VoW4xUvwNwin4py5V11uoo=; b=tZM2fyHaJBuvo5YdDNqfjUwGxcPDrJo1hNCsI/4jgz+fcuivXJT9eRK+seDLmXlnWa tEhLMe6QigCTxPHhs61QplJgeJxz9ur2r9TLtR7c/QijF9y1NXWaPjoNSIqp8QHyus4o EJZAtenmgKJS57yf1nGjpaYwlls5H1GpefspsRkP4JxPKfHWD9VhxulJz2opfYwqO1uY jfdU1fhq5Kt4DSoXM7MYmtefsEu4nK0IebTASzSAWStlSXE+NnWlNrkZKM7Zi9f/Q9fO +wQviI7L8fuqDRPX9Fb5/G+tPLwlTy++MuPogxab5xBCvFgLLaYyVeqXWMse14u6k4Nd TO9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SY0Zd9Ni; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j63si1864047qke.421.2017.09.28.10.01.33 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 28 Sep 2017 10:01:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=SY0Zd9Ni; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:60088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxcBo-0001sE-4u for patch@linaro.org; Thu, 28 Sep 2017 13:01:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxc51-0004qR-6E for qemu-devel@nongnu.org; Thu, 28 Sep 2017 12:54:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxc50-0004O3-HT for qemu-devel@nongnu.org; Thu, 28 Sep 2017 12:54:31 -0400 Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]:50889) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dxc50-0004Ns-Ah for qemu-devel@nongnu.org; Thu, 28 Sep 2017 12:54:30 -0400 Received: by mail-pf0-x22d.google.com with SMTP id m63so1140555pfk.7 for ; Thu, 28 Sep 2017 09:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=iHGWhZ7FMiF/1t3mBnHk2VoW4xUvwNwin4py5V11uoo=; b=SY0Zd9NiZRCCN4DpF48624Bv3ZoEkpj4JDzn+MWs1buhy1mGDFuzLwz3NRfxZS1qF2 3x2/t7XRFzIJXCSUDvudWQQXBleuBz0CWZRWHURrqdKJ+fECcv+QggvD1zctqYVlF5Wq rYFitSRnLP3HZBMTahIk967f3ipTreYWe3RaA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iHGWhZ7FMiF/1t3mBnHk2VoW4xUvwNwin4py5V11uoo=; b=lmEQppYx2k+DpRnkGuuMLiHrgSDx4EHSCljnuoN+Wm+LN+t2IZxmzfYYu6C12G/x9h 6Ee35DV+r9wYm/LIRcIT8/gxV+R6CcXFgVAZV4FqsB98OQeis/iWxtQROOWSfaX5JBag +ItSoPzAv0lGMUmlxOuv3US1hj8v6pPUu9xLmmM+fUTmQ6GxkkYQpdkuW3153ytz0Vzw tzL5cHk/giqVeoXKT/TRZ0hlx41J9uJD2phEFSOKYo5qcspSJimFJUrzrgE8ZOfuI3PC hafZPzA3HAeCZ8Mp3t6aoSnLdrA9CgN1tCu4KaYKkBTJYt9BS2ufLwCvEreJJx35ExEH 3c9w== X-Gm-Message-State: AHPjjUgHPIUayWYWydssHpQaiyARuqu+522Aob/aVc9JgYD92ZPEcsJJ aWNPtoJtQ+E3EY9cq1difp6q99bW1Tw= X-Google-Smtp-Source: AOwi7QDqPoSs7gDlfNr66ytCRRfYKhHtOOlyMhSb3+NW1ktuE3HRI7BHM88Un8jg3vkXQl7lXuWuGQ== X-Received: by 10.99.175.65 with SMTP id s1mr3957pgo.448.1506617669071; Thu, 28 Sep 2017 09:54:29 -0700 (PDT) Received: from bigtime.twiddle.net ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id e133sm3062332pfh.177.2017.09.28.09.54.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Sep 2017 09:54:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Sep 2017 09:54:13 -0700 Message-Id: <20170928165414.7339-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170928165414.7339-1-richard.henderson@linaro.org> References: <20170928165414.7339-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::22d Subject: [Qemu-devel] [PATCH v4 8/9] disas: Remove monitor_disas_is_physical 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Even though there is only one monitor, and thus no race on this global data object, there is also no point in having it. We can just as well record the decision in the read_memory_function that we select. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- disas.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) -- 2.13.5 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé diff --git a/disas.c b/disas.c index 0d212f2ac5..194c523885 100644 --- a/disas.c +++ b/disas.c @@ -513,19 +513,11 @@ const char *lookup_symbol(target_ulong orig_addr) #include "monitor/monitor.h" -static int monitor_disas_is_physical; - static int -monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length, +physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length, struct disassemble_info *info) { - CPUDebug *s = container_of(info, CPUDebug, info); - - if (monitor_disas_is_physical) { - cpu_physical_memory_read(memaddr, myaddr, length); - } else { - cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0); - } + cpu_physical_memory_read(memaddr, myaddr, length); return 0; } @@ -540,8 +532,8 @@ void monitor_disas(Monitor *mon, CPUState *cpu, INIT_DISASSEMBLE_INFO(s.info, (FILE *)mon, monitor_fprintf); s.cpu = cpu; - monitor_disas_is_physical = is_physical; - s.info.read_memory_func = monitor_read_memory; + s.info.read_memory_func + = (is_physical ? physical_read_memory : target_read_memory); s.info.print_address_func = generic_print_address; s.info.buffer_vma = pc; s.info.cap_arch = -1;