From patchwork Tue Oct 17 15:37:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116137 Delivered-To: patch@linaro.org Received: by 10.80.163.170 with SMTP id s39csp1373654edb; Tue, 17 Oct 2017 08:42:12 -0700 (PDT) X-Received: by 10.55.95.67 with SMTP id t64mr19514801qkb.249.1508254932302; Tue, 17 Oct 2017 08:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508254932; cv=none; d=google.com; s=arc-20160816; b=KSzM0u6UFvAYtKg0l8nMcaUPzVATkao9NeJUL+hp9UHo5N2K+8gkjUNP4wlW2h0FC5 yoeKAxs8IpPd5XfFadZ1Ppz+leJd8wWsj/+JU1X0Jd/OAzJUftM07CZcapcJxqvbc8n6 JxFlu8gG99+tc9FExKgNN2FyMvcwmnHRKCJJnXu8pYTrhR6IkVPSq5I87F2w1yp4oSgC uO0YbOcLNECEiPZNHQnspqL4efbSIDTElVllRckOHgvRo+CpnqgV3YxELv5x7qlD49OG lQK6nv5+LVbAV0m8h29iIjbmNmQyItXiWDrOJy1v5TPonPeFO3IMi9UUcDpLsaAVlGae mG8w== 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=hka4OKpB1sEXWyM0u9lG2fdZe8a2ld1bOBH1qwvYLsg=; b=P6z1hw08iVUg7yYg5cOVa6MTMFm9L6qMsG6W5qWHGunoVfwE0mxDoHaNEVYWq+PU6F u5vl9mKiCd5bfghPWNdkKQEW4yfnza4G2inJ3+y7mw1Dy+K+AXmbqTSZHX8PWKWiWk4z UtgoifXEsrAXJIh+HM7Q3jP9+DIDhyCo9jyEr3tSbe1H4pM87yUIP6VhSCnN+Kf+RSvN 65lR48WWG6A04jRgcWfcvgK27fg/w/23oxK2QBUonTY0D2kx1uJBTQNNLE4LJkJAckGR LOpu3y5En8QDkI1dDlkKzyk+qvXC81ydQu2SRaqOshToE0QNp9V55mZ34yvtKjkdJnZ5 4meg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QnUjzmiW; 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 m4si195148qtb.194.2017.10.17.08.42.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Oct 2017 08:42:12 -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=QnUjzmiW; 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]:40106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4U0Q-0007Oo-1C for patch@linaro.org; Tue, 17 Oct 2017 11:42:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4TwQ-0004NG-9Y for qemu-devel@nongnu.org; Tue, 17 Oct 2017 11:38:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4TwP-00062L-8V for qemu-devel@nongnu.org; Tue, 17 Oct 2017 11:38:02 -0400 Received: from mail-pf0-x233.google.com ([2607:f8b0:400e:c00::233]:57257) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4TwP-000602-2H for qemu-devel@nongnu.org; Tue, 17 Oct 2017 11:38:01 -0400 Received: by mail-pf0-x233.google.com with SMTP id b85so1602227pfj.13 for ; Tue, 17 Oct 2017 08:38:00 -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=hka4OKpB1sEXWyM0u9lG2fdZe8a2ld1bOBH1qwvYLsg=; b=QnUjzmiWI0dBlEbxfQxCN/04dHg1smwyFHDkMMzCkTqn/y9Ip71aZe1GxehlwYQlGZ 0DaTpgMX/4TBFaOnXpBtl3tUxJbu6mvIC+neJ3AJXMAPtAyTH62AuqHacmpZdOF5lozf ACOdG+7ffMSe3PANl3+9LtUaNKMuKj1vGunQM= 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=hka4OKpB1sEXWyM0u9lG2fdZe8a2ld1bOBH1qwvYLsg=; b=Q0+CfxOS9kLpZUMHvK0eJ7poFk5GzTkj358+q1J6llLuBoETiYQWhss2sfWiwcp90A YvjPGreJOA6/Uovsp9rI8vmdk4JeqoOc7Wg2UT2SBNREHgyqCQOh8ahX0B0HF0AmUCS+ yTIedy25A2z1AZ7KDXr02Q6zWYEIk2T8m/3KCgIrrtZd8sdS3puvzg+/17koxmDj81VX UCg89giOmeMXd4lNIzgYUXPIji/h7Dpk6uRQLcoKRKk097/mx7PihJuOyMUw5co70yBn zJAnN1ZxY9d3PJvlqnILPjyg4NDYlDTIYRGkK96PQSX051qUHMXRNtok05YWWZS6j0Xm oBpA== X-Gm-Message-State: AMCzsaWzyoAEZG8TPSxEYSxN4ZnqU00V4WNMZBH/ZfNHf6IuffRWLaqj JjVpM84YFeK+7XXCvot+oSDMNEQaOCY= X-Google-Smtp-Source: AOwi7QBMxHL0lgAOGvekyTQxumGk3q3ycovCDCgN/gvTi5Dk3y5fvEWWaVmFKPdRqx03b0HsBcWTYA== X-Received: by 10.99.3.21 with SMTP id 21mr11058460pgd.77.1508254675771; Tue, 17 Oct 2017 08:37:55 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-104-76.tukw.qwest.net. [97.126.104.76]) by smtp.gmail.com with ESMTPSA id y84sm20094415pff.158.2017.10.17.08.37.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Oct 2017 08:37:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 08:37:41 -0700 Message-Id: <20171017153742.10026-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171017153742.10026-1-richard.henderson@linaro.org> References: <20171017153742.10026-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::233 Subject: [Qemu-devel] [PATCH v5 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. 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 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;