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

Re: [Minios-devel] [UNIKRAFT PATCHv6 11/37] plat/common: Introduce SYSREG_READ32/64 SYSTEM_WRITE32/64 for different size



Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>

On 14.09.2018 09:56, Wei Chen wrote:
On Arm, the system registers may have different size. Introduce these
four helpers will give us a direct visual about the register's size we
are accessing.

Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
---
  plat/common/include/arm/arm64/cpu.h | 14 ++++++++++++++
  1 file changed, 14 insertions(+)

diff --git a/plat/common/include/arm/arm64/cpu.h 
b/plat/common/include/arm/arm64/cpu.h
index 702761c..db8be9c 100644
--- a/plat/common/include/arm/arm64/cpu.h
+++ b/plat/common/include/arm/arm64/cpu.h
@@ -90,3 +90,17 @@ static inline void ioreg_write64(volatile uint64_t *addr, 
uint64_t value)
  #define SYSREG_WRITE(reg, val) \
        __asm__ __volatile__("msr " __STRINGIFY(reg) ", %0" \
                        : : "r" ((uint64_t)(val)))
+
+#define SYSREG_READ32(reg) \
+({     uint32_t val; \
+       __asm__ __volatile__("mrs %0, " __STRINGIFY(reg) \
+                       : "=&r" (val)); \
+       val; \
+})
+
+#define SYSREG_WRITE32(reg, val) \
+       __asm__ __volatile__("msr " __STRINGIFY(reg) ", %0" \
+                       : : "r" ((uint32_t)(val)))
+
+#define SYSREG_READ64(reg) SYSREG_READ(reg)
+#define SYSREG_WRITE64(reg, val) SYSREG_WRITE(reg, val)


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.