qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	Alistair Francis <alistair.francis@xilinx.com>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] register: fix incorrect read mask
Date: Mon,  6 Feb 2017 20:39:31 -0300	[thread overview]
Message-ID: <20170206233931.14921-3-f4bug@amsat.org> (raw)
In-Reply-To: <20170206233931.14921-1-f4bug@amsat.org>

The register_read() function expects a bitmask argument.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/core/register.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/core/register.c b/hw/core/register.c
index 12f4c1e62d..482e3f827a 100644
--- a/hw/core/register.c
+++ b/hw/core/register.c
@@ -213,6 +213,7 @@ uint64_t register_read_memory(void *opaque, hwaddr addr,
     RegisterInfoArray *reg_array = opaque;
     RegisterInfo *reg = NULL;
     uint64_t read_val;
+    uint64_t re;
     int i;
 
     for (i = 0; i < reg_array->num_elements; i++) {
@@ -228,7 +229,10 @@ uint64_t register_read_memory(void *opaque, hwaddr addr,
         return 0;
     }
 
-    read_val = register_read(reg, size * 8, reg_array->prefix,
+    /* Generate appropriate read enable mask */
+    re = register_enabled_mask(reg->data_size, size);
+
+    read_val = register_read(reg, re, reg_array->prefix,
                              reg_array->debug);
 
     return extract64(read_val, 0, size * 8);
-- 
2.11.0

  parent reply	other threads:[~2017-02-06 23:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 23:39 [Qemu-devel] [PATCH 0/2] register: fix incorrect read mask Philippe Mathieu-Daudé
2017-02-06 23:39 ` [Qemu-devel] [PATCH 1/2] register: inline register_enabled_mask Philippe Mathieu-Daudé
2017-02-06 23:39 ` Philippe Mathieu-Daudé [this message]
2017-02-10 22:19   ` [Qemu-devel] [PATCH 2/2] register: fix incorrect read mask Alistair Francis
2017-02-11  3:16     ` Philippe Mathieu-Daudé
2017-02-11  3:43     ` [Qemu-devel] [PATCH v2] " Philippe Mathieu-Daudé
2017-02-14  1:20       ` Alistair Francis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170206233931.14921-3-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=alistair.francis@xilinx.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).