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

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


  • To: <minios-devel@xxxxxxxxxxxxxxxxxxxx>, <simon.kuenzer@xxxxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Fri, 14 Sep 2018 07:56:44 +0000
  • Authentication-results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=bestguesspass action=none header.from=arm.com;
  • Cc: Kaly.Xin@xxxxxxx, nd@xxxxxxx, wei.chen@xxxxxxx
  • Delivery-date: Fri, 14 Sep 2018 07:57:50 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

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


_______________________________________________
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®.