diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-26 12:16:05 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-26 12:16:05 -0600 |
commit | b6ed8d1bed845fdba8ba207776dc1f7b83de57fd (patch) | |
tree | 7a50c9cc92745c0f80b8557354a836020275328f /nuttx/binfmt | |
parent | 690fb7b9fb8bc38f97c38cd5a36140bd8efe7bd7 (diff) | |
download | nuttx-b6ed8d1bed845fdba8ba207776dc1f7b83de57fd.tar.gz nuttx-b6ed8d1bed845fdba8ba207776dc1f7b83de57fd.tar.bz2 nuttx-b6ed8d1bed845fdba8ba207776dc1f7b83de57fd.zip |
Rename up_addrenv_assign() to up_addrenv_clone() and generalize its arguments so that can be used for other purposes
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r-- | nuttx/binfmt/binfmt_execmodule.c | 13 | ||||
-rw-r--r-- | nuttx/binfmt/elf.c | 8 | ||||
-rw-r--r-- | nuttx/binfmt/nxflat.c | 6 |
3 files changed, 13 insertions, 14 deletions
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 */ - diff --git a/nuttx/binfmt/elf.c b/nuttx/binfmt/elf.c index 98924a6a8..2cb18fe91 100644 --- a/nuttx/binfmt/elf.c +++ b/nuttx/binfmt/elf.c @@ -1,7 +1,7 @@ /**************************************************************************** * binfmt/elf.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -294,11 +294,11 @@ static int elf_loadbinary(FAR struct binary_s *binp) #endif #ifdef CONFIG_ARCH_ADDRENV - /* Save the address environment. This will be needed when the module is - * executed for the up_addrenv_assign() call. + /* Save the address environment in the binfmt structure. This will be + * needed when the module is executed. */ - binp->addrenv = loadinfo.addrenv; + up_addrenv_clone(&loadinfo.addrenv, &binp->addrenv); #endif elf_dumpentrypt(binp, &loadinfo); diff --git a/nuttx/binfmt/nxflat.c b/nuttx/binfmt/nxflat.c index d225912e3..a839bbc07 100644 --- a/nuttx/binfmt/nxflat.c +++ b/nuttx/binfmt/nxflat.c @@ -206,11 +206,11 @@ static int nxflat_loadbinary(struct binary_s *binp) #endif #ifdef CONFIG_ARCH_ADDRENV - /* Save the address environment. This will be needed when the module is - * executed for the up_addrenv_assign() call. + /* Save the address environment in the binfmt structure. This will be + * needed when the module is executed. */ - binp->addrenv = loadinfo.addrenv; + up_addrenv_clone(&loadinfo.addrenv, &binp->addrenv); #endif nxflat_dumpbuffer("Entry code", (FAR const uint8_t*)binp->entrypt, |