Skip to contentSkip to conversation

XTF: small fixes

PATCH In review Roger Pau Monne 2 participants 7 messages May 6, 2016 Kbuild

lore
Share & tools
lore
#1 lore raw

PATCH 1/3 xtf: don't re-define __noinline

On FreeBSD __noinline is already defined in cdefs.h

---
Cc: Andrew Cooper <[email protected]>

---
 include/xtf/compiler.h | 2 ++
 1 file changed, 2 insertions(+)
include/xtf/compiler.h +2 -0
index 47d929c..251b853 100644
@@ -4,7 +4,9 @@
 #define __aligned(x)          __attribute__((__aligned__(x)))
 #define __packed              __attribute__((__packed__))
 
+#ifndef __noinline /* Avoid conflicting with cdefs.h */
 #define __noinline            __attribute__((__noinline__))
+#endif
 
 #ifndef __always_inline /* Avoid conflicting with cdefs.h */
 #define __always_inline       __attribute__((__always_inline__))
Signature · 7 lines
2.7.4 (Apple Git-66)


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

PATCH 2/3 xtf: avoid shifting a negative value

In reply to Roger Pau Monne

Because it's undefined behaviour.

---
Cc: Andrew Cooper <[email protected]>

---
 include/arch/x86/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/arch/x86/processor.h +1 -1
index c9f253f..841953c 100644
@@ -134,7 +134,7 @@
 /* Segment-based Error Code - supplemental constants. */
 #define X86_EC_TABLE_MASK (3  << 1)
 #define X86_EC_SEL_SHIFT  3
-#define X86_EC_SEL_MASK   (-1 << X86_EC_SEL_SHIFT)
+#define X86_EC_SEL_MASK   (-1U << X86_EC_SEL_SHIFT)
 #define X86_EC_GDT        0
 #define X86_EC_LDT        X86_EC_TI
 
Signature · 7 lines
2.7.4 (Apple Git-66)


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

Re: [PATCH 2/3] xtf: avoid shifting a negative value

Quoted 14 lines · Roger Pau Monne

Because it's undefined behaviour.

---
Cc: Andrew Cooper <[email protected]>

---
 include/arch/x86/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/arch/x86/processor.h +0 -0
index c9f253f..841953c 100644

include/arch/x86/processor.h line 137

Quoted 5 lines
include/arch/x86/processor.h +1 -1
@@ -134,7 +134,7 @@
 /* Segment-based Error Code - supplemental constants. */
 #define X86_EC_TABLE_MASK (3  << 1)
 #define X86_EC_SEL_SHIFT  3
-#define X86_EC_SEL_MASK   (-1 << X86_EC_SEL_SHIFT)
+#define X86_EC_SEL_MASK   (-1U << X86_EC_SEL_SHIFT)

The resulting expression needs to be signed, to DTRT when implicitly promoted. I presume this was clang complaining?

Does using the constant (-9) work?

~Andrew

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

#4 lore raw

Re: [PATCH 2/3] xtf: avoid shifting a negative value

Quoted 23 lines · Andrew Cooper
Quoted 14 lines · Roger Pau Monne

Because it's undefined behaviour.

---
Cc: Andrew Cooper <[email protected]>

---
 include/arch/x86/processor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/arch/x86/processor.h +0 -0
index c9f253f..841953c 100644

include/arch/x86/processor.h line 137

Quoted 5 lines
include/arch/x86/processor.h +1 -1
@@ -134,7 +134,7 @@
 /* Segment-based Error Code - supplemental constants. */
 #define X86_EC_TABLE_MASK (3  << 1)
 #define X86_EC_SEL_SHIFT  3
-#define X86_EC_SEL_MASK   (-1 << X86_EC_SEL_SHIFT)
+#define X86_EC_SEL_MASK   (-1U << X86_EC_SEL_SHIFT)

The resulting expression needs to be signed, to DTRT when implicitly promoted. I presume this was clang complaining?

Quoted 1 line

Does using the constant (-9) work?

Or indeed perhaps ~(1 << X86_EC_SEL_SHIFT) which (iirc) will keep the signed-ness of 1 even through bitwise inversion.

~Andrew

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

#5 lore raw

PATCH 3/3 xtf: fix usage of "-executable" with find

In reply to Roger Pau Monne

"-executable" is a GNU only extension to find. Instead replace it with a POSIX compatible one.

---
Cc: Andrew Cooper <[email protected]>

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 7657e19..fd8c3e0 100644
@@ -22,7 +22,7 @@ cscope:
 .PHONY: clean
 clean:
 	find . \( -name "*.o" -o -name "*.d" -o -name "*.lds" \) -delete
-	find tests/ \( -executable -name "test-*" -o -name "test-*.cfg" \
+	find tests/ \( -perm -a=x -name "test-*" -o -name "test-*.cfg" \
 		-o -name "test-info.json" \) -delete
 
 .PHONY: distclean
Signature · 7 lines
2.7.4 (Apple Git-66)


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