Skip to contentSkip to conversation

The BUG() macro should print the correct architecture, not a hardcoded value.

PATCH In review [email protected] 3 participants 5 messages Jan 11, 2013 – Jan 24, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 The BUG() macro should print the correct architecture, not a hardcoded value.

From: Lars Rasmusson <[email protected]>

---
 xen/arch/arm/traps.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
xen/arch/arm/traps.c +17 -1
index f42e4e9..1909abf 100644
@@ -68,7 +68,23 @@ static void print_xen_info(void)
     debug = 'y';
 #endif
 
-    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",
+#ifdef CONFIG_ARM_32
+#define THE_ARCH "arm_32"
+#elif CONFIG_ARM_64
+#define THE_ARCH "arm_64"
+#elif CONFIG_ARM
+#define THE_ARCH "arm"
+#elif CONFIG_X86_32
+#define THE_ARCH "x86_32"
+#elif CONFIG_X86_64
+#define THE_ARCH "x86_64"
+#elif CONFIG_X86
+#define THE_ARCH "x86"
+#else      
+#define THE_ARCH "unknown_arch"
+#endif
+
+    printk("----[ Xen-%d.%d%s  " THE_ARCH "  debug=%c  %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
            debug, print_tainted(taint_str));
 }
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 14 lines · On Fri, 2013-01-11 at 13:15 +0000, [email protected] wrote:

From: Lars Rasmusson <[email protected]>

---
 xen/arch/arm/traps.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
xen/arch/arm/traps.c +0 -0
index f42e4e9..1909abf 100644

xen/arch/arm/traps.c static void print_xen_info(void) · line 71

Quoted 4 lines
xen/arch/arm/traps.c +0 -1
@@ -68,7 +68,23 @@ static void print_xen_info(void)
     debug = 'y';
 #endif
 
-    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",

Oops!

xen/arch/arm/traps.c static void print_xen_info(void) · line 74

Quoted 4 lines
xen/arch/arm/traps.c +4 -0
+#ifdef CONFIG_ARM_32
+#define THE_ARCH "arm_32"
+#elif CONFIG_ARM_64
+#define THE_ARCH "arm_64"

Since this is xen/arch/*arm*/traps.c you only need to handle these two cases.

Ian.

#2 lore raw
Quoted 20 lines · Ian Campbell
Quoted 13 lines · On Fri, 2013-01-11 at 13:15 +0000, [email protected] wrote:

From: Lars Rasmusson <[email protected]>

---
 xen/arch/arm/traps.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
xen/arch/arm/traps.c +0 -0
index f42e4e9..1909abf 100644

xen/arch/arm/traps.c static void print_xen_info(void) · line 71

Quoted 4 lines
xen/arch/arm/traps.c +0 -1
@@ -68,7 +68,23 @@ static void print_xen_info(void)
     debug = 'y';
 #endif
 
-    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",

Oops!

Quoted 8 lines

xen/arch/arm/traps.c static void print_xen_info(void) · line 74

Quoted 4 lines
xen/arch/arm/traps.c +4 -0
+#ifdef CONFIG_ARM_32
+#define THE_ARCH "arm_32"
+#elif CONFIG_ARM_64
+#define THE_ARCH "arm_64"

Since this is xen/arch/*arm*/traps.c you only need to handle these two cases.

Ian.

Is there not a -D available from the Makefiles which would be appropriate, to save having to change this every time a new architecture is added?

~Andrew

Quoted 6 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
In reply to [email protected]
Quoted 21 lines · On 11/01/13 13:15, [email protected] wrote:

From: Lars Rasmusson <[email protected]>

---
 xen/arch/arm/traps.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
xen/arch/arm/traps.c +5 -1
index f42e4e9..1909abf 100644
@@ -68,7 +68,23 @@ static void print_xen_info(void)
     debug = 'y';
 #endif
 
-    printk("----[ Xen-%d.%d%s  x86_64  debug=%c  %s ]----\n",
+#ifdef CONFIG_ARM_32
+#define THE_ARCH "arm_32"
+#elif CONFIG_ARM_64
+#define THE_ARCH "arm_64"
+#elif CONFIG_ARM

xen/arch/arm/traps.c static void print_xen_info(void) · line 85

Quoted 10 lines
xen/arch/arm/traps.c +10 -0
+#define THE_ARCH "arm"
+#elif CONFIG_X86_32
+#define THE_ARCH "x86_32"
+#elif CONFIG_X86_64
+#define THE_ARCH "x86_64"
+#elif CONFIG_X86
+#define THE_ARCH "x86"
+#else      
+#define THE_ARCH "unknown_arch"
+#endif

The value should not be x86_64, but this is not the correct way to get the architecture. In xen/arch/arm, you can be certain that the arch is not unknown, nor is it any x86.

~Andrew

Quoted 5 lines
xen/arch/arm/traps.c +2 -0
+
+    printk("----[ Xen-%d.%d%s  " THE_ARCH "  debug=%c  %s ]----\n",
            xen_major_version(), xen_minor_version(), xen_extra_version(),
            debug, print_tainted(taint_str));
 }