From 83bf4a347c5765e1ce7bd50cc8440dabe2bd3af9 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 25 Aug 2014 13:28:13 -0600 Subject: Misc changed to get the SAMA5 ELF configuration with address environments working --- nuttx/binfmt/libelf/libelf.h | 4 ++-- nuttx/binfmt/libelf/libelf_addrenv.c | 30 ++++++++++++------------------ nuttx/binfmt/libnxflat/libnxflat.h | 4 ++-- nuttx/binfmt/libnxflat/libnxflat_addrenv.c | 4 ++-- 4 files changed, 18 insertions(+), 24 deletions(-) (limited to 'nuttx/binfmt') diff --git a/nuttx/binfmt/libelf/libelf.h b/nuttx/binfmt/libelf/libelf.h index 8763e0808..a8ab2a48f 100644 --- a/nuttx/binfmt/libelf/libelf.h +++ b/nuttx/binfmt/libelf/libelf.h @@ -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 /**************************************************************************** diff --git a/nuttx/binfmt/libelf/libelf_addrenv.c b/nuttx/binfmt/libelf/libelf_addrenv.c index b112d869f..a67070fd1 100644 --- a/nuttx/binfmt/libelf/libelf_addrenv.c +++ b/nuttx/binfmt/libelf/libelf_addrenv.c @@ -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; } diff --git a/nuttx/binfmt/libnxflat/libnxflat.h b/nuttx/binfmt/libnxflat/libnxflat.h index 5c020414b..bcb88bdc6 100644 --- a/nuttx/binfmt/libnxflat/libnxflat.h +++ b/nuttx/binfmt/libnxflat/libnxflat.h @@ -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 /**************************************************************************** diff --git a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c index 825135fc5..86c50d7a2 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c +++ b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c @@ -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: -- cgit v1.2.3