1
0
Fork 0
forked from nuttx/nuttx-update

Refine __KERNEL__ and CONFIG_BUILD_xxx usage in the code base

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-04-30 03:21:23 +08:00 committed by Alan Carvalho de Assis
parent fe5cb9529d
commit eca7059785
83 changed files with 158 additions and 339 deletions

View file

@ -43,8 +43,7 @@
#include "svcall.h" #include "svcall.h"
#include "arm_internal.h" #include "arm_internal.h"
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_KERNEL)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -88,4 +87,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
(uintptr_t)info, (uintptr_t)ucontext); (uintptr_t)info, (uintptr_t)ucontext);
} }
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ #endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */

View file

@ -44,8 +44,7 @@
#include "pgalloc.h" #include "pgalloc.h"
#include "arm_internal.h" #include "arm_internal.h"
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_KERNEL)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -104,4 +103,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
} }
} }
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */ #endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */

View file

@ -28,8 +28,7 @@
#include "svcall.h" #include "svcall.h"
#include "arm_internal.h" #include "arm_internal.h"
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_KERNEL)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -73,4 +72,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
(uintptr_t)info, (uintptr_t)ucontext); (uintptr_t)info, (uintptr_t)ucontext);
} }
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ #endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */

View file

@ -44,8 +44,7 @@
#include "pgalloc.h" #include "pgalloc.h"
#include "arm_internal.h" #include "arm_internal.h"
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_PROTECTED)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -104,4 +103,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
} }
} }
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_PROTECTED */ #endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */

View file

@ -28,8 +28,7 @@
#include "svcall.h" #include "svcall.h"
#include "arm_internal.h" #include "arm_internal.h"
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_KERNEL)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -73,4 +72,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
(uintptr_t)info, (uintptr_t)ucontext); (uintptr_t)info, (uintptr_t)ucontext);
} }
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ #endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */

View file

@ -46,12 +46,6 @@
/* Configuration */ /* 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
/* For use with EABI and floating point, the stack must be aligned to 8-byte /* For use with EABI and floating point, the stack must be aligned to 8-byte
* addresses. * addresses.
*/ */
@ -146,7 +140,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
*/ */
#ifdef CONFIG_TLS #ifdef CONFIG_TLS
#ifdef HAVE_KERNEL_HEAP #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)
@ -164,7 +158,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
} }
#else /* CONFIG_TLS */ #else /* CONFIG_TLS */
#ifdef HAVE_KERNEL_HEAP #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -44,8 +44,8 @@
#include "svcall.h" #include "svcall.h"
#include "arm_internal.h" #include "arm_internal.h"
#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
defined(CONFIG_BUILD_KERNEL)) && !defined(CONFIG_DISABLE_PTHREAD) !defined(CONFIG_DISABLE_PTHREAD)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -84,4 +84,4 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
PANIC(); PANIC();
} }
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ #endif /* !CONFIG_BUILD_FLAT && __KERNEL__ && !CONFIG_DISABLE_PTHREAD */

View file

@ -47,18 +47,6 @@
#include "arm_internal.h" #include "arm_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
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@ -100,7 +88,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#ifdef HAVE_KERNEL_HEAP #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -43,7 +43,7 @@
#include "svcall.h" #include "svcall.h"
#include "arm_internal.h" #include "arm_internal.h"
#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) #ifndef CONFIG_BUILD_FLAT
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -84,4 +84,4 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[])
PANIC(); PANIC();
} }
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */ #endif /* !CONFIG_BUILD_FLAT */

View file

@ -125,7 +125,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. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -122,7 +122,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. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -143,7 +143,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. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -143,7 +143,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. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -89,7 +89,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -135,7 +135,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
* create a zeroed stack to make stack dumps easier to trace. * create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -89,7 +89,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -61,12 +61,6 @@
/* Configuration */ /* 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
/* For use with EABI and floating point, the stack must be aligned to 8-byte /* For use with EABI and floating point, the stack must be aligned to 8-byte
* addresses. * addresses.
*/ */
@ -161,7 +155,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
*/ */
#ifdef CONFIG_TLS #ifdef CONFIG_TLS
#ifdef HAVE_KERNEL_HEAP #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)
@ -179,7 +173,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
} }
#else /* CONFIG_TLS */ #else /* CONFIG_TLS */
#ifdef HAVE_KERNEL_HEAP #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -44,8 +44,8 @@
#include "svcall.h" #include "svcall.h"
#include "up_internal.h" #include "up_internal.h"
#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
defined(CONFIG_BUILD_KERNEL)) && !defined(CONFIG_DISABLE_PTHREAD) !defined(CONFIG_DISABLE_PTHREAD)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -86,4 +86,4 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
PANIC(); PANIC();
} }
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ #endif /* !CONFIG_BUILD_FLAT && __KERNEL__ && !CONFIG_DISABLE_PTHREAD */

View file

@ -51,14 +51,6 @@
* Pre-processor Definitions * 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
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@ -100,7 +92,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#ifdef HAVE_KERNEL_HEAP #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -43,7 +43,7 @@
#include "svcall.h" #include "svcall.h"
#include "up_internal.h" #include "up_internal.h"
#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) #ifndef CONFIG_BUILD_FLAT
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -86,4 +86,4 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[])
PANIC(); PANIC();
} }
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */ #endif /* !CONFIG_BUILD_FLAT */

View file

@ -122,7 +122,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. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -143,7 +143,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. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -29,8 +29,8 @@
#include "svcall.h" #include "svcall.h"
#include "riscv_internal.h" #include "riscv_internal.h"
#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
defined(CONFIG_BUILD_KERNEL)) && !defined(CONFIG_DISABLE_PTHREAD) !defined(CONFIG_DISABLE_PTHREAD)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -69,4 +69,4 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
PANIC(); PANIC();
} }
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ #endif /* !CONFIG_BUILD_FLAT && __KERNEL__ && !CONFIG_DISABLE_PTHREAD */

View file

@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -28,7 +28,7 @@
#include "svcall.h" #include "svcall.h"
#include "riscv_internal.h" #include "riscv_internal.h"
#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) #ifndef CONFIG_BUILD_FLAT
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -69,4 +69,4 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[])
PANIC(); PANIC();
} }
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */ #endif /* !CONFIG_BUILD_FLAT */

View file

@ -28,8 +28,7 @@
#include "svcall.h" #include "svcall.h"
#include "riscv_internal.h" #include "riscv_internal.h"
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_KERNEL)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -73,4 +72,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
(uintptr_t)info, (uintptr_t)ucontext); (uintptr_t)info, (uintptr_t)ucontext);
} }
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ #endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */

View file

@ -124,7 +124,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. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -109,7 +109,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. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -86,7 +86,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -150,7 +150,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. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -88,7 +88,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -54,7 +54,7 @@ extern uint32_t _emodtext;
#ifdef CONFIG_ENDIAN_BIG #ifdef CONFIG_ENDIAN_BIG
#error not implemented #error not implemented
#endif #endif
#if defined(CONFIG_BUILD_PROTECTED) || defined (CONFIG_BUILD_KERNEL) #ifndef CONFIG_BUILD_FLAT
#error permission check not implemented #error permission check not implemented
#endif #endif

View file

@ -107,7 +107,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. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -81,7 +81,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef CONFIG_MM_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View file

@ -194,8 +194,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb)
/* Get the stream list from the TCB */ /* Get the stream list from the TCB */
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #ifdef CONFIG_MM_KERNEL_HEAP
defined(CONFIG_MM_KERNEL_HEAP)
slist = tcb->group->tg_streamlist; slist = tcb->group->tg_streamlist;
#else #else
slist = &tcb->group->tg_streamlist; slist = &tcb->group->tg_streamlist;

View file

@ -54,7 +54,7 @@
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* These interfaces are not available to kernel code */ /* These interfaces are not available to kernel code */
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && defined(__KERNEL__) #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
# undef CONFIG_FS_AIO # undef CONFIG_FS_AIO
#endif #endif

View file

@ -53,10 +53,6 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_BUILD_FLAT
# error "Only flat build supported for now"
#endif
/* Disable DEBUGASSERT macro if LIBDSP debug is not enabled */ /* Disable DEBUGASSERT macro if LIBDSP debug is not enabled */
#ifdef CONFIG_LIBDSP_DEBUG #ifdef CONFIG_LIBDSP_DEBUG

View file

@ -48,7 +48,7 @@
/* How can we access the errno variable? */ /* How can we access the errno variable? */
#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) #ifdef CONFIG_BUILD_FLAT
/* Flat build */ /* Flat build */
# if defined(CONFIG_LIB_SYSCALL) && !defined(__KERNEL__) # if defined(CONFIG_LIB_SYSCALL) && !defined(__KERNEL__)
@ -66,31 +66,17 @@
# define __DIRECT_ERRNO_ACCESS 1 # define __DIRECT_ERRNO_ACCESS 1
# endif # endif
#elif defined(CONFIG_BUILD_PROTECTED) #else
# if defined(__KERNEL__) # if defined(__KERNEL__)
/* Kernel portion of protected build. Kernel code has direct access */ /* Kernel portion of protected/kernel build. Kernel code has direct access */
# define __DIRECT_ERRNO_ACCESS 1 # define __DIRECT_ERRNO_ACCESS 1
# else # else
/* User portion of protected build. Application code has only indirect /* User portion of protected/kernel build. Application code has only indirect
* access * access
*/ */
# undef __DIRECT_ERRNO_ACCESS
# endif
#elif defined(CONFIG_BUILD_KERNEL) && !defined(__KERNEL__)
# if defined(__KERNEL__)
/* Kernel build. Kernel code has direct access */
# define __DIRECT_ERRNO_ACCESS 1
# else
/* User libraries for the kernel. Only indirect access from user
* libraries
*/
# undef __DIRECT_ERRNO_ACCESS # undef __DIRECT_ERRNO_ACCESS
# endif # endif
#endif #endif

View file

@ -551,8 +551,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver);
* *
****************************************************************************/ ****************************************************************************/
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_KERNEL)
void up_task_start(main_t taskentry, int argc, FAR char *argv[]) void up_task_start(main_t taskentry, int argc, FAR char *argv[])
noreturn_function; noreturn_function;
#endif #endif
@ -581,8 +580,8 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[])
* *
****************************************************************************/ ****************************************************************************/
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) !defined(CONFIG_DISABLE_PTHREAD)
void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
noreturn_function; noreturn_function;
#endif #endif
@ -615,8 +614,7 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
* *
****************************************************************************/ ****************************************************************************/
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_KERNEL)
void up_signal_dispatch(_sa_sigaction_t sighand, int signo, void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
FAR siginfo_t *info, FAR void *ucontext); FAR siginfo_t *info, FAR void *ucontext);
#endif #endif
@ -640,7 +638,7 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
* *
****************************************************************************/ ****************************************************************************/
#if (defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)) #if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)
void up_signal_handler(_sa_sigaction_t sighand, int signo, void up_signal_handler(_sa_sigaction_t sighand, int signo,
FAR siginfo_t *info, FAR void *ucontext) FAR siginfo_t *info, FAR void *ucontext)
noreturn_function; noreturn_function;

View file

