diff --git a/arch/arm/src/armv7-a/arm_pgalloc.c b/arch/arm/src/armv7-a/arm_pgalloc.c index 673af5834a..da46237925 100644 --- a/arch/arm/src/armv7-a/arm_pgalloc.c +++ b/arch/arm/src/armv7-a/arm_pgalloc.c @@ -51,7 +51,7 @@ #include "mmu.h" #include "pgalloc.h" -#if defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU) +#ifdef CONFIG_BUILD_KERNEL /**************************************************************************** * Pre-processor Definitions @@ -317,4 +317,4 @@ uintptr_t pgalloc(uintptr_t brkaddr, unsigned int npages) return brkaddr; } -#endif /* CONFIG_MM_PGALLOC && CONFIG_ARCH_USE_MMU */ +#endif /* CONFIG_BUILD_KERNEL */ diff --git a/include/sched.h b/include/sched.h index 64d6a6b821..a0f296e14b 100644 --- a/include/sched.h +++ b/include/sched.h @@ -99,7 +99,7 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority, FAR char * const argv[]); int task_activate(FAR struct tcb_s *tcb); -#ifndef CONFIG_ARCH_ADDRENV +#ifndef CONFIG_BUILD_KERNEL int task_create(FAR const char *name, int priority, int stack_size, main_t entry, FAR char * const argv[]); #endif diff --git a/include/spawn.h b/include/spawn.h index f994ac51f4..e47bf47b24 100644 --- a/include/spawn.h +++ b/include/spawn.h @@ -89,7 +89,7 @@ struct posix_spawnattr_s sigset_t sigmask; /* Signals to be masked */ #endif -#ifndef CONFIG_ARCH_ADDRENV +#ifndef CONFIG_BUILD_KERNEL /* Used only by task_spawn (non-standard) */ size_t stacksize; /* Task stack size */ @@ -141,7 +141,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, posix_spawn(pid,path,file_actions,attr,argv,envp) #endif -#ifndef CONFIG_ARCH_ADDRENV +#ifndef CONFIG_BUILD_KERNEL /* Non-standard task_spawn interface. This function uses the same * semantics to execute a file in memory at 'entry', giving it the name * 'name'. diff --git a/include/sys/syscall.h b/include/sys/syscall.h index 3ec10b3cd0..10e6fb2c88 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -94,7 +94,7 @@ * address environments. */ -#ifndef CONFIG_ARCH_ADDRENV +#ifndef CONFIG_BUILD_KERNEL # define SYS_task_create (CONFIG_SYS_RESERVED+22) # define __SYS_task_delete (CONFIG_SYS_RESERVED+23) @@ -102,11 +102,9 @@ * allocator selected. MMU support from the CPU is also required. */ -#elif defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU) +#else # define SYS_pgalloc (CONFIG_SYS_RESERVED+22) # define __SYS_task_delete (CONFIG_SYS_RESERVED+23) -#else -# define __SYS_task_delete (CONFIG_SYS_RESERVED+22) #endif # define SYS_task_delete __SYS_task_delete diff --git a/libc/spawn/Make.defs b/libc/spawn/Make.defs index d186de38ed..7b4fdba4ce 100644 --- a/libc/spawn/Make.defs +++ b/libc/spawn/Make.defs @@ -50,7 +50,7 @@ ifneq ($(CONFIG_DISABLE_SIGNALS),y) CSRCS += lib_psa_getsigmask.c lib_psa_setsigmask.c endif -ifneq ($(CONFIG_ARCH_ADDRENV),y) +ifneq ($(CONFIG_BUILD_KERNEL),y) CSRCS += lib_psa_getstacksize.c lib_psa_setstacksize.c endif diff --git a/libc/spawn/lib_psa_getstacksize.c b/libc/spawn/lib_psa_getstacksize.c index d6fd8978e8..4c50ee526f 100644 --- a/libc/spawn/lib_psa_getstacksize.c +++ b/libc/spawn/lib_psa_getstacksize.c @@ -43,7 +43,7 @@ #include #include -#ifndef CONFIG_ARCH_ADDRENV +#ifndef CONFIG_BUILD_KERNEL /**************************************************************************** * Public Functions @@ -75,4 +75,4 @@ int task_spawnattr_getstacksize(FAR const posix_spawnattr_t *attr, return OK; } -#endif /* !CONFIG_ARCH_ADDRENV */ +#endif /* !CONFIG_BUILD_KERNEL */ diff --git a/libc/spawn/lib_psa_setstacksize.c b/libc/spawn/lib_psa_setstacksize.c index bad7627a1a..54d48173b3 100644 --- a/libc/spawn/lib_psa_setstacksize.c +++ b/libc/spawn/lib_psa_setstacksize.c @@ -43,7 +43,7 @@ #include #include -#ifndef CONFIG_ARCH_ADDRENV +#ifndef CONFIG_BUILD_KERNEL /**************************************************************************** * Public Functions @@ -74,4 +74,4 @@ int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr, size_t stacksize) return OK; } -#endif /* !CONFIG_ARCH_ADDRENV */ +#endif /* !CONFIG_BUILD_KERNEL */ diff --git a/mm/kmm_sbrk.c b/mm/kmm_sbrk.c index 547dba0476..90c9b66276 100755 --- a/mm/kmm_sbrk.c +++ b/mm/kmm_sbrk.c @@ -41,8 +41,7 @@ #include -#if defined(CONFIG_MM_KERNEL_HEAP) && defined(CONFIG_ARCH_ADDRENV) && \ - defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU) +#if defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__) /**************************************************************************** * Pre-processor Definitions @@ -89,4 +88,4 @@ FAR void *kmm_sbrk(intptr_t incr) return mm_sbrk(&g_kmmheap, incr, UINTPTR_MAX); } -#endif /* CONFIG_MM_KERNEL_HEAP && CONFIG_ARCH_ADDRENV && ... */ +#endif /* CONFIG_BUILD_KERNEL && __KERNEL__ */ diff --git a/mm/mm_sbrk.c b/mm/mm_sbrk.c index 5d81250fa9..dc4c0318ec 100644 --- a/mm/mm_sbrk.c +++ b/mm/mm_sbrk.c @@ -47,8 +47,7 @@ #include #include -#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC) && \ - defined(CONFIG_ARCH_USE_MMU) +#ifdef CONFIG_BUILD_KERNEL /**************************************************************************** * Pre-processor Definitions @@ -166,4 +165,4 @@ errout: set_errno(err); return (FAR void *)-1; } -#endif /* CONFIG_ARCH_ADDRENV && CONFIG_MM_PGALLOC && CONFIG_ARCH_USE_MMU */ +#endif /* CONFIG_BUILD_KERNEL */ diff --git a/mm/umm_malloc.c b/mm/umm_malloc.c index 31511b82f8..972b214de5 100644 --- a/mm/umm_malloc.c +++ b/mm/umm_malloc.c @@ -50,7 +50,7 @@ * Pre-processor Definitions ****************************************************************************/ -#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) +#ifdef 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 @@ -103,7 +103,7 @@ FAR void *malloc(size_t size) { -#ifdef CONFIG_ARCH_ADDRENV +#ifdef CONFIG_BUILD_KERNEL FAR void *brkaddr; FAR void *mem; diff --git a/mm/umm_sbrk.c b/mm/umm_sbrk.c index bb74385ee1..1e6eaf5c37 100644 --- a/mm/umm_sbrk.c +++ b/mm/umm_sbrk.c @@ -42,17 +42,15 @@ #include #include +#include #include -#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC) && \ - defined(CONFIG_ARCH_USE_MMU) && (!defined(CONFIG_BUILD_PROTECTED) || \ - !defined(__KERNEL__)) +#if defined(CONFIG_BUILD_KERNEL) && !defined(__KERNEL__) /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -#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 @@ -60,14 +58,7 @@ * ARCH_DATA_RESERVE_SIZE */ -# include -# define USR_HEAP (&ARCH_DATA_RESERVE->ar_usrheap) - -#else -/* Otherwise, the user heap data structures are in common .bss */ - -# define USR_HEAP &g_mmheap -#endif +#define USR_HEAP (&ARCH_DATA_RESERVE->ar_usrheap) /**************************************************************************** * Public Functions @@ -110,4 +101,4 @@ FAR void *sbrk(intptr_t incr) return mm_sbrk(USR_HEAP, incr, CONFIG_ARCH_HEAP_NPAGES << MM_PGSHIFT); } -#endif /* CONFIG_ARCH_ADDRENV && CONFIG_MM_PGALLOC && ... */ +#endif /* CONFIG_BUILD_KERNEL && !__KERNEL__ */ diff --git a/sched/task/Make.defs b/sched/task/Make.defs index 5d0b093da6..81410d71f7 100644 --- a/sched/task/Make.defs +++ b/sched/task/Make.defs @@ -33,11 +33,10 @@ # ############################################################################ -TSK_SRCS = task_create.c task_init.c task_setup.c task_activate.c -TSK_SRCS += task_start.c task_delete.c task_exit.c task_exithook.c -TSK_SRCS += task_recover.c task_restart.c task_spawnparms.c -TSK_SRCS += task_terminate.c task_getgroup.c task_prctl.c task_getpid.c -TSK_SRCS += exit.c +TSK_SRCS = task_init.c task_setup.c task_activate.c task_start.c +TSK_SRCS += task_delete.c task_exit.c task_exithook.c task_recover.c +TSK_SRCS += task_restart.c task_spawnparms.c task_terminate.c +TSK_SRCS += task_getgroup.c task_prctl.c task_getpid.c exit.c ifeq ($(CONFIG_ARCH_HAVE_VFORK),y) ifeq ($(CONFIG_SCHED_WAITPID),y) @@ -45,8 +44,8 @@ TSK_SRCS += task_vfork.c endif endif -ifneq ($(CONFIG_ARCH_ADDRENV),y) -TSK_SRCS += task_spawn.c +ifneq ($(CONFIG_BUILD_KERNEL),y) +TSK_SRCS += task_create.c task_spawn.c endif ifneq ($(CONFIG_BINFMT_DISABLE),y) diff --git a/sched/task/task_create.c b/sched/task/task_create.c index f2078b5922..358306c134 100644 --- a/sched/task/task_create.c +++ b/sched/task/task_create.c @@ -52,6 +52,8 @@ #include "group/group.h" #include "task/task.h" +#ifndef CONFIG_BUILD_KERNEL + /**************************************************************************** * Definitions ****************************************************************************/ @@ -270,3 +272,4 @@ int kernel_thread(FAR const char *name, int priority, return thread_create(name, TCB_FLAG_TTYPE_KERNEL, priority, stack_size, entry, argv); } +#endif /* CONFIG_BUILD_KERNEL */ diff --git a/sched/task/task_spawn.c b/sched/task/task_spawn.c index eb2983bf04..9853507829 100644 --- a/sched/task/task_spawn.c +++ b/sched/task/task_spawn.c @@ -49,7 +49,7 @@ #include "task/spawn.h" #include "task/task.h" -#ifndef CONFIG_ARCH_ADDRENV +#ifndef CONFIG_BUILD_KERNEL /**************************************************************************** * Pre-processor Definitions @@ -455,4 +455,4 @@ errout_with_lock: return ret; } -#endif /* CONFIG_ARCH_ADDRENV */ +#endif /* CONFIG_BUILD_KERNEL */ diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 073f9d1d91..254464f8ee 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -42,7 +42,7 @@ "nanosleep","time.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const struct timespec *", "FAR struct timespec*" "open","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","int","..." "opendir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","FAR DIR*","FAR const char*" -"pgalloc", "nuttx/arch.h", "defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU)", "uintptr_t", "uintptr_t", "unsigned int" +"pgalloc", "nuttx/arch.h", "defined(CONFIG_BUILD_KERNEL)", "uintptr_t", "uintptr_t", "unsigned int" "pipe","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int [2]|int*" "poll","poll.h","!defined(CONFIG_DISABLE_POLL) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","FAR struct pollfd*","nfds_t","int" "prctl","sys/prctl.h", "CONFIG_TASK_NAME_SIZE > 0","int","int","..." @@ -124,7 +124,7 @@ "stat","sys/stat.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","FAR struct stat*" #"statfs","stdio.h","","int","FAR const char*","FAR struct statfs*" "statfs","sys/statfs.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","struct statfs*" -"task_create","sched.h","!defined(CONFIG_ARCH_ADDRENV)","int","FAR const char*","int","int","main_t","FAR char * const []|FAR char * const *" +"task_create","sched.h","!defined(CONFIG_BUILD_KERNEL)", "int","FAR const char*","int","int","main_t","FAR char * const []|FAR char * const *" #"task_create","sched.h","","int","const char*","int","main_t","FAR char * const []|FAR char * const *" "task_delete","sched.h","","int","pid_t" "task_restart","sched.h","","int","pid_t" diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index f4779fe2a1..ac4fd20f2e 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -65,9 +65,9 @@ SYSCALL_LOOKUP(sem_trywait, 1, STUB_sem_trywait) SYSCALL_LOOKUP(sem_unlink, 1, STUB_sem_unlink) SYSCALL_LOOKUP(sem_wait, 1, STUB_sem_wait) SYSCALL_LOOKUP(set_errno, 1, STUB_set_errno) -#ifndef CONFIG_ARCH_ADDRENV +#ifndef CONFIG_BUILD_KERNEL SYSCALL_LOOKUP(task_create, 5, STUB_task_create) -#elif defined(CONFIG_MM_PGALLOC) && defined(CONFIG_ARCH_USE_MMU) +#else SYSCALL_LOOKUP(pgalloc, 2, STUB_pgalloc) #endif SYSCALL_LOOKUP(task_delete, 1, STUB_task_delete)