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

[XTF 1/4] xtf: Perform misc code cleanup



-define macro ALIGN to set alignment:
Header file asm_macros.h should not contain
architecture specific code. Replace hardcoded
alignment value with a call to macro ALIGN.

-move declaration of shared_info into xtf/traps.h:
Declaration of shared_info structure should be
placed in xtf/traps.h as it is a common declaration
for all the possible architectures.

-do not protect including <arch/barrier.h>
We should always include <arch/barrier.h> and rely
on the compiler to throw an error. This would avoid
increasing #if protection each time we would add
a new architecture.

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 arch/x86/include/arch/asm_macros.h | 2 ++
 arch/x86/include/arch/traps.h      | 1 -
 include/xtf/asm_macros.h           | 2 +-
 include/xtf/barrier.h              | 4 ----
 include/xtf/traps.h                | 2 ++
 5 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/arch/asm_macros.h 
b/arch/x86/include/arch/asm_macros.h
index e12e1ba..1aabed5 100644
--- a/arch/x86/include/arch/asm_macros.h
+++ b/arch/x86/include/arch/asm_macros.h
@@ -15,6 +15,8 @@
 # define __ASM_CODE_RAW(x) #x
 #endif
 
+#define ALIGN .align 16
+
 /* Select between two variations based on compat or long mode. */
 #ifdef __i386__
 # define __ASM_SEL(c, l)     __ASM_CODE(c)
diff --git a/arch/x86/include/arch/traps.h b/arch/x86/include/arch/traps.h
index 0c6888b..60fc3a4 100644
--- a/arch/x86/include/arch/traps.h
+++ b/arch/x86/include/arch/traps.h
@@ -57,7 +57,6 @@ extern uint8_t user_stack[PAGE_SIZE];
 
 extern xen_pv_start_info_t *pv_start_info;
 extern xen_pvh_start_info_t *pvh_start_info;
-extern shared_info_t shared_info;
 
 /*
  * Parameters for fine tuning the exec_user_*() behaviour.
diff --git a/include/xtf/asm_macros.h b/include/xtf/asm_macros.h
index 5484f7c..c531355 100644
--- a/include/xtf/asm_macros.h
+++ b/include/xtf/asm_macros.h
@@ -25,7 +25,7 @@
  * @param name Function name.
  */
 #define ENTRY(name)                             \
-    .align 16;                                  \
+    ALIGN;                                      \
     GLOBAL(name)
 
 /**
diff --git a/include/xtf/barrier.h b/include/xtf/barrier.h
index b526fe1..3b02d49 100644
--- a/include/xtf/barrier.h
+++ b/include/xtf/barrier.h
@@ -1,11 +1,7 @@
 #ifndef XTF_BARRIER_H
 #define XTF_BARRIER_H
 
-#if defined(__x86_64__) || defined (__i386__)
 # include <arch/barrier.h>
-#else
-# error Bad architecture
-#endif
 
 #endif /* XTF_BARRIER_H */
 
diff --git a/include/xtf/traps.h b/include/xtf/traps.h
index 8fc66af..4081db6 100644
--- a/include/xtf/traps.h
+++ b/include/xtf/traps.h
@@ -6,6 +6,8 @@
 
 #include <arch/traps.h>
 
+extern shared_info_t shared_info;
+
 /**
  * May be implemented by a guest to provide custom exception handling.
  */
-- 
2.29.0




 


Rackspace

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