From patchwork Wed Oct 25 12:30:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 117125 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp1698357edm; Wed, 25 Oct 2017 05:39:43 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RNnmZP9yFHXUE8xfixJyaAO2ksPqzSNhdzwMtGDeI1NiXVTw4LBWNvGpr6fYRi9y5Fz+LK X-Received: by 10.37.200.134 with SMTP id y128mr1229000ybf.43.1508935183046; Wed, 25 Oct 2017 05:39:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508935183; cv=none; d=google.com; s=arc-20160816; b=raK1DcPK+QbhOfpMBciqSvW43zlI40ZANwZY9mOIc7HuAo1Pl8FHpI+aggp/0TK2I6 nK8WxSicRMi619bZuXGJTEei/vZbC+kQCO9kFLFdBxVTBuuJmz6IgT0psJ+W5XKwcsi8 V0AIluw+L6GzmXGzFKxpa8jQ28cRZ2rEjXZAhFXctK7kDz9wXJfTsl8McagTyWWgICja OtVKOGIm/kr5VdfDAG+Dud7jmmalpA0L0+5qBg912JgY9YuUgqiQa3AW+W5M5kdKvgJe If6I8HVxOokfkv9Gn9ny/cUgCYg9scsImLPsu18kpPxUdwb/8KQkNQCnapJ3bjQV6VMt QLVw== 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=aOJWGi2Pwa8CB86BDvgFrq76U2vszJP+XqAlZxiiw1a8rEMpTjZcBr58/yxAxG1GJz USpsUeBZkAc1mIeVfcjqWgojmr63oGzaQDBlps87uNgdwgrXit7V3Ks++qWdzYw2572P lELlrq3KEG2uQDEjWAoOxcAYts1RrKgD44ngaxVsXPhQVaCzIs9m6tPeM3F8X3X9mjrm xPacCASR0lQSmVY9dgEfX20xGf+mqN6uRP8tK+UGWBDFUqtMwithd/+0fFuuTN4cQQ5A hc1LaVs4IzTO0TYJdXNyapPc9nV2yaYflNJudLcSUqCVWCZNrU65YAmHxY6XfRrtAhyV Ep1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZB03vdqv; 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 q123si431270ywe.122.2017.10.25.05.39.42 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 25 Oct 2017 05:39:43 -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=ZB03vdqv; 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]:48117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7KyE-0005Xw-Gy for patch@linaro.org; Wed, 25 Oct 2017 08:39:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7KqB-0007eM-Ho for qemu-devel@nongnu.org; Wed, 25 Oct 2017 08:31:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7Kq5-000857-M9 for qemu-devel@nongnu.org; Wed, 25 Oct 2017 08:31:23 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:48214) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e7Kq5-00084T-Fa for qemu-devel@nongnu.org; Wed, 25 Oct 2017 08:31:17 -0400 Received: by mail-wm0-x243.google.com with SMTP id p75so1567064wmg.3 for ; Wed, 25 Oct 2017 05:31:17 -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=ZB03vdqvURmLv46r1jFolv8s2py0xTbOMDPfzp2NkcHwTxry74D/fmPr4hX7bznCkU kHB3lp6lhm8qjuKQnF4hSPbhQIWRuAJox2vgRdKCAJZDuOGe/Nfxcu8fPT2wN+QMGmOK OR8GNoHkLVBAPR4wlroXyiG7AuLxP0EWeOmNs= 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=X7t8mMWhd2RHSdbr3Kts6JYD6mOV2+p2d5Nrwz/n8/nifzK8tEJfOH+CX9cIuMljMI +AYU5H1v/tMOAQEA68LCKe0D059HDEt5JZjnKQ/ikb0jp8A5PxZSgTsPRFjze/HsOp2X 23LZPbeiGOU5WHQyHDtckU2TS/4q9pDAurcDVZDC5HljQRMjR/DxGm8GsiWP+MFOgkS1 FvxGHqf7AtzwbpDtEZ+OPiDcqqL8T0w/Ls41WqigC2wtedrJrcA8uZOi6WzOPFnxDzBQ E4nErrfXt4GvRcTK9eDSadJZFWdOZ6L/PlfZERzSG/pVAoNssLPZXlRWVynF0Yo3mKQB qvBA== X-Gm-Message-State: AMCzsaW/PwUZC8xNXCUZcfu9hEI/FNCPlgGZJ1f15tDrVlTcfRaOrFR1 UE71K60IqG/26pTsJxFjm3Ti+ztg7Iw= X-Received: by 10.28.73.9 with SMTP id w9mr1643852wma.3.1508934676250; Wed, 25 Oct 2017 05:31:16 -0700 (PDT) Received: from cloudburst.twiddle.net ([62.168.35.105]) by smtp.gmail.com with ESMTPSA id 61sm2263446wrg.58.2017.10.25.05.31.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2017 05:31:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 25 Oct 2017 14:30:55 +0200 Message-Id: <20171025123056.3165-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171025123056.3165-1-richard.henderson@linaro.org> References: <20171025123056.3165-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: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 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: , Cc: peter.maydell@linaro.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. 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;