From patchwork Tue Sep 26 20:14:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 114294 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4246203qgf; Tue, 26 Sep 2017 13:25:50 -0700 (PDT) X-Received: by 10.55.177.129 with SMTP id a123mr16450618qkf.210.1506457550370; Tue, 26 Sep 2017 13:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506457550; cv=none; d=google.com; s=arc-20160816; b=py8mkznVdTY+2sHEDe04HbEemXhzV311dtVdBJUJH9ZTqJab8CLML8U1q/KLP7J6ld yaNl2OtyQllsDgmdNTjCPo6Eg+5ahLsCguWv9r/O6UjFVYbfwcGbaxQXjh/tdt4xGTib iRAd7s8jq6mE7nQbHZaMuhPAFxqudr6F6z9ojo7N0ar641ALd/fWqAZsEZ0D3xVzkvsn vGvPlVzM6y4X8YFEXrfZwZr7zmThYxhVEwKwXy61+dQjNsVZiuYvPyIjswrcHFmxPZ2+ 7cFOs0iH7433FpPfGxru4VrAifBt473Jng6QHO0eX8fYFw7BQkh6I9ZJK5L+SINeaK1G 4Yjg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=iHGWhZ7FMiF/1t3mBnHk2VoW4xUvwNwin4py5V11uoo=; b=yjKyE/i6oCIrCSyYzromCRrcPBx71+VpdOt5QUM6dA6pouSRJ0NYZjbyFKtYyIkQZl ff7pObJOVlAqiPdsiwLS/3B+TQxBT1oF8pWg7IFUQiBjXxwHByae/GZmPsa/Saq5Ld21 tBpv8AIwvlvSJh65OuKYJgQUncU2CAgkY56GanepRp13604KCxy6BdzGE/xPU0l208mu vdHNGJUepkVEgY2u25NupJJifNdo25/p3Ev2RaRr9Zl3N8+pjFvd4/0WtzQ4Rs98uxvT fnMd3mtnnwgRl1T1O64jZ60jjIkZRZaJuu84b3ipX740XNuTo+diAvxM4GJb9/ybODCt Tjyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=V2foSD8u; 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 i2si1715203qkf.196.2017.09.26.13.25.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Sep 2017 13:25:50 -0700 (PDT) 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=V2foSD8u; 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]:51039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwwQO-000349-5e for patch@linaro.org; Tue, 26 Sep 2017 16:25:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwwFg-0002yp-AN for qemu-devel@nongnu.org; Tue, 26 Sep 2017 16:14:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwwFf-0003Gm-Dq for qemu-devel@nongnu.org; Tue, 26 Sep 2017 16:14:44 -0400 Received: from mail-pg0-x22f.google.com ([2607:f8b0:400e:c05::22f]:48917) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dwwFf-0003Fw-7T for qemu-devel@nongnu.org; Tue, 26 Sep 2017 16:14:43 -0400 Received: by mail-pg0-x22f.google.com with SMTP id v23so6516393pgc.5 for ; Tue, 26 Sep 2017 13:14:43 -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 :mime-version:content-transfer-encoding; bh=iHGWhZ7FMiF/1t3mBnHk2VoW4xUvwNwin4py5V11uoo=; b=V2foSD8upKy8zHkZTTcI/X/T3o4ZgD3BR5f3N6SLpdGSGiyot553RG38IioqV2UFfm XzNz/vCnz4TWhn2qQwt/u3C/uWH97z+do9sPyyQJR93eigSMZhKnxu/tvVkrCqG+NEFw 1AL14DeUKyeIZzS2nrTKAdbhCcjNZO7uyYT1s= 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:mime-version:content-transfer-encoding; bh=iHGWhZ7FMiF/1t3mBnHk2VoW4xUvwNwin4py5V11uoo=; b=RzLeBGLnwbv7ADx9HvVh47bzKWTrnyOjzG2h+PcdyKWNcBN5kmWEEiCMHw9Qj80vT6 CqdaNSpzc+4WGE+N0T2rC/K2NfTvLtdzrTY2s0l17GzAuYt319Gu9CFxQ8E1+Dkme1Lm ySpV+OBFNzdsqol7pNYel3cncynZV5VicK6UzFJjBGZofiEu4wnX2SG/MvtyNFDStnID tMrkOJXjovQL1zR1W/nPqTeSd3qNhCG6Wvt2GkcpCcJM+Gon90mNNVnsOZNpEc7K4IeO LbU9xKXSIGautBwIXMoxQpgdP3W2KJUjdK5bKHZ5Y+arqJy9CUZMAI+fkdTFQL8Ymbp6 TZCA== X-Gm-Message-State: AHPjjUipbNmk1ls1rfRAxvtN6fcOt24kXMyKVVAJRyfYMdQSyCPomw7R XsZMBKjATlFmiFCsfgzqz/vSuHES2kk= X-Google-Smtp-Source: AOwi7QCPO/T7YdbaUmE3sajSJEvwvC/Ikb62vMALuT7RXQ4Er70sNYMZad4vFiaAuWzbFyJ4/Zz2sQ== X-Received: by 10.101.74.129 with SMTP id b1mr11968029pgu.272.1506456882139; Tue, 26 Sep 2017 13:14:42 -0700 (PDT) Received: from bigtime.twiddle.net ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id r138sm15582470pgr.12.2017.09.26.13.14.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Sep 2017 13:14:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 26 Sep 2017 13:14:26 -0700 Message-Id: <20170926201427.2833-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170926201427.2833-1-richard.henderson@linaro.org> References: <20170926201427.2833-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::22f Subject: [Qemu-devel] [PATCH v3 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: , Cc: peter.maydell@linaro.org, qemu-ppc@nongnu.org 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 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;