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

[Minios-devel] [PATCH v2 12/47] arm32: move arm32 specific code to a separate header



This patch creates a new header,include/arm/arm32/os.h,
and move some functions to it.

Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx>
---
 include/arm/arm32/os.h | 31 +++++++++++++++++++++++++++++++
 include/arm/os.h       | 31 +++----------------------------
 2 files changed, 34 insertions(+), 28 deletions(-)
 create mode 100644 include/arm/arm32/os.h

diff --git a/include/arm/arm32/os.h b/include/arm/arm32/os.h
new file mode 100644
index 0000000..cb8e440
--- /dev/null
+++ b/include/arm/arm32/os.h
@@ -0,0 +1,31 @@
+#ifndef _ARM32_OS_H
+#define _ARM32_OS_H
+
+#define BUG() while(1){asm volatile (".word 0xe7f000f0\n");} /* Undefined 
instruction; will call our fault handler. */
+
+static inline void local_irq_disable(void) {
+    __asm__ __volatile__("cpsid i":::"memory");
+}
+
+static inline void local_irq_enable(void) {
+    __asm__ __volatile__("cpsie i":::"memory");
+}
+
+#define local_irq_save(x) { \
+    __asm__ __volatile__("mrs %0, cpsr;cpsid i":"=r"(x)::"memory");    \
+}
+
+#define local_irq_restore(x) {    \
+    __asm__ __volatile__("msr cpsr_c, %0"::"r"(x):"memory");    \
+}
+
+#define local_save_flags(x)    { \
+    __asm__ __volatile__("mrs %0, cpsr":"=r"(x)::"memory");    \
+}
+
+/* We probably only need "dmb" here, but we'll start by being paranoid. */
+#define mb() __asm__("dsb":::"memory");
+#define rmb() __asm__("dsb":::"memory");
+#define wmb() __asm__("dsb":::"memory");
+
+#endif
diff --git a/include/arm/os.h b/include/arm/os.h
index 6a1cc37..89b072d 100644
--- a/include/arm/os.h
+++ b/include/arm/os.h
@@ -14,35 +14,15 @@ void timer_handler(evtchn_port_t port, struct pt_regs 
*regs, void *ign);
 
 extern void *device_tree;
 
-#define BUG() while(1){asm volatile (".word 0xe7f000f0\n");} /* Undefined 
instruction; will call our fault handler. */
-
 #define smp_processor_id() 0
 
 #define barrier() __asm__ __volatile__("": : :"memory")
 
 extern shared_info_t *HYPERVISOR_shared_info;
 
-// disable interrupts
-static inline void local_irq_disable(void) {
-    __asm__ __volatile__("cpsid i":::"memory");
-}
-
-// enable interrupts
-static inline void local_irq_enable(void) {
-    __asm__ __volatile__("cpsie i":::"memory");
-}
-
-#define local_irq_save(x) { \
-    __asm__ __volatile__("mrs %0, cpsr;cpsid i":"=r"(x)::"memory");    \
-}
-
-#define local_irq_restore(x) {    \
-    __asm__ __volatile__("msr cpsr_c, %0"::"r"(x):"memory");    \
-}
-
-#define local_save_flags(x)    { \
-    __asm__ __volatile__("mrs %0, cpsr":"=r"(x)::"memory");    \
-}
+#if defined (__arm__)
+#include <arm32/os.h>
+#endif
 
 static inline int irqs_disabled(void) {
     int x;
@@ -50,11 +30,6 @@ static inline int irqs_disabled(void) {
     return x & 0x80;
 }
 
-/* We probably only need "dmb" here, but we'll start by being paranoid. */
-#define mb() __asm__("dsb":::"memory");
-#define rmb() __asm__("dsb":::"memory");
-#define wmb() __asm__("dsb":::"memory");
-
 /************************** arm *******************************/
 #ifdef __INSIDE_MINIOS__
 #if defined (__arm__)
-- 
2.7.4


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