From patchwork Thu Oct 19 15:51:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116413 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp654949qgn; Thu, 19 Oct 2017 09:01:40 -0700 (PDT) X-Received: by 10.55.134.70 with SMTP id i67mr2738049qkd.22.1508428900048; Thu, 19 Oct 2017 09:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508428900; cv=none; d=google.com; s=arc-20160816; b=wLuSvSeZbPLxu15i/OOz6W0dw8KwymXONUxB9ms25SGYf6tpSn+ikNgCMPHoPURT8x 9JvC/eCvnWPLIS09MKaWJ4GCtvNXbBk9hjskRmdsewFStnmbhr8LBZXk0YayY+OJG5se UZ+cT4bPb4OFZ6TRAms0v45MS4ZnN0ZNRrKLYjNST8iWML7yrJ7VYT8lj20qugsYoi+P GOyPjvV+vclgJwWla5p8fbchJ0HcMDmEkzHVum61il3OK9Ddu5hiCzIXRLYesItaORAm CUdbnyseGjlv8yW16kkSXM0bUqrpWwtZDuaYMsQVHi+hIPcaC12ZAbOhvB4GqCEjBeC4 SjTw== 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=ZPp5mFCuMXXtXXcl4cuF8jT0S6sf5Zb1W02xzDFlJ/4=; b=QVSaVtLhmv8yXIC/zZKj+ev9z+OymdmTPhYvLtMSi/2NN7C5WrgtMBFXMf01UoIhBE 1/yVCRdrukpUPIkuFp+ptvsPKWerQrVBEeKvu743aLgpoG9fJ+iNj/J7/ySyjak2iGfH p/DQvK4yehVUiZGzb9aYjgbHW0jrdVoU486EniS23EnQ5AJvkiaQY94Sw9Nc37sz2YTM 5aLvLYdeFFfCbvf6LsZ25KiP8wdOjtaUV9xq5eBPqRmAiZZmSuhlJm9uzQZP/FR23aKe OLiqvBk/g0mJvkhl4Qr7zQVtp1DgAq9lMs7bb6lP5kOfw9BYsGPOs7hB4ZtPDXa/7cDn Hv0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Wp1iwzPK; 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 o37si4713574qkh.186.2017.10.19.09.01.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 19 Oct 2017 09:01:40 -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=Wp1iwzPK; 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]:49895 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5DGL-0005vx-Vv for patch@linaro.org; Thu, 19 Oct 2017 12:01:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5D74-0007FV-OD for qemu-devel@nongnu.org; Thu, 19 Oct 2017 11:52:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5D73-0000Iw-S7 for qemu-devel@nongnu.org; Thu, 19 Oct 2017 11:52:02 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:47746) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5D73-0000I5-Ld for qemu-devel@nongnu.org; Thu, 19 Oct 2017 11:52:01 -0400 Received: by mail-pg0-x242.google.com with SMTP id r25so7532975pgn.4 for ; Thu, 19 Oct 2017 08:52:01 -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=ZPp5mFCuMXXtXXcl4cuF8jT0S6sf5Zb1W02xzDFlJ/4=; b=Wp1iwzPK4Qz12LTcA1cq6LoR96X4IxFW9PqEtQGGoMEyR3+yHhG9qXckxgQq7EBj+p 0GLhXGzNREBsOaL1lA2o0rzHL8o/252kxm64SWowStytI/wyAix0VId+DlCM4EWI6KwQ fJiwBzA07+r8KJiJQG0X8jYxLvM+mAX8JvZSA= 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=ZPp5mFCuMXXtXXcl4cuF8jT0S6sf5Zb1W02xzDFlJ/4=; b=hqTDKTIhi+/OP7NWv4n3CFtqhkm5mKXmaOsHp8LatwDAkX2b0//f3eRhRaQaryTbJ+ 0Xe9rGK2ElgoYR4eN4Yqkx/kXKwl6VXM+D6fbqgAZwnZRu+sDeNGLcFzWQ911zEY1A6S D5s1rf+Zht8jAoUbU1YE1S7wuUinBIRsNlLtZppE29ny4zsr/umcGErZIYMXsQdT9xVX YzF4eQmn1Sae72kxgFCQpVLCZ9yuGSO89FH6YLVrvuccCxz/1vrqfTJhn+/laDeWsTt0 2yxIcy2AUmAGS5k0c+AOQwNKgABlkUHYCXComKPfJ80k2cEIyfOuGLj70lhSI33iPNCA L01A== X-Gm-Message-State: AMCzsaUKwxNISO3A/R+WfuPELo706iTo/rhKH0HhQhl5P6DXAS7IQ0WV 6b0oH7Z6x/KdF2aLWh0rMLV1fcfzjS0= X-Google-Smtp-Source: ABhQp+SFVXHIOzXILcVtJGGEhlMvpygdoiuXuPDAKhsV/rpc8Ku7L+asKDvd8fFLVU6H9Y45ev8qYw== X-Received: by 10.99.190.12 with SMTP id l12mr1784516pgf.340.1508428320342; Thu, 19 Oct 2017 08:52:00 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-165-104.tukw.qwest.net. [97.113.165.104]) by smtp.gmail.com with ESMTPSA id 76sm27971114pfq.4.2017.10.19.08.51.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Oct 2017 08:51:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 19 Oct 2017 08:51:45 -0700 Message-Id: <20171019155146.30434-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171019155146.30434-1-richard.henderson@linaro.org> References: <20171019155146.30434-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::242 Subject: [Qemu-devel] [PATCH v6 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: kraxel@redhat.com 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;