Integrate PIC support into context switching

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1900 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2009-06-17 23:38:05 +00:00
parent 2afd39df07
commit f876eb552a
13 changed files with 139 additions and 33 deletions
+1 -1
View File
@@ -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 */
+8 -8
View File
@@ -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;