diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-29 14:47:22 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-29 14:47:22 -0600 |
commit | 64892e44f2ce2612c77b1b20497fb007adafafb8 (patch) | |
tree | 2c917f29727a017b85193ac85959663d504b26e5 /nuttx/arch/arm/src/common | |
parent | c48af0eb9c61462f59a7ba63ca7a73e8df146f49 (diff) | |
download | nuttx-64892e44f2ce2612c77b1b20497fb007adafafb8.tar.gz nuttx-64892e44f2ce2612c77b1b20497fb007adafafb8.tar.bz2 nuttx-64892e44f2ce2612c77b1b20497fb007adafafb8.zip |
Rename CONFIG_NUTTX_KERNEL to CONFIG_BUILD_PROTECTED; Partially integrate new CONFIG_BUILD_KERNEL
Diffstat (limited to 'nuttx/arch/arm/src/common')
-rw-r--r-- | nuttx/arch/arm/src/common/up_allocateheap.c | 23 | ||||
-rw-r--r-- | nuttx/arch/arm/src/common/up_createstack.c | 20 | ||||
-rw-r--r-- | nuttx/arch/arm/src/common/up_pthread_start.c | 8 | ||||
-rw-r--r-- | nuttx/arch/arm/src/common/up_releasestack.c | 23 | ||||
-rw-r--r-- | nuttx/arch/arm/src/common/up_signal_dispatch.c | 8 | ||||
-rw-r--r-- | nuttx/arch/arm/src/common/up_task_start.c | 6 |
6 files changed, 59 insertions, 29 deletions
diff --git a/nuttx/arch/arm/src/common/up_allocateheap.c b/nuttx/arch/arm/src/common/up_allocateheap.c index a5c1a068c..f312ae067 100644 --- a/nuttx/arch/arm/src/common/up_allocateheap.c +++ b/nuttx/arch/arm/src/common/up_allocateheap.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_allocateheap.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,13 @@ /**************************************************************************** * Private Definitions ****************************************************************************/ +/* Configuration */ + +#undef HAVE_KERNEL_HEAP +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) +# define HAVE_KERNEL_HEAP 1 +#endif /**************************************************************************** * Private Data @@ -74,9 +81,9 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and - * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the - * size of the unprotected, user-space heap. + * For the kernel build (CONFIG_BUILD_KERNEL/PROTECTED=y) with both kernel- + * and user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides + * the size of the unprotected, user-space heap. * * If a protected kernel-space heap is provided, the kernel heap must be * allocated by an analogous up_allocate_kheap(). A custom version of this @@ -104,7 +111,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#ifdef HAVE_KERNEL_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). @@ -134,14 +141,14 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) * Name: up_allocate_kheap * * Description: - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and - * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates + * For the kernel build (CONFIG_BUILD_PROTECTED/KERNEL=y) with both kernel- + * and user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * the kernel-space heap. A custom version of this function is need if * memory protection of the kernel heap is required. * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#ifdef HAVE_KERNEL_HEAP void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) { /* Get the unaligned size and position of the user-space heap. diff --git a/nuttx/arch/arm/src/common/up_createstack.c b/nuttx/arch/arm/src/common/up_createstack.c index 44d6ce862..38170e228 100644 --- a/nuttx/arch/arm/src/common/up_createstack.c +++ b/nuttx/arch/arm/src/common/up_createstack.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_createstack.c * - * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -54,6 +54,13 @@ /**************************************************************************** * Pre-processor Macros ****************************************************************************/ +/* Configuration */ + +#undef HAVE_KERNEL_HEAP +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) +# define HAVE_KERNEL_HEAP 1 +#endif /* ARM requires at least a 4-byte stack alignment. For use with EABI and * floating point, the stack must be aligned to 8-byte addresses. @@ -120,10 +127,11 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect - * how the stack is allocated. For example, kernel thread stacks should - * be allocated from protected kernel memory. Stacks for user tasks and - * threads must come from memory that is accessible to user code. + * If either CONFIG_BUILD_PROTECTED or CONFIG_BUILD_KERNEL are defined, + * then this thread type may affect how the stack is allocated. For + * example, kernel thread stacks should be allocated from protected + * kernel memory. Stacks for user tasks and threads must come from + * memory that is accessible to user code. * ****************************************************************************/ @@ -149,7 +157,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * then create a zeroed stack to make stack dumps easier to trace. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#ifdef HAVE_KERNEL_HEAP /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/arm/src/common/up_pthread_start.c b/nuttx/arch/arm/src/common/up_pthread_start.c index 2f9de8995..31ccb80c1 100644 --- a/nuttx/arch/arm/src/common/up_pthread_start.c +++ b/nuttx/arch/arm/src/common/up_pthread_start.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_pthread_start.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -44,7 +44,9 @@ #include "svcall.h" #include "up_internal.h" -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_PTHREAD) +#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) || \ + defined(defined(CONFIG_BUILD_KERNEL)) && \ + !defined(CONFIG_DISABLE_PTHREAD) /**************************************************************************** * Pre-processor Definitions @@ -93,4 +95,4 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) sys_call2(SYS_pthread_start, (uintptr_t)entrypt, (uintptr_t)arg); } -#endif /* CONFIG_NUTTX_KERNEL &&& __KERNEL__ && !CONFIG_DISABLE_PTHREAD */ +#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ diff --git a/nuttx/arch/arm/src/common/up_releasestack.c b/nuttx/arch/arm/src/common/up_releasestack.c index 9668ec245..d7abec71a 100644 --- a/nuttx/arch/arm/src/common/up_releasestack.c +++ b/nuttx/arch/arm/src/common/up_releasestack.c @@ -48,6 +48,17 @@ #include "up_internal.h" /**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Configuration */ + +#undef HAVE_KERNEL_HEAP +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) +# define HAVE_KERNEL_HEAP 1 +#endif + +/**************************************************************************** * Private Types ****************************************************************************/ @@ -79,11 +90,11 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect - * how the stack is freed. For example, kernel thread stacks may have - * been allocated from protected kernel memory. Stacks for user tasks - * and threads must have come from memory that is accessible to user - * code. + * If either CONFIG_BUILD_PROTECTED or CONFIG_BUILD_KERNEL are defined, + * then this thread type may affect how the stack is freed. For example, + * kernel thread stacks may have been allocated from protected kernel + * memory. Stacks for user tasks and threads must have come from memory + * that is accessible to user code. * * Returned Value: * None @@ -96,7 +107,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#ifdef HAVE_KERNEL_HEAP /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/arm/src/common/up_signal_dispatch.c b/nuttx/arch/arm/src/common/up_signal_dispatch.c index d46b77928..75725237f 100644 --- a/nuttx/arch/arm/src/common/up_signal_dispatch.c +++ b/nuttx/arch/arm/src/common/up_signal_dispatch.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_signal_dispatch.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,9 @@ #include "svcall.h" #include "up_internal.h" -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_SIGNALS) +#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) || \ + defined(defined(CONFIG_BUILD_KERNEL)) && \ + !defined(CONFIG_DISABLE_SIGNALS) /**************************************************************************** * Pre-processor Definitions @@ -99,4 +101,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo, (uintptr_t)info, (uintptr_t)ucontext); } -#endif /* CONFIG_NUTTX_KERNEL && __KERNEL__ && !CONFIG_DISABLE_SIGNALS */ +#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ diff --git a/nuttx/arch/arm/src/common/up_task_start.c b/nuttx/arch/arm/src/common/up_task_start.c index 0a3f3c4a4..c840a19dc 100644 --- a/nuttx/arch/arm/src/common/up_task_start.c +++ b/nuttx/arch/arm/src/common/up_task_start.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_task_start.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ #include "svcall.h" #include "up_internal.h" -#ifdef CONFIG_NUTTX_KERNEL +#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) /**************************************************************************** * Pre-processor Definitions @@ -94,4 +94,4 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[]) (uintptr_t)argv); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */ |