X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Fplatform.h;h=8d6ed9a3e4166a9a743a01caaa2393483dc03b87;hb=defc1ea34074e7882724c460260d307cdf981a70;hp=0e0ccaf90c69bc0547b59086fcb7ea8026c2f2da;hpb=98636eb08c5ecc216e18970e11f7021206ac9b04;p=oweals%2Fbusybox.git diff --git a/include/platform.h b/include/platform.h index 0e0ccaf90..8d6ed9a3e 100644 --- a/include/platform.h +++ b/include/platform.h @@ -97,6 +97,13 @@ # endif #endif +#if __GNUC_PREREQ(3,0) && defined(i386) +/* || defined(__x86_64__)? */ +# define FAST_FUNC __attribute__((regparm(3))) +#else +# define FAST_FUNC +#endif + /* ---- Endian Detection ------------------------------------ */ #if (defined __digital__ && defined __unix__) @@ -135,7 +142,18 @@ #define SWAP_LE64(x) (x) #endif +/* ---- Unaligned access ------------------------------------ */ + +/* parameter is supposed to be an uint32_t* ptr */ +#if defined(i386) || defined(__x86_64__) /* + other arches? */ +#define get_unaligned_u32p(u32p) (*(u32p)) +#else +/* performs reasonably well (gcc usually inlines memcpy here) */ +#define get_unaligned_u32p(u32p) ({ uint32_t __t; memcpy(&__t, (u32p), 4); __t; }) +#endif + /* ---- Networking ------------------------------------------ */ + #ifndef __APPLE__ # include # ifndef __socklen_t_defined @@ -146,6 +164,7 @@ typedef int socklen_t; #endif /* ---- Compiler dependent settings ------------------------- */ + #if (defined __digital__ && defined __unix__) || defined __APPLE__ # undef HAVE_MNTENT_H # undef HAVE_SYS_STATFS_H @@ -163,9 +182,10 @@ __extension__ typedef unsigned long long __u64; #endif /*----- Kernel versioning ------------------------------------*/ + #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -/* ---- miscellaneous --------------------------------------- */ +/* ---- Miscellaneous --------------------------------------- */ #if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ < 5 && \ !defined(__dietlibc__) && \ @@ -235,12 +255,10 @@ typedef unsigned smalluint; (defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \ __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__) #define BB_MMU 0 -#define BB_NOMMU 1 #define USE_FOR_NOMMU(...) __VA_ARGS__ #define USE_FOR_MMU(...) #else #define BB_MMU 1 -/* BB_NOMMU is not defined in this case! */ #define USE_FOR_NOMMU(...) #define USE_FOR_MMU(...) __VA_ARGS__ #endif