summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/binfmt/binfmt_execmodule.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/nuttx/binfmt/binfmt_execmodule.c b/nuttx/binfmt/binfmt_execmodule.c
index 3756fbaf6..dae892571 100644
--- a/nuttx/binfmt/binfmt_execmodule.c
+++ b/nuttx/binfmt/binfmt_execmodule.c
@@ -165,8 +165,7 @@ int exec_module(FAR const struct binary_s *binp)
goto errout;
}
-#ifdef CONFIG_ARCH_ADDRENV
-#ifdef CONFIG_BUILD_KERNEL
+#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
/* Instantiate the address environment containing the user heap */
ret = up_addrenv_select(&binp->addrenv, &oldenv);
@@ -183,19 +182,6 @@ int exec_module(FAR const struct binary_s *binp)
up_addrenv_heapsize(&binp->addrenv));
#endif
-#ifdef CONFIG_ARCH_KERNEL_STACK
- /* Allocate the kernel stack */
-
- ret = up_addrenv_kstackalloc(&tcb->cmn);
- if (ret < 0)
- {
- bdbg("ERROR: up_addrenv_select() failed: %d\n", ret);
- err = -ret;
- goto errout_with_addrenv;
- }
-#endif
-#endif
-
/* Allocate the stack for the new task.
*
* REVISIT: This allocation is currently always from the user heap. That
@@ -223,6 +209,18 @@ int exec_module(FAR const struct binary_s *binp)
/* Note that tcb->flags are not modified. 0=normal task */
/* tcb->flags |= TCB_FLAG_TTYPE_TASK; */
+#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
+ /* Allocate the kernel stack */
+
+ ret = up_addrenv_kstackalloc(&tcb->cmn);
+ if (ret < 0)
+ {
+ bdbg("ERROR: up_addrenv_select() failed: %d\n", ret);
+ err = -ret;
+ goto errout_with_addrenv;
+ }
+#endif
+
#ifdef CONFIG_PIC
/* Add the D-Space address as the PIC base address. By convention, this
* must be the first allocated address space.