@ -74,15 +74,10 @@
#if defined(CONFIG_SCHED_TICKLESS) #if defined(CONFIG_SCHED_TICKLESS)
/* Case 1: There is no global timer data */ /* Case 1: There is no global timer data */
#elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) #elif defined(__KERNEL__)
/* Case 3: Kernel mode of protected kernel build */ /* Case 3: Kernel mode of protected/kernel build */
# define __HAVE_KERNEL_GLOBALS 1 # define __HAVE_KERNEL_GLOBALS 1
#elif defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)
/* Case 3: Kernel only build */
# define __HAVE_KERNEL_GLOBALS 1
#elif defined(CONFIG_LIB_SYSCALL) #elif defined(CONFIG_LIB_SYSCALL)
/* Case 4: Building with SYSCALLs enabled, but not part of a kernel build */ /* Case 4: Building with SYSCALLs enabled, but not part of a kernel build */
@ -90,7 +85,7 @@
#else #else
/* Case 2: Un-protected, non-kernel build */ /* Case 2: Un-protected, non-kernel build */
# define __HAVE_KERNEL_GLOBALS 1 # define __HAVE_KERNEL_GLOBALS 1
#endif #endif
/* If CONFIG_SYSTEM_TIME64 is selected and the CPU supports long long types, /* If CONFIG_SYSTEM_TIME64 is selected and the CPU supports long long types,

View file

@ -34,8 +34,6 @@
#include <nuttx/mm/mm.h> #include <nuttx/mm/mm.h>
#include <nuttx/userspace.h> #include <nuttx/userspace.h>
#if !defined(CONFIG_BUILD_PROTECTED) || defined(__KERNEL__)
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/
@ -84,25 +82,7 @@ extern "C"
/* This family of allocators is used to manage kernel protected memory */ /* This family of allocators is used to manage kernel protected memory */
#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_MM_KERNEL_HEAP) #ifndef CONFIG_MM_KERNEL_HEAP
/* If this is not a kernel build, then these map to the same interfaces
* as were used for the user-mode function.
*/
# define kmm_initialize(h,s) /* Initialization done by kumm_initialize */
# define kmm_addregion(h,s) umm_addregion(h,s)
# define kmm_trysemaphore() umm_trysemaphore()
# define kmm_givesemaphore() umm_givesemaphore()
# define kmm_calloc(n,s) calloc(n,s);
# define kmm_malloc(s) malloc(s)
# define kmm_zalloc(s) zalloc(s)
# define kmm_realloc(p,s) realloc(p,s)
# define kmm_memalign(a,s) memalign(a,s)
# define kmm_free(p) free(p)
# define kmm_mallinfo() mallinfo()
#elif !defined(CONFIG_MM_KERNEL_HEAP)
/* If this the kernel phase of a kernel build, and there are only user-space /* If this the kernel phase of a kernel build, and there are only user-space
* allocators, then the following are defined in userspace.h as macros that * allocators, then the following are defined in userspace.h as macros that
* call into user-space via a header at the beginning of the user-space blob. * call into user-space via a header at the beginning of the user-space blob.
@ -128,8 +108,7 @@ extern "C"
#endif #endif
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #ifdef CONFIG_MM_KERNEL_HEAP
defined(CONFIG_MM_KERNEL_HEAP)
/**************************************************************************** /****************************************************************************
* Group memory management * Group memory management
* *
@ -169,5 +148,4 @@ void group_free(FAR struct task_group_s *group, FAR void *mem);
} }
#endif #endif
#endif /* !CONFIG_BUILD_PROTECTED || __KERNEL__ */
#endif /* __INCLUDE_NUTTX_KMALLOC_H */ #endif /* __INCLUDE_NUTTX_KMALLOC_H */

View file

