mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
Change CONFIG_ADDRENV to CONFIG_ARCH_ADDRENV; change how it is selected -- the architecure must first declare support
This commit is contained in:
@@ -96,7 +96,7 @@ int dump_module(FAR const struct binary_s *bin)
|
||||
bdbg(" ctors: %p nctors=%d\n", bin->ctors, bin->nctors);
|
||||
bdbg(" dtors: %p ndtors=%d\n", bin->dtors, bin->ndtors);
|
||||
#endif
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
bdbg(" addrenv: %p\n", bin->addrenv);
|
||||
#endif
|
||||
bdbg(" stacksize: %d\n", bin->stacksize);
|
||||
|
||||
@@ -207,7 +207,7 @@ int exec_module(FAR const struct binary_s *binp)
|
||||
|
||||
/* Assign the address environment to the new task group */
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = up_addrenv_assign(binp->addrenv, tcb->cmn.group);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
static inline int exec_dtors(FAR struct binary_s *binp)
|
||||
{
|
||||
binfmt_dtor_t *dtor = binp->dtors;
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
hw_addrenv_t oldenv;
|
||||
int ret;
|
||||
#endif
|
||||
@@ -95,7 +95,7 @@ static inline int exec_dtors(FAR struct binary_s *binp)
|
||||
|
||||
/* Instantiate the address enviroment containing the destructors */
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = up_addrenv_select(binp->addrenv, &oldenv);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ static inline int exec_dtors(FAR struct binary_s *binp)
|
||||
|
||||
/* Restore the address enviroment */
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
return up_addrenv_restore(oldenv);
|
||||
#else
|
||||
return OK;
|
||||
|
||||
+2
-2
@@ -226,7 +226,7 @@ static int elf_loadbinary(struct binary_s *binp)
|
||||
* a memory leak?
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# warning "REVISIT"
|
||||
#else
|
||||
binp->alloc[0] = (FAR void *)loadinfo.elfalloc;
|
||||
@@ -246,7 +246,7 @@ static int elf_loadbinary(struct binary_s *binp)
|
||||
binp->ndtors = loadinfo.ndtors;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Save the address environment. This will be needed when the module is
|
||||
* executed for the up_addrenv_assign() call.
|
||||
*/
|
||||
|
||||
@@ -79,7 +79,7 @@ int elf_verifyheader(FAR const Elf32_Ehdr *header);
|
||||
* read into 'buffer.' If 'buffer' is part of the ELF address environment,
|
||||
* then the caller is responsibile for assuring that that address
|
||||
* environment is in place before calling this function (i.e., that
|
||||
* elf_addrenv_select() has been called if CONFIG_ADDRENV=y).
|
||||
* elf_addrenv_select() has been called if CONFIG_ARCH_ADDRENV=y).
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
@@ -264,8 +264,8 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo);
|
||||
* Name: elf_addrenv_alloc
|
||||
*
|
||||
* Description:
|
||||
* Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n,
|
||||
* elfalloc will be allocated using kzalloc(). If CONFIG_ADDRENV-y, then
|
||||
* Allocate memory for the ELF image (elfalloc). If CONFIG_ARCH_ADDRENV=n,
|
||||
* elfalloc will be allocated using kzalloc(). If CONFIG_ARCH_ADDRENV-y, then
|
||||
* elfalloc will be allocated using up_addrenv_create(). In either case,
|
||||
* there will be a unique instance of elfalloc (and stack) for each
|
||||
* instance of a process.
|
||||
@@ -296,7 +296,7 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t envsize);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# define elf_addrenv_select(l) up_addrenv_select((l)->addrenv, &(l)->oldenv)
|
||||
#endif
|
||||
|
||||
@@ -314,7 +314,7 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t envsize);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# define elf_addrenv_restore(l) up_addrenv_restore((l)->oldenv)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@
|
||||
* Name: elf_addrenv_alloc
|
||||
*
|
||||
* Description:
|
||||
* Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n,
|
||||
* elfalloc will be allocated using kuzalloc(). If CONFIG_ADDRENV-y, then
|
||||
* Allocate memory for the ELF image (elfalloc). If CONFIG_ARCH_ADDRENV=n,
|
||||
* elfalloc will be allocated using kuzalloc(). If CONFIG_ARCH_ADDRENV-y, then
|
||||
* elfalloc will be allocated using up_addrenv_create(). In either case,
|
||||
* there will be a unique instance of elfalloc (and stack) for each
|
||||
* instance of a process.
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t envsize)
|
||||
{
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
FAR void *vaddr;
|
||||
int ret;
|
||||
|
||||
@@ -146,7 +146,7 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t envsize)
|
||||
|
||||
void elf_addrenv_free(FAR struct elf_loadinfo_s *loadinfo)
|
||||
{
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
int ret;
|
||||
|
||||
/* Free the address environemnt */
|
||||
|
||||
@@ -195,12 +195,12 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx,
|
||||
|
||||
addr = dstsec->sh_addr + rel.r_offset;
|
||||
|
||||
/* If CONFIG_ADDRENV=y, then 'addr' lies in a virtual address space that
|
||||
/* If CONFIG_ARCH_ADDRENV=y, then 'addr' lies in a virtual address space that
|
||||
* may not be in place now. elf_addrenv_select() will temporarily
|
||||
* instantiate that address space.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = elf_addrenv_select(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -214,7 +214,7 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx,
|
||||
ret = arch_relocate(&rel, &sym, addr);
|
||||
if (ret < 0)
|
||||
{
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
(void)elf_addrenv_restore(loadinfo);
|
||||
#endif
|
||||
bdbg("ERROR: Section %d reloc %d: Relocation failed: %d\n", ret);
|
||||
@@ -223,7 +223,7 @@ static int elf_relocate(FAR struct elf_loadinfo_s *loadinfo, int relidx,
|
||||
|
||||
/* Restore the original address environment */
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = elf_addrenv_restore(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
@@ -165,12 +165,12 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo)
|
||||
|
||||
if (shdr->sh_type != SHT_NOBITS)
|
||||
{
|
||||
/* If CONFIG_ADDRENV=y, then 'dest' lies in a virtual address space
|
||||
/* If CONFIG_ARCH_ADDRENV=y, then 'dest' lies in a virtual address space
|
||||
* that may not be in place now. elf_addrenv_select() will
|
||||
* temporarily instantiate that address space.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = elf_addrenv_select(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -190,7 +190,7 @@ static inline int elf_loadfile(FAR struct elf_loadinfo_s *loadinfo)
|
||||
|
||||
/* Restore the original address environment */
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = elf_addrenv_restore(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
@@ -102,7 +102,7 @@ static inline void elf_dumpreaddata(char *buffer, int buflen)
|
||||
* read into 'buffer.' If 'buffer' is part of the ELF address environment,
|
||||
* then the caller is responsibile for assuring that that address
|
||||
* environment is in place before calling this function (i.e., that
|
||||
* elf_addrenv_select() has been called if CONFIG_ADDRENV=y).
|
||||
* elf_addrenv_select() has been called if CONFIG_ARCH_ADDRENV=y).
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 (OK) is returned on success and a negated errno is returned on
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
* Name: nxflat_addrenv_alloc
|
||||
*
|
||||
* Description:
|
||||
* Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n,
|
||||
* elfalloc will be allocated using kzalloc(). If CONFIG_ADDRENV-y, then
|
||||
* Allocate memory for the ELF image (elfalloc). If CONFIG_ARCH_ADDRENV=n,
|
||||
* elfalloc will be allocated using kzalloc(). If CONFIG_ARCH_ADDRENV-y, then
|
||||
* elfalloc will be allocated using up_addrenv_create(). In either case,
|
||||
* there will be a unique instance of elfalloc (and stack) for each
|
||||
* instance of a process.
|
||||
@@ -91,7 +91,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# define nxflat_addrenv_select(l) up_addrenv_select((l)->addrenv, &(l)->oldenv)
|
||||
#endif
|
||||
|
||||
@@ -109,7 +109,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# define nxflat_addrenv_restore(l) up_addrenv_restore((l)->oldenv)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@
|
||||
* Name: nxflat_addrenv_alloc
|
||||
*
|
||||
* Description:
|
||||
* Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n,
|
||||
* elfalloc will be allocated using kuzalloc(). If CONFIG_ADDRENV-y, then
|
||||
* Allocate memory for the ELF image (elfalloc). If CONFIG_ARCH_ADDRENV=n,
|
||||
* elfalloc will be allocated using kuzalloc(). If CONFIG_ARCH_ADDRENV-y, then
|
||||
* elfalloc will be allocated using up_addrenv_create(). In either case,
|
||||
* there will be a unique instance of elfalloc (and stack) for each
|
||||
* instance of a process.
|
||||
@@ -87,7 +87,7 @@
|
||||
int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
|
||||
{
|
||||
FAR struct dspace_s *dspace;
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
FAR void *vaddr;
|
||||
hw_addrenv_t oldenv;
|
||||
int ret;
|
||||
@@ -104,7 +104,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Create a D-Space address environment for the new NXFLAT task */
|
||||
|
||||
ret = up_addrenv_create(envsize, &loadinfo->addrenv);
|
||||
@@ -198,7 +198,7 @@ errout_with_dspace:
|
||||
void nxflat_addrenv_free(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
{
|
||||
FAR struct dspace_s *dspace;
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
@@ -207,7 +207,7 @@ void nxflat_addrenv_free(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
|
||||
if (dspace)
|
||||
{
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Destroy the address environment */
|
||||
|
||||
ret = up_addrenv_destroy(loadinfo->addrenv);
|
||||
|
||||
@@ -255,13 +255,13 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
(long)loadinfo->isize, loadinfo->dspace->region, relocs);
|
||||
|
||||
/* All relocations are performed within the D-Space allocation. If
|
||||
* CONFIG_ADDRENV=y, then that D-Space allocation lies in an address
|
||||
* CONFIG_ARCH_ADDRENV=y, then that D-Space allocation lies in an address
|
||||
* environment that may not be in place. So, in that case, we must call
|
||||
* nxflat_addrenv_select to temporarily instantiate that address space
|
||||
* before the relocations can be performed.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = nxflat_addrenv_select(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -355,7 +355,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
|
||||
/* Restore the original address environment */
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = nxflat_addrenv_restore(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -390,7 +390,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
char *symname;
|
||||
uint32_t offset;
|
||||
uint16_t nimports;
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
int ret;
|
||||
#endif
|
||||
int i;
|
||||
@@ -408,13 +408,13 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
bvdbg("Imports offset: %08x nimports: %d\n", offset, nimports);
|
||||
|
||||
/* The import[] table resides within the D-Space allocation. If
|
||||
* CONFIG_ADDRENV=y, then that D-Space allocation lies in an address
|
||||
* CONFIG_ARCH_ADDRENV=y, then that D-Space allocation lies in an address
|
||||
* environment that may not be in place. So, in that case, we must call
|
||||
* nxflat_addrenv_select to temporarily instantiate that address space
|
||||
* before the import[] table can be modified.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = nxflat_addrenv_select(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -474,7 +474,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
if (!symbol)
|
||||
{
|
||||
bdbg("Exported symbol \"%s\" not found\n", symname);
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
(void)nxflat_addrenv_restore(loadinfo);
|
||||
#endif
|
||||
return -ENOENT;
|
||||
@@ -500,7 +500,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
|
||||
/* Restore the original address environment */
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = nxflat_addrenv_restore(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -527,18 +527,18 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
|
||||
|
||||
static inline int nxflat_clearbss(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
{
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
/* .bss resides within the D-Space allocation. If CONFIG_ADDRENV=y, then
|
||||
/* .bss resides within the D-Space allocation. If CONFIG_ARCH_ADDRENV=y, then
|
||||
* that D-Space allocation lies in an address environment that may not be
|
||||
* in place. So, in that case, we must call nxflat_addrenv_select to
|
||||
* temporarily instantiate that address space before the .bss can be
|
||||
* accessed.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = nxflat_addrenv_select(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -554,7 +554,7 @@ static inline int nxflat_clearbss(FAR struct nxflat_loadinfo_s *loadinfo)
|
||||
|
||||
/* Restore the original address environment */
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = nxflat_addrenv_restore(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
@@ -170,13 +170,13 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
|
||||
bvdbg("Allocated DSpace (%d bytes) at %p\n",
|
||||
loadinfo->dsize, loadinfo->dspace->region);
|
||||
|
||||
/* If CONFIG_ADDRENV=y, then the D-Space allocation lies in an address
|
||||
/* If CONFIG_ARCH_ADDRENV=y, then the D-Space allocation lies in an address
|
||||
* environment that may not be in place. So, in that case, we must call
|
||||
* nxflat_addrenv_select to temporarily instantiate that address space
|
||||
* it can be initialized.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = nxflat_addrenv_select(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -201,7 +201,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
|
||||
|
||||
/* Restore the original address environment */
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
ret = nxflat_addrenv_restore(loadinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -213,7 +213,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
|
||||
return OK;
|
||||
|
||||
errout:
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
(void)nxflat_addrenv_restore(loadinfo);
|
||||
#endif
|
||||
(void)nxflat_unload(loadinfo);
|
||||
|
||||
+2
-2
@@ -199,13 +199,13 @@ static int nxflat_loadbinary(struct binary_s *binp)
|
||||
* a memory leak?
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# warning "REVISIT"
|
||||
#else
|
||||
binp->alloc[0] = (void*)loadinfo.dspace;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ADDRENV
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
/* Save the address environment. This will be needed when the module is
|
||||
* executed for the up_addrenv_assign() call.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user