XTF: small fixes
cover XTF: small fixes
Hello,
This is a series of very small fixes for XTF, the first two are code fixes, while the last one is a build system fix.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
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
@@ -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
PATCH 2/3 xtf: avoid shifting a negative value
In reply to Roger Pau MonneBecause 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
@@ -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
Re: [PATCH 2/3] xtf: avoid shifting a negative value
Quoted 14 lines · Roger Pau Monne
Because it's undefined behaviour.
Signed-off-by Roger Pau Monné <[email protected]>---
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
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
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.
Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Andrew Cooper <[email protected]>--- include/arch/x86/processor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/arch/x86/processor.h +0
-0include/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
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
@@ -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
Quoted 6 lines · Roger Pau Monne
Hello,
This is a series of very small fixes for XTF, the first two are code fixes, while the last one is a build system fix.
Thanks, Roger.
1 and 3 look fine - I will take them straight as-is.
2 is slightly more problematic - comment on that patch.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel