[PATCH 1/6] ARM: asm: Add convenience fucntions to access VBAR

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

 



Add two functions to get/set VBAR register.

Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 arch/arm/include/asm/system.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 26fb18c..2e37675 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -71,6 +71,31 @@ static inline void set_cr(unsigned int val)
 	isb();
 }

+#if __LINUX_ARM_ARCH__ >= 7
+static inline unsigned int get_vbar(void)
+{
+	unsigned int vbar;
+	asm volatile("mrc p15, 0, %0, c12, c0, 0 @ get VBAR"
+		     : "=r" (vbar) : : "cc");
+	return vbar;
+}
+
+static inline void set_vbar(unsigned int vbar)
+{
+	asm volatile("mcr p15, 0, %0, c12, c0, 0 @ set VBAR"
+		     : : "r" (vbar) : "cc");
+	isb();
+}
+#else
+/*
+   Pre ARMv7 CPUs do not implement Security Extensions so normal
+   exceptions base address cannot be re-mapped from 0x00000000
+ */
+static inline unsigned int get_vbar(void) { return 0; }
+static inline void set_vbar(u32 vbar) {}
+#endif
+
+
 #endif

 #endif /* __ASM_ARM_SYSTEM_H */
--
2.5.0

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux