mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 20:44:39 +08:00
Refine __KERNEL__ and CONFIG_BUILD_xxx usage in the code base
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
fe5cb9529d
commit
eca7059785
@@ -43,8 +43,7 @@
|
||||
#include "svcall.h"
|
||||
#include "arm_internal.h"
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -88,4 +87,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
|
||||
(uintptr_t)info, (uintptr_t)ucontext);
|
||||
}
|
||||
|
||||
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */
|
||||
#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */
|
||||
|
||||
@@ -44,8 +44,7 @@
|
||||
#include "pgalloc.h"
|
||||
#include "arm_internal.h"
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||
|
||||
/****************************************************************************
|
||||
* 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__ */
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
#include "svcall.h"
|
||||
#include "arm_internal.h"
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -73,4 +72,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
|
||||
(uintptr_t)info, (uintptr_t)ucontext);
|
||||
}
|
||||
|
||||
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */
|
||||
#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */
|
||||
|
||||
@@ -44,8 +44,7 @@
|
||||
#include "pgalloc.h"
|
||||
#include "arm_internal.h"
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_PROTECTED)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||
|
||||
/****************************************************************************
|
||||
* 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__ */
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
#include "svcall.h"
|
||||
#include "arm_internal.h"
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -73,4 +72,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
|
||||
(uintptr_t)info, (uintptr_t)ucontext);
|
||||
}
|
||||
|
||||
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */
|
||||
#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */
|
||||
|
||||
@@ -46,12 +46,6 @@
|
||||
|
||||
/* 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
|
||||
* 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 HAVE_KERNEL_HEAP
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
/* Use the kernel allocator if this is a kernel thread */
|
||||
|
||||
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 */
|
||||
#ifdef HAVE_KERNEL_HEAP
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
/* Use the kernel allocator if this is a kernel thread */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
#include "svcall.h"
|
||||
#include "arm_internal.h"
|
||||
|
||||
#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL)) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
|
||||
!defined(CONFIG_DISABLE_PTHREAD)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -84,4 +84,4 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
|
||||
PANIC();
|
||||
}
|
||||
|
||||
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */
|
||||
#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ && !CONFIG_DISABLE_PTHREAD */
|
||||
|
||||
@@ -47,18 +47,6 @@
|
||||
|
||||
#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
|
||||
****************************************************************************/
|
||||
@@ -100,7 +88,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
if (dtcb->stack_alloc_ptr)
|
||||
{
|
||||
#ifdef HAVE_KERNEL_HEAP
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
/* Use the kernel allocator if this is a kernel thread */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "svcall.h"
|
||||
#include "arm_internal.h"
|
||||
|
||||
#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)
|
||||
#ifndef CONFIG_BUILD_FLAT
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -84,4 +84,4 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[])
|
||||
PANIC();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */
|
||||
#endif /* !CONFIG_BUILD_FLAT */
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -89,7 +89,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -89,7 +89,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -61,12 +61,6 @@
|
||||
|
||||
/* 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
|
||||
* 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 HAVE_KERNEL_HEAP
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
/* Use the kernel allocator if this is a kernel thread */
|
||||
|
||||
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 */
|
||||
#ifdef HAVE_KERNEL_HEAP
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
/* Use the kernel allocator if this is a kernel thread */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
#include "svcall.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL)) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
|
||||
!defined(CONFIG_DISABLE_PTHREAD)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -86,4 +86,4 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
|
||||
PANIC();
|
||||
}
|
||||
|
||||
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */
|
||||
#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ && !CONFIG_DISABLE_PTHREAD */
|
||||
|
||||
@@ -51,14 +51,6 @@
|
||||
* 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
|
||||
****************************************************************************/
|
||||
@@ -100,7 +92,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
if (dtcb->stack_alloc_ptr)
|
||||
{
|
||||
#ifdef HAVE_KERNEL_HEAP
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
/* Use the kernel allocator if this is a kernel thread */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "svcall.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)
|
||||
#ifndef CONFIG_BUILD_FLAT
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -86,4 +86,4 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[])
|
||||
PANIC();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */
|
||||
#endif /* !CONFIG_BUILD_FLAT */
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#include "svcall.h"
|
||||
#include "riscv_internal.h"
|
||||
|
||||
#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL)) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
|
||||
!defined(CONFIG_DISABLE_PTHREAD)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -69,4 +69,4 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
|
||||
PANIC();
|
||||
}
|
||||
|
||||
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */
|
||||
#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ && !CONFIG_DISABLE_PTHREAD */
|
||||
|
||||
@@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "svcall.h"
|
||||
#include "riscv_internal.h"
|
||||
|
||||
#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)
|
||||
#ifndef CONFIG_BUILD_FLAT
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -69,4 +69,4 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[])
|
||||
PANIC();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */
|
||||
#endif /* !CONFIG_BUILD_FLAT */
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
#include "svcall.h"
|
||||
#include "riscv_internal.h"
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -73,4 +72,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
|
||||
(uintptr_t)info, (uintptr_t)ucontext);
|
||||
}
|
||||
|
||||
#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */
|
||||
#endif /* !CONFIG_BUILD_FLAT && __KERNEL__ */
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -86,7 +86,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -88,7 +88,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -54,7 +54,7 @@ extern uint32_t _emodtext;
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
#error not implemented
|
||||
#endif
|
||||
#if defined(CONFIG_BUILD_PROTECTED) || defined (CONFIG_BUILD_KERNEL)
|
||||
#ifndef CONFIG_BUILD_FLAT
|
||||
#error permission check not implemented
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
@@ -81,7 +81,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
|
||||
|
||||
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 */
|
||||
|
||||
if (ttype == TCB_FLAG_TTYPE_KERNEL)
|
||||
|
||||
+1
-2
@@ -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 */
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \
|
||||
defined(CONFIG_MM_KERNEL_HEAP)
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
slist = tcb->group->tg_streamlist;
|
||||
#else
|
||||
slist = &tcb->group->tg_streamlist;
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@
|
||||
/* Configuration ************************************************************/
|
||||
/* 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
|
||||
#endif
|
||||
|
||||
|
||||
@@ -53,10 +53,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_BUILD_FLAT
|
||||
# error "Only flat build supported for now"
|
||||
#endif
|
||||
|
||||
/* Disable DEBUGASSERT macro if LIBDSP debug is not enabled */
|
||||
|
||||
#ifdef CONFIG_LIBDSP_DEBUG
|
||||
|
||||
+4
-18
@@ -48,7 +48,7 @@
|
||||
|
||||
/* How can we access the errno variable? */
|
||||
|
||||
#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)
|
||||
#ifdef CONFIG_BUILD_FLAT
|
||||
/* Flat build */
|
||||
|
||||
# if defined(CONFIG_LIB_SYSCALL) && !defined(__KERNEL__)
|
||||
@@ -66,31 +66,17 @@
|
||||
# define __DIRECT_ERRNO_ACCESS 1
|
||||
# endif
|
||||
|
||||
#elif defined(CONFIG_BUILD_PROTECTED)
|
||||
#else
|
||||
# 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
|
||||
|
||||
# else
|
||||
/* User portion of protected build. Application code has only indirect
|
||||
/* User portion of protected/kernel build. Application code has only indirect
|
||||
* 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
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -551,8 +551,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||
void up_task_start(main_t taskentry, int argc, FAR char *argv[])
|
||||
noreturn_function;
|
||||
#endif
|
||||
@@ -581,8 +580,8 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[])
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) && \
|
||||
!defined(CONFIG_DISABLE_PTHREAD)
|
||||
void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
|
||||
noreturn_function;
|
||||
#endif
|
||||
@@ -615,8 +614,7 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \
|
||||
defined(CONFIG_BUILD_KERNEL)
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||
void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
|
||||
FAR siginfo_t *info, FAR void *ucontext);
|
||||
#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,
|
||||
FAR siginfo_t *info, FAR void *ucontext)
|
||||
noreturn_function;
|
||||
|
||||
@@ -74,15 +74,10 @@
|
||||
#if defined(CONFIG_SCHED_TICKLESS)
|
||||
/* Case 1: There is no global timer data */
|
||||
|
||||
#elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)
|
||||
/* Case 3: Kernel mode of protected kernel build */
|
||||
#elif defined(__KERNEL__)
|
||||
/* Case 3: Kernel mode of protected/kernel build */
|
||||
|
||||
# define __HAVE_KERNEL_GLOBALS 1
|
||||
|
||||
#elif defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)
|
||||
/* Case 3: Kernel only build */
|
||||
|
||||
# define __HAVE_KERNEL_GLOBALS 1
|
||||
# define __HAVE_KERNEL_GLOBALS 1
|
||||
|
||||
#elif defined(CONFIG_LIB_SYSCALL)
|
||||
/* Case 4: Building with SYSCALLs enabled, but not part of a kernel build */
|
||||
@@ -90,7 +85,7 @@
|
||||
#else
|
||||
/* Case 2: Un-protected, non-kernel build */
|
||||
|
||||
# define __HAVE_KERNEL_GLOBALS 1
|
||||
# define __HAVE_KERNEL_GLOBALS 1
|
||||
#endif
|
||||
|
||||
/* If CONFIG_SYSTEM_TIME64 is selected and the CPU supports long long types,
|
||||
|
||||
+2
-24
@@ -34,8 +34,6 @@
|
||||
#include <nuttx/mm/mm.h>
|
||||
#include <nuttx/userspace.h>
|
||||
|
||||
#if !defined(CONFIG_BUILD_PROTECTED) || defined(__KERNEL__)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
@@ -84,25 +82,7 @@ extern "C"
|
||||
|
||||
/* This family of allocators is used to manage kernel protected memory */
|
||||
|
||||
#if !defined(CONFIG_BUILD_PROTECTED) && !defined(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)
|
||||
#ifndef CONFIG_MM_KERNEL_HEAP
|
||||
/* 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
|
||||
* call into user-space via a header at the beginning of the user-space blob.
|
||||
@@ -128,8 +108,7 @@ extern "C"
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \
|
||||
defined(CONFIG_MM_KERNEL_HEAP)
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
/****************************************************************************
|
||||
* Group memory management
|
||||
*
|
||||
@@ -169,5 +148,4 @@ void group_free(FAR struct task_group_s *group, FAR void *mem);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !CONFIG_BUILD_PROTECTED || __KERNEL__ */
|
||||
#endif /* __INCLUDE_NUTTX_KMALLOC_H */
|
||||
|
||||
+4
-13
@@ -84,9 +84,7 @@
|
||||
*/
|
||||
|
||||
#undef MM_KERNEL_USRHEAP_INIT
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)
|
||||
# define MM_KERNEL_USRHEAP_INIT 1
|
||||
#elif !defined(CONFIG_BUILD_KERNEL)
|
||||
#if !defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)
|
||||
# define MM_KERNEL_USRHEAP_INIT 1
|
||||
#endif
|
||||
|
||||
@@ -285,7 +283,6 @@ extern "C"
|
||||
* 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
|
||||
* group. In this build configuration, the user heap structure lies
|
||||
* in a reserved region at the beginning of the .bss/.data address
|
||||
@@ -293,13 +290,12 @@ extern "C"
|
||||
* 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
|
||||
* user heap. In that case the user heap structure lies in the user space
|
||||
* (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 */
|
||||
|
||||
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 *************************************/
|
||||
|
||||
#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__)
|
||||
FAR void *umm_brkaddr(int region);
|
||||
#endif
|
||||
|
||||
/* Functions contained in kmm_brkaddr.c *************************************/
|
||||
|
||||
@@ -455,8 +449,7 @@ FAR void *kmm_brkaddr(int region);
|
||||
|
||||
/* Functions contained in mm_sbrk.c *****************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC) && \
|
||||
defined(CONFIG_ARCH_USE_MMU)
|
||||
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC)
|
||||
FAR void *mm_sbrk(FAR struct mm_heap_s *heap, intptr_t incr,
|
||||
uintptr_t maxbreak);
|
||||
#endif
|
||||
@@ -464,7 +457,7 @@ FAR void *mm_sbrk(FAR struct mm_heap_s *heap, intptr_t incr,
|
||||
/* Functions contained in kmm_sbrk.c ****************************************/
|
||||
|
||||
#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);
|
||||
#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 **************************************/
|
||||
|
||||
#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__)
|
||||
void umm_extend(FAR void *mem, size_t size, int region);
|
||||
#endif
|
||||
|
||||
/* Functions contained in kmm_extend.c **************************************/
|
||||
|
||||
|
||||
@@ -554,8 +554,7 @@ struct task_group_s
|
||||
* allocated using a user-space allocator.
|
||||
*/
|
||||
|
||||
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \
|
||||
defined(CONFIG_MM_KERNEL_HEAP)
|
||||
#ifdef CONFIG_MM_KERNEL_HEAP
|
||||
FAR struct streamlist *tg_streamlist;
|
||||
#else
|
||||
struct streamlist tg_streamlist; /* Holds C buffered I/O info */
|
||||
|
||||
@@ -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;
|
||||
#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);
|
||||
#endif
|
||||
|
||||
|
||||
+12
-21
@@ -100,38 +100,29 @@
|
||||
* 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.
|
||||
*/
|
||||
|
||||
# ifndef __KERNEL__
|
||||
|
||||
# undef CONFIG_SCHED_HPWORK
|
||||
# undef CONFIG_SCHED_LPWORK
|
||||
# undef CONFIG_SCHED_WORKQUEUE
|
||||
# undef CONFIG_SCHED_HPWORK
|
||||
# undef CONFIG_SCHED_LPWORK
|
||||
# undef CONFIG_SCHED_WORKQUEUE
|
||||
|
||||
/* 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
|
||||
* 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
|
||||
|
||||
/* High priority, kernel work queue configuration ***************************/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user