diff --git a/arch/Kconfig b/arch/Kconfig index 0cb83efcf0..41b28fab59 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -154,6 +154,10 @@ config ARCH_HAVE_MMU bool default n +config ARCH_HAVE_MPU + bool + default n + config ARCH_NAND_HWECC bool default n @@ -162,6 +166,26 @@ config ARCH_HAVE_EXTCLK bool default n +config ARCH_USE_MMU + bool "Enable MMU" + default n + depends on ARCH_HAVE_MMU + ---help--- + The architecture supports supports an MMU. Enable this option in + order to enable use of the MMU. For most architectures, this is + not really an option: It is required to use the MMU. In those + cases, this selection will always be forced. + +config ARCH_USE_MPU + bool "Enable MPU" + default n + depends on ARCH_HAVE_MPU + ---help--- + The architecture supports supports an MPU. Enable this option in + order to enable use of the MPU. For most architectures, this option + is enabled by other, platform-specific logic. In those cases, this + selection will always be forced. + menuconfig ARCH_ADDRENV bool "Address environments" default n @@ -224,12 +248,12 @@ config ARCH_STACK_NPAGES This, along with knowledge of the page size, determines the size of the stack virtual address space. Default is 1. -endif # ARCH_ADDRENV && ARCH_HAVE_MMU +endif # ARCH_ADDRENV && ARCH_NEED_ADDRENV_MAPPING menuconfig PAGING bool "On-demand paging" default n - depends on ARCH_HAVE_MMU && !ARCH_ROMPGTABLE + depends on ARCH_USE_MMU && !ARCH_ROMPGTABLE ---help--- If set =y in your configation file, this setting will enable the on-demand paging feature as described in http://www.nuttx.org/NuttXDemandPaging.html. @@ -537,7 +561,7 @@ config ARCH_HIPRI_INTERRUPT int up_prioritize_irq(int irq, int priority) - NOTE: ARCH_INTERRUPTSTACK must be set in kernel mode (NUTTX_KERNEL). + NOTE: ARCH_INTERRUPTSTACK must be set in kernel mode (BUILD_KERNEL). In kernel mode without an interrupt stack, the interrupt handler will set the MSP to the stack pointer of the interrupted thread. If the interrupted thread was a privileged thread, that will be the MSP @@ -641,7 +665,7 @@ config RAM_START config RAM_VSTART hex "Primary RAM start address (virtual)" default 0x0 - depends on ARCH_HAVE_MMU + depends on ARCH_USE_MMU help The virtual start address of installed primary RAM. "Primary" RAM refers to the RAM that you link program code into. If program code @@ -657,7 +681,7 @@ config RAM_SIZE does not execute out of RAM but from FLASH, then you may designate any block of RAM as "primary." -if BOOT_RUNFROMFLASH && ARCH_HAVE_MMU +if BOOT_RUNFROMFLASH && ARCH_USE_MMU config FLASH_START hex "Boot FLASH start address (physical)" @@ -680,7 +704,7 @@ config FLASH_SIZE The size in bytes of the installed boot FLASH. "Boot" FLASH refers to the FLASH that you link program code into. -endif # BOOT_RUNFROMFLASH && ARCH_HAVE_MMU +endif # BOOT_RUNFROMFLASH && ARCH_USE_MMU config ARCH_HAVE_SDRAM bool diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 31007c7d34..fd815b85a4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -15,11 +15,12 @@ config ARCH_CHIP_A1X select ARCH_CORTEXA8 select ARCH_HAVE_FPU select ARCH_HAVE_MMU + select ARCH_USE_MMU select ARCH_HAVE_LOWVECTORS select ARCH_HAVE_SDRAM select BOOT_RUNFROMSDRAM - select ARCH_HAVE_ADDRENV if EXPERIMENTAL - select ARCH_NEED_ADDRENV_MAPPING if EXPERIMENTAL + select ARCH_HAVE_ADDRENV + select ARCH_NEED_ADDRENV_MAPPING ---help--- Allwinner A1X family: A10, A10S (A12), A13 (ARM Cortex-A8) @@ -137,8 +138,8 @@ config ARCH_CHIP_SAMA5 select ARCH_HAVE_LOWVECTORS select ARCH_HAVE_I2CRESET select ARCH_HAVE_TICKLESS - select ARCH_HAVE_ADDRENV if EXPERIMENTAL - select ARCH_NEED_ADDRENV_MAPPING if EXPERIMENTAL + select ARCH_HAVE_ADDRENV + select ARCH_NEED_ADDRENV_MAPPING ---help--- Atmel SAMA5 (ARM Cortex-A5) @@ -182,11 +183,13 @@ config ARCH_ARM926EJS bool default n select ARCH_HAVE_MMU + select ARCH_USE_MMU config ARCH_ARM920T bool default n select ARCH_HAVE_MMU + select ARCH_USE_MMU config ARCH_CORTEXM0 bool @@ -212,6 +215,7 @@ config ARCH_CORTEXA5 default n select ARCH_HAVE_IRQPRIO select ARCH_HAVE_MMU + select ARCH_USE_MMU select ARCH_HAVE_COHERENT_DCACHE if ELF config ARCH_CORTEXA8 @@ -219,6 +223,7 @@ config ARCH_CORTEXA8 default n select ARCH_HAVE_IRQPRIO select ARCH_HAVE_MMU + select ARCH_USE_MMU select ARCH_HAVE_COHERENT_DCACHE if ELF config ARCH_FAMILY @@ -288,14 +293,12 @@ config ARCH_FPU Build in support for the ARM Cortex-M4 Floating Point Unit (FPU). Check your chip specifications first; not all Cortex-M4 chips support the FPU. -config ARCH_HAVE_MPU - bool - default n - config ARMV7M_MPU bool "MPU support" - default n + default n if !ARCH_USE_MPU + default y if ARCH_USE_MPU depends on ARCH_HAVE_MPU + select ARCH_USE_MPU ---help--- Build in support for the ARM Cortex-M3/4 Memory Protection Unit (MPU). Check your chip specifications first; not all Cortex-M3/4 chips support the MPU. @@ -305,7 +308,7 @@ config ARMV7M_MPU_NREGIONS default 8 depends on ARMV7M_MPU ---help--- - This is the number of protection regions supported by the MPU. + This is the number of protection regions supported by the MPU. config ARCH_HAVE_LOWVECTORS bool @@ -320,7 +323,7 @@ config ARCH_LOWVECTORS config ARCH_ROMPGTABLE bool "ROM page table" default n - depends on ARCH_HAVE_MMU + depends on ARCH_USE_MMU ---help--- Support a fixed memory mapping use a (read-only) page table in ROM/FLASH. diff --git a/arch/arm/include/armv6-m/irq.h b/arch/arm/include/armv6-m/irq.h index be851aa938..05bff9df66 100644 --- a/arch/arm/include/armv6-m/irq.h +++ b/arch/arm/include/armv6-m/irq.h @@ -85,7 +85,7 @@ * modes. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED # define REG_EXC_RETURN (10) /* EXC_RETURN */ # define SW_XCPT_REGS (11) #else @@ -178,11 +178,11 @@ struct xcptcontext uint32_t saved_pc; uint32_t saved_primask; uint32_t saved_xpsr; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED uint32_t saved_lr; #endif -# ifdef CONFIG_NUTTX_KERNEL +# ifdef CONFIG_BUILD_PROTECTED /* This is the saved address to use when returning from a user-space * signal handler. */ diff --git a/arch/arm/include/armv7-a/irq.h b/arch/arm/include/armv7-a/irq.h index f21aba7345..3373819dfb 100755 --- a/arch/arm/include/armv7-a/irq.h +++ b/arch/arm/include/armv7-a/irq.h @@ -200,7 +200,7 @@ #ifdef CONFIG_LIB_SYSCALL struct xcpt_syscall_s { -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL uint32_t cpsr; /* The CPSR value */ #endif uint32_t sysreturn; /* The return PC */ diff --git a/arch/arm/include/armv7-m/irq.h b/arch/arm/include/armv7-m/irq.h index 818af65609..c170ff99d3 100644 --- a/arch/arm/include/armv7-m/irq.h +++ b/arch/arm/include/armv7-m/irq.h @@ -140,11 +140,11 @@ struct xcptcontext uint32_t saved_primask; #endif uint32_t saved_xpsr; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED uint32_t saved_lr; #endif -# ifdef CONFIG_NUTTX_KERNEL +# ifdef CONFIG_BUILD_PROTECTED /* This is the saved address to use when returning from a user-space * signal handler. */ diff --git a/arch/arm/include/armv7-m/irq_lazyfpu.h b/arch/arm/include/armv7-m/irq_lazyfpu.h index f2380cbb6d..e211cfbe50 100644 --- a/arch/arm/include/armv7-m/irq_lazyfpu.h +++ b/arch/arm/include/armv7-m/irq_lazyfpu.h @@ -65,7 +65,7 @@ #define REG_R10 (8) /* R10 */ #define REG_R11 (9) /* R11 */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED # define REG_EXC_RETURN (10) /* EXC_RETURN */ # define SW_INT_REGS (11) #else diff --git a/arch/arm/src/a1x/a1x_boot.c b/arch/arm/src/a1x/a1x_boot.c index 392b4744db..9750bf90d9 100644 --- a/arch/arm/src/a1x/a1x_boot.c +++ b/arch/arm/src/a1x/a1x_boot.c @@ -356,16 +356,6 @@ void up_boot(void) up_earlyserialinit(); #endif -#ifdef CONFIG_NUTTX_KERNEL - /* For the case of the separate user-/kernel-space build, perform whatever - * platform specific initialization of the user memory is required. - * Normally this just means initializing the user space .data and .bss - * segments. - */ - - a1x_userspace(); -#endif - /* Perform board-specific initialization, This must include: * * - Initialization of board-specific memory resources (e.g., SDRAM) diff --git a/arch/arm/src/arm/up_initialstate.c b/arch/arm/src/arm/up_initialstate.c index 7d8ef65b18..2ff8cedbf3 100644 --- a/arch/arm/src/arm/up_initialstate.c +++ b/arch/arm/src/arm/up_initialstate.c @@ -114,7 +114,7 @@ void up_initial_state(struct tcb_s *tcb) * what kind of thread is being started. Disable FIQs in any event */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL) { /* It is a kernel thread.. set supervisor mode */ diff --git a/arch/arm/src/armv6-m/svcall.h b/arch/arm/src/armv6-m/svcall.h index 0aaf9b7010..c3e849394e 100644 --- a/arch/arm/src/armv6-m/svcall.h +++ b/arch/arm/src/armv6-m/svcall.h @@ -53,11 +53,11 @@ /* Configuration ********************************************************************/ /* This logic uses three system calls {0,1,2} for context switching and one for the * syscall return. So a minimum of four syscall values must be reserved. If - * CONFIG_NUTTX_KERNEL is defined, then four more syscall values must be reserved. + * CONFIG_BUILD_PROTECTED is defined, then four more syscall values must be reserved. */ #ifdef CONFIG_LIB_SYSCALL -# ifdef CONFIG_NUTTX_KERNEL +# ifdef CONFIG_BUILD_PROTECTED # ifndef CONFIG_SYS_RESERVED # error "CONFIG_SYS_RESERVED must be defined to have the value 8" # elif CONFIG_SYS_RESERVED != 8 @@ -103,7 +103,7 @@ #define SYS_syscall_return (3) -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* SYS call 4: * * void up_task_start(main_t taskentry, int argc, FAR char *argv[]) @@ -135,7 +135,7 @@ #define SYS_signal_handler_return (7) -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ #endif /* CONFIG_LIB_SYSCALL */ /************************************************************************************ diff --git a/arch/arm/src/armv6-m/up_assert.c b/arch/arm/src/armv6-m/up_assert.c index 5bd9790d03..492ee730ee 100644 --- a/arch/arm/src/armv6-m/up_assert.c +++ b/arch/arm/src/armv6-m/up_assert.c @@ -160,7 +160,7 @@ static inline void up_registerdump(void) current_regs[REG_R10], current_regs[REG_R11], current_regs[REG_R12], current_regs[REG_R13], current_regs[REG_R14], current_regs[REG_R15]); -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED lldbg("xPSR: %08x PRIMASK: %08x EXEC_RETURN: %08x\n", current_regs[REG_XPSR], current_regs[REG_PRIMASK], current_regs[REG_EXC_RETURN]); diff --git a/arch/arm/src/armv6-m/up_exception.S b/arch/arm/src/armv6-m/up_exception.S index 1a04cfe278..62cb7a2d68 100644 --- a/arch/arm/src/armv6-m/up_exception.S +++ b/arch/arm/src/armv6-m/up_exception.S @@ -92,7 +92,7 @@ exception_common: * the context is on the MSP or PSP. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED mov r0, r14 /* Copy high register to low register */ lsl r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */ bmi 1f /* Test bit 31 */ @@ -129,7 +129,7 @@ exception_common: mov r3, r9 mov r4, r10 mov r5, r11 -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED mov r6, r14 stmia r0!, {r2-r6} /* Save the high registers r8-r11 and r14 */ #else @@ -200,7 +200,7 @@ exception_common: mov r2, #(4*REG_R8) /* R2=Offset to R8 storage */ add r0, r1, r2 /* R0=Address of R8 storage */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r0!, {r2-r6} /* Recover R8-R11 and R14 (5 registers)*/ mov r8, r2 /* Move to position in high registers */ mov r9, r3 @@ -227,7 +227,7 @@ exception_common: * context is on the MSP or PSP. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED mov r0, r14 /* Copy high register to low register */ lsl r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */ bmi 5f /* Test bit 31 */ diff --git a/arch/arm/src/armv6-m/up_hardfault.c b/arch/arm/src/armv6-m/up_hardfault.c index 988a4f13bd..b7bbe88144 100644 --- a/arch/arm/src/armv6-m/up_hardfault.c +++ b/arch/arm/src/armv6-m/up_hardfault.c @@ -99,7 +99,7 @@ int up_hardfault(int irq, FAR void *context) * REVISIT: What if the PC lies in "unknown" external memory? */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* In the kernel build, SVCalls are expected in either the base, kernel * FLASH region or in the user FLASH region. */ diff --git a/arch/arm/src/armv6-m/up_initialstate.c b/arch/arm/src/armv6-m/up_initialstate.c index 6dc000d125..1ee3130951 100644 --- a/arch/arm/src/armv6-m/up_initialstate.c +++ b/arch/arm/src/armv6-m/up_initialstate.c @@ -126,9 +126,9 @@ void up_initial_state(struct tcb_s *tcb) #endif #endif /* CONFIG_PIC */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* All tasks start via a stub function in kernel space. So all - * tasks must start in privileged thread mode. If CONFIG_NUTTX_KERNEL + * tasks must start in privileged thread mode. If CONFIG_BUILD_PROTECTED * is defined, then that stub function will switch to unprivileged * mode before transferring control to the user task. */ diff --git a/arch/arm/src/armv6-m/up_schedulesigaction.c b/arch/arm/src/armv6-m/up_schedulesigaction.c index e6e4314fd6..e538674b47 100644 --- a/arch/arm/src/armv6-m/up_schedulesigaction.c +++ b/arch/arm/src/armv6-m/up_schedulesigaction.c @@ -152,7 +152,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) tcb->xcp.saved_pc = current_regs[REG_PC]; tcb->xcp.saved_primask = current_regs[REG_PRIMASK]; tcb->xcp.saved_xpsr = current_regs[REG_XPSR]; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tcb->xcp.saved_lr = current_regs[REG_LR]; #endif /* Then set up to vector to the trampoline with interrupts @@ -163,7 +163,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) current_regs[REG_PC] = (uint32_t)up_sigdeliver; current_regs[REG_PRIMASK] = 1; current_regs[REG_XPSR] = ARMV6M_XPSR_T; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED current_regs[REG_LR] = EXC_RETURN_PRIVTHR; #endif /* And make sure that the saved context in the TCB is the same @@ -190,7 +190,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) tcb->xcp.saved_pc = tcb->xcp.regs[REG_PC]; tcb->xcp.saved_primask = tcb->xcp.regs[REG_PRIMASK]; tcb->xcp.saved_xpsr = tcb->xcp.regs[REG_XPSR]; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tcb->xcp.saved_lr = tcb->xcp.regs[REG_LR]; #endif @@ -202,7 +202,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver; tcb->xcp.regs[REG_PRIMASK] = 1; tcb->xcp.regs[REG_XPSR] = ARMV6M_XPSR_T; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tcb->xcp.regs[REG_LR] = EXC_RETURN_PRIVTHR; #endif } diff --git a/arch/arm/src/armv6-m/up_sigdeliver.c b/arch/arm/src/armv6-m/up_sigdeliver.c index e1e8589eaa..def3de0ac8 100644 --- a/arch/arm/src/armv6-m/up_sigdeliver.c +++ b/arch/arm/src/armv6-m/up_sigdeliver.c @@ -109,7 +109,7 @@ void up_sigdeliver(void) regs[REG_PC] = rtcb->xcp.saved_pc; regs[REG_PRIMASK] = rtcb->xcp.saved_primask; regs[REG_XPSR] = rtcb->xcp.saved_xpsr; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED regs[REG_LR] = rtcb->xcp.saved_lr; #endif diff --git a/arch/arm/src/armv6-m/up_signal_handler.S b/arch/arm/src/armv6-m/up_signal_handler.S index 559b8c6d70..f294db9fc8 100644 --- a/arch/arm/src/armv6-m/up_signal_handler.S +++ b/arch/arm/src/armv6-m/up_signal_handler.S @@ -41,7 +41,7 @@ #include -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) /**************************************************************************** * File info @@ -112,4 +112,4 @@ up_signal_handler: .size up_signal_handler, .-up_signal_handler .end -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/arch/arm/src/armv6-m/up_svcall.c b/arch/arm/src/armv6-m/up_svcall.c index b88260281b..ac5e89d7bb 100644 --- a/arch/arm/src/armv6-m/up_svcall.c +++ b/arch/arm/src/armv6-m/up_svcall.c @@ -181,7 +181,7 @@ int up_svcall(int irq, FAR void *context) svcdbg(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); -# ifdef CONFIG_NUTTX_KERNEL +# ifdef CONFIG_BUILD_PROTECTED svcdbg(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n", regs[REG_XPSR], regs[REG_PRIMASK], regs[REG_EXC_RETURN]); # else @@ -312,7 +312,7 @@ int up_svcall(int irq, FAR void *context) * R3 = argv */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED case SYS_task_start: { /* Set up to return to the user-space task start-up function in @@ -344,7 +344,7 @@ int up_svcall(int irq, FAR void *context) * R2 = arg */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { /* Set up to return to the user-space pthread start-up function in @@ -378,7 +378,7 @@ int up_svcall(int irq, FAR void *context) * ucontext (on the stack) */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS) case SYS_signal_handler: { struct tcb_s *rtcb = sched_self(); @@ -421,7 +421,7 @@ int up_svcall(int irq, FAR void *context) * R0 = SYS_signal_handler_return */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS) case SYS_signal_handler_return: { struct tcb_s *rtcb = sched_self(); @@ -497,7 +497,7 @@ int up_svcall(int irq, FAR void *context) current_regs[REG_R10], current_regs[REG_R11], current_regs[REG_R12], current_regs[REG_R13], current_regs[REG_R14], current_regs[REG_R15]); -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED svcdbg(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n", current_regs[REG_XPSR], current_regs[REG_PRIMASK], current_regs[REG_EXC_RETURN]); diff --git a/arch/arm/src/armv7-a/arm_initialstate.c b/arch/arm/src/armv7-a/arm_initialstate.c index d42062941b..74205394c0 100644 --- a/arch/arm/src/armv7-a/arm_initialstate.c +++ b/arch/arm/src/armv7-a/arm_initialstate.c @@ -114,7 +114,7 @@ void up_initial_state(struct tcb_s *tcb) * what kind of thread is being started. Disable FIQs in any event */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL) { /* It is a kernel thread.. set supervisor mode */ diff --git a/arch/arm/src/armv7-a/arm_syscall.c b/arch/arm/src/armv7-a/arm_syscall.c index 542f9c7d0e..32b122e42e 100644 --- a/arch/arm/src/armv7-a/arm_syscall.c +++ b/arch/arm/src/armv7-a/arm_syscall.c @@ -157,7 +157,7 @@ static void dispatch_syscall(void) uint32_t *arm_syscall(uint32_t *regs) { uint32_t cmd; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL uint32_t cpsr; #endif @@ -214,7 +214,7 @@ uint32_t *arm_syscall(uint32_t *regs) */ regs[REG_PC] = rtcb->xcp.syscall[index].sysreturn; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL regs[REG_CPSR] = rtcb->xcp.syscall[index].cpsr; #endif rtcb->xcp.nsyscalls = index; @@ -239,7 +239,7 @@ uint32_t *arm_syscall(uint32_t *regs) * R3 = argv */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL case SYS_task_start: { /* Set up to return to the user-space task start-up function in @@ -272,7 +272,7 @@ uint32_t *arm_syscall(uint32_t *regs) * R2 = arg */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) +#if defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { /* Set up to return to the user-space pthread start-up function in @@ -307,7 +307,7 @@ uint32_t *arm_syscall(uint32_t *regs) * ucontext (on the stack) */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) +#if defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) case SYS_signal_handler: { struct tcb_s *rtcb = sched_self(); @@ -351,7 +351,7 @@ uint32_t *arm_syscall(uint32_t *regs) * R0 = SYS_signal_handler_return */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) +#if defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) case SYS_signal_handler_return: { struct tcb_s *rtcb = sched_self(); @@ -392,13 +392,13 @@ uint32_t *arm_syscall(uint32_t *regs) /* Setup to return to dispatch_syscall in privileged mode. */ rtcb->xcp.syscall[index].sysreturn = regs[REG_PC]; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL rtcb->xcp.syscall[index].cpsr = regs[REG_CPSR]; #endif rtcb->xcp.nsyscalls = index + 1; regs[REG_PC] = (uint32_t)dispatch_syscall; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL regval = regs[REG_CPSR] & ~PSR_MODE_MASK; regs[REG_CPSR] = regval | PSR_MODE_SVC; #endif diff --git a/arch/arm/src/armv7-a/svcall.h b/arch/arm/src/armv7-a/svcall.h index 90a25fb2cf..5253e27b92 100644 --- a/arch/arm/src/armv7-a/svcall.h +++ b/arch/arm/src/armv7-a/svcall.h @@ -54,11 +54,11 @@ /* Configuration ********************************************************************/ /* This logic uses one system call for the syscall return. So a minimum of one - * syscall values must be reserved. If CONFIG_NUTTX_KERNEL is defined, then four + * syscall values must be reserved. If CONFIG_BUILD_KERNEL is defined, then four * more syscall values must be reserved. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL # ifndef CONFIG_SYS_RESERVED # error "CONFIG_SYS_RESERVED must be defined to have the value 5" # elif CONFIG_SYS_RESERVED != 5 @@ -81,7 +81,7 @@ #define SYS_syscall_return (0) -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL /* SYS call 1: * * void up_task_start(main_t taskentry, int argc, FAR char *argv[]) @@ -113,7 +113,7 @@ #define SYS_signal_handler_return (4) -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_KERNEL */ /************************************************************************************ * Inline Functions diff --git a/arch/arm/src/armv7-m/svcall.h b/arch/arm/src/armv7-m/svcall.h index dd4ef8d6c2..f905799461 100644 --- a/arch/arm/src/armv7-m/svcall.h +++ b/arch/arm/src/armv7-m/svcall.h @@ -53,11 +53,11 @@ /* Configuration ********************************************************************/ /* This logic uses three system calls {0,1,2} for context switching and one for the * syscall return. So a minimum of four syscall values must be reserved. If - * CONFIG_NUTTX_KERNEL is defined, then four more syscall values must be reserved. + * CONFIG_BUILD_PROTECTED is defined, then four more syscall values must be reserved. */ #ifdef CONFIG_LIB_SYSCALL -# ifdef CONFIG_NUTTX_KERNEL +# ifdef CONFIG_BUILD_PROTECTED # ifndef CONFIG_SYS_RESERVED # error "CONFIG_SYS_RESERVED must be defined to have the value 8" # elif CONFIG_SYS_RESERVED != 8 @@ -103,7 +103,7 @@ #define SYS_syscall_return (3) -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* SYS call 4: * * void up_task_start(main_t taskentry, int argc, FAR char *argv[]) @@ -135,7 +135,7 @@ #define SYS_signal_handler_return (7) -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ #endif /* CONFIG_LIB_SYSCALL */ /************************************************************************************ diff --git a/arch/arm/src/armv7-m/up_exception.S b/arch/arm/src/armv7-m/up_exception.S index 517525415b..88f5fe2d60 100644 --- a/arch/arm/src/armv7-m/up_exception.S +++ b/arch/arm/src/armv7-m/up_exception.S @@ -66,7 +66,7 @@ * no privileged task has run. */ -# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 +# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4 # error Interrupt stack must be used with high priority interrupts in kernel mode # endif @@ -259,7 +259,7 @@ exception_common: /* The EXC_RETURN value tells us whether we are returning on the MSP or PSP */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/arch/arm/src/armv7-m/up_hardfault.c b/arch/arm/src/armv7-m/up_hardfault.c index 732c2ca0ea..7af0fe551e 100644 --- a/arch/arm/src/armv7-m/up_hardfault.c +++ b/arch/arm/src/armv7-m/up_hardfault.c @@ -108,7 +108,7 @@ int up_hardfault(int irq, FAR void *context) * use the BASEPRI register if you have external memory. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* In the kernel build, SVCalls are expected in either the base, kernel * FLASH region or in the user FLASH region. */ diff --git a/arch/arm/src/armv7-m/up_initialstate.c b/arch/arm/src/armv7-m/up_initialstate.c index e7f7ef7fdb..d4c625b86f 100644 --- a/arch/arm/src/armv7-m/up_initialstate.c +++ b/arch/arm/src/armv7-m/up_initialstate.c @@ -126,16 +126,16 @@ void up_initial_state(struct tcb_s *tcb) #endif #endif /* CONFIG_PIC */ -#if defined(CONFIG_ARMV7M_CMNVECTOR) || defined(CONFIG_NUTTX_KERNEL) +#if defined(CONFIG_ARMV7M_CMNVECTOR) || defined(CONFIG_BUILD_PROTECTED) /* All tasks start via a stub function in kernel space. So all - * tasks must start in privileged thread mode. If CONFIG_NUTTX_KERNEL + * tasks must start in privileged thread mode. If CONFIG_BUILD_PROTECTED * is defined, then that stub function will switch to unprivileged * mode before transferring control to the user task. */ xcp->regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR; -#endif /* CONFIG_ARMV7M_CMNVECTOR || CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_ARMV7M_CMNVECTOR || CONFIG_BUILD_PROTECTED */ #if defined(CONFIG_ARMV7M_CMNVECTOR) && defined(CONFIG_ARCH_FPU) diff --git a/arch/arm/src/armv7-m/up_schedulesigaction.c b/arch/arm/src/armv7-m/up_schedulesigaction.c index 8110ef2dac..d61420a73d 100644 --- a/arch/arm/src/armv7-m/up_schedulesigaction.c +++ b/arch/arm/src/armv7-m/up_schedulesigaction.c @@ -157,7 +157,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) tcb->xcp.saved_primask = current_regs[REG_PRIMASK]; #endif tcb->xcp.saved_xpsr = current_regs[REG_XPSR]; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tcb->xcp.saved_lr = current_regs[REG_LR]; #endif /* Then set up to vector to the trampoline with interrupts @@ -172,7 +172,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) current_regs[REG_PRIMASK] = 1; #endif current_regs[REG_XPSR] = ARMV7M_XPSR_T; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED current_regs[REG_LR] = EXC_RETURN_PRIVTHR; #endif /* And make sure that the saved context in the TCB is the same @@ -203,7 +203,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) tcb->xcp.saved_primask = tcb->xcp.regs[REG_PRIMASK]; #endif tcb->xcp.saved_xpsr = tcb->xcp.regs[REG_XPSR]; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tcb->xcp.saved_lr = tcb->xcp.regs[REG_LR]; #endif /* Then set up to vector to the trampoline with interrupts @@ -218,7 +218,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) tcb->xcp.regs[REG_PRIMASK] = 1; #endif tcb->xcp.regs[REG_XPSR] = ARMV7M_XPSR_T; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tcb->xcp.regs[REG_LR] = EXC_RETURN_PRIVTHR; #endif } diff --git a/arch/arm/src/armv7-m/up_sigdeliver.c b/arch/arm/src/armv7-m/up_sigdeliver.c index 4fbfc02c5d..c65f3cf0a6 100644 --- a/arch/arm/src/armv7-m/up_sigdeliver.c +++ b/arch/arm/src/armv7-m/up_sigdeliver.c @@ -108,7 +108,7 @@ void up_sigdeliver(void) regs[REG_PRIMASK] = rtcb->xcp.saved_primask; #endif regs[REG_XPSR] = rtcb->xcp.saved_xpsr; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED regs[REG_LR] = rtcb->xcp.saved_lr; #endif diff --git a/arch/arm/src/armv7-m/up_signal_handler.S b/arch/arm/src/armv7-m/up_signal_handler.S index f19dcdaa76..38a0bd35d3 100644 --- a/arch/arm/src/armv7-m/up_signal_handler.S +++ b/arch/arm/src/armv7-m/up_signal_handler.S @@ -41,7 +41,7 @@ #include -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) /**************************************************************************** * File info @@ -115,4 +115,4 @@ up_signal_handler: .size up_signal_handler, .-up_signal_handler .end -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/arch/arm/src/armv7-m/up_svcall.c b/arch/arm/src/armv7-m/up_svcall.c index 4a87401c15..80d07b4e50 100644 --- a/arch/arm/src/armv7-m/up_svcall.c +++ b/arch/arm/src/armv7-m/up_svcall.c @@ -311,7 +311,7 @@ int up_svcall(int irq, FAR void *context) * R3 = argv */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED case SYS_task_start: { /* Set up to return to the user-space task start-up function in @@ -343,7 +343,7 @@ int up_svcall(int irq, FAR void *context) * R2 = arg */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { /* Set up to return to the user-space pthread start-up function in @@ -377,7 +377,7 @@ int up_svcall(int irq, FAR void *context) * ucontext (on the stack) */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS) case SYS_signal_handler: { struct tcb_s *rtcb = sched_self(); @@ -420,7 +420,7 @@ int up_svcall(int irq, FAR void *context) * R0 = SYS_signal_handler_return */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS) case SYS_signal_handler_return: { struct tcb_s *rtcb = sched_self(); diff --git a/arch/arm/src/common/up_allocateheap.c b/arch/arm/src/common/up_allocateheap.c index a5c1a068c6..f312ae0675 100644 --- a/arch/arm/src/common/up_allocateheap.c +++ b/arch/arm/src/common/up_allocateheap.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_allocateheap.c * - * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,13 @@ /**************************************************************************** * Private Definitions ****************************************************************************/ +/* Configuration */ + +#undef HAVE_KERNEL_HEAP +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) +# define HAVE_KERNEL_HEAP 1 +#endif /**************************************************************************** * Private Data @@ -74,9 +81,9 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and - * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the - * size of the unprotected, user-space heap. + * For the kernel build (CONFIG_BUILD_KERNEL/PROTECTED=y) with both kernel- + * and user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides + * the size of the unprotected, user-space heap. * * If a protected kernel-space heap is provided, the kernel heap must be * allocated by an analogous up_allocate_kheap(). A custom version of this @@ -104,7 +111,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#ifdef HAVE_KERNEL_HEAP /* Get the unaligned size and position of the user-space heap. * This heap begins after the user-space .bss section at an offset * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). @@ -134,14 +141,14 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) * Name: up_allocate_kheap * * Description: - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and - * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates + * For the kernel build (CONFIG_BUILD_PROTECTED/KERNEL=y) with both kernel- + * and user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * the kernel-space heap. A custom version of this function is need if * memory protection of the kernel heap is required. * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#ifdef HAVE_KERNEL_HEAP void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) { /* Get the unaligned size and position of the user-space heap. diff --git a/arch/arm/src/common/up_createstack.c b/arch/arm/src/common/up_createstack.c index 44d6ce8628..38170e2289 100644 --- a/arch/arm/src/common/up_createstack.c +++ b/arch/arm/src/common/up_createstack.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_createstack.c * - * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -54,6 +54,13 @@ /**************************************************************************** * Pre-processor Macros ****************************************************************************/ +/* Configuration */ + +#undef HAVE_KERNEL_HEAP +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) +# define HAVE_KERNEL_HEAP 1 +#endif /* ARM requires at least a 4-byte stack alignment. For use with EABI and * floating point, the stack must be aligned to 8-byte addresses. @@ -120,10 +127,11 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect - * how the stack is allocated. For example, kernel thread stacks should - * be allocated from protected kernel memory. Stacks for user tasks and - * threads must come from memory that is accessible to user code. + * If either CONFIG_BUILD_PROTECTED or CONFIG_BUILD_KERNEL are defined, + * then this thread type may affect how the stack is allocated. For + * example, kernel thread stacks should be allocated from protected + * kernel memory. Stacks for user tasks and threads must come from + * memory that is accessible to user code. * ****************************************************************************/ @@ -149,7 +157,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * then create a zeroed stack to make stack dumps easier to trace. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#ifdef HAVE_KERNEL_HEAP /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/arm/src/common/up_pthread_start.c b/arch/arm/src/common/up_pthread_start.c index 2f9de8995a..31ccb80c1f 100644 --- a/arch/arm/src/common/up_pthread_start.c +++ b/arch/arm/src/common/up_pthread_start.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_pthread_start.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,7 +44,9 @@ #include "svcall.h" #include "up_internal.h" -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_PTHREAD) +#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) || \ + defined(defined(CONFIG_BUILD_KERNEL)) && \ + !defined(CONFIG_DISABLE_PTHREAD) /**************************************************************************** * Pre-processor Definitions @@ -93,4 +95,4 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) sys_call2(SYS_pthread_start, (uintptr_t)entrypt, (uintptr_t)arg); } -#endif /* CONFIG_NUTTX_KERNEL &&& __KERNEL__ && !CONFIG_DISABLE_PTHREAD */ +#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ diff --git a/arch/arm/src/common/up_releasestack.c b/arch/arm/src/common/up_releasestack.c index 9668ec245d..d7abec71ac 100644 --- a/arch/arm/src/common/up_releasestack.c +++ b/arch/arm/src/common/up_releasestack.c @@ -47,6 +47,17 @@ #include "up_internal.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Configuration */ + +#undef HAVE_KERNEL_HEAP +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) +# define HAVE_KERNEL_HEAP 1 +#endif + /**************************************************************************** * Private Types ****************************************************************************/ @@ -79,11 +90,11 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect - * how the stack is freed. For example, kernel thread stacks may have - * been allocated from protected kernel memory. Stacks for user tasks - * and threads must have come from memory that is accessible to user - * code. + * If either CONFIG_BUILD_PROTECTED or CONFIG_BUILD_KERNEL are defined, + * then this thread type may affect how the stack is freed. For example, + * kernel thread stacks may have been allocated from protected kernel + * memory. Stacks for user tasks and threads must have come from memory + * that is accessible to user code. * * Returned Value: * None @@ -96,7 +107,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#ifdef HAVE_KERNEL_HEAP /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/arm/src/common/up_signal_dispatch.c b/arch/arm/src/common/up_signal_dispatch.c index d46b779283..75725237f6 100644 --- a/arch/arm/src/common/up_signal_dispatch.c +++ b/arch/arm/src/common/up_signal_dispatch.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_signal_dispatch.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,9 @@ #include "svcall.h" #include "up_internal.h" -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_SIGNALS) +#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) || \ + defined(defined(CONFIG_BUILD_KERNEL)) && \ + !defined(CONFIG_DISABLE_SIGNALS) /**************************************************************************** * Pre-processor Definitions @@ -99,4 +101,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo, (uintptr_t)info, (uintptr_t)ucontext); } -#endif /* CONFIG_NUTTX_KERNEL && __KERNEL__ && !CONFIG_DISABLE_SIGNALS */ +#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ diff --git a/arch/arm/src/common/up_task_start.c b/arch/arm/src/common/up_task_start.c index 0a3f3c4a48..c840a19dc7 100644 --- a/arch/arm/src/common/up_task_start.c +++ b/arch/arm/src/common/up_task_start.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/common/up_task_start.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ #include "svcall.h" #include "up_internal.h" -#ifdef CONFIG_NUTTX_KERNEL +#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) /**************************************************************************** * Pre-processor Definitions @@ -94,4 +94,4 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[]) (uintptr_t)argv); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */ diff --git a/arch/arm/src/dm320/dm320_allocateheap.c b/arch/arm/src/dm320/dm320_allocateheap.c index 1ccffe3bba..509d08fede 100644 --- a/arch/arm/src/dm320/dm320_allocateheap.c +++ b/arch/arm/src/dm320/dm320_allocateheap.c @@ -71,7 +71,7 @@ * This function will be called to dynamically set aside * the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both * kernel- and user-space heaps (CONFIG_MM_KERNEL_HEAP=y), * this function provides the size of the unprotected, * user-space heap. diff --git a/arch/arm/src/imx/imx_allocateheap.c b/arch/arm/src/imx/imx_allocateheap.c index 266e743f87..93c0f48c0e 100644 --- a/arch/arm/src/imx/imx_allocateheap.c +++ b/arch/arm/src/imx/imx_allocateheap.c @@ -74,7 +74,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * diff --git a/arch/arm/src/kinetis/Make.defs b/arch/arm/src/kinetis/Make.defs index 6f0de05948..4e5689d271 100644 --- a/arch/arm/src/kinetis/Make.defs +++ b/arch/arm/src/kinetis/Make.defs @@ -58,7 +58,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -91,7 +91,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += kinetis_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += kinetis_userspace.c kinetis_mpuinit.c endif diff --git a/arch/arm/src/kinetis/kinetis_allocateheap.c b/arch/arm/src/kinetis/kinetis_allocateheap.c index fab0b3cb51..a03b132223 100644 --- a/arch/arm/src/kinetis/kinetis_allocateheap.c +++ b/arch/arm/src/kinetis/kinetis_allocateheap.c @@ -76,7 +76,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * @@ -105,7 +105,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) /* Get the unaligned size and position of the user-space heap. * This heap begins after the user-space .bss section at an offset * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). @@ -151,13 +151,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) * Name: up_allocate_kheap * * Description: - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * (and protects) the kernel-space heap. * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) { /* Get the unaligned size and position of the user-space heap. diff --git a/arch/arm/src/kinetis/kinetis_mpuinit.c b/arch/arm/src/kinetis/kinetis_mpuinit.c index bd81374ff8..07ea72229e 100644 --- a/arch/arm/src/kinetis/kinetis_mpuinit.c +++ b/arch/arm/src/kinetis/kinetis_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.h" #include "kinetis_mpuinit.h" -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU) /**************************************************************************** * Private Definitions @@ -120,5 +120,5 @@ void kinetis_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/arch/arm/src/kinetis/kinetis_mpuinit.h b/arch/arm/src/kinetis/kinetis_mpuinit.h index 1e88b67a23..f3cf95370e 100644 --- a/arch/arm/src/kinetis/kinetis_mpuinit.h +++ b/arch/arm/src/kinetis/kinetis_mpuinit.h @@ -67,7 +67,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void kinetis_mpuinitialize(void); #else # define kinetis_mpuinitialize() @@ -81,7 +81,7 @@ void kinetis_mpuinitialize(void); * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void kinetis_mpu_uheap(uintptr_t start, size_t size); #else # define kinetis_mpu_uheap(start,size) diff --git a/arch/arm/src/kinetis/kinetis_start.c b/arch/arm/src/kinetis/kinetis_start.c index b611709a64..1d463ec2eb 100644 --- a/arch/arm/src/kinetis/kinetis_start.c +++ b/arch/arm/src/kinetis/kinetis_start.c @@ -146,7 +146,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED kinetis_userspace(); #endif diff --git a/arch/arm/src/kinetis/kinetis_userspace.c b/arch/arm/src/kinetis/kinetis_userspace.c index d0d57145db..4fc37a0904 100644 --- a/arch/arm/src/kinetis/kinetis_userspace.c +++ b/arch/arm/src/kinetis/kinetis_userspace.c @@ -47,7 +47,7 @@ #include "kinetis_mpuinit.h" #include "kinetis_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -115,5 +115,5 @@ void kinetis_userspace(void) kinetis_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/arch/arm/src/kinetis/kinetis_userspace.h b/arch/arm/src/kinetis/kinetis_userspace.h index ecad3b6091..39b4b6ef54 100644 --- a/arch/arm/src/kinetis/kinetis_userspace.h +++ b/arch/arm/src/kinetis/kinetis_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void kinetis_userspace(void); #endif diff --git a/arch/arm/src/kinetis/kinetis_vectors.S b/arch/arm/src/kinetis/kinetis_vectors.S index 8ba6db658d..ed0ba52a13 100644 --- a/arch/arm/src/kinetis/kinetis_vectors.S +++ b/arch/arm/src/kinetis/kinetis_vectors.S @@ -63,7 +63,7 @@ * nested interrupt, the interrupt stack if no privileged task has run. */ -# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 +# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4 # error Interrupt stack must be used with high priority interrupts in kernel mode # endif @@ -621,7 +621,7 @@ exception_common: /* Complete the context save */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) @@ -663,7 +663,7 @@ exception_common: * r14=register values. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */ @@ -751,7 +751,7 @@ exception_common: ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -766,7 +766,7 @@ exception_common: */ 2: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -791,7 +791,7 @@ exception_common: 3: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/arch/arm/src/kl/Make.defs b/arch/arm/src/kl/Make.defs index 9fc5bcd08d..12162fde0b 100644 --- a/arch/arm/src/kl/Make.defs +++ b/arch/arm/src/kl/Make.defs @@ -47,7 +47,7 @@ CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_systemreset.c CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c CMN_CSRCS += up_svcall.c up_vectors.c up_vfork.c -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_task_start.c up_pthread_start.c up_stackframe.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -75,7 +75,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += kl_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += kl_userspace.c endif diff --git a/arch/arm/src/kl/kl_start.c b/arch/arm/src/kl/kl_start.c index 79d1ec1600..c87f65b7c3 100644 --- a/arch/arm/src/kl/kl_start.c +++ b/arch/arm/src/kl/kl_start.c @@ -162,7 +162,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED kl_userspace(); showprogress('E'); #endif diff --git a/arch/arm/src/kl/kl_userspace.c b/arch/arm/src/kl/kl_userspace.c index 8949a90d2b..d66bfe2e45 100644 --- a/arch/arm/src/kl/kl_userspace.c +++ b/arch/arm/src/kl/kl_userspace.c @@ -46,7 +46,7 @@ #include "kl_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -110,5 +110,5 @@ void kl_userspace(void) } } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/arch/arm/src/kl/kl_userspace.h b/arch/arm/src/kl/kl_userspace.h index c92dfe2b02..a87af46f7e 100644 --- a/arch/arm/src/kl/kl_userspace.h +++ b/arch/arm/src/kl/kl_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void kl_userspace(void); #endif diff --git a/arch/arm/src/lpc17xx/Make.defs b/arch/arm/src/lpc17xx/Make.defs index 19114864bc..539e5de71e 100644 --- a/arch/arm/src/lpc17xx/Make.defs +++ b/arch/arm/src/lpc17xx/Make.defs @@ -70,7 +70,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -113,7 +113,7 @@ ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y) CHIP_ASRCS += lpc17_vectors.S endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += lpc17_userspace.c lpc17_mpuinit.c endif diff --git a/arch/arm/src/lpc17xx/lpc17_allocateheap.c b/arch/arm/src/lpc17xx/lpc17_allocateheap.c index cc84be3526..e5116a96a1 100644 --- a/arch/arm/src/lpc17xx/lpc17_allocateheap.c +++ b/arch/arm/src/lpc17xx/lpc17_allocateheap.c @@ -186,7 +186,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * @@ -215,7 +215,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) /* Get the unaligned size and position of the user-space heap. * This heap begins after the user-space .bss section at an offset * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). @@ -261,13 +261,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) * Name: up_allocate_kheap * * Description: - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * (and protects) the kernel-space heap. * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) { /* Get the unaligned size and position of the user-space heap. @@ -326,7 +326,7 @@ void up_addregion(void) */ #ifdef LPC17_AHB_HEAPBASE -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) /* Yes.. allow user-mode access to the AHB SRAM user heap memory */ diff --git a/arch/arm/src/lpc17xx/lpc17_mpuinit.c b/arch/arm/src/lpc17xx/lpc17_mpuinit.c index 046f6e7033..c8ccee51fc 100644 --- a/arch/arm/src/lpc17xx/lpc17_mpuinit.c +++ b/arch/arm/src/lpc17xx/lpc17_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.h" #include "lpc17_mpuinit.h" -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU) /**************************************************************************** * Private Definitions @@ -120,5 +120,5 @@ void lpc17_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/arch/arm/src/lpc17xx/lpc17_mpuinit.h b/arch/arm/src/lpc17xx/lpc17_mpuinit.h index 4d0e6944ff..145789532d 100644 --- a/arch/arm/src/lpc17xx/lpc17_mpuinit.h +++ b/arch/arm/src/lpc17xx/lpc17_mpuinit.h @@ -67,7 +67,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void lpc17_mpuinitialize(void); #else # define lpc17_mpuinitialize() @@ -81,7 +81,7 @@ void lpc17_mpuinitialize(void); * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void lpc17_mpu_uheap(uintptr_t start, size_t size); #else # define lpc17_mpu_uheap(start,size) diff --git a/arch/arm/src/lpc17xx/lpc17_start.c b/arch/arm/src/lpc17xx/lpc17_start.c index 80f136f11b..2cfb16f397 100644 --- a/arch/arm/src/lpc17xx/lpc17_start.c +++ b/arch/arm/src/lpc17xx/lpc17_start.c @@ -239,7 +239,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED lpc17_userspace(); showprogress('E'); #endif diff --git a/arch/arm/src/lpc17xx/lpc17_userspace.c b/arch/arm/src/lpc17xx/lpc17_userspace.c index 8a2d23dde0..3e8f4e7744 100644 --- a/arch/arm/src/lpc17xx/lpc17_userspace.c +++ b/arch/arm/src/lpc17xx/lpc17_userspace.c @@ -47,7 +47,7 @@ #include "lpc17_mpuinit.h" #include "lpc17_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -115,5 +115,5 @@ void lpc17_userspace(void) lpc17_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/arch/arm/src/lpc17xx/lpc17_userspace.h b/arch/arm/src/lpc17xx/lpc17_userspace.h index 880e52eda7..5adb8771cb 100644 --- a/arch/arm/src/lpc17xx/lpc17_userspace.h +++ b/arch/arm/src/lpc17xx/lpc17_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void lpc17_userspace(void); #endif diff --git a/arch/arm/src/lpc17xx/lpc17_vectors.S b/arch/arm/src/lpc17xx/lpc17_vectors.S index 9e54b30486..555bf0ddca 100644 --- a/arch/arm/src/lpc17xx/lpc17_vectors.S +++ b/arch/arm/src/lpc17xx/lpc17_vectors.S @@ -64,7 +64,7 @@ * nested interrupt, the interrupt stack if no privileged task has run. */ -# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 +# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4 # error Interrupt stack must be used with high priority interrupts in kernel mode # endif @@ -233,7 +233,7 @@ exception_common: /* Complete the context save */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) @@ -275,7 +275,7 @@ exception_common: * r14=register values. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */ @@ -363,7 +363,7 @@ exception_common: ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -378,7 +378,7 @@ exception_common: */ 2: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -403,7 +403,7 @@ exception_common: 3: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/arch/arm/src/lpc31xx/lpc31_allocateheap.c b/arch/arm/src/lpc31xx/lpc31_allocateheap.c index 6606f5a805..4c2c262b16 100644 --- a/arch/arm/src/lpc31xx/lpc31_allocateheap.c +++ b/arch/arm/src/lpc31xx/lpc31_allocateheap.c @@ -159,7 +159,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * diff --git a/arch/arm/src/lpc43xx/Make.defs b/arch/arm/src/lpc43xx/Make.defs index 9b4053b3b9..04793d7b1f 100644 --- a/arch/arm/src/lpc43xx/Make.defs +++ b/arch/arm/src/lpc43xx/Make.defs @@ -59,7 +59,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -91,7 +91,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += lpc43_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += lpc43_userspace.c lpc43_mpuinit.c endif diff --git a/arch/arm/src/lpc43xx/lpc43_allocateheap.c b/arch/arm/src/lpc43xx/lpc43_allocateheap.c index 0dd84e1aeb..93cbe2acc3 100644 --- a/arch/arm/src/lpc43xx/lpc43_allocateheap.c +++ b/arch/arm/src/lpc43xx/lpc43_allocateheap.c @@ -234,7 +234,7 @@ const uint32_t g_idle_topstack = (uint32_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE; * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * diff --git a/arch/arm/src/lpc43xx/lpc43_mpuinit.c b/arch/arm/src/lpc43xx/lpc43_mpuinit.c index 02e8fb04ed..c9a20b55ac 100644 --- a/arch/arm/src/lpc43xx/lpc43_mpuinit.c +++ b/arch/arm/src/lpc43xx/lpc43_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.h" #include "lpc43_mpuinit.h" -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU) /**************************************************************************** * Private Definitions @@ -120,5 +120,5 @@ void lpc43_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/arch/arm/src/lpc43xx/lpc43_mpuinit.h b/arch/arm/src/lpc43xx/lpc43_mpuinit.h index 1759e0dcd3..f4c6c59ca3 100644 --- a/arch/arm/src/lpc43xx/lpc43_mpuinit.h +++ b/arch/arm/src/lpc43xx/lpc43_mpuinit.h @@ -67,7 +67,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void lpc43_mpuinitialize(void); #else # define lpc43_mpuinitialize() @@ -81,7 +81,7 @@ void lpc43_mpuinitialize(void); * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void lpc43_mpu_uheap(uintptr_t start, size_t size); #else # define lpc43_mpu_uheap(start,size) diff --git a/arch/arm/src/lpc43xx/lpc43_start.c b/arch/arm/src/lpc43xx/lpc43_start.c index 19756c7549..f07811eb59 100644 --- a/arch/arm/src/lpc43xx/lpc43_start.c +++ b/arch/arm/src/lpc43xx/lpc43_start.c @@ -339,7 +339,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED lpc43_userspace(); showprogress('F'); #endif diff --git a/arch/arm/src/lpc43xx/lpc43_userspace.c b/arch/arm/src/lpc43xx/lpc43_userspace.c index 7bc7f1c252..822381b249 100644 --- a/arch/arm/src/lpc43xx/lpc43_userspace.c +++ b/arch/arm/src/lpc43xx/lpc43_userspace.c @@ -47,7 +47,7 @@ #include "lpc43_mpuinit.h" #include "lpc43_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -115,5 +115,5 @@ void lpc43_userspace(void) lpc43_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/arch/arm/src/lpc43xx/lpc43_userspace.h b/arch/arm/src/lpc43xx/lpc43_userspace.h index f7632388f2..77b6d1e609 100644 --- a/arch/arm/src/lpc43xx/lpc43_userspace.h +++ b/arch/arm/src/lpc43xx/lpc43_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void lpc43_userspace(void); #endif diff --git a/arch/arm/src/nuc1xx/Make.defs b/arch/arm/src/nuc1xx/Make.defs index c8cfdf0a39..6161b49288 100644 --- a/arch/arm/src/nuc1xx/Make.defs +++ b/arch/arm/src/nuc1xx/Make.defs @@ -47,7 +47,7 @@ CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_systemreset.c CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c CMN_CSRCS += up_svcall.c up_vectors.c up_vfork.c -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_task_start.c up_pthread_start.c up_stackframe.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -75,7 +75,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += nuc_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += nuc_userspace.c endif diff --git a/arch/arm/src/nuc1xx/nuc_start.c b/arch/arm/src/nuc1xx/nuc_start.c index aeb0f4e6e0..e7cf1b4b1f 100644 --- a/arch/arm/src/nuc1xx/nuc_start.c +++ b/arch/arm/src/nuc1xx/nuc_start.c @@ -156,7 +156,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED nuc_userspace(); showprogress('E'); #endif diff --git a/arch/arm/src/nuc1xx/nuc_userspace.c b/arch/arm/src/nuc1xx/nuc_userspace.c index 88a50695cd..2ace6184b7 100644 --- a/arch/arm/src/nuc1xx/nuc_userspace.c +++ b/arch/arm/src/nuc1xx/nuc_userspace.c @@ -46,7 +46,7 @@ #include "nuc_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -110,5 +110,5 @@ void nuc_userspace(void) } } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/arch/arm/src/nuc1xx/nuc_userspace.h b/arch/arm/src/nuc1xx/nuc_userspace.h index 9123ce8e1f..e648c04e7a 100644 --- a/arch/arm/src/nuc1xx/nuc_userspace.h +++ b/arch/arm/src/nuc1xx/nuc_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void nuc_userspace(void); #endif diff --git a/arch/arm/src/sam34/Make.defs b/arch/arm/src/sam34/Make.defs index 607b08fd64..ec7d10b3ae 100644 --- a/arch/arm/src/sam34/Make.defs +++ b/arch/arm/src/sam34/Make.defs @@ -62,7 +62,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -104,7 +104,7 @@ else CHIP_CSRCS += sam_clockconfig.c sam_gpio.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += sam_userspace.c sam_mpuinit.c endif diff --git a/arch/arm/src/sam34/sam_allocateheap.c b/arch/arm/src/sam34/sam_allocateheap.c index a868b419d9..dc468ed0d1 100644 --- a/arch/arm/src/sam34/sam_allocateheap.c +++ b/arch/arm/src/sam34/sam_allocateheap.c @@ -175,7 +175,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * @@ -204,7 +204,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) /* Get the unaligned size and position of the user-space heap. * This heap begins after the user-space .bss section at an offset * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). @@ -250,13 +250,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) * Name: up_allocate_kheap * * Description: - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * (and protects) the kernel-space heap. * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) { /* Get the unaligned size and position of the user-space heap. diff --git a/arch/arm/src/sam34/sam_mpuinit.c b/arch/arm/src/sam34/sam_mpuinit.c index 3b49f9d971..ec2366a8e7 100644 --- a/arch/arm/src/sam34/sam_mpuinit.c +++ b/arch/arm/src/sam34/sam_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.h" #include "sam_mpuinit.h" -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU) /**************************************************************************** * Private Definitions @@ -120,5 +120,5 @@ void sam_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/arch/arm/src/sam34/sam_mpuinit.h b/arch/arm/src/sam34/sam_mpuinit.h index d047447acb..cedc3c8ef2 100644 --- a/arch/arm/src/sam34/sam_mpuinit.h +++ b/arch/arm/src/sam34/sam_mpuinit.h @@ -85,7 +85,7 @@ extern "C" * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void sam_mpuinitialize(void); #else # define sam_mpuinitialize() @@ -99,7 +99,7 @@ void sam_mpuinitialize(void); * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void sam_mpu_uheap(uintptr_t start, size_t size); #else # define sam_mpu_uheap(start,size) diff --git a/arch/arm/src/sam34/sam_start.c b/arch/arm/src/sam34/sam_start.c index 24857d9ce8..0a51927a54 100644 --- a/arch/arm/src/sam34/sam_start.c +++ b/arch/arm/src/sam34/sam_start.c @@ -154,7 +154,7 @@ void __start(void) * segements. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED sam_userspace(); showprogress('C'); #endif diff --git a/arch/arm/src/sam34/sam_userspace.c b/arch/arm/src/sam34/sam_userspace.c index fc266fe8f9..d61e07d0f3 100644 --- a/arch/arm/src/sam34/sam_userspace.c +++ b/arch/arm/src/sam34/sam_userspace.c @@ -47,7 +47,7 @@ #include "sam_mpuinit.h" #include "sam_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Private Definitions @@ -115,5 +115,5 @@ void sam_userspace(void) sam_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/arch/arm/src/sam34/sam_userspace.h b/arch/arm/src/sam34/sam_userspace.h index b245775893..57ce401d35 100644 --- a/arch/arm/src/sam34/sam_userspace.h +++ b/arch/arm/src/sam34/sam_userspace.h @@ -92,7 +92,7 @@ extern "C" * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void sam_userspace(void); #endif diff --git a/arch/arm/src/sam34/sam_vectors.S b/arch/arm/src/sam34/sam_vectors.S index 10cbd82f38..51524be860 100644 --- a/arch/arm/src/sam34/sam_vectors.S +++ b/arch/arm/src/sam34/sam_vectors.S @@ -62,7 +62,7 @@ * nested interrupt, the interrupt stack if no privileged task has run. */ -# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 +# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4 # error Interrupt stack must be used with high priority interrupts in kernel mode # endif @@ -246,7 +246,7 @@ exception_common: /* Complete the context save */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) @@ -288,7 +288,7 @@ exception_common: * r14=register values. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */ @@ -376,7 +376,7 @@ exception_common: ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -391,7 +391,7 @@ exception_common: */ 2: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -416,7 +416,7 @@ exception_common: 3: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/arch/arm/src/sama5/sam_allocateheap.c b/arch/arm/src/sama5/sam_allocateheap.c index 3a4113fded..44c32fcd4e 100644 --- a/arch/arm/src/sama5/sam_allocateheap.c +++ b/arch/arm/src/sama5/sam_allocateheap.c @@ -46,7 +46,6 @@ #include #include -#include #include @@ -219,7 +218,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * @@ -249,7 +248,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Get the unaligned size and position of the user-space heap. * This heap begins after the user-space .bss section at an offset * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). @@ -291,14 +290,14 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) * Name: up_allocate_kheap * * Description: - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * the kernel-space heap. A custom version of this function is need if * memory protection of the kernel heap is required. * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) { /* Get the unaligned size and position of the user-space heap. @@ -341,7 +340,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_ISRAM0_VADDR size = SAM_ISRAM0_SIZE + SAM_ISRAM1_SIZE; -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Allow user-mode access to the ISRAM heap */ sam_uheap(vaddr, size); @@ -360,7 +359,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_DDRCS_VSECTION + SAMA5_DDRCS_HEAP_OFFSET; size = SAMA5_DDRCS_HEAP_SIZE; -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Allow user-mode access to the DDR-SDRAM heap */ sam_uheap(vaddr, size); @@ -385,7 +384,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_EBICS0_VSECTION + SAMA5_EBICS0_HEAP_OFFSET; size = SAMA5_EBICS0_HEAP_SIZE; -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Allow user-mode access to the EBICS0 heap */ sam_uheap(vaddr, size); @@ -410,7 +409,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_EBICS1_VSECTION + SAMA5_EBICS1_HEAP_OFFSET; size = SAMA5_EBICS1_HEAP_SIZE; -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Allow user-mode access to the EBICS1 heap */ sam_uheap(vaddr, size); @@ -435,7 +434,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_EBICS2_VSECTION + SAMA5_EBICS2_HEAP_OFFSET; size = SAMA5_EBICS2_HEAP_SIZE; -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Allow user-mode access to the EBICS2 heap */ sam_uheap(vaddr, size); @@ -460,7 +459,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_EBICS3_VSECTION + SAMA5_EBICS3_HEAP_OFFSET; size = SAMA5_EBICS3_HEAP_SIZE; -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Allow user-mode access to the EBICS3 heap */ sam_uheap(vaddr, size); diff --git a/arch/arm/src/sama5/sam_boot.c b/arch/arm/src/sama5/sam_boot.c index 37f3c4ba5c..32d51a9e88 100644 --- a/arch/arm/src/sama5/sam_boot.c +++ b/arch/arm/src/sama5/sam_boot.c @@ -782,14 +782,4 @@ void up_boot(void) sam_earlyserialinit(); #endif - -#ifdef CONFIG_NUTTX_KERNEL - /* For the case of the separate user-/kernel-space build, perform whatever - * platform specific initialization of the user memory is required. - * Normally this just means initializing the user space .data and .bss - * segments. - */ - - sam_userspace(); -#endif } diff --git a/arch/arm/src/samd/Make.defs b/arch/arm/src/samd/Make.defs index 3087578814..1cc4b2f4df 100644 --- a/arch/arm/src/samd/Make.defs +++ b/arch/arm/src/samd/Make.defs @@ -47,7 +47,7 @@ CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_systemreset.c CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c CMN_CSRCS += up_svcall.c up_vectors.c up_vfork.c -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_task_start.c up_pthread_start.c up_stackframe.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -76,7 +76,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += sam_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += sam_userspace.c endif diff --git a/arch/arm/src/samd/sam_start.c b/arch/arm/src/samd/sam_start.c index 81aacbe47a..58062bfc12 100644 --- a/arch/arm/src/samd/sam_start.c +++ b/arch/arm/src/samd/sam_start.c @@ -157,7 +157,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED sam_userspace(); showprogress('E'); #endif diff --git a/arch/arm/src/samd/sam_userspace.c b/arch/arm/src/samd/sam_userspace.c index 0f40d617e2..60275e56db 100644 --- a/arch/arm/src/samd/sam_userspace.c +++ b/arch/arm/src/samd/sam_userspace.c @@ -46,7 +46,7 @@ #include "sam_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -110,4 +110,4 @@ void sam_userspace(void) } } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/arch/arm/src/samd/sam_userspace.h b/arch/arm/src/samd/sam_userspace.h index 922aed1dbb..e460afad36 100644 --- a/arch/arm/src/samd/sam_userspace.h +++ b/arch/arm/src/samd/sam_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void sam_userspace(void); #endif diff --git a/arch/arm/src/stm32/Make.defs b/arch/arm/src/stm32/Make.defs index c8b7df07d5..2a3675da19 100644 --- a/arch/arm/src/stm32/Make.defs +++ b/arch/arm/src/stm32/Make.defs @@ -67,7 +67,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -105,7 +105,7 @@ ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y) CHIP_ASRCS += stm32_vectors.S endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += stm32_userspace.c stm32_mpuinit.c endif diff --git a/arch/arm/src/stm32/stm32_allocateheap.c b/arch/arm/src/stm32/stm32_allocateheap.c index a89f38c90f..7d662938de 100644 --- a/arch/arm/src/stm32/stm32_allocateheap.c +++ b/arch/arm/src/stm32/stm32_allocateheap.c @@ -426,7 +426,7 @@ static inline void up_heap_color(FAR void *start, size_t size) * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * @@ -455,7 +455,7 @@ static inline void up_heap_color(FAR void *start, size_t size) void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) /* Get the unaligned size and position of the user-space heap. * This heap begins after the user-space .bss section at an offset * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). @@ -509,13 +509,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) * Name: up_allocate_kheap * * Description: - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * (and protects) the kernel-space heap. * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) { /* Get the unaligned size and position of the user-space heap. @@ -562,7 +562,7 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) void up_addregion(void) { #ifndef CONFIG_STM32_CCMEXCLUDE -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) /* Allow user-mode access to the STM32F20xxx/STM32F40xxx CCM SRAM heap */ @@ -580,7 +580,7 @@ void up_addregion(void) #endif #ifdef CONFIG_STM32_FSMC_SRAM -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) /* Allow user-mode access to the FSMC SRAM user heap memory */ diff --git a/arch/arm/src/stm32/stm32_mpuinit.c b/arch/arm/src/stm32/stm32_mpuinit.c index 0b44a32cc3..e2eeaaa99b 100644 --- a/arch/arm/src/stm32/stm32_mpuinit.c +++ b/arch/arm/src/stm32/stm32_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.h" #include "stm32_mpuinit.h" -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU) /**************************************************************************** * Private Definitions @@ -120,5 +120,5 @@ void stm32_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/arch/arm/src/stm32/stm32_mpuinit.h b/arch/arm/src/stm32/stm32_mpuinit.h index 009306947b..6d76db47ee 100644 --- a/arch/arm/src/stm32/stm32_mpuinit.h +++ b/arch/arm/src/stm32/stm32_mpuinit.h @@ -67,7 +67,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void stm32_mpuinitialize(void); #else # define stm32_mpuinitialize() @@ -81,7 +81,7 @@ void stm32_mpuinitialize(void); * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void stm32_mpu_uheap(uintptr_t start, size_t size); #else # define stm32_mpu_uheap(start,size) diff --git a/arch/arm/src/stm32/stm32_start.c b/arch/arm/src/stm32/stm32_start.c index 20fb2054c6..e115a63ccf 100644 --- a/arch/arm/src/stm32/stm32_start.c +++ b/arch/arm/src/stm32/stm32_start.c @@ -280,7 +280,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stm32_userspace(); showprogress('E'); #endif diff --git a/arch/arm/src/stm32/stm32_userspace.c b/arch/arm/src/stm32/stm32_userspace.c index b68705dcee..55dcc11224 100644 --- a/arch/arm/src/stm32/stm32_userspace.c +++ b/arch/arm/src/stm32/stm32_userspace.c @@ -47,7 +47,7 @@ #include "stm32_mpuinit.h" #include "stm32_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -115,5 +115,5 @@ void stm32_userspace(void) stm32_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/arch/arm/src/stm32/stm32_userspace.h b/arch/arm/src/stm32/stm32_userspace.h index 297ceeaa06..70614552d2 100644 --- a/arch/arm/src/stm32/stm32_userspace.h +++ b/arch/arm/src/stm32/stm32_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void stm32_userspace(void); #endif diff --git a/arch/arm/src/stm32/stm32_vectors.S b/arch/arm/src/stm32/stm32_vectors.S index 645f0f1c81..8f015b7e25 100644 --- a/arch/arm/src/stm32/stm32_vectors.S +++ b/arch/arm/src/stm32/stm32_vectors.S @@ -70,7 +70,7 @@ * no privileged task has run. */ -# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 +# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4 # error Interrupt stack must be used with high priority interrupts in kernel mode # endif @@ -248,7 +248,7 @@ exception_common: /* Complete the context save */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) @@ -290,7 +290,7 @@ exception_common: * r14=register values. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */ @@ -378,7 +378,7 @@ exception_common: ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -393,7 +393,7 @@ exception_common: */ 2: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -418,7 +418,7 @@ exception_common: 3: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/arch/arm/src/tiva/Make.defs b/arch/arm/src/tiva/Make.defs index e97d5f50f8..e13771bfa2 100644 --- a/arch/arm/src/tiva/Make.defs +++ b/arch/arm/src/tiva/Make.defs @@ -58,7 +58,7 @@ ifeq ($(CONFIG_DEBUG_STACK),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -81,7 +81,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += tiva_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += tiva_userspace.c tiva_mpuinit.c endif diff --git a/arch/arm/src/tiva/tiva_allocateheap.c b/arch/arm/src/tiva/tiva_allocateheap.c index b38457e98c..a76fb5bc83 100644 --- a/arch/arm/src/tiva/tiva_allocateheap.c +++ b/arch/arm/src/tiva/tiva_allocateheap.c @@ -76,7 +76,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * @@ -105,7 +105,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) /* Get the unaligned size and position of the user-space heap. * This heap begins after the user-space .bss section at an offset * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). @@ -151,13 +151,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) * Name: up_allocate_kheap * * Description: - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * (and protects) the kernel-space heap. * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) { /* Get the unaligned size and position of the user-space heap. diff --git a/arch/arm/src/tiva/tiva_mpuinit.c b/arch/arm/src/tiva/tiva_mpuinit.c index 8ec8da5dfc..803cfe9bf4 100644 --- a/arch/arm/src/tiva/tiva_mpuinit.c +++ b/arch/arm/src/tiva/tiva_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.h" #include "tiva_mpuinit.h" -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU) /**************************************************************************** * Private Definitions @@ -120,5 +120,5 @@ void tiva_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/arch/arm/src/tiva/tiva_mpuinit.h b/arch/arm/src/tiva/tiva_mpuinit.h index faba854258..82dde88d74 100644 --- a/arch/arm/src/tiva/tiva_mpuinit.h +++ b/arch/arm/src/tiva/tiva_mpuinit.h @@ -67,7 +67,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void tiva_mpuinitialize(void); #else # define tiva_mpuinitialize() @@ -81,7 +81,7 @@ void tiva_mpuinitialize(void); * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void tiva_mpu_uheap(uintptr_t start, size_t size); #else # define tiva_mpu_uheap(start,size) diff --git a/arch/arm/src/tiva/tiva_start.c b/arch/arm/src/tiva/tiva_start.c index f0c66f6d2e..1e13266787 100644 --- a/arch/arm/src/tiva/tiva_start.c +++ b/arch/arm/src/tiva/tiva_start.c @@ -150,7 +150,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tiva_userspace(); showprogress('E'); #endif diff --git a/arch/arm/src/tiva/tiva_userspace.c b/arch/arm/src/tiva/tiva_userspace.c index e2b2780240..9f2c6b59aa 100644 --- a/arch/arm/src/tiva/tiva_userspace.c +++ b/arch/arm/src/tiva/tiva_userspace.c @@ -47,7 +47,7 @@ #include "tiva_mpuinit.h" #include "tiva_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -115,4 +115,4 @@ void tiva_userspace(void) tiva_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/arch/arm/src/tiva/tiva_userspace.h b/arch/arm/src/tiva/tiva_userspace.h index b6cb3541c8..cdfced1426 100644 --- a/arch/arm/src/tiva/tiva_userspace.h +++ b/arch/arm/src/tiva/tiva_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void tiva_userspace(void); #endif diff --git a/arch/arm/src/tiva/tiva_vectors.S b/arch/arm/src/tiva/tiva_vectors.S index 8dc52e8810..0680f0baa2 100644 --- a/arch/arm/src/tiva/tiva_vectors.S +++ b/arch/arm/src/tiva/tiva_vectors.S @@ -69,7 +69,7 @@ * no privileged task has run. */ -# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 +# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4 # error Interrupt stack must be used with high priority interrupts in kernel mode # endif @@ -223,7 +223,7 @@ exception_common: /* Complete the context save */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) @@ -265,7 +265,7 @@ exception_common: * r14=register values. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */ @@ -353,7 +353,7 @@ exception_common: ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -368,7 +368,7 @@ exception_common: */ 2: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -393,7 +393,7 @@ exception_common: 3: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/arch/avr/src/avr/up_createstack.c b/arch/avr/src/avr/up_createstack.c index 1dd7e50062..d14ec63fd2 100644 --- a/arch/avr/src/avr/up_createstack.c +++ b/arch/avr/src/avr/up_createstack.c @@ -96,11 +96,6 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect - * how the stack is allocated. For example, kernel thread stacks should - * be allocated from protected kernel memory. Stacks for user tasks and - * threads must come from memory that is accessible to user code. - * ****************************************************************************/ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) @@ -125,28 +120,11 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * then create a zeroed stack to make stack dumps easier to trace. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Use the kernel allocator if this is a kernel thread */ - - if (ttype == TCB_FLAG_TTYPE_KERNEL) - { #if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kzalloc(stack_size); + tcb->stack_alloc_ptr = (uint32_t *)kuzalloc(stack_size); #else - tcb->stack_alloc_ptr = (uint32_t *)kmalloc(stack_size); + tcb->stack_alloc_ptr = (uint32_t *)kumalloc(stack_size); #endif - } - else -#endif - { - /* Use the user-space allocator if this is a task or pthread */ - -#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kuzalloc(stack_size); -#else - tcb->stack_alloc_ptr = (uint32_t *)kumalloc(stack_size); -#endif - } #ifdef CONFIG_DEBUG /* Was the allocation successful? */ diff --git a/arch/avr/src/avr32/up_createstack.c b/arch/avr/src/avr32/up_createstack.c index fd1af6782d..9082d796f5 100644 --- a/arch/avr/src/avr32/up_createstack.c +++ b/arch/avr/src/avr32/up_createstack.c @@ -95,7 +95,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is allocated. For example, kernel thread stacks should * be allocated from protected kernel memory. Stacks for user tasks and * threads must come from memory that is accessible to user code. @@ -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_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/avr/src/avr32/up_initialstate.c b/arch/avr/src/avr32/up_initialstate.c index 86138b616e..821637423a 100644 --- a/arch/avr/src/avr32/up_initialstate.c +++ b/arch/avr/src/avr32/up_initialstate.c @@ -115,8 +115,8 @@ void up_initial_state(struct tcb_s *tcb) * supervisor-mode. */ -#ifdef CONFIG_NUTTX_KERNEL -# error "Missing logic for the CONFIG_NUTTX_KERNEL build" +#ifdef CONFIG_BUILD_KERNEL +# error "Missing logic for the CONFIG_BUILD_KERNEL build" #endif /* Enable or disable interrupts, based on user configuration */ diff --git a/arch/avr/src/common/up_allocateheap.c b/arch/avr/src/common/up_allocateheap.c index b5a080d43f..4076d97d1a 100644 --- a/arch/avr/src/common/up_allocateheap.c +++ b/arch/avr/src/common/up_allocateheap.c @@ -70,7 +70,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * diff --git a/arch/avr/src/common/up_releasestack.c b/arch/avr/src/common/up_releasestack.c index 11b5181c45..7595f1e0af 100644 --- a/arch/avr/src/common/up_releasestack.c +++ b/arch/avr/src/common/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is freed. For example, kernel thread stacks may have * been allocated from protected kernel memory. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/hc/src/common/up_allocateheap.c b/arch/hc/src/common/up_allocateheap.c index 505edd1128..b16016acd3 100644 --- a/arch/hc/src/common/up_allocateheap.c +++ b/arch/hc/src/common/up_allocateheap.c @@ -69,7 +69,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * diff --git a/arch/hc/src/common/up_createstack.c b/arch/hc/src/common/up_createstack.c index aad1557fcc..ea542d9852 100644 --- a/arch/hc/src/common/up_createstack.c +++ b/arch/hc/src/common/up_createstack.c @@ -92,7 +92,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is allocated. For example, kernel thread stacks should * be allocated from protected kernel memory. Stacks for user tasks and * threads must come from memory that is accessible to user code. @@ -121,7 +121,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * then create a zeroed stack to make stack dumps easier to trace. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/hc/src/common/up_releasestack.c b/arch/hc/src/common/up_releasestack.c index 096108f86c..86819d3894 100644 --- a/arch/hc/src/common/up_releasestack.c +++ b/arch/hc/src/common/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is freed. For example, kernel thread stacks may have * been allocated from protected kernel memory. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/mips/include/mips32/irq.h b/arch/mips/include/mips32/irq.h index d42dbcfd28..27c200edf7 100644 --- a/arch/mips/include/mips32/irq.h +++ b/arch/mips/include/mips32/irq.h @@ -57,7 +57,7 @@ */ #undef MIPS32_SAVE_GP -#if defined(CONFIG_NUTTX_KERNEL) || defined(CONFIG_NXFLAT) +#if defined(CONFIG_BUILD_KERNEL) || defined(CONFIG_NXFLAT) # define MIPS32_SAVE_GP 1 #endif @@ -316,7 +316,7 @@ /* This structure represents the return state from a system call */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL struct xcpt_syscall_s { uint32_t sysreturn; /* The return PC */ @@ -343,7 +343,7 @@ struct xcptcontext uint32_t saved_epc; /* Trampoline PC */ uint32_t saved_status; /* Status with interrupts disabled. */ -# ifdef CONFIG_NUTTX_KERNEL +# ifdef CONFIG_BUILD_KERNEL /* This is the saved address to use when returning from a user-space * signal handler. */ @@ -353,7 +353,7 @@ struct xcptcontext # endif #endif -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL /* The following array holds information needed to return from each nested * system call. */ diff --git a/arch/mips/include/mips32/syscall.h b/arch/mips/include/mips32/syscall.h index bf2a7847f7..a9ec7f9e09 100644 --- a/arch/mips/include/mips32/syscall.h +++ b/arch/mips/include/mips32/syscall.h @@ -63,7 +63,7 @@ * reserved (0 is not used). */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL # ifndef CONFIG_SYS_RESERVED # error "CONFIG_SYS_RESERVED must be defined to the value 4" # elif CONFIG_SYS_RESERVED != 4 @@ -170,7 +170,7 @@ #define up_switchcontext(saveregs, restoreregs) \ (void)sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs) -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL /* SYS call 3: * * void up_syscall_return(void); diff --git a/arch/mips/src/common/up_allocateheap.c b/arch/mips/src/common/up_allocateheap.c index c334290ddb..507114420c 100644 --- a/arch/mips/src/common/up_allocateheap.c +++ b/arch/mips/src/common/up_allocateheap.c @@ -70,7 +70,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * diff --git a/arch/mips/src/common/up_createstack.c b/arch/mips/src/common/up_createstack.c index 506ece44d2..92b99842af 100644 --- a/arch/mips/src/common/up_createstack.c +++ b/arch/mips/src/common/up_createstack.c @@ -113,7 +113,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is allocated. For example, kernel thread stacks should * be allocated from protected kernel memory. Stacks for user tasks and * threads must come from memory that is accessible to user code. @@ -142,7 +142,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * then create a zeroed stack to make stack dumps easier to trace. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/mips/src/common/up_releasestack.c b/arch/mips/src/common/up_releasestack.c index 6e510ed3d2..a023342fa4 100644 --- a/arch/mips/src/common/up_releasestack.c +++ b/arch/mips/src/common/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is freed. For example, kernel thread stacks may have * been allocated from protected kernel memory. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/mips/src/mips32/up_initialstate.c b/arch/mips/src/mips32/up_initialstate.c index ca981ffaf1..7a9b629fbd 100644 --- a/arch/mips/src/mips32/up_initialstate.c +++ b/arch/mips/src/mips32/up_initialstate.c @@ -116,7 +116,7 @@ void up_initial_state(struct tcb_s *tcb) * privileged thread mode. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL # warning "Missing logic" #endif diff --git a/arch/mips/src/mips32/up_swint0.c b/arch/mips/src/mips32/up_swint0.c index 5b1c2067c9..4cfc74b5b2 100644 --- a/arch/mips/src/mips32/up_swint0.c +++ b/arch/mips/src/mips32/up_swint0.c @@ -122,7 +122,7 @@ static void up_registerdump(const uint32_t *regs) * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL static void dispatch_syscall(void) naked_function; static void dispatch_syscall(void) { @@ -234,7 +234,7 @@ int up_swint0(int irq, FAR void *context) * unprivileged thread mode. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL case SYS_syscall_return: { struct tcb_s *rtcb = sched_self(); @@ -262,7 +262,7 @@ int up_swint0(int irq, FAR void *context) default: { -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL FAR struct tcb_s *rtcb = sched_self(); int index = rtcb->xcp.nsyscalls; diff --git a/arch/mips/src/pic32mx/pic32mx-config.h b/arch/mips/src/pic32mx/pic32mx-config.h index 058b02f68d..a80e2bba54 100644 --- a/arch/mips/src/pic32mx/pic32mx-config.h +++ b/arch/mips/src/pic32mx/pic32mx-config.h @@ -491,7 +491,7 @@ * reserved (0 is not used). */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL # if !defined(CONFIG_SYS_RESERVED) || CONFIG_SYS_RESERVED < 4 # error "CONFIG_SYS_RESERVED must be defined to be 4 for a kernel build" # elif CONFIG_SYS_RESERVED > 4 diff --git a/arch/rgmp/src/nuttx.c b/arch/rgmp/src/nuttx.c index 4cc2a1a05c..338940be34 100644 --- a/arch/rgmp/src/nuttx.c +++ b/arch/rgmp/src/nuttx.c @@ -126,7 +126,7 @@ int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype) /* Allocate the memory for the stack */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) { @@ -170,7 +170,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size) return OK; } -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { uintptr_t topaddr; @@ -206,7 +206,7 @@ void up_release_stack(struct tcb_s *dtcb, uint8_t ttype) /* Is there a stack allocated? */ if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) { diff --git a/arch/sh/src/common/up_allocateheap.c b/arch/sh/src/common/up_allocateheap.c index ee7e90e053..cbfea5684e 100644 --- a/arch/sh/src/common/up_allocateheap.c +++ b/arch/sh/src/common/up_allocateheap.c @@ -69,7 +69,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * diff --git a/arch/sh/src/common/up_createstack.c b/arch/sh/src/common/up_createstack.c index 4c2d36ae92..03808f7655 100644 --- a/arch/sh/src/common/up_createstack.c +++ b/arch/sh/src/common/up_createstack.c @@ -92,7 +92,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is allocated. For example, kernel thread stacks should * be allocated from protected kernel memory. Stacks for user tasks and * threads must come from memory that is accessible to user code. @@ -121,7 +121,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * then create a zeroed stack to make stack dumps easier to trace. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/sh/src/common/up_releasestack.c b/arch/sh/src/common/up_releasestack.c index 422f12f493..c6f04be760 100644 --- a/arch/sh/src/common/up_releasestack.c +++ b/arch/sh/src/common/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is freed. For example, kernel thread stacks may have * been allocated from protected kernel memory. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/sh/src/sh1/sh1_initialstate.c b/arch/sh/src/sh1/sh1_initialstate.c index fe703f5a93..0f63c0afb4 100644 --- a/arch/sh/src/sh1/sh1_initialstate.c +++ b/arch/sh/src/sh1/sh1_initialstate.c @@ -115,8 +115,8 @@ void up_initial_state(struct tcb_s *tcb) * supervisor-mode. */ -#ifdef CONFIG_NUTTX_KERNEL -# error "Missing logic for the CONFIG_NUTTX_KERNEL build" +#ifdef CONFIG_BUILD_KERNEL +# error "Missing logic for the CONFIG_BUILD_KERNEL build" #endif /* Enable or disable interrupts, based on user configuration */ diff --git a/arch/sim/src/up_allocateheap.c b/arch/sim/src/up_allocateheap.c index 9f5dfd2052..da6511c65e 100644 --- a/arch/sim/src/up_allocateheap.c +++ b/arch/sim/src/up_allocateheap.c @@ -72,10 +72,6 @@ static uint8_t sim_heap[SIM_HEAP_SIZE]; * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and - * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the - * size of the unprotected, user-space heap. - * * If a protected kernel-space heap is provided, the kernel heap must be * allocated (and protected) by an analogous up_allocate_kheap(). * diff --git a/arch/sim/src/up_createstack.c b/arch/sim/src/up_createstack.c index 4115dd4ede..07a8efc15f 100644 --- a/arch/sim/src/up_createstack.c +++ b/arch/sim/src/up_createstack.c @@ -93,11 +93,6 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect - * how the stack is allocated. For example, kernel thread stacks should - * be allocated from protected kernel memory. Stacks for user tasks and - * threads must come from memory that is accessible to user code. - * ****************************************************************************/ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) @@ -112,18 +107,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) /* Allocate the memory for the stack */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Use the kernel allocator if this is a kernel thread */ - - if (ttype == TCB_FLAG_TTYPE_KERNEL) - { - stack_alloc_ptr = (uint32_t *)kmalloc(stack_size); - } - else -#endif - { - stack_alloc_ptr = (uint32_t*)kumalloc(adj_stack_size); - } + stack_alloc_ptr = (uint32_t*)kumalloc(adj_stack_size); /* Was the allocation successful? */ diff --git a/arch/sim/src/up_releasestack.c b/arch/sim/src/up_releasestack.c index 49a68eb8d7..f8f47c44d3 100644 --- a/arch/sim/src/up_releasestack.c +++ b/arch/sim/src/up_releasestack.c @@ -82,12 +82,6 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect - * how the stack is freed. For example, kernel thread stacks may have - * been allocated from protected kernel memory. Stacks for user tasks - * and threads must have come from memory that is accessible to user - * code. - * * Returned Value: * None * @@ -99,20 +93,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Use the kernel allocator if this is a kernel thread */ - - if (ttype == TCB_FLAG_TTYPE_KERNEL) - { - sched_kfree(dtcb->stack_alloc_ptr); - } - else -#endif - { - /* Use the user-space allocator if this is a task or pthread */ - - sched_ufree(dtcb->stack_alloc_ptr); - } + sched_ufree(dtcb->stack_alloc_ptr); } /* Mark the stack freed */ diff --git a/arch/x86/src/common/up_allocateheap.c b/arch/x86/src/common/up_allocateheap.c index c51e3d855f..79779ffbac 100644 --- a/arch/x86/src/common/up_allocateheap.c +++ b/arch/x86/src/common/up_allocateheap.c @@ -70,7 +70,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * diff --git a/arch/x86/src/i486/up_createstack.c b/arch/x86/src/i486/up_createstack.c index cdd7fec7c5..6b02e44642 100644 --- a/arch/x86/src/i486/up_createstack.c +++ b/arch/x86/src/i486/up_createstack.c @@ -94,7 +94,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is allocated. For example, kernel thread stacks should * be allocated from protected kernel memory. Stacks for user tasks and * threads must come from memory that is accessible to user code. @@ -123,7 +123,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * then create a zeroed stack to make stack dumps easier to trace. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/x86/src/i486/up_initialstate.c b/arch/x86/src/i486/up_initialstate.c index 8efd0e92a5..242545330a 100644 --- a/arch/x86/src/i486/up_initialstate.c +++ b/arch/x86/src/i486/up_initialstate.c @@ -111,8 +111,8 @@ void up_initial_state(struct tcb_s *tcb) * supervisor-mode. */ -#ifdef CONFIG_NUTTX_KERNEL -# error "Missing logic for the CONFIG_NUTTX_KERNEL build" +#ifdef CONFIG_BUILD_KERNEL +# error "Missing logic for the CONFIG_BUILD_KERNEL build" #endif /* Enable or disable interrupts, based on user configuration. If the IF diff --git a/arch/x86/src/i486/up_releasestack.c b/arch/x86/src/i486/up_releasestack.c index 89bf974c75..797934f9f6 100644 --- a/arch/x86/src/i486/up_releasestack.c +++ b/arch/x86/src/i486/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is freed. For example, kernel thread stacks may have * been allocated from protected kernel memory. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/z16/src/common/up_allocateheap.c b/arch/z16/src/common/up_allocateheap.c index af3b06713d..8f6f3ac41e 100644 --- a/arch/z16/src/common/up_allocateheap.c +++ b/arch/z16/src/common/up_allocateheap.c @@ -85,13 +85,6 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and - * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the - * size of the unprotected, user-space heap. - * - * If a protected kernel-space heap is provided, the kernel heap must be - * allocated (and protected) by an analogous up_allocate_kheap(). - * ****************************************************************************/ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) diff --git a/arch/z16/src/common/up_createstack.c b/arch/z16/src/common/up_createstack.c index 0a7fecd3b9..5daf8cc761 100644 --- a/arch/z16/src/common/up_createstack.c +++ b/arch/z16/src/common/up_createstack.c @@ -93,11 +93,6 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect - * how the stack is allocated. For example, kernel thread stacks should - * be allocated from protected kernel memory. Stacks for user tasks and - * threads must come from memory that is accessible to user code. - * ****************************************************************************/ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) @@ -122,28 +117,11 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * then create a zeroed stack to make stack dumps easier to trace. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Use the kernel allocator if this is a kernel thread */ - - if (ttype == TCB_FLAG_TTYPE_KERNEL) - { #if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kzalloc(stack_size); + tcb->stack_alloc_ptr = (uint32_t *)kuzalloc(stack_size); #else - tcb->stack_alloc_ptr = (uint32_t *)kmalloc(stack_size); + tcb->stack_alloc_ptr = (uint32_t *)kumalloc(stack_size); #endif - } - else -#endif - { - /* Use the user-space allocator if this is a task or pthread */ - -#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kuzalloc(stack_size); -#else - tcb->stack_alloc_ptr = (uint32_t *)kumalloc(stack_size); -#endif - } #ifdef CONFIG_DEBUG /* Was the allocation successful? */ diff --git a/arch/z16/src/common/up_releasestack.c b/arch/z16/src/common/up_releasestack.c index d57f2c11a7..c64a5f4087 100644 --- a/arch/z16/src/common/up_releasestack.c +++ b/arch/z16/src/common/up_releasestack.c @@ -79,12 +79,6 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect - * how the stack is freed. For example, kernel thread stacks may have - * been allocated from protected kernel memory. Stacks for user tasks - * and threads must have come from memory that is accessible to user - * code. - * * Returned Value: * None * @@ -96,20 +90,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Use the kernel allocator if this is a kernel thread */ - - if (ttype == TCB_FLAG_TTYPE_KERNEL) - { - sched_kfree(dtcb->stack_alloc_ptr); - } - else -#endif - { - /* Use the user-space allocator if this is a task or pthread */ - - sched_ufree(dtcb->stack_alloc_ptr); - } + sched_ufree(dtcb->stack_alloc_ptr); /* Mark the stack freed */ diff --git a/arch/z80/src/common/up_allocateheap.c b/arch/z80/src/common/up_allocateheap.c index 8a6095d51c..c3c5a03495 100644 --- a/arch/z80/src/common/up_allocateheap.c +++ b/arch/z80/src/common/up_allocateheap.c @@ -87,7 +87,7 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and + * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * size of the unprotected, user-space heap. * diff --git a/arch/z80/src/common/up_createstack.c b/arch/z80/src/common/up_createstack.c index 1a058ec509..1b75066733 100644 --- a/arch/z80/src/common/up_createstack.c +++ b/arch/z80/src/common/up_createstack.c @@ -92,7 +92,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is allocated. For example, kernel thread stacks should * be allocated from protected kernel memory. Stacks for user tasks and * threads must come from memory that is accessible to user code. @@ -121,7 +121,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) * then create a zeroed stack to make stack dumps easier to trace. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/arch/z80/src/common/up_releasestack.c b/arch/z80/src/common/up_releasestack.c index 9ea249a63e..be978aadd9 100644 --- a/arch/z80/src/common/up_releasestack.c +++ b/arch/z80/src/common/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is defined, then this thread type may affect * how the stack is freed. For example, kernel thread stacks may have * been allocated from protected kernel memory. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL)