mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
Misc changed to get the SAMA5 ELF configuration with address environments working
This commit is contained in:
@@ -301,7 +301,7 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t textsize,
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# define elf_addrenv_select(l) up_addrenv_select((l)->addrenv, &(l)->oldenv)
|
||||
# define elf_addrenv_select(l) up_addrenv_select(&(l)->addrenv, &(l)->oldenv)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@@ -319,7 +319,7 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t textsize,
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# define elf_addrenv_restore(l) up_addrenv_restore((l)->oldenv)
|
||||
# define elf_addrenv_restore(l) up_addrenv_restore(&(l)->oldenv)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -109,21 +109,21 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t textsize,
|
||||
* selected.
|
||||
*/
|
||||
|
||||
ret = up_addrenv_vtext(loadinfo->addrenv, &vtext);
|
||||
ret = up_addrenv_vtext(&loadinfo->addrenv, &vtext);
|
||||
if (ret < 0)
|
||||
{
|
||||
bdbg("ERROR: up_addrenv_vtext failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = up_addrenv_vdata(loadinfo->addrenv, textsize, &vdata);
|
||||
ret = up_addrenv_vdata(&loadinfo->addrenv, textsize, &vdata);
|
||||
if (ret < 0)
|
||||
{
|
||||
bdbg("ERROR: up_adup_addrenv_vdatadrenv_vtext failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
loadinfo->textalloc = (uintptr_t)vaddr;
|
||||
loadinfo->textalloc = (uintptr_t)vtext;
|
||||
loadinfo->dataalloc = (uintptr_t)vdata;
|
||||
return OK;
|
||||
#else
|
||||
@@ -163,21 +163,13 @@ void elf_addrenv_free(FAR struct elf_loadinfo_s *loadinfo)
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
int ret;
|
||||
|
||||
/* Free the address environemnt */
|
||||
/* Free the address environment */
|
||||
|
||||
ret = up_addrenv_destroy(loadinfo->addrenv);
|
||||
ret = up_addrenv_destroy(&loadinfo->addrenv);
|
||||
if (ret < 0)
|
||||
{
|
||||
bdbg("ERROR: up_addrenv_destroy failed: %d\n", ret);
|
||||
}
|
||||
|
||||
/* Clear out all indications of the allocated address environment */
|
||||
|
||||
loadinfo->textalloc = 0;
|
||||
loadinfo->dataalloc = 0;
|
||||
loadinfo->textsize = 0;
|
||||
loadinfo->datasize = 0;
|
||||
loadinfo->addrenv = 0;
|
||||
#else
|
||||
/* If there is an allocation for the ELF image, free it */
|
||||
|
||||
@@ -185,10 +177,12 @@ void elf_addrenv_free(FAR struct elf_loadinfo_s *loadinfo)
|
||||
{
|
||||
kufree((FAR void *)loadinfo->textalloc);
|
||||
}
|
||||
|
||||
loadinfo->textalloc = 0;
|
||||
loadinfo->dataalloc = 0;
|
||||
loadinfo->textsize = 0;
|
||||
loadinfo->datasize = 0;
|
||||
#endif
|
||||
|
||||
/* Clear out all indications of the allocated address environment */
|
||||
|
||||
loadinfo->textalloc = 0;
|
||||
loadinfo->dataalloc = 0;
|
||||
loadinfo->textsize = 0;
|
||||
loadinfo->datasize = 0;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# define nxflat_addrenv_select(l) up_addrenv_select((l)->addrenv, &(l)->oldenv)
|
||||
# define nxflat_addrenv_select(l) up_addrenv_select(&(l)->addrenv, &(l)->oldenv)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@@ -108,7 +108,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# define nxflat_addrenv_restore(l) up_addrenv_restore((l)->oldenv)
|
||||
# define nxflat_addrenv_restore(l) up_addrenv_restore(&(l)->oldenv)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -118,7 +118,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
|
||||
* selected.
|
||||
*/
|
||||
|
||||
ret = up_addrenv_vdata(loadinfo->addrenv, 0, &vdata);
|
||||
ret = up_addrenv_vdata(&loadinfo->addrenv, 0, &vdata);
|
||||
if (ret < 0)
|
||||
{
|
||||
bdbg("ERROR: up_addrenv_vdata failed: %d\n", ret);
|
||||
@@ -153,7 +153,7 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
|
||||
return OK;
|
||||
|
||||
errout_with_addrenv:
|
||||
(void)up_addrenv_destroy(loadinfo->addrenv);
|
||||
(void)up_addrenv_destroy(&loadinfo->addrenv);
|
||||
loadinfo->addrenv = 0;
|
||||
|
||||
errout_with_dspace:
|
||||
|
||||
Reference in New Issue
Block a user