From patchwork Tue Sep 19 15:03: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: 113030 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp5064305qgf; Tue, 19 Sep 2017 08:40:20 -0700 (PDT) X-Received: by 10.200.53.216 with SMTP id l24mr2807228qtb.7.1505835620294; Tue, 19 Sep 2017 08:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505835620; cv=none; d=google.com; s=arc-20160816; b=wLkKjyKKPJ3HV+1febdPZk+Mqjk/j5qpArZexJk3JRYeUUbFwxc8XyUc+XlPE3z89M hVhKt29xQNhNmMtw+0PWRdg6gUYPTRX4iK/wJdaHsLsCABXgeL3RXUwjKRDejV1J2EAI y64LyXn3B9Bl+J30XvzpuUTQH0G/Ffpbr9VG9y+a96lgsmXNvlmAbENLByghLUwY6VxB 1uOrO2+XXejkTNYd6LNGm49l+T+WaJ6WdcvBsrHdXk5zXjIKE5Ti1Y+5jPyrXfI18mqQ rL1+9gKxcz/60J2X731tldVTPyStA4zSllxja8B6Z8FzqtLnlJY8pbDQKmE0bDeWCrnL +1Hg== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=3hkq2jrf4zLN0ohNd3zfc5ZyRYqIqhwKRQspcnViGNc=; b=uQjMFmeopZ1rU+hvxQ7QhvHBe1fO0pkPK/RPLGfjr3hBivNG3CpDN04Tzpd0N4vqVn 5MjGFpK2KwUqpZdXWpWMFdqHNvqn3vBSZgHipq9/QWnEag420RI7OaIWG7OCAbiAD7Ka APZ3F4VMR6anHClpZaH6d11dwf0JGN/C6mxVDLMqcE/1ndkbVI1yGkeyrHI/L1jcR0qY Pc3RpUYTbA7S+r8QB71wlRRWsJssA9OoTAWcrZTlPf/UT803aFNaixB7c+dDZ+Nicm0L A5V730nED2FCtHFz0t5AdEkruIdaMkQWKUYXI290FSkmYVa0q35tkp6dpsHxpRk328cE kqRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=R5DyBz7J; 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 c64si9582169qkd.468.2017.09.19.08.40.19 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 19 Sep 2017 08:40:20 -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=R5DyBz7J; 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]:43624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duKdG-0006wU-8X for patch@linaro.org; Tue, 19 Sep 2017 11:40:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duK3j-00089i-BQ for qemu-devel@nongnu.org; Tue, 19 Sep 2017 11:03:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duK3i-0003mq-AN for qemu-devel@nongnu.org; Tue, 19 Sep 2017 11:03:35 -0400 Received: from mail-io0-x231.google.com ([2607:f8b0:4001:c06::231]:49512) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duK3i-0003mT-6V for qemu-devel@nongnu.org; Tue, 19 Sep 2017 11:03:34 -0400 Received: by mail-io0-x231.google.com with SMTP id 21so726216iof.6 for ; Tue, 19 Sep 2017 08:03:34 -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; bh=3hkq2jrf4zLN0ohNd3zfc5ZyRYqIqhwKRQspcnViGNc=; b=R5DyBz7J6PEUyn6OYT4uVuSvCPISa8RkIGPoZYGIkmD8g0zymWqZIiXDdH2JXKDRL2 fFQ94tDa8VKO7bwmO9ipoh4mimwaSUN4Zz/8GuDoZYWuydCL0l17xxhLfRBRWcn/Pq9J 2KhYGAmcwtgAyFtPMTt/u+07qWiZ08paNg50s= 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; bh=3hkq2jrf4zLN0ohNd3zfc5ZyRYqIqhwKRQspcnViGNc=; b=gVk40/7AlB82UkY9J2ABKLW2/ZbN9+wmx6Q6WxZxrd8JcoNCvwnEH7TIwdC5lb79mE 1+/ymveRoFwNw307MhdelLmnfYswc/J1NnMizJL5Ulm+0FA+IvBYRZdvm8to5k3j0K4K g5EfAFlSEEhDP6VmkebPXPhDlpLDE3gVPWXzqrZXr72LvKzkg9VC2USkPP1ExJCzTrrz V6VAUNKYz+Jf4K9BS0KWz+NQmmNItDzm+PNVjajLyBNRPaBvLrRMpC8ZSOW906OlHZOM MNXYZcBZhygBBVk/TXEOJK+ZhfupQX90cjyIo0xwtIWSTdqNpo3AMTAkXwZTYatJRnuV 4pPA== X-Gm-Message-State: AHPjjUjX4SdqLjYg1f2qZiLsARhnW17f7NQLSf08nwu96JlNFG5Yqwsr UvyZhL3ugWAtsST7fuBoa1STkpVkzj0= X-Google-Smtp-Source: AOwi7QCMFvjmTBa/eqt1ZOOTupThjbksJa0WfdhL/jItr1QYHPEWYi/xe5DpxK3PTOuXkYYlJRMBvw== X-Received: by 10.202.4.6 with SMTP id 6mr1767974oie.240.1505833413126; Tue, 19 Sep 2017 08:03:33 -0700 (PDT) Received: from bigtime.twiddle.net (162.189-204-159.bestel.com.mx. [189.204.159.162]) by smtp.gmail.com with ESMTPSA id h63sm360621otb.59.2017.09.19.08.03.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Sep 2017 08:03:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 10:03:13 -0500 Message-Id: <20170919150313.10833-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170919150313.10833-1-richard.henderson@linaro.org> References: <20170919150313.10833-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::231 Subject: [Qemu-devel] [PATCH v2 8/8] 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. Signed-off-by: Richard Henderson --- disas.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) -- 2.13.5 Reviewed-by: Alex Bennée diff --git a/disas.c b/disas.c index b4e4fc409e..c3606b3986 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, - struct disassemble_info *info) +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;