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: 828186 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Wp1iwzPK"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yHttN1FQBz9s83 for ; Fri, 20 Oct 2017 03:00:12 +1100 (AEDT) Received: from localhost ([::1]:49861 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5DEw-0004qE-5K for incoming@patchwork.ozlabs.org; Thu, 19 Oct 2017 12:00:10 -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+incoming=patchwork.ozlabs.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(-) 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;