@ -84,9 +84,7 @@
*/ */
#undef MM_KERNEL_USRHEAP_INIT #undef MM_KERNEL_USRHEAP_INIT
#if defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) #if !defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)
# define MM_KERNEL_USRHEAP_INIT 1
#elif !defined(CONFIG_BUILD_KERNEL)
# define MM_KERNEL_USRHEAP_INIT 1 # define MM_KERNEL_USRHEAP_INIT 1
#endif #endif
@ -285,7 +283,6 @@ extern "C"
* no global user heap structure. * no global user heap structure.
*/ */
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
/* In the kernel build, there a multiple user heaps; one for each task /* In the kernel build, there a multiple user heaps; one for each task
* group. In this build configuration, the user heap structure lies * group. In this build configuration, the user heap structure lies
* in a reserved region at the beginning of the .bss/.data address * in a reserved region at the beginning of the .bss/.data address
@ -293,13 +290,12 @@ extern "C"
* ARCH_DATA_RESERVE_SIZE * ARCH_DATA_RESERVE_SIZE
*/ */
#elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)
/* In the protected mode, there are two heaps: A kernel heap and a single /* In the protected mode, there are two heaps: A kernel heap and a single
* user heap. In that case the user heap structure lies in the user space * user heap. In that case the user heap structure lies in the user space
* (with a reference in the userspace interface). * (with a reference in the userspace interface).
*/ */
#else #if defined(CONFIG_BUILD_FLAT) || !defined(__KERNEL__)
/* Otherwise, the user heap data structures are in common .bss */ /* Otherwise, the user heap data structures are in common .bss */
EXTERN struct mm_heap_s g_mmheap; EXTERN struct mm_heap_s g_mmheap;
@ -443,9 +439,7 @@ FAR void *mm_brkaddr(FAR struct mm_heap_s *heap, int region);
/* Functions contained in umm_brkaddr.c *************************************/ /* Functions contained in umm_brkaddr.c *************************************/
#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__)
FAR void *umm_brkaddr(int region); FAR void *umm_brkaddr(int region);
#endif
/* Functions contained in kmm_brkaddr.c *************************************/ /* Functions contained in kmm_brkaddr.c *************************************/
@ -455,8 +449,7 @@ FAR void *kmm_brkaddr(int region);
/* Functions contained in mm_sbrk.c *****************************************/ /* Functions contained in mm_sbrk.c *****************************************/
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC) && \ #if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC)
defined(CONFIG_ARCH_USE_MMU)
FAR void *mm_sbrk(FAR struct mm_heap_s *heap, intptr_t incr, FAR void *mm_sbrk(FAR struct mm_heap_s *heap, intptr_t incr,
uintptr_t maxbreak); uintptr_t maxbreak);
#endif #endif
@ -464,7 +457,7 @@ FAR void *mm_sbrk(FAR struct mm_heap_s *heap, intptr_t incr,
/* Functions contained in kmm_sbrk.c ****************************************/ /* Functions contained in kmm_sbrk.c ****************************************/
#if defined(CONFIG_MM_KERNEL_HEAP) && defined(CONFIG_ARCH_ADDRENV) && \ #if defined(CONFIG_MM_KERNEL_HEAP) && defined(CONFIG_ARCH_ADDRENV) && \
defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU) defined(CONFIG_MM_PGALLOC)
FAR void *kmm_sbrk(intptr_t incr); FAR void *kmm_sbrk(intptr_t incr);
#endif #endif
@ -475,9 +468,7 @@ void mm_extend(FAR struct mm_heap_s *heap, FAR void *mem, size_t size,
/* Functions contained in umm_extend.c **************************************/ /* Functions contained in umm_extend.c **************************************/
#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__)
void umm_extend(FAR void *mem, size_t size, int region); void umm_extend(FAR void *mem, size_t size, int region);
#endif
/* Functions contained in kmm_extend.c **************************************/ /* Functions contained in kmm_extend.c **************************************/

View file

@ -554,8 +554,7 @@ struct task_group_s
* allocated using a user-space allocator. * allocated using a user-space allocator.
*/ */
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #ifdef CONFIG_MM_KERNEL_HEAP
defined(CONFIG_MM_KERNEL_HEAP)
FAR struct streamlist *tg_streamlist; FAR struct streamlist *tg_streamlist;
#else #else
struct streamlist tg_streamlist; /* Holds C buffered I/O info */ struct streamlist tg_streamlist; /* Holds C buffered I/O info */

View file

@ -165,7 +165,7 @@ extern "C"
* *
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) #ifndef __KERNEL__
void task_startup(main_t entrypt, int argc, FAR char *argv[]) noreturn_function; void task_startup(main_t entrypt, int argc, FAR char *argv[]) noreturn_function;
#endif #endif
@ -185,7 +185,7 @@ void task_startup(main_t entrypt, int argc, FAR char *argv[]) noreturn_function;
* *
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) && !defined(CONFIG_DISABLE_PTHREAD) #if !defined(__KERNEL__) && !defined(CONFIG_DISABLE_PTHREAD)
void pthread_startup(pthread_startroutine_t entrypt, pthread_addr_t arg); void pthread_startup(pthread_startroutine_t entrypt, pthread_addr_t arg);
#endif #endif

View file

@ -100,38 +100,29 @@
* priority worker thread. Default: 2048. * priority worker thread. Default: 2048.
*/ */
/* Is this a protected build (CONFIG_BUILD_PROTECTED=y) */ /* Is this a flat build (CONFIG_BUILD_FLAT=y) */
#if defined(CONFIG_BUILD_PROTECTED) #if defined(CONFIG_BUILD_FLAT)
/* Yes.. kernel worker threads are not built in a kernel build when we are /* Yes.. user-space worker threads are not built in a flat build */
# undef CONFIG_LIB_USRWORK
#elif !defined(__KERNEL__)
/* Kernel worker threads are not built in a kernel build when we are
* building the user-space libraries. * building the user-space libraries.
*/ */
# ifndef __KERNEL__ # undef CONFIG_SCHED_HPWORK
# undef CONFIG_SCHED_LPWORK
# undef CONFIG_SCHED_HPWORK # undef CONFIG_SCHED_WORKQUEUE
# undef CONFIG_SCHED_LPWORK
# undef CONFIG_SCHED_WORKQUEUE
/* User-space worker threads are not built in a kernel build when we are /* User-space worker threads are not built in a kernel build when we are
* building the kernel-space libraries (but we still need to know that it * building the kernel-space libraries (but we still need to know that it
* is configured). * is configured).
*/ */
# endif
#elif defined(CONFIG_BUILD_KERNEL)
/* The kernel only build is equivalent to the kernel part of the protected
* build.
*/
#else
/* User-space worker threads are not built in a flat build
* (CONFIG_BUILD_PROTECTED=n && CONFIG_BUILD_KERNEL=n)
*/
# undef CONFIG_LIB_USRWORK
#endif #endif
/* High priority, kernel work queue configuration ***************************/ /* High priority, kernel work queue configuration ***************************/

View file

@ -213,10 +213,10 @@ FAR char *tempnam(FAR const char *dir, FAR const char *pfx);
int remove(FAR const char *path); int remove(FAR const char *path);
/* Shell operations. These are not actually implemented in the OS. See /* Shell operations. These are not actually implemented in the OS. See
* apps/system/open for implementation. * apps/system/popen for implementation.
*/ */
#if !defined(CONFIG_BUILD_KERNEL) && !defined(__KERNEL__) #ifndef __KERNEL__
FILE *popen(FAR const char *command, FAR const char *mode); FILE *popen(FAR const char *command, FAR const char *mode);
int pclose(FILE *stream); int pclose(FILE *stream);
#endif #endif

View file

@ -68,15 +68,7 @@
int dlsymtab(FAR const struct symtab_s *symtab, int nsymbols) int dlsymtab(FAR const struct symtab_s *symtab, int nsymbols)
{ {
#if defined(CONFIG_BUILD_FLAT) || defined(CONFIG_BUILD_PROTECTED) #ifdef CONFIG_BUILD_KERNEL
/* Set the symbol take information that will be used by this instance of
* the module library.
*/
modlib_setsymtab(symtab, nsymbols);
return OK;
#else /* if defined(CONFIG_BUILD_KERNEL) */
/* The KERNEL build is considerably more complex: In order to be shared, /* The KERNEL build is considerably more complex: In order to be shared,
* the .text portion of the module must be (1) build for PIC/PID operation * the .text portion of the module must be (1) build for PIC/PID operation
* and (2) must like in a shared memory region accessible from all * and (2) must like in a shared memory region accessible from all
@ -88,5 +80,13 @@ int dlsymtab(FAR const struct symtab_s *symtab, int nsymbols)
#warning Missing logic #warning Missing logic
return -ENOSYS; return -ENOSYS;
#else
/* Set the symbol take information that will be used by this instance of
* the module library.
*/
modlib_setsymtab(symtab, nsymbols);
return OK;
#endif #endif
} }

View file

@ -81,8 +81,7 @@
* mode is supported. * mode is supported.
*/ */
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_KERNEL)
# include <nuttx/kmalloc.h> # include <nuttx/kmalloc.h>
/* Domain-specific allocations */ /* Domain-specific allocations */

View file

@ -52,8 +52,7 @@
#include "libc.h" #include "libc.h"
#if (!defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)) || \ #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
defined(__KERNEL__)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -74,8 +73,7 @@ void lib_stream_initialize(FAR struct task_group_s *group)
FAR struct streamlist *list; FAR struct streamlist *list;
int i; int i;
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #ifdef CONFIG_MM_KERNEL_HEAP
defined(CONFIG_MM_KERNEL_HEAP)
DEBUGASSERT(group && group->tg_streamlist); DEBUGASSERT(group && group->tg_streamlist);
list = group->tg_streamlist; list = group->tg_streamlist;
#else #else
@ -124,12 +122,9 @@ void lib_stream_initialize(FAR struct task_group_s *group)
void lib_stream_release(FAR struct task_group_s *group) void lib_stream_release(FAR struct task_group_s *group)
{ {
FAR struct streamlist *list; FAR struct streamlist *list;
#ifndef CONFIG_STDIO_DISABLE_BUFFERING
int i; int i;
#endif
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #ifdef CONFIG_MM_KERNEL_HEAP
defined(CONFIG_MM_KERNEL_HEAP)
DEBUGASSERT(group && group->tg_streamlist); DEBUGASSERT(group && group->tg_streamlist);
list = group->tg_streamlist; list = group->tg_streamlist;
#else #else
@ -157,11 +152,7 @@ void lib_stream_release(FAR struct task_group_s *group)
if (stream->fs_bufstart != NULL && if (stream->fs_bufstart != NULL &&
(stream->fs_flags & __FS_FLAG_UBF) == 0) (stream->fs_flags & __FS_FLAG_UBF) == 0)
{ {
#ifndef CONFIG_BUILD_KERNEL #ifdef CONFIG_BUILD_KERNEL
/* Release memory from the user heap */
kumm_free(stream->fs_bufstart);
#else
/* If the exiting group is unprivileged, then it has an address /* If the exiting group is unprivileged, then it has an address
* environment. Don't bother to release the memory in this case... * environment. Don't bother to release the memory in this case...
* There is no point since the memory lies in the user heap which * There is no point since the memory lies in the user heap which
@ -171,14 +162,16 @@ void lib_stream_release(FAR struct task_group_s *group)
*/ */
if ((group->tg_flags & GROUP_FLAG_PRIVILEGED) != 0) if ((group->tg_flags & GROUP_FLAG_PRIVILEGED) != 0)
{
kmm_free(stream->fs_bufstart);
}
#endif #endif
{
group_free(group, stream->fs_bufstart);
}
} }
} }
#endif #endif
UNUSED(i);
} }
#endif /* CONFIG_NFILE_STREAMS > 0 */ #endif /* CONFIG_NFILE_STREAMS > 0 */
#endif /* (!CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL) || __KERNEL__ */ #endif /* CONFIG_BUILD_FLAT || __KERNEL__ */

View file

@ -52,8 +52,7 @@
* a kernel system call. * a kernel system call.
*/ */
#if (!defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)) || \ #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
defined(__KERNEL__)
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -125,4 +124,4 @@ int uname(FAR struct utsname *name)
return ret; return ret;
} }
#endif /* (!CONFIG_BUILD_PROTECTED) && !CONFIG_BUILD_KERNEL) || __KERNEL__ */ #endif /* CONFIG_BUILD_FLAT || __KERNEL__ */

View file

@ -56,8 +56,7 @@
* the user address space. * the user address space.
*/ */
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #if !defined(CONFIG_BUILD_FLAT) && !defined(__KERNEL__)
!defined(__KERNEL__)
const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER; const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER;
#endif #endif

View file

@ -44,8 +44,7 @@
#include <nuttx/userspace.h> #include <nuttx/userspace.h>
#if (defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && !defined(__KERNEL__)
!defined(CONFIG_BUILD_KERNEL)
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -106,4 +105,4 @@ void pthread_startup(pthread_startroutine_t entrypt, pthread_addr_t arg)
pthread_exit(exit_status); pthread_exit(exit_status);
} }
#endif /* (CONFIG_BUILD_PROTECTED && !__KERNEL__) && !CONFIG_BUILD_KERNEL */ #endif /* !CONFIG_BUILD_FLAT && !__KERNEL__ */

View file

@ -170,17 +170,6 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec,
int dsgn; /* Unused sign indicator */ int dsgn; /* Unused sign indicator */
int i; int i;
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
/* This function may *NOT* be called within interrupt level logic. That is
* because the logic in __dtoa may attempt to allocate memory. That will
* lead to cryptic failures down the road within the memory manager.
* Better to explicitly assert upstream here. Rule: Don't use floating
* point formats on any output from interrupt handling logic.
*/
DEBUGASSERT(up_interrupt_context() == false);
#endif
/* Set to default precision if none specified */ /* Set to default precision if none specified */
notrailing = false; notrailing = false;

View file

@ -105,8 +105,7 @@ int gethostname(FAR char *name, size_t namelen)
* function. * function.
*/ */
#if (!defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)) || \ #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
defined(__KERNEL__)
irqstate_t flags; irqstate_t flags;

View file

@ -52,8 +52,7 @@
* function only be called from user space is only via a kernel system call. * function only be called from user space is only via a kernel system call.
*/ */
#if (!defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)) || \ #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
defined(__KERNEL__)
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -124,4 +123,4 @@ int sethostname(FAR const char *name, size_t size)
return 0; return 0;
} }
#endif /* (!CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL) || __KERNEL__ */ #endif /* CONFIG_BUILD_FLAT || __KERNEL__ */

View file

@ -37,25 +37,8 @@ ifeq ($(CONFIG_LIB_USRWORK),y)
# Add the work queue C files to the build # Add the work queue C files to the build
WORK_CSRCS += work_usrthread.c work_queue.c work_cancel.c work_signal.c CSRCS += work_usrthread.c work_queue.c work_cancel.c work_signal.c
WORK_CSRCS += work_lock.c CSRCS += work_lock.c
# Protected mode
ifeq ($(CONFIG_BUILD_PROTECTED),y)
CSRCS += $(WORK_CSRCS)
# Add the wqueue directory to the build
DEPPATH += --dep-path wqueue
VPATH += :wqueue
else
# Kernel mode
ifeq ($(CONFIG_BUILD_KERNEL),y)
CSRCS += $(WORK_CSRCS)
# Add the wqueue directory to the build # Add the wqueue directory to the build
@ -63,5 +46,3 @@ DEPPATH += --dep-path wqueue
VPATH += :wqueue VPATH += :wqueue
endif endif
endif
endif

View file

@ -60,8 +60,7 @@
* mode is supported. * mode is supported.
*/ */
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_KERNEL)
# include <nuttx/kmalloc.h> # include <nuttx/kmalloc.h>

View file

@ -52,8 +52,7 @@
// built as separated kernel- and user-space modules, then only the first // built as separated kernel- and user-space modules, then only the first
// mode is supported. // mode is supported.
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ #if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
defined(CONFIG_BUILD_KERNEL)
# include <nuttx/kmalloc.h> # include <nuttx/kmalloc.h>
# define lib_malloc(s) kmm_malloc(s) # define lib_malloc(s) kmm_malloc(s)
# define lib_zalloc(s) kmm_zalloc(s) # define lib_zalloc(s) kmm_zalloc(s)

View file

@ -84,10 +84,9 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
FAR struct mm_freenode_s *node; FAR struct mm_freenode_s *node;
FAR struct mm_freenode_s *prev; FAR struct mm_freenode_s *prev;
FAR struct mm_freenode_s *next; FAR struct mm_freenode_s *next;
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
int ret; int ret;
#endif
UNUSED(ret);
minfo("Freeing %p\n", mem); minfo("Freeing %p\n", mem);
/* Protect against attempts to free a NULL reference */ /* Protect against attempts to free a NULL reference */

View file

@ -59,9 +59,9 @@
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
static void mm_free_delaylist(FAR struct mm_heap_s *heap) static void mm_free_delaylist(FAR struct mm_heap_s *heap)
{ {
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
FAR struct mm_delaynode_s *tmp; FAR struct mm_delaynode_s *tmp;
irqstate_t flags; irqstate_t flags;
@ -91,8 +91,8 @@ static void mm_free_delaylist(FAR struct mm_heap_s *heap)
mm_free(heap, address); mm_free(heap, address);
} }
}
#endif #endif
}
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -116,11 +116,9 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
void *ret = NULL; void *ret = NULL;
int ndx; int ndx;
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
/* Firstly, free mm_delaylist */ /* Firstly, free mm_delaylist */
mm_free_delaylist(heap); mm_free_delaylist(heap);
#endif
/* Ignore zero-length allocations */ /* Ignore zero-length allocations */

View file

@ -47,7 +47,7 @@
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) #if defined(CONFIG_ARCH_ADDRENV) && defined(__KERNEL__)
/* In the kernel build, there a multiple user heaps; one for each task /* In the kernel build, there a multiple user heaps; one for each task
* group. In this build configuration, the user heap structure lies * group. In this build configuration, the user heap structure lies
* in a reserved region at the beginning of the .bss/.data address * in a reserved region at the beginning of the .bss/.data address

View file

@ -48,7 +48,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) #if defined(CONFIG_ARCH_ADDRENV) && defined(__KERNEL__)
/* In the kernel build, there are multiple user heaps; one for each task /* In the kernel build, there are multiple user heaps; one for each task
* group. In this build configuration, the user heap structure lies * group. In this build configuration, the user heap structure lies
* in a reserved region at the beginning of the .bss/.data address * in a reserved region at the beginning of the .bss/.data address

View file

@ -66,7 +66,7 @@
FAR void *malloc(size_t size) FAR void *malloc(size_t size)
{ {
#ifdef CONFIG_BUILD_KERNEL #if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
FAR void *brkaddr; FAR void *brkaddr;
FAR void *mem; FAR void *mem;

View file

@ -64,12 +64,8 @@ ifeq ($(CONFIG_BINFMT_LOADABLE),y)
CSRCS += group_exitinfo.c CSRCS += group_exitinfo.c
endif endif
ifeq ($(CONFIG_BUILD_PROTECTED),y) ifneq ($(CONFIG_BUILD_FLAT),y)
CSRCS += group_malloc.c group_zalloc.c group_free.c CSRCS += group_malloc.c group_zalloc.c group_free.c
else
ifeq ($(CONFIG_BUILD_KERNEL),y)
CSRCS += group_malloc.c group_zalloc.c group_free.c
endif
endif endif
# Include group build support # Include group build support

View file

@ -225,8 +225,7 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype)
return -ENOMEM; return -ENOMEM;
} }
#if CONFIG_NFILE_STREAMS > 0 && (defined(CONFIG_BUILD_PROTECTED) || \ #if CONFIG_NFILE_STREAMS > 0 && defined(CONFIG_MM_KERNEL_HEAP)
defined(CONFIG_BUILD_KERNEL)) && defined(CONFIG_MM_KERNEL_HEAP)
/* If this group is being created for a privileged thread, then all elements /* If this group is being created for a privileged thread, then all elements
* of the group must be created for privileged access. * of the group must be created for privileged access.
*/ */
@ -276,8 +275,7 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype)
ret = env_dup(group); ret = env_dup(group);
if (ret < 0) if (ret < 0)
{ {
#if CONFIG_NFILE_STREAMS > 0 && (defined(CONFIG_BUILD_PROTECTED) || \ #if CONFIG_NFILE_STREAMS > 0 && defined(CONFIG_MM_KERNEL_HEAP)
defined(CONFIG_BUILD_KERNEL)) && defined(CONFIG_MM_KERNEL_HEAP)
group_free(group, group->tg_streamlist); group_free(group, group->tg_streamlist);
#endif #endif
kmm_free(group); kmm_free(group);

View file

@ -47,8 +47,7 @@
#include "sched/sched.h" #include "sched/sched.h"
#include "group/group.h" #include "group/group.h"
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #ifdef CONFIG_MM_KERNEL_HEAP
defined(CONFIG_MM_KERNEL_HEAP)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -92,4 +91,4 @@ void group_free(FAR struct task_group_s *group, FAR void *mem)
} }
} }
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && CONFIG_MM_KERNEL_HEAP */ #endif /* CONFIG_MM_KERNEL_HEAP */

View file

@ -229,14 +229,7 @@ static inline void group_release(FAR struct task_group_s *group)
* freed here. * freed here.
*/ */
# if defined(CONFIG_BUILD_PROTECTED) # ifdef CONFIG_BUILD_KERNEL
/* In the protected build, the task's stream list is always allocated
* and freed from the single, global user allocator.
*/
kumm_free(group->tg_streamlist);
# elif defined(CONFIG_BUILD_KERNEL)
/* In the kernel build, the unprivileged process's stream list will be /* In the kernel build, the unprivileged process's stream list will be
* allocated from with its per-process, private user heap. But in that * allocated from with its per-process, private user heap. But in that
* case, there is no reason to do anything here: That allocation resides * case, there is no reason to do anything here: That allocation resides
@ -245,16 +238,15 @@ static inline void group_release(FAR struct task_group_s *group)
*/ */
if ((group->tg_flags & GROUP_FLAG_PRIVILEGED) != 0) if ((group->tg_flags & GROUP_FLAG_PRIVILEGED) != 0)
# endif
{ {
/* But kernel threads are different in this build configuration: Their /* But kernel threads are different in this build configuration: Their
* stream lists were allocated from the common, global kernel heap and * stream lists were allocated from the common, global kernel heap and
* must explicitly freed here. * must explicitly freed here.
*/ */
kmm_free(group->tg_streamlist); group_free(group, group->tg_streamlist);
} }
# endif
#endif #endif
#ifdef CONFIG_BINFMT_LOADABLE #ifdef CONFIG_BINFMT_LOADABLE

View file

@ -47,8 +47,7 @@
#include "sched/sched.h" #include "sched/sched.h"
#include "group/group.h" #include "group/group.h"
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #ifdef CONFIG_MM_KERNEL_HEAP
defined(CONFIG_MM_KERNEL_HEAP)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -95,4 +94,4 @@ FAR void *group_malloc(FAR struct task_group_s *group, size_t nbytes)
} }
} }
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && CONFIG_MM_KERNEL_HEAP */ #endif /* CONFIG_MM_KERNEL_HEAP */

View file

@ -43,15 +43,14 @@
#include "group/group.h" #include "group/group.h"
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #ifdef CONFIG_MM_KERNEL_HEAP
defined(CONFIG_MM_KERNEL_HEAP)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: group_malloc * Name: group_zalloc
* *
* Description: * Description:
* Allocate memory and clear appropriate for the group type. If the * Allocate memory and clear appropriate for the group type. If the
@ -72,4 +71,4 @@ FAR void *group_zalloc(FAR struct task_group_s *group, size_t nbytes)
return mem; return mem;
} }
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && CONFIG_MM_KERNEL_HEAP */ #endif /* CONFIG_MM_KERNEL_HEAP */

View file

@ -545,8 +545,6 @@ void nx_start(void)
nxsem_initialize(); nxsem_initialize();
#if defined(MM_KERNEL_USRHEAP_INIT) || defined(CONFIG_MM_KERNEL_HEAP) || \
defined(CONFIG_MM_PGALLOC)
/* Initialize the memory manager */ /* Initialize the memory manager */
{ {
@ -571,10 +569,6 @@ void nx_start(void)
kmm_initialize(heap_start, heap_size); kmm_initialize(heap_start, heap_size);
#endif #endif
#ifdef CONFIG_ARCH_USE_MODULE_TEXT
up_module_text_init();
#endif
#ifdef CONFIG_MM_PGALLOC #ifdef CONFIG_MM_PGALLOC
/* If there is a page allocator in the configuration, then get the page /* If there is a page allocator in the configuration, then get the page
* heap information from the platform-specific code and configure the * heap information from the platform-specific code and configure the
@ -585,6 +579,9 @@ void nx_start(void)
mm_pginitialize(heap_start, heap_size); mm_pginitialize(heap_start, heap_size);
#endif #endif
} }
#ifdef CONFIG_ARCH_USE_MODULE_TEXT
up_module_text_init();
#endif #endif
#ifdef CONFIG_MM_IOB #ifdef CONFIG_MM_IOB

View file

@ -204,11 +204,11 @@ static void pthread_start(void)
* to switch to user-mode before calling into the pthread. * to switch to user-mode before calling into the pthread.
*/ */
#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) #ifdef CONFIG_BUILD_FLAT
exit_status = (*ptcb->cmn.entry.pthread)(ptcb->arg);
#else
up_pthread_start(ptcb->cmn.entry.pthread, ptcb->arg); up_pthread_start(ptcb->cmn.entry.pthread, ptcb->arg);
exit_status = NULL; exit_status = NULL;
#else
exit_status = (*ptcb->cmn.entry.pthread)(ptcb->arg);
#endif #endif
/* The thread has returned (should never happen in the kernel mode case) */ /* The thread has returned (should never happen in the kernel mode case) */

View file

@ -70,8 +70,7 @@ FAR struct streamlist *sched_getstreams(void)
DEBUGASSERT(group); DEBUGASSERT(group);
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #ifdef CONFIG_MM_KERNEL_HEAP
defined(CONFIG_MM_KERNEL_HEAP)
return group->tg_streamlist; return group->tg_streamlist;
#else #else
return &group->tg_streamlist; return &group->tg_streamlist;

View file

@ -136,7 +136,7 @@ void nxsig_deliver(FAR struct tcb_s *stcb)
SIGNO2SET(sigq->info.si_signo); SIGNO2SET(sigq->info.si_signo);
stcb->sigprocmask = newsigprocmask; stcb->sigprocmask = newsigprocmask;
#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) #ifndef CONFIG_BUILD_FLAT
/* In the kernel build this has to be handled differently if we are /* In the kernel build this has to be handled differently if we are
* dispatching to a signal handler in a user-space task or thread; we * dispatching to a signal handler in a user-space task or thread; we
* have to switch to user-mode before calling the task. * have to switch to user-mode before calling the task.

View file

@ -570,8 +570,7 @@ static inline void nxtask_flushstreams(FAR struct tcb_s *tcb)
if (group && group->tg_nmembers == 1) if (group && group->tg_nmembers == 1)
{ {
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ #ifdef CONFIG_MM_KERNEL_HEAP
defined(CONFIG_MM_KERNEL_HEAP)
lib_flushall(tcb->group->tg_streamlist); lib_flushall(tcb->group->tg_streamlist);
#else #else
lib_flushall(&tcb->group->tg_streamlist); lib_flushall(&tcb->group->tg_streamlist);

View file

@ -134,7 +134,7 @@ void nxtask_start(void)
* we have to switch to user-mode before calling the task. * we have to switch to user-mode before calling the task.
*/ */
#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) #ifndef CONFIG_BUILD_FLAT
if ((tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL) if ((tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
{ {
up_task_start(tcb->cmn.entry.main, argc, tcb->argv); up_task_start(tcb->cmn.entry.main, argc, tcb->argv);

View file

@ -64,13 +64,11 @@ USERDEPDIRS :=
ifeq ($(CONFIG_BUILD_PROTECTED),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
USERDEPDIRS += $(APPDIR) USERDEPDIRS += $(APPDIR)
else else ifneq ($(CONFIG_BUILD_KERNEL),y)
ifneq ($(CONFIG_BUILD_KERNEL),y)
KERNDEPDIRS += $(APPDIR) KERNDEPDIRS += $(APPDIR)
else else
CLEANDIRS += $(APPDIR) CLEANDIRS += $(APPDIR)
endif endif
endif
KERNDEPDIRS += sched drivers boards $(ARCH_SRC) KERNDEPDIRS += sched drivers boards $(ARCH_SRC)
KERNDEPDIRS += fs binfmt KERNDEPDIRS += fs binfmt

View file

@ -170,9 +170,7 @@ LINKLIBS = $(patsubst staging/%,%,$(NUTTXLIBS))
MKEXPORT= tools/mkexport.sh MKEXPORT= tools/mkexport.sh
MKEXPORT_ARGS = -w$(WINTOOL) -t "$(TOPDIR)" MKEXPORT_ARGS = -w$(WINTOOL) -t "$(TOPDIR)"
ifeq ($(CONFIG_BUILD_PROTECTED),y) ifneq ($(CONFIG_BUILD_FLAT),y)
MKEXPORT_ARGS += -u
else ifeq ($(CONFIG_BUILD_KERNEL),y)
MKEXPORT_ARGS += -u MKEXPORT_ARGS += -u
endif endif

View file

@ -152,9 +152,7 @@ LINKLIBS = $(patsubst staging\\%,%,$(NUTTXLIBS))
MKEXPORT = tools\mkexport.bat MKEXPORT = tools\mkexport.bat
MKEXPORT_ARGS = -w$(WINTOOL) -t "$(TOPDIR)" MKEXPORT_ARGS = -w$(WINTOOL) -t "$(TOPDIR)"
ifeq ($(CONFIG_BUILD_PROTECTED),y) ifneq ($(CONFIG_BUILD_FLAT),y)
MKEXPORT_ARGS += -u
else ifeq ($(CONFIG_BUILD_KERNEL),y)
MKEXPORT_ARGS += -u MKEXPORT_ARGS += -u
endif endif