diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-09-13 12:25:32 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-09-13 12:25:32 -0600 |
commit | dccca8a00662956a7fd4d7e106c041e977e4fe0a (patch) | |
tree | 6a5bb0d62d36310bc57dfa99cea2e77ee14fcff7 /nuttx/include/nuttx/addrenv.h | |
parent | b473253b2042c86a77fdd3a23f26e4344ff9cc3c (diff) | |
download | nuttx-dccca8a00662956a7fd4d7e106c041e977e4fe0a.tar.gz nuttx-dccca8a00662956a7fd4d7e106c041e977e4fe0a.tar.bz2 nuttx-dccca8a00662956a7fd4d7e106c041e977e4fe0a.zip |
Add a configuration option for dynamic stack management
Diffstat (limited to 'nuttx/include/nuttx/addrenv.h')
-rw-r--r-- | nuttx/include/nuttx/addrenv.h | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/nuttx/include/nuttx/addrenv.h b/nuttx/include/nuttx/addrenv.h index 385bce32e..5f5ee5f1f 100644 --- a/nuttx/include/nuttx/addrenv.h +++ b/nuttx/include/nuttx/addrenv.h @@ -86,7 +86,7 @@ #ifndef CONFIG_ARCH_DATA_VBASE # error CONFIG_ARCH_DATA_VBASE not defined -# define CONFIG_ARCH_DATA_VBASE (CONFIG_ARCH_TEXT_VBASE + ARCH_TEXT_SIZE) +# define CONFIG_ARCH_DATA_VBASE ARCH_TEXT_VEND #endif #if (CONFIG_ARCH_DATA_VBASE & CONFIG_MM_MASK) != 0 @@ -123,7 +123,7 @@ #ifndef CONFIG_ARCH_HEAP_VBASE # error CONFIG_ARCH_HEAP_VBASE not defined -# define CONFIG_ARCH_HEAP_VBASE (CONFIG_ARCH_DATA_VBASE + ARCH_DATA_SIZE) +# define CONFIG_ARCH_HEAP_VBASE ARCH_DATA_VEND #endif #if (CONFIG_ARCH_HEAP_VBASE & CONFIG_MM_MASK) != 0 @@ -138,28 +138,34 @@ #define ARCH_HEAP_SIZE (CONFIG_ARCH_HEAP_NPAGES * CONFIG_MM_PGSIZE) #define ARCH_HEAP_VEND (CONFIG_ARCH_HEAP_VBASE + ARCH_HEAP_SIZE) -/* Stack region */ +#ifdef CONFIG_ARCH_STACK_DYNAMIC + /* Stack region */ -#ifndef CONFIG_ARCH_STACK_VBASE -# error CONFIG_ARCH_STACK_VBASE not defined -# define CONFIG_ARCH_STACK_VBASE (CONFIG_ARCH_HEAP_VBASE + ARCH_HEAP_SIZE) -#endif +# ifndef CONFIG_ARCH_STACK_VBASE +# error CONFIG_ARCH_STACK_VBASE not defined +# define CONFIG_ARCH_STACK_VBASE ARCH_HEAP_VEND +# endif -#if (CONFIG_ARCH_STACK_VBASE & CONFIG_MM_MASK) != 0 -# error CONFIG_ARCH_STACK_VBASE not aligned to page boundary -#endif +# if (CONFIG_ARCH_STACK_VBASE & CONFIG_MM_MASK) != 0 +# error CONFIG_ARCH_STACK_VBASE not aligned to page boundary +# endif -#ifndef CONFIG_ARCH_STACK_NPAGES -# warning CONFIG_ARCH_STACK_NPAGES not defined -# define CONFIG_ARCH_STACK_NPAGES 1 -#endif +# ifndef CONFIG_ARCH_STACK_NPAGES +# warning CONFIG_ARCH_STACK_NPAGES not defined +# define CONFIG_ARCH_STACK_NPAGES 1 +# endif + +# define ARCH_STACK_SIZE (CONFIG_ARCH_STACK_NPAGES * CONFIG_MM_PGSIZE) +# define ARCH_STACK_VEND (CONFIG_ARCH_STACK_VBASE + ARCH_STACK_SIZE) -#define ARCH_STACK_SIZE (CONFIG_ARCH_STACK_NPAGES * CONFIG_MM_PGSIZE) -#define ARCH_STACK_VEND (CONFIG_ARCH_STACK_VBASE + ARCH_STACK_SIZE) + /* A single page scratch region used for temporary mappings */ -/* A single page scratch region used for temporary mappings */ +# define ARCH_SCRATCH_VBASE ARCH_STACK_VEND +#else + /* A single page scratch region used for temporary mappings */ -#define ARCH_SCRATCH_VBASE (CONFIG_ARCH_STACK_VBASE + ARCH_STACK_SIZE) +# define ARCH_SCRATCH_VBASE ARCH_HEAP_VEND +#endif /* There is no need to use the scratch memory region if the page pool memory * is statically mapped. @@ -263,9 +269,9 @@ struct addrenv_reserve_s * * up_addrenv_attach - Clone the address environment assigned to one TCB * to another. This operation is done when a pthread - * is created that share's the same address + * is created that share's the same group address * environment. - * up_addrenv_detach - Release the threads reference to an address + * up_addrenv_detach - Release the thread's reference to an address * environment when a task/thread exits. * ****************************************************************************/ |