[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH] build: choose arch-includes at makefile level
Looks good. Thanks! Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> On 21.09.2018 17:11, Yuri Volchkov wrote: Instead of adding multiple ifdefs in the headers in order to choose a header specific to current architecture, include <uk/asm/arch_specific_header.h>. This will automatically resolve to the correct header, via -I flags provided to compiler. This also moves the arch headers in arch/<arch_family>/<arch_name>/uk/asm Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx> --- arch/arm/arm/Makefile.uk | 4 +++ .../arm/arm/include/uk/asm}/atomic.h | 0 .../arm/arm/include/uk/asm}/intsizes.h | 0 .../arm/arm/include/uk/asm}/lcpu.h | 0 .../arm/arm/include/uk/asm}/limits.h | 0 .../arm/arm/include/uk/asm}/types.h | 0 arch/arm/arm64/Makefile.uk | 4 +++ .../arm/arm64/include/uk/asm}/atomic.h | 0 .../arm/arm64/include/uk/asm}/intsizes.h | 0 .../arm/arm64/include/uk/asm}/lcpu.h | 0 .../arm/arm64/include/uk/asm}/limits.h | 0 .../arm/arm64/include/uk/asm}/types.h | 0 arch/x86/x86_64/Makefile.uk | 5 ++++ .../x86/x86_64/include/uk/asm}/atomic.h | 0 .../x86/x86_64/include/uk/asm}/intsizes.h | 0 .../x86/x86_64/include/uk/asm}/lcpu.h | 0 .../x86/x86_64/include/uk/asm}/limits.h | 0 .../x86/x86_64/include/uk/asm}/types.h | 0 include/uk/arch/atomic.h | 13 +--------- include/uk/arch/lcpu.h | 13 +--------- include/uk/arch/limits.h | 26 ++----------------- include/uk/arch/types.h | 18 ++----------- 22 files changed, 19 insertions(+), 64 deletions(-) rename {include/uk/arch/arm/arm => arch/arm/arm/include/uk/asm}/atomic.h (100%) rename {include/uk/arch/arm/arm => arch/arm/arm/include/uk/asm}/intsizes.h (100%) rename {include/uk/arch/arm/arm => arch/arm/arm/include/uk/asm}/lcpu.h (100%) rename {include/uk/arch/arm/arm => arch/arm/arm/include/uk/asm}/limits.h (100%) rename {include/uk/arch/arm/arm => arch/arm/arm/include/uk/asm}/types.h (100%) rename {include/uk/arch/arm/arm64 => arch/arm/arm64/include/uk/asm}/atomic.h (100%) rename {include/uk/arch/arm/arm64 => arch/arm/arm64/include/uk/asm}/intsizes.h (100%) rename {include/uk/arch/arm/arm64 => arch/arm/arm64/include/uk/asm}/lcpu.h (100%) rename {include/uk/arch/arm/arm64 => arch/arm/arm64/include/uk/asm}/limits.h (100%) rename {include/uk/arch/arm/arm64 => arch/arm/arm64/include/uk/asm}/types.h (100%) rename {include/uk/arch/x86/x86_64 => arch/x86/x86_64/include/uk/asm}/atomic.h (100%) rename {include/uk/arch/x86/x86_64 => arch/x86/x86_64/include/uk/asm}/intsizes.h (100%) rename {include/uk/arch/x86/x86_64 => arch/x86/x86_64/include/uk/asm}/lcpu.h (100%) rename {include/uk/arch/x86/x86_64 => arch/x86/x86_64/include/uk/asm}/limits.h (100%) rename {include/uk/arch/x86/x86_64 => arch/x86/x86_64/include/uk/asm}/types.h (100%) diff --git a/arch/arm/arm/Makefile.uk b/arch/arm/arm/Makefile.uk index 9aef849..3c5dd1f 100644 --- a/arch/arm/arm/Makefile.uk +++ b/arch/arm/arm/Makefile.uk @@ -5,6 +5,10 @@ CFLAGS += -marm -fms-extensions CXXFLAGS += -D__ARM_32__ CXXFLAGS += -marm -fms-extensions+CINCLUDES += -I$(CONFIG_UK_BASE)/arch/arm/arm/include+ASINCLUDES += -I$(CONFIG_UK_BASE)/arch/arm/arm/include +CXXINCLUDES += -I$(CONFIG_UK_BASE)/arch/arm/arm/include + # Set GCC flags for MARCH_ARM32_GENERICV7. GCC supports -mtune=generic-armv7-a from 4.7 ifeq ($(CONFIG_MARCH_ARM32_GENERICV7),y) $(call error_if_gcc_version_lt,4,7) diff --git a/include/uk/arch/arm/arm/atomic.h b/arch/arm/arm/include/uk/asm/atomic.h similarity index 100% rename from include/uk/arch/arm/arm/atomic.h rename to arch/arm/arm/include/uk/asm/atomic.h diff --git a/include/uk/arch/arm/arm/intsizes.h b/arch/arm/arm/include/uk/asm/intsizes.h similarity index 100% rename from include/uk/arch/arm/arm/intsizes.h rename to arch/arm/arm/include/uk/asm/intsizes.h diff --git a/include/uk/arch/arm/arm/lcpu.h b/arch/arm/arm/include/uk/asm/lcpu.h similarity index 100% rename from include/uk/arch/arm/arm/lcpu.h rename to arch/arm/arm/include/uk/asm/lcpu.h diff --git a/include/uk/arch/arm/arm/limits.h b/arch/arm/arm/include/uk/asm/limits.h similarity index 100% rename from include/uk/arch/arm/arm/limits.h rename to arch/arm/arm/include/uk/asm/limits.h diff --git a/include/uk/arch/arm/arm/types.h b/arch/arm/arm/include/uk/asm/types.h similarity index 100% rename from include/uk/arch/arm/arm/types.h rename to arch/arm/arm/include/uk/asm/types.h diff --git a/arch/arm/arm64/Makefile.uk b/arch/arm/arm64/Makefile.uk index 54b1b01..eb73cac 100644 --- a/arch/arm/arm64/Makefile.uk +++ b/arch/arm/arm64/Makefile.uk @@ -7,6 +7,10 @@ ASFLAGS += -D__ARM_64__ -mgeneral-regs-only CFLAGS += -D__ARM_64__ -fms-extensions -mgeneral-regs-only CXXFLAGS += -D__ARM_64__ -fms-extensions -mgeneral-regs-only+CINCLUDES += -I$(CONFIG_UK_BASE)/arch/arm/arm64/include+ASINCLUDES += -I$(CONFIG_UK_BASE)/arch/arm/arm64/include +CXXINCLUDES += -I$(CONFIG_UK_BASE)/arch/arm/arm64/include + # GCC support -mcpu=native for arm64 from 6.0 ifeq ($(CONFIG_MARCH_ARM64_NATIVE),y) $(call error_if_gcc_version_lt,6,0) diff --git a/include/uk/arch/arm/arm64/atomic.h b/arch/arm/arm64/include/uk/asm/atomic.h similarity index 100% rename from include/uk/arch/arm/arm64/atomic.h rename to arch/arm/arm64/include/uk/asm/atomic.h diff --git a/include/uk/arch/arm/arm64/intsizes.h b/arch/arm/arm64/include/uk/asm/intsizes.h similarity index 100% rename from include/uk/arch/arm/arm64/intsizes.h rename to arch/arm/arm64/include/uk/asm/intsizes.h diff --git a/include/uk/arch/arm/arm64/lcpu.h b/arch/arm/arm64/include/uk/asm/lcpu.h similarity index 100% rename from include/uk/arch/arm/arm64/lcpu.h rename to arch/arm/arm64/include/uk/asm/lcpu.h diff --git a/include/uk/arch/arm/arm64/limits.h b/arch/arm/arm64/include/uk/asm/limits.h similarity index 100% rename from include/uk/arch/arm/arm64/limits.h rename to arch/arm/arm64/include/uk/asm/limits.h diff --git a/include/uk/arch/arm/arm64/types.h b/arch/arm/arm64/include/uk/asm/types.h similarity index 100% rename from include/uk/arch/arm/arm64/types.h rename to arch/arm/arm64/include/uk/asm/types.h diff --git a/arch/x86/x86_64/Makefile.uk b/arch/x86/x86_64/Makefile.uk index 6b03f7a..9d540c0 100644 --- a/arch/x86/x86_64/Makefile.uk +++ b/arch/x86/x86_64/Makefile.uk @@ -5,6 +5,11 @@ CFLAGS += -m64 -mno-red-zone -fno-reorder-blocks -fno-asynchronous-unwind-tabl CXXFLAGS += -D__X86_64__ CXXFLAGS += -m64 -mno-red-zone -fno-reorder-blocks -fno-asynchronous-unwind-tables+CINCLUDES += -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include+ASINCLUDES += -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include +CXXINCLUDES += -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include + + CFLAGS-$(CONFIG_MARCH_X86_64_GENERIC) += -mtune=generic CXXFLAGS-$(CONFIG_MARCH_X86_64_GENERIC) += -mtune=generic CFLAGS-$(CONFIG_MARCH_X86_64_NOCONA) += -march=nocona diff --git a/include/uk/arch/x86/x86_64/atomic.h b/arch/x86/x86_64/include/uk/asm/atomic.h similarity index 100% rename from include/uk/arch/x86/x86_64/atomic.h rename to arch/x86/x86_64/include/uk/asm/atomic.h diff --git a/include/uk/arch/x86/x86_64/intsizes.h b/arch/x86/x86_64/include/uk/asm/intsizes.h similarity index 100% rename from include/uk/arch/x86/x86_64/intsizes.h rename to arch/x86/x86_64/include/uk/asm/intsizes.h diff --git a/include/uk/arch/x86/x86_64/lcpu.h b/arch/x86/x86_64/include/uk/asm/lcpu.h similarity index 100% rename from include/uk/arch/x86/x86_64/lcpu.h rename to arch/x86/x86_64/include/uk/asm/lcpu.h diff --git a/include/uk/arch/x86/x86_64/limits.h b/arch/x86/x86_64/include/uk/asm/limits.h similarity index 100% rename from include/uk/arch/x86/x86_64/limits.h rename to arch/x86/x86_64/include/uk/asm/limits.h diff --git a/include/uk/arch/x86/x86_64/types.h b/arch/x86/x86_64/include/uk/asm/types.h similarity index 100% rename from include/uk/arch/x86/x86_64/types.h rename to arch/x86/x86_64/include/uk/asm/types.h diff --git a/include/uk/arch/atomic.h b/include/uk/arch/atomic.h index 7cd34b8..d4abeb7 100644 --- a/include/uk/arch/atomic.h +++ b/include/uk/arch/atomic.h @@ -36,18 +36,7 @@ extern "C" { #endif-#ifdef __X86_32__-#include <uk/arch/x86/x86/atomic.h> -#endif -#ifdef __X86_64__ -#include <uk/arch/x86/x86_64/atomic.h> -#endif -#ifdef __ARM_32__ -#include <uk/arch/arm/arm/atomic.h> -#endif -#ifdef __ARM_64__ -#include <uk/arch/arm/arm64/atomic.h> -#endif +#include <uk/asm/atomic.h>/*** Perform a atomic load operation. diff --git a/include/uk/arch/lcpu.h b/include/uk/arch/lcpu.h index a9e10d2..83ea6ec 100644 --- a/include/uk/arch/lcpu.h +++ b/include/uk/arch/lcpu.h @@ -42,18 +42,7 @@ extern "C" { #endif-#ifdef __X86_32__-#include <uk/arch/x86/x86/lcpu.h> -#endif -#ifdef __X86_64__ -#include <uk/arch/x86/x86_64/lcpu.h> -#endif -#ifdef __ARM_32__ -#include <uk/arch/arm/arm/lcpu.h> -#endif -#ifdef __ARM_64__ -#include <uk/arch/arm/arm64/lcpu.h> -#endif +#include <uk/asm/lcpu.h>#ifndef likely#define likely(x) (__builtin_expect((!!(x)), 1)) diff --git a/include/uk/arch/limits.h b/include/uk/arch/limits.h index a0683ad..f1b5831 100644 --- a/include/uk/arch/limits.h +++ b/include/uk/arch/limits.h @@ -36,33 +36,11 @@ #ifndef __UKARCH_LIMITS_H__ #define __UKARCH_LIMITS_H__-#ifdef __X86_32__-#include <uk/arch/x86/x86/limits.h> -#endif -#ifdef __X86_64__ -#include <uk/arch/x86/x86_64/limits.h> -#endif -#ifdef __ARM_32__ -#include <uk/arch/arm/arm/limits.h> -#endif -#ifdef __ARM_64__ -#include <uk/arch/arm/arm64/limits.h> -#endif +#include <uk/asm/limits.h>#ifndef __ASSEMBLY__ -#ifdef __X86_32__-#include <uk/arch/x86/x86/intsizes.h> -#endif -#ifdef __X86_64__ -#include <uk/arch/x86/x86_64/intsizes.h> -#endif -#ifdef __ARM_32__ -#include <uk/arch/arm/arm/intsizes.h> -#endif -#ifdef __ARM_64__ -#include <uk/arch/arm/arm64/intsizes.h> -#endif +#include <uk/asm/intsizes.h>#if (defined __C_IS_8)#define __C_MAX (127) diff --git a/include/uk/arch/types.h b/include/uk/arch/types.h index 8b97baf..af6c3e3 100644 --- a/include/uk/arch/types.h +++ b/include/uk/arch/types.h @@ -40,22 +40,8 @@ extern "C" { #endif-#ifdef __X86_32__-#include <uk/arch/x86/x86/intsizes.h> -#include <uk/arch/x86/x86/types.h> -#endif -#ifdef __X86_64__ -#include <uk/arch/x86/x86_64/intsizes.h> -#include <uk/arch/x86/x86_64/types.h> -#endif -#ifdef __ARM_32__ -#include <uk/arch/arm/arm/intsizes.h> -#include <uk/arch/arm/arm/types.h> -#endif -#ifdef __ARM_64__ -#include <uk/arch/arm/arm64/intsizes.h> -#include <uk/arch/arm/arm64/types.h> -#endif +#include <uk/asm/intsizes.h> +#include <uk/asm/types.h>#ifndef __ASSEMBLY__ _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |