From patchwork Sun Oct 22 00:46:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116621 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3189122qgn; Sat, 21 Oct 2017 17:53:50 -0700 (PDT) X-Received: by 10.55.175.132 with SMTP id y126mr13753259qke.45.1508633630351; Sat, 21 Oct 2017 17:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508633630; cv=none; d=google.com; s=arc-20160816; b=toQU7HtQQcqWtlOifK1T9GDW5LV2ZOyRa09ua7ocCrmxSg/jKcmnNxs7ixIZM3x0ND HXtD0rwpmexbLtD4oydzE4pRVVJiVIiRKYMCOUxxJEv1ZIgUvQQ4YHpYaLWINMuvdsl9 Gu5D5IoxmfvKvLtl6jnVwrtZeVt9POi48+s3fhDi5QD7qx9uZCpelhhXmLiBSxr8uR/K RGbHAS068hqEbl32eRXai2s73w4OkUDQz6Clhwd4/UNEaktT0uTw3P5ms7CR2W13HRQl 8KU6A1fOrTkJMMuzI/3CepUirUfVKNr8MePA0ZFf+mk7bjm6pCTPMQuQrzrTgIL/Xdj+ 3R9w== 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=ZPp5mFCuMXXtXXcl4cuF8jT0S6sf5Zb1W02xzDFlJ/4=; b=Bba0EPWesF7DBlwQXJH2+pDDqlXLn4ckLp5LLlvH91vtGFSgOyLCObGGenKtEIrGEL QzYcWki8bbyViW/USpPj3iO4X0IXtTJyR0geUJE9LxzkN5uACczZ7YUerd+FNjKmFpom xWaYOrMK0f5fe9HUd0UGikcVm07BHn5qhpvbhgLOETfaFxLjYe66l63lXXgFwNduETBt 1luT7ZchgdTc+JyICLlAop8shmTgMQe8MhwB2Xb26t0LLe22dqJfPR5rCxAroND8xeFK uBGeq3MQJO11eVrkZHZx+Eb/hZO/Z3nQFD+iiYOIFlpCPbJGtt2BjSxW2loRkuQ0YxDl xyXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aSopRGql; 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 d29si3605781qtc.94.2017.10.21.17.53.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 21 Oct 2017 17:53:50 -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=aSopRGql; 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]:59648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e64WS-0007E3-Am for patch@linaro.org; Sat, 21 Oct 2017 20:53:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e64Pa-0002Iq-MS for qemu-devel@nongnu.org; Sat, 21 Oct 2017 20:46:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e64PZ-0008Pe-GJ for qemu-devel@nongnu.org; Sat, 21 Oct 2017 20:46:42 -0400 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:51804) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e64PZ-0008Or-8u for qemu-devel@nongnu.org; Sat, 21 Oct 2017 20:46:41 -0400 Received: by mail-pg0-x241.google.com with SMTP id p9so9199815pgc.8 for ; Sat, 21 Oct 2017 17:46:41 -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=ZPp5mFCuMXXtXXcl4cuF8jT0S6sf5Zb1W02xzDFlJ/4=; b=aSopRGqlWmzYhYjmLIshLCd6nkYpig5/K/tyuI0rKKda3JcC3ShBSl8C3ezGaAZgSL iDcwEhxzxh+uiFznOGA060M1VskBcu3xMbtRXwTO5V65al81Wdt+fR3OfBqoVMgOcN3L NHQTuioNXZB6sXMNSE2oS2egNLE0lFlfC6aRw= 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=ZPp5mFCuMXXtXXcl4cuF8jT0S6sf5Zb1W02xzDFlJ/4=; b=DOrBdzRd1+cVswlMQfkQp7HvCZRW8AZaR8qsQl0Ym/UMinw4xOe8Oudq041gTI8Nm3 CvHf9au0T6J/UBqFgCST3N51TRNfEglqEOoMLatMtcLRJACDSq4Lk8jMSOS/gH481ATj IZZJVomTeq8v8xWzpUSn0la/SBKq89gKzXVzVVjsCfkAd86oCaukmx5w1odvh6lPmlsh LgMJCCDXKrbEu8MaI5N+m7VtidEjBGtMUug0oAt9WxjgFtqvMaVUzb8hQhEZyutcghMB pBxIg6NUxi9p4TLIN+b4hLl1q/7YVCXjYH2s/C8iKnBD9YKFygssV3mQFztiVaL/w6IO ktKQ== X-Gm-Message-State: AMCzsaU1O997GPpbFIrX6zjxkSF7Jl47LD61oE2uVQRpRE2ciTFHw2/8 6lI0ZG8Q2K2fKQ2oP2UGmMvSp3h1cXs= X-Google-Smtp-Source: ABhQp+Tt5LqSIJtYNGCoahau6SwblHDEvkmBcFlLWvUlSl2tbZ/8FyGt1lAAruLBjn/96FS56uVftw== X-Received: by 10.99.172.83 with SMTP id z19mr8276201pgn.46.1508633200087; Sat, 21 Oct 2017 17:46:40 -0700 (PDT) Received: from cloudburst.twiddle.net (174-21-9-158.tukw.qwest.net. [174.21.9.158]) by smtp.gmail.com with ESMTPSA id j12sm5766728pgs.35.2017.10.21.17.46.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Oct 2017 17:46:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 21 Oct 2017 17:46:20 -0700 Message-Id: <20171022004621.28372-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171022004621.28372-1-richard.henderson@linaro.org> References: <20171022004621.28372-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:c05::241 Subject: [Qemu-devel] [PATCH v7 10/11] 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. Tested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- disas.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) -- 2.13.6 diff --git a/disas.c b/disas.c index e52e776a60..92b389d25f 100644 --- a/disas.c +++ b/disas.c @@ -512,19 +512,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; } @@ -539,8 +531,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;