qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] register: fix incorrect read mask


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 2/2] register: fix incorrect read mask
Date: Sat, 11 Feb 2017 00:16:54 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0


On 02/10/2017 07:19 PM, Alistair Francis wrote:
On Mon, Feb 6, 2017 at 3:39 PM, Philippe Mathieu-Daudé <address@hidden> wrote:
The register_read() function expects a bitmask argument.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>

The functionality of these two patches looks good to me.

I think it's weird that we convert the write function in one patch
(when we add the function) and the read in another.

I think both patches should just be squashed together. It's a pretty
small change.

Thanks,

Alistair

Sure, will do in v2.

Thanks!


---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]