mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
Rename up_addrenv_assign() to up_addrenv_clone() and generalize its arguments so that can be used for other purposes
This commit is contained in:
@@ -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 */
|
||||
|
||||
|
||||
+4
-4
@@ -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);
|
||||
|
||||
+3
-3
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user