[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/4] hw/registerfields: add 64-bit extract/deposit m
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH 3/4] hw/registerfields: add 64-bit extract/deposit macros |
Date: |
Wed, 13 Dec 2017 02:17:35 -0300 |
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
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
- [Qemu-devel] [PATCH 0/4] Trivial changes in "registerfields.h", Philippe Mathieu-Daudé, 2017/12/13
- [Qemu-devel] [PATCH 1/4] MAINTAINERS: add "hw/registerfields.h" in Register API entry, Philippe Mathieu-Daudé, 2017/12/13
- [Qemu-devel] [PATCH 2/4] hw/registerfields: fix a typo in the FIELD() documentation, Philippe Mathieu-Daudé, 2017/12/13
- [Qemu-devel] [PATCH 3/4] hw/registerfields: add 64-bit extract/deposit macros,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 4/4] hw/registerfields: add missing include, Philippe Mathieu-Daudé, 2017/12/13
- Re: [Qemu-devel] [PATCH 0/4] Trivial changes in "registerfields.h", Darren Kenny, 2017/12/13
- Re: [Qemu-devel] [PATCH 0/4] Trivial changes in "registerfields.h", Edgar E. Iglesias, 2017/12/13