diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-14 14:42:52 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-14 14:42:52 +0000 |
commit | 0d36830a37fcdb64c2b2d00990e084e7f8d63456 (patch) | |
tree | 78cc505c6874907ce2a37ab2b94d15c848c0ce50 /nuttx/arch/arm/src/sam3u/sam3u_allocateheap.c | |
parent | 5be9588ed42d1a4ed297bdc76d9e05e582e78969 (diff) | |
download | nuttx-0d36830a37fcdb64c2b2d00990e084e7f8d63456.tar.gz nuttx-0d36830a37fcdb64c2b2d00990e084e7f8d63456.tar.bz2 nuttx-0d36830a37fcdb64c2b2d00990e084e7f8d63456.zip |
Rename g_heapbase to g_idle_topstack; Fix kernel build heap allocation which cannot use g_heapbase
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5739 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/sam3u/sam3u_allocateheap.c')
-rw-r--r-- | nuttx/arch/arm/src/sam3u/sam3u_allocateheap.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/nuttx/arch/arm/src/sam3u/sam3u_allocateheap.c b/nuttx/arch/arm/src/sam3u/sam3u_allocateheap.c index 86d5fbf36..576fae802 100644 --- a/nuttx/arch/arm/src/sam3u/sam3u_allocateheap.c +++ b/nuttx/arch/arm/src/sam3u/sam3u_allocateheap.c @@ -109,9 +109,12 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { #if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Get the unaligned size of the user-space heap */ + /* Get the unaligned size and position of the user-space heap. + * This heap begins after the user-space .bss section at an offset + * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). + */ - uintptr_t ubase = (uintptr_t)g_heapbase + CONFIG_MM_KERNEL_HEAPSIZE; + uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE; size_t usize = CONFIG_DRAM_END - ubase; int log2; @@ -142,8 +145,8 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) /* Return the heap settings */ up_ledon(LED_HEAPALLOCATE); - *heap_start = (FAR void*)g_heapbase; - *heap_size = CONFIG_DRAM_END - g_heapbase; + *heap_start = (FAR void*)g_idle_topstack; + *heap_size = CONFIG_DRAM_END - g_idle_topstack; #endif } @@ -160,9 +163,12 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) #if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) { - /* Get the unaligned size of the user-space heap */ + /* Get the unaligned size and position of the user-space heap. + * This heap begins after the user-space .bss section at an offset + * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). + */ - uintptr_t ubase = (uintptr_t)g_heapbase + CONFIG_MM_KERNEL_HEAPSIZE; + uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE; size_t usize = CONFIG_DRAM_END - ubase; int log2; @@ -179,10 +185,12 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) usize = (1 << log2); ubase = CONFIG_DRAM_END - usize; - /* Return the kernel heap settings */ + /* Return the kernel heap settings (i.e., the part of the heap region + * that was not dedicated to the user heap). + */ - *heap_start = (FAR void*)g_heapbase; - *heap_size = ubase - (uintptr_t)g_heapbase; + *heap_start = (FAR void*)USERSPACE->us_bssend; + *heap_size = ubase - (uintptr_t)USERSPACE->us_bssend; } #endif |