From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Alistair Francis <alistair.francis@xilinx.com>,
"Edgar E . Iglesias" <edgar.iglesias@xilinx.com>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Subject: [Qemu-devel] [PATCH 3/4] hw/registerfields: add 64-bit extract/deposit macros
Date: Wed, 13 Dec 2017 02:17:35 -0300 [thread overview]
Message-ID: <20171213051736.17755-4-f4bug@amsat.org> (raw)
In-Reply-To: <20171213051736.17755-1-f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/hw/registerfields.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/hw/registerfields.h b/include/hw/registerfields.h
index ad9d7a82a3..f59e7f47bd 100644
--- a/include/hw/registerfields.h
+++ b/include/hw/registerfields.h
@@ -35,6 +35,9 @@
#define FIELD_EX32(storage, reg, field) \
extract32((storage), R_ ## reg ## _ ## field ## _SHIFT, \
R_ ## reg ## _ ## field ## _LENGTH)
+#define FIELD_EX64(storage, reg, field) \
+ extract64((storage), R_ ## reg ## _ ## field ## _SHIFT, \
+ R_ ## reg ## _ ## field ## _LENGTH)
/* Extract a field from an array of registers */
#define ARRAY_FIELD_EX32(regs, reg, field) \
@@ -52,6 +55,14 @@
d = deposit32((storage), R_ ## reg ## _ ## field ## _SHIFT, \
R_ ## reg ## _ ## field ## _LENGTH, v.v); \
d; })
+#define FIELD_DP64(storage, reg, field, val) ({ \
+ struct { \
+ unsigned int v:R_ ## reg ## _ ## field ## _LENGTH; \
+ } v = { .v = val }; \
+ uint64_t d; \
+ d = deposit64((storage), R_ ## reg ## _ ## field ## _SHIFT, \
+ R_ ## reg ## _ ## field ## _LENGTH, v.v); \
+ d; })
/* Deposit a field to array of registers. */
#define ARRAY_FIELD_DP32(regs, reg, field, val) \
--
2.15.1
next prev parent reply other threads:[~2017-12-13 5:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 5:17 [Qemu-devel] [PATCH 0/4] Trivial changes in "registerfields.h" Philippe Mathieu-Daudé
2017-12-13 5:17 ` [Qemu-devel] [PATCH 1/4] MAINTAINERS: add "hw/registerfields.h" in Register API entry Philippe Mathieu-Daudé
2017-12-13 5:17 ` [Qemu-devel] [PATCH 2/4] hw/registerfields: fix a typo in the FIELD() documentation Philippe Mathieu-Daudé
2017-12-13 5:17 ` Philippe Mathieu-Daudé [this message]
2017-12-13 21:37 ` [Qemu-devel] [PATCH 3/4] hw/registerfields: add 64-bit extract/deposit macros francisco iglesias
2017-12-14 13:49 ` Philippe Mathieu-Daudé
2017-12-13 5:17 ` [Qemu-devel] [PATCH 4/4] hw/registerfields: add missing include Philippe Mathieu-Daudé
2017-12-13 9:06 ` [Qemu-devel] [PATCH 0/4] Trivial changes in "registerfields.h" Darren Kenny
2017-12-13 17:25 ` Alistair Francis
2017-12-13 18:10 ` Edgar E. Iglesias
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=20171213051736.17755-4-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=alistair.francis@xilinx.com \
--cc=edgar.iglesias@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).