Merge remote-tracking branch 'origin/master' into bas24

This commit is contained in:
Gregory Nutt 2014-11-02 12:11:45 -06:00
commit b6a08c375c
2 changed files with 39 additions and 14 deletions

View File

@ -77,10 +77,15 @@
#define LLONG_MAX 9223372036854775807LL #define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL #define ULLONG_MAX 18446744073709551615ULL
/* A pointer is 4 bytes */ /* A pointer is 4 or 8 bytes */
#define PTR_MIN (-PTR_MAX - 1) #define PTR_MIN (-PTR_MAX - 1)
#define PTR_MAX 2147483647 #if !defined(CONFIG_HOST_X86_64) || defined(CONFIG_SIM_M32)
#define UPTR_MAX 4294967295U # define PTR_MAX 2147483647
# define UPTR_MAX 4294967295U
#else
# define PTR_MAX 9223372036854775807LL
# define UPTR_MAX 18446744073709551615ULL
#endif
#endif /* __ARCH_SIM_INCLUDE_LIMITS_H */ #endif /* __ARCH_SIM_INCLUDE_LIMITS_H */

View File

@ -112,24 +112,44 @@
/* These definitions define the characteristics of allocator /* These definitions define the characteristics of allocator
* *
* MM_MIN_SHIFT is used to define MM_MIN_CHUNK. * MM_MIN_SHIFT is used to define MM_MIN_CHUNK.
* MM_MIN_CHUNK - is the smallest physical chunk that can * MM_MIN_CHUNK - is the smallest physical chunk that can be allocated. It
* be allocated. It must be at least a large as * must be at least a large as sizeof(struct mm_freenode_s). Larger values
* sizeof(struct mm_freenode_s). Larger values may * may improve performance slightly, but will waste memory due to
* improve performance slightly, but will waste memory * quantization losses.
* due to quantization losses.
* *
* MM_MAX_SHIFT is used to define MM_MAX_CHUNK * MM_MAX_SHIFT is used to define MM_MAX_CHUNK
* MM_MAX_CHUNK is the largest, contiguous chunk of memory * MM_MAX_CHUNK is the largest, contiguous chunk of memory that can be
* that can be allocated. It can range from 16-bytes to * allocated. It can range from 16-bytes to 4Gb. Larger values of
* 4Gb. Larger values of MM_MAX_SHIFT can cause larger * MM_MAX_SHIFT can cause larger data structure sizes and, perhaps,
* data structure sizes and, perhaps, minor performance * minor performance losses.
* 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_MIN_SHIFT 4 /* 16 bytes */
# define MM_MAX_SHIFT 15 /* 32 Kb */ # 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 #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_MIN_SHIFT 4 /* 16 bytes */
# define MM_MAX_SHIFT 22 /* 4 Mb */ # define MM_MAX_SHIFT 22 /* 4 Mb */
#endif #endif