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 1/2] register: inline register_enabled_mask
Date: Mon, 6 Feb 2017 20:39:30 -0300 [thread overview]
Message-ID: <20170206233931.14921-2-f4bug@amsat.org> (raw)
In-Reply-To: <20170206233931.14921-1-f4bug@amsat.org>
This patch prepares for the fix of register_read() incorrect mask.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/core/register.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/hw/core/register.c b/hw/core/register.c
index 4bfbc508de..12f4c1e62d 100644
--- a/hw/core/register.c
+++ b/hw/core/register.c
@@ -59,6 +59,15 @@ static inline uint64_t register_read_val(RegisterInfo *reg)
return 0; /* unreachable */
}
+static inline uint64_t register_enabled_mask(int data_size, unsigned size)
+{
+ if (data_size < size) {
+ size = data_size;
+ }
+
+ return MAKE_64BIT_MASK(0, size * 8);
+}
+
void register_write(RegisterInfo *reg, uint64_t val, uint64_t we,
const char *prefix, bool debug)
{
@@ -192,11 +201,7 @@ void register_write_memory(void *opaque, hwaddr addr,
}
/* Generate appropriate write enable mask */
- if (reg->data_size < size) {
- we = MAKE_64BIT_MASK(0, reg->data_size * 8);
- } else {
- we = MAKE_64BIT_MASK(0, size * 8);
- }
+ we = register_enabled_mask(reg->data_size, size);
register_write(reg, value, we, reg_array->prefix,
reg_array->debug);
--
2.11.0
next prev 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 ` Philippe Mathieu-Daudé [this message]
2017-02-06 23:39 ` [Qemu-devel] [PATCH 2/2] " Philippe Mathieu-Daudé
2017-02-10 22:19 ` 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-2-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).