From b6ed8d1bed845fdba8ba207776dc1f7b83de57fd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 26 Aug 2014 12:16:05 -0600 Subject: Rename up_addrenv_assign() to up_addrenv_clone() and generalize its arguments so that can be used for other purposes --- nuttx/binfmt/binfmt_execmodule.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'nuttx/binfmt/binfmt_execmodule.c') diff --git a/nuttx/binfmt/binfmt_execmodule.c b/nuttx/binfmt/binfmt_execmodule.c index f415bccac..5d49acf74 100644 --- a/nuttx/binfmt/binfmt_execmodule.c +++ b/nuttx/binfmt/binfmt_execmodule.c @@ -163,9 +163,9 @@ int exec_module(FAR const struct binary_s *binp) goto errout; } +#ifndef CONFIG_CUSTOM_STACK /* Allocate the stack for the new task (always from the user heap) */ -#ifndef CONFIG_CUSTOM_STACK stack = (FAR uint32_t*)kumalloc(binp->stacksize); if (!tcb) { @@ -193,11 +193,11 @@ 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; */ +#ifdef CONFIG_PIC /* Add the D-Space address as the PIC base address. By convention, this * must be the first allocated address space. */ -#ifdef CONFIG_PIC tcb->cmn.dspace = binp->alloc[0]; /* Re-initialize the task's initial state to account for the new PIC base */ @@ -205,24 +205,24 @@ int exec_module(FAR const struct binary_s *binp) up_initial_state(&tcb->cmn); #endif +#ifdef CONFIG_ARCH_ADDRENV /* Assign the address environment to the new task group */ -#ifdef CONFIG_ARCH_ADDRENV - ret = up_addrenv_assign(&binp->addrenv, tcb->cmn.group); + ret = up_addrenv_clone(&binp->addrenv, &tcb->cmn.group->addrenv); if (ret < 0) { err = -ret; - bdbg("ERROR: up_addrenv_assign() failed: %d\n", ret); + bdbg("ERROR: up_addrenv_clone() failed: %d\n", ret); goto errout_with_stack; } #endif +#ifdef CONFIG_BINFMT_CONSTRUCTORS /* Setup a start hook that will execute all of the C++ static constructors * on the newly created thread. The struct binary_s must persist at least * until the new task has been started. */ -#ifdef CONFIG_BINFMT_CONSTRUCTORS task_starthook(tcb, exec_ctors, (FAR void *)binp); #endif @@ -261,4 +261,3 @@ errout: } #endif /* CONFIG_BINFMT_DISABLE */ - -- cgit v1.2.3