summaryrefslogtreecommitdiffstats
path: root/nuttx/binfmt
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2009-06-17 23:38:05 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2009-06-17 23:38:05 +0000
commit340f9673f39088001e07d4337c33250ea768a364 (patch)
tree4b5911ef52d216a622db785fddf36eb72c5c3512 /nuttx/binfmt
parent4d89bbea4598f60f733b00b455c7614c52a6dc98 (diff)
Integrate PIC support into context switching
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1900 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r--nuttx/binfmt/binfmt_execmodule.c2
-rw-r--r--nuttx/binfmt/libnxflat/libnxflat_load.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/nuttx/binfmt/binfmt_execmodule.c b/nuttx/binfmt/binfmt_execmodule.c
index de65c15cf2..21fe559874 100644
--- a/nuttx/binfmt/binfmt_execmodule.c
+++ b/nuttx/binfmt/binfmt_execmodule.c
@@ -145,7 +145,7 @@ int exec_module(FAR const struct binary_s *bin, int priority)
/* Add the DSpace address as the PIC base address */
#ifdef CONFIG_PIC
- tcb->picbase = bin->dspace;
+ tcb->dspace = bin->dspace;
/* Re-initialize the task's initial state to account for the new PIC base */
diff --git a/nuttx/binfmt/libnxflat/libnxflat_load.c b/nuttx/binfmt/libnxflat/libnxflat_load.c
index aa00f50c75..b27dca9356 100644
--- a/nuttx/binfmt/libnxflat/libnxflat_load.c
+++ b/nuttx/binfmt/libnxflat/libnxflat_load.c
@@ -118,7 +118,7 @@ static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl)
* DSpace to hold information needed by ld.so at run time.
*/
- datastart = loadinfo->dspace;
+ datastart = (uint32)loadinfo->dspace->region;
/* Get a pointer to the value that needs relocation in
* DSpace.
@@ -257,22 +257,22 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
* uninitialized ISpace memory.
*/
- loadinfo->dspace = (uint32)malloc(loadinfo->dsize);
+ loadinfo->dspace = (struct dspace_s *)malloc(SIZEOF_DSPACE_S(loadinfo->dsize));
if (loadinfo->dspace == 0)
{
bdbg("Failed to allocate DSpace\n");
ret = -ENOMEM;
goto errout;
}
+ loadinfo->dspace->crefs = 1;
- bvdbg("Allocated DSpace (%d bytes) at %08x\n",
- loadinfo->dsize, loadinfo->dspace);
+ bvdbg("Allocated DSpace (%d bytes) at %p\n", loadinfo->dsize, loadinfo->dspace);
/* Now, read the data into allocated DSpace at doffset into the
* allocated DSpace memory.
*/
- ret = nxflat_read(loadinfo, (char*)loadinfo->dspace, dreadsize, doffset);
+ ret = nxflat_read(loadinfo, (char*)loadinfo->dspace->region, dreadsize, doffset);
if (ret < 0)
{
bdbg("Failed to read .data section: %d\n", ret);
@@ -285,10 +285,10 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
/* Resolve the address of the relocation table. In the file, the
* relocations should lie at the same offset as BSS. The current
* value of relocstart is the offset from the beginning of the file.
- * The following adjustment will convert it to an address in DSpace.
+ * The following adjustment will convert it to an address in dspace->
*/
- reloctab = (uint32*)(loadinfo->relocstart + loadinfo->dspace - loadinfo->isize);
+ reloctab = (uint32*)(loadinfo->relocstart + (uint32)loadinfo->dspace->region - loadinfo->isize);
bvdbg("Relocation table at 0x%p, reloccount=%d\n",
reloctab, loadinfo->reloccount);
@@ -304,7 +304,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
* in the file.
*/
- memset((void*)(loadinfo->dspace + loadinfo->datasize),
+ memset((void*)(loadinfo->dspace->region + loadinfo->datasize),
0, loadinfo->bsssize);
return OK;