You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/06/30 06:26:48 UTC

[incubator-nuttx] 03/03: binfmt/exec: allocate stack from internal

This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit b9ad4a000e254f5032914b520234cb23290c8aae
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Jun 29 16:26:48 2020 +0800

    binfmt/exec: allocate stack from internal
    
    Implement of nxtask_init() support stack allocation from internal
    
    Change-Id: I4885c5b901d90e57eb9d15d8bc1af32761584d19
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 binfmt/binfmt_execmodule.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/binfmt/binfmt_execmodule.c b/binfmt/binfmt_execmodule.c
index c276467..57a6fd0 100644
--- a/binfmt/binfmt_execmodule.c
+++ b/binfmt/binfmt_execmodule.c
@@ -117,7 +117,6 @@ int exec_module(FAR const struct binary_s *binp)
 #if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL)
   save_addrenv_t oldenv;
 #endif
-  FAR void *stack;
   pid_t pid;
   int ret;
 
@@ -151,27 +150,17 @@ int exec_module(FAR const struct binary_s *binp)
     }
 #endif
 
-  /* Allocate the stack for the new task.
-   *
-   * REVISIT:  This allocation is currently always from the user heap.  That
-   * will need to change if/when we want to support dynamic stack allocation.
-   */
+  /* Note that tcb->flags are not modified.  0=normal task */
 
-  stack = kumm_malloc(binp->stacksize);
-  if (!stack)
-    {
-      ret = -ENOMEM;
-      goto errout_with_addrenv;
-    }
+  /* tcb->flags |= TCB_FLAG_TTYPE_TASK; */
 
   /* Initialize the task */
 
   ret = nxtask_init((FAR struct tcb_s *)tcb, binp->filename, binp->priority,
-                    stack, binp->stacksize, binp->entrypt, binp->argv);
+                    NULL, binp->stacksize, binp->entrypt, binp->argv);
   if (ret < 0)
     {
       berr("nxtask_init() failed: %d\n", ret);
-      kumm_free(stack);
       goto errout_with_addrenv;
     }
 
@@ -183,10 +172,6 @@ int exec_module(FAR const struct binary_s *binp)
 
   binfmt_freeargv((FAR 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 */
 
@@ -273,7 +258,6 @@ int exec_module(FAR const struct binary_s *binp)
 errout_with_tcbinit:
   tcb->cmn.stack_alloc_ptr = NULL;
   nxsched_release_tcb(&tcb->cmn, TCB_FLAG_TTYPE_TASK);
-  kumm_free(stack);
   return ret;
 #endif