|
40 | 40 |
|
41 | 41 | #include <stdio.h> |
42 | 42 |
|
| 43 | +#if defined(__ia64__) || defined(__x86_64__) || defined(__PPC64__) || defined(__arm__) |
| 44 | + #define U64L "l" |
| 45 | +#else |
| 46 | + #define U64L "ll" |
| 47 | +#endif |
| 48 | + |
| 49 | + |
| 50 | +/* define macros to the architecture of the CPU */ |
| 51 | +#if defined(__linux__) || defined(__FreeBSD__) |
| 52 | +# if defined(__i386__) |
| 53 | +# define ARCH_x86 |
| 54 | +# elif defined(__x86_64__) |
| 55 | +# define ARCH_x86_64 |
| 56 | +# elif defined(__ia64__) |
| 57 | +# define ARCH_ia64 |
| 58 | +# elif defined(__PPC64__) || defined(__s390x__) |
| 59 | +# define ARCH_ppc64 |
| 60 | +# elif defined(__PPC__) |
| 61 | +# define ARCH_ppc |
| 62 | +# elif defined(__aarch64__) |
| 63 | +# define ARCH_arm64 |
| 64 | +# elif defined(__arm__) |
| 65 | +# define ARCH_arm6l |
| 66 | +# else |
| 67 | +# error Unknown CPU architecture using the linux OS |
| 68 | +# endif |
| 69 | +#elif defined(__MINGW32__) || defined(__MINGW64__) /* Windows MINGW */ |
| 70 | +# if defined(__MINGW32__) |
| 71 | +# define ARCH_x86 |
| 72 | +# elif defined(__MINGW64__) |
| 73 | +# define ARCH_x86_64 |
| 74 | +# else |
| 75 | +# error Unknown CPU architecture using the windows-mingw OS |
| 76 | +# endif |
| 77 | +#elif defined(_WIN32) || defined(_WIN64) /* Windows */ |
| 78 | +# if defined(_WIN32) |
| 79 | +# define ARCH_x86 |
| 80 | +# elif defined(_WIN64) |
| 81 | +# define ARCH_x86_64 |
| 82 | +# else |
| 83 | +# error Unknown CPU architecture using the windows OS |
| 84 | +# endif |
| 85 | +#else /* Unknown */ |
| 86 | +# error Unknown OS |
| 87 | +#endif |
| 88 | + |
43 | 89 | /* define macros for print fields */ |
44 | 90 | #define U32D_FMT "%u" |
45 | 91 | #define U32H_FMT "0x%08x" |
|
48 | 94 | #define U16H_FMT "0x%04x" |
49 | 95 | #define U8H_FMT "0x%02x" |
50 | 96 |
|
51 | | -#if defined(__linux) || defined(__FreeBSD__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(_WIN32) || defined(_WIN64) |
52 | | -# include <stdint.h> |
53 | | -# include <inttypes.h> |
54 | | -# if defined(PRId64) && defined(PRIx64) |
55 | | -# define U64D_FMT "%" PRId64 |
| 97 | +#if defined(ARCH_x86) || defined(ARCH_ppc) || defined(UEFI_BUILD) || defined(ARCH_arm6l) |
| 98 | +# if defined(__MINGW32__) || defined(__MINGW64__) |
| 99 | +# include <inttypes.h> |
| 100 | +# define U64D_FMT "0x%" PRId64 |
56 | 101 | # define U64H_FMT "0x%" PRIx64 |
57 | | -# define U64H_FMT_GEN PRIx64 |
| 102 | +# define U64H_FMT_GEN "" PRIx64 |
58 | 103 | # define U48H_FMT "0x%" PRIx64 |
59 | | -# define U64D_FMT_GEN PRId64 |
60 | | -# elif defined(__MINGW32__) || defined(_WIN32) || defined(__i386__) || defined(__PPC__) || defined(UEFI_BUILD) || defined(__arm__) |
61 | | -# define U64L "ll" |
| 104 | +# define U64D_FMT_GEN "" PRId64 |
| 105 | +# else |
62 | 106 | # define U64D_FMT "%llu" |
63 | 107 | # define U64H_FMT "0x%016llx" |
64 | 108 | # define U64H_FMT_GEN "llx" |
65 | 109 | # define U48H_FMT "0x%012llx" |
66 | 110 | # define U64D_FMT_GEN "llu" |
67 | | -# else |
68 | | -# define U64L "l" |
69 | | -# define U64D_FMT "%lu" |
70 | | -# define U64H_FMT "0x%016lx" |
71 | | -# define U48H_FMT "0x%012lx" |
72 | | -# define U64H_FMT_GEN "lx" |
73 | | -# define U64D_FMT_GEN "lu" |
74 | 111 | # endif |
| 112 | +#elif defined(ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(ARCH_arm64) |
| 113 | +# define U64D_FMT "%lu" |
| 114 | +# define U64H_FMT "0x%016lx" |
| 115 | +# define U48H_FMT "0x%012lx" |
| 116 | +# define U64H_FMT_GEN "lx" |
| 117 | +# define U64D_FMT_GEN "lu" |
75 | 118 | #else |
76 | | -# error Unknown OS or Architecture |
77 | | -#endif |
| 119 | +# error Unknown architecture |
| 120 | +#endif /* ARCH */ |
78 | 121 |
|
79 | 122 | /* |
80 | 123 | * Only for architectures which can't do swab by themselves |
@@ -386,7 +429,7 @@ typedef uint8_t u_int8_t; |
386 | 429 | #include <inttypes.h> |
387 | 430 | #endif |
388 | 431 |
|
389 | | -#if defined(__VMKERNEL_UW_VMKLINUX__) || defined(__VMKERNEL_UW_NATIVE__) |
| 432 | +#if defined(__VMKERNEL_UW_NATIVE__) |
390 | 433 | #define ROOT_PATH "/opt/mellanox/" |
391 | 434 | #else |
392 | 435 | #define ROOT_PATH "/" |
|
0 commit comments