diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-02 12:11:45 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-02 12:11:45 -0600 |
commit | cb6a2d29d01be343d3cad9bea08c90f260861849 (patch) | |
tree | bc11bd7dd7eaa1d5863c53b6ee3386098ada111b /nuttx | |
parent | b6aec437b60f4bfe69f9f5b1adc5331ce9c38e21 (diff) | |
parent | 9c84d7131b36c9845454c10d3afcf6c4a60b8fa8 (diff) | |
download | px4-nuttx-cb6a2d29d01be343d3cad9bea08c90f260861849.tar.gz px4-nuttx-cb6a2d29d01be343d3cad9bea08c90f260861849.tar.bz2 px4-nuttx-cb6a2d29d01be343d3cad9bea08c90f260861849.zip |
Merge remote-tracking branch 'origin/master' into bas24
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/sim/include/limits.h | 11 | ||||
-rw-r--r-- | nuttx/include/nuttx/mm/mm.h | 42 |
2 files changed, 39 insertions, 14 deletions
diff --git a/nuttx/arch/sim/include/limits.h b/nuttx/arch/sim/include/limits.h index 5a8d7c54e..fabb97d8e 100644 --- a/nuttx/arch/sim/include/limits.h +++ b/nuttx/arch/sim/include/limits.h @@ -77,10 +77,15 @@ #define LLONG_MAX 9223372036854775807LL #define ULLONG_MAX 18446744073709551615ULL -/* A pointer is 4 bytes */ +/* A pointer is 4 or 8 bytes */ #define PTR_MIN (-PTR_MAX - 1) -#define PTR_MAX 2147483647 -#define UPTR_MAX 4294967295U +#if !defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32) +# define PTR_MAX 2147483647 +# define UPTR_MAX 4294967295U +#else +# define PTR_MAX 9223372036854775807LL +# define UPTR_MAX 18446744073709551615ULL +#endif #endif /* __ARCH_SIM_INCLUDE_LIMITS_H */ diff --git a/nuttx/include/nuttx/mm/mm.h b/nuttx/include/nuttx/mm/mm.h index 707d7f7da..97c260f50 100644 --- a/nuttx/include/nuttx/mm/mm.h +++ b/nuttx/include/nuttx/mm/mm.h @@ -112,24 +112,44 @@ /* These definitions define the characteristics of allocator * * MM_MIN_SHIFT is used to define MM_MIN_CHUNK. - * MM_MIN_CHUNK - is the smallest physical chunk that can - * be allocated. It must be at least a large as - * sizeof(struct mm_freenode_s). Larger values may - * improve performance slightly, but will waste memory - * due to quantization losses. + * MM_MIN_CHUNK - is the smallest physical chunk that can be allocated. It + * must be at least a large as sizeof(struct mm_freenode_s). Larger values + * may improve performance slightly, but will waste memory due to + * quantization losses. * * MM_MAX_SHIFT is used to define MM_MAX_CHUNK - * MM_MAX_CHUNK is the largest, contiguous chunk of memory - * that can be allocated. It can range from 16-bytes to - * 4Gb. Larger values of MM_MAX_SHIFT can cause larger - * data structure sizes and, perhaps, minor performance - * losses. + * MM_MAX_CHUNK is the largest, contiguous chunk of memory that can be + * allocated. It can range from 16-bytes to 4Gb. Larger values of + * MM_MAX_SHIFT can cause larger data structure sizes and, perhaps, + * minor performance losses. + */ + +#if defined(CONFIG_MM_SMALL) && UINTPTR_MAX <= UINT32_MAX +/* Two byte offsets; Pointers may be 2 or 4 bytes; + * sizeof(struct mm_freenode_s) is 8 or 12 bytes. + * REVISIT: We could do better on machines with 16-bit addressing. */ -#ifdef CONFIG_MM_SMALL # define MM_MIN_SHIFT 4 /* 16 bytes */ # define MM_MAX_SHIFT 15 /* 32 Kb */ + +#elif defined(CONFIG_HAVE_LONG_LONG) +/* Four byte offsets; Pointers may be 4 or 8 bytes + * sizeof(struct mm_freenode_s) is 16 or 24 bytes. + */ + +# if UINTPTR_MAX <= UINT32_MAX +# define MM_MIN_SHIFT 4 /* 16 bytes */ +# elif UINTPTR_MAX <= UINT64_MAX +# define MM_MIN_SHIFT 5 /* 32 bytes */ +# endif +# define MM_MAX_SHIFT 22 /* 4 Mb */ + #else +/* Four byte offsets; Pointers must be 4 bytes. + * sizeof(struct mm_freenode_s) is 16 bytes. + */ + # define MM_MIN_SHIFT 4 /* 16 bytes */ # define MM_MAX_SHIFT 22 /* 4 Mb */ #endif |