[{"id":1775524,"web_url":"http://patchwork.ozlabs.org/comment/1775524/","msgid":"<87y3p1tvyr.fsf@linaro.org>","list_archive_url":null,"date":"2017-09-26T13:45:16","subject":"Re: [Qemu-devel] [PATCH v2 8/8] disas: Remove\n\tmonitor_disas_is_physical","submitter":{"id":39532,"url":"http://patchwork.ozlabs.org/api/people/39532/","name":"Alex Bennée","email":"alex.bennee@linaro.org"},"content":"Richard Henderson <richard.henderson@linaro.org> writes:\n\n> Even though there is only one monitor, and thus no race on this\n> global data object, there is also no point in having it.  We can\n> just as well record the decision in the read_memory_function that\n> we select.\n>\n> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>\n\nReviewed-by: Alex Bennée <alex.bennee@linaro.org>\n\n> ---\n>  disas.c | 18 +++++-------------\n>  1 file changed, 5 insertions(+), 13 deletions(-)\n>\n> diff --git a/disas.c b/disas.c\n> index b4e4fc409e..c3606b3986 100644\n> --- a/disas.c\n> +++ b/disas.c\n> @@ -513,19 +513,11 @@ const char *lookup_symbol(target_ulong orig_addr)\n>\n>  #include \"monitor/monitor.h\"\n>\n> -static int monitor_disas_is_physical;\n> -\n>  static int\n> -monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length,\n> -                     struct disassemble_info *info)\n> +physical_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length,\n> +                      struct disassemble_info *info)\n>  {\n> -    CPUDebug *s = container_of(info, CPUDebug, info);\n> -\n> -    if (monitor_disas_is_physical) {\n> -        cpu_physical_memory_read(memaddr, myaddr, length);\n> -    } else {\n> -        cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);\n> -    }\n> +    cpu_physical_memory_read(memaddr, myaddr, length);\n>      return 0;\n>  }\n>\n> @@ -540,8 +532,8 @@ void monitor_disas(Monitor *mon, CPUState *cpu,\n>      INIT_DISASSEMBLE_INFO(s.info, (FILE *)mon, monitor_fprintf);\n>\n>      s.cpu = cpu;\n> -    monitor_disas_is_physical = is_physical;\n> -    s.info.read_memory_func = monitor_read_memory;\n> +    s.info.read_memory_func\n> +        = (is_physical ? physical_read_memory : target_read_memory);\n>      s.info.print_address_func = generic_print_address;\n>      s.info.buffer_vma = pc;\n>      s.info.cap_arch = -1;\n\n\n--\nAlex Bennée","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"OnwgSKOH\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y1j065Wxkz9t3m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 23:45:58 +1000 (AEST)","from localhost ([::1]:47637 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dwqBQ-00045X-UH\n\tfor incoming@patchwork.ozlabs.org; Tue, 26 Sep 2017 09:45:56 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:51719)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <alex.bennee@linaro.org>) id 1dwqAu-00044F-1d\n\tfor qemu-devel@nongnu.org; Tue, 26 Sep 2017 09:45:25 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <alex.bennee@linaro.org>) id 1dwqAp-0004kE-0O\n\tfor qemu-devel@nongnu.org; Tue, 26 Sep 2017 09:45:24 -0400","from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:50835)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <alex.bennee@linaro.org>)\n\tid 1dwqAo-0004ji-OB\n\tfor qemu-devel@nongnu.org; Tue, 26 Sep 2017 09:45:18 -0400","by mail-wr0-x229.google.com with SMTP id w12so13271042wrc.7\n\tfor <qemu-devel@nongnu.org>; Tue, 26 Sep 2017 06:45:18 -0700 (PDT)","from zen.linaro.local ([81.128.185.34])\n\tby smtp.gmail.com with ESMTPSA id\n\tc78sm2163812wmd.7.2017.09.26.06.45.16\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 26 Sep 2017 06:45:16 -0700 (PDT)","from zen (localhost [127.0.0.1])\n\tby zen.linaro.local (Postfix) with ESMTPS id 127343E0137;\n\tTue, 26 Sep 2017 14:45:16 +0100 (BST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=references:user-agent:from:to:cc:subject:in-reply-to:date\n\t:message-id:mime-version:content-transfer-encoding;\n\tbh=C7s2sqotb/eA2hzhZxqxwYEme5/3x94AQeJ2HAQe8t0=;\n\tb=OnwgSKOH+01912vCTah4vXqQoOCOd0E0If9aeeKhQX9ta3dbe9i0ddOjc+ONF4UQ9B\n\tuNXHNDLFvYTCQwsmGltS5CxAGpsLsaPDpg1Jv/itGuu0aXuoQRVNvubtdhC/TAODWEqK\n\tvCX0IUL9lLqLbi/RinJY+sSBLMyR9e8gAFjhs=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:references:user-agent:from:to:cc:subject\n\t:in-reply-to:date:message-id:mime-version:content-transfer-encoding; \n\tbh=C7s2sqotb/eA2hzhZxqxwYEme5/3x94AQeJ2HAQe8t0=;\n\tb=pL1h9WZ1Mv6ZQxXAMLiwtnMSymOwFNcIZrogOnIie8OVNRvBx4lZl+lhGzFDS5PUU2\n\tiLdZpqL0yjOojIhZLOgyeXue71y/p4VQ0gLUgq0s/ipgXD8v4kiYgtupYGyOgQy2aOYv\n\tI6ME9JldsBc+/r76maTmq7cPhh09WD9mKbuotX3sQKhtDlqQDKwBt5F4RiCYiW593AZ+\n\t1EH0GpkUKFOR2pvkwZqBclD4m+f7eKGVOowsLEaIbv5dud041lZMkGx7zlvgGa+zJtzY\n\tJoDTERkS2OzVdhm0vDLllZgOwoLb6GEaqZPJem5u30VSomamnevWPIi+GdsjcR59q0Er\n\tihuA==","X-Gm-Message-State":"AHPjjUi/+CPQeH1BCR9c8Gk7vQkudijUQakt1YIJr5tbWutggkFbs1Ys\n\tfx+fU2oYeTkoHikQLPu5tGcYQg==","X-Google-Smtp-Source":"AOwi7QAOXFIZAb7iqZWwfP+8w/fQqmj68DyDIWYMcY2z3C0z2AxK42wBh2zvn5yDBQwgsfk2xG3uew==","X-Received":"by 10.223.138.238 with SMTP id z43mr8671228wrz.83.1506433517562; \n\tTue, 26 Sep 2017 06:45:17 -0700 (PDT)","References":"<20170919150313.10833-1-richard.henderson@linaro.org>\n\t<20170919150313.10833-9-richard.henderson@linaro.org>","User-agent":"mu4e 0.9.19; emacs 26.0.60","From":"Alex =?utf-8?q?Benn=C3=A9e?= <alex.bennee@linaro.org>","To":"Richard Henderson <richard.henderson@linaro.org>","In-reply-to":"<20170919150313.10833-9-richard.henderson@linaro.org>","Date":"Tue, 26 Sep 2017 14:45:16 +0100","Message-ID":"<87y3p1tvyr.fsf@linaro.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"8bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c0c::229","Subject":"Re: [Qemu-devel] [PATCH v2 8/8] disas: Remove\n\tmonitor_disas_is_physical","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-devel@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]