diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-06-25 21:59:30 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-06-25 21:59:30 +0000 |
commit | ae9d6c8fa77b4f18594f11b603d27a9a8146a632 (patch) | |
tree | f1c3ddab7c38ffff9f9e1ed662bed53bb6267625 /nuttx/binfmt/libnxflat | |
parent | 78ebab4466b64dcbfbef471e78827af90ee753e6 (diff) | |
download | px4-nuttx-ae9d6c8fa77b4f18594f11b603d27a9a8146a632.tar.gz px4-nuttx-ae9d6c8fa77b4f18594f11b603d27a9a8146a632.tar.bz2 px4-nuttx-ae9d6c8fa77b4f18594f11b603d27a9a8146a632.zip |
Mostly cosmetic integration changes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1953 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt/libnxflat')
-rw-r--r-- | nuttx/binfmt/libnxflat/libnxflat_bind.c | 14 | ||||
-rw-r--r-- | nuttx/binfmt/libnxflat/libnxflat_init.c | 49 |
2 files changed, 37 insertions, 26 deletions
diff --git a/nuttx/binfmt/libnxflat/libnxflat_bind.c b/nuttx/binfmt/libnxflat/libnxflat_bind.c index 84ef3a9a3..4e89a76ec 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_bind.c +++ b/nuttx/binfmt/libnxflat/libnxflat_bind.c @@ -54,17 +54,15 @@ * Pre-processor Definitions ****************************************************************************/ -#undef NXFLAT_DUMPBUFFER /* Define to enable very verbose buffer dumping */ - /* CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE, and CONFIG_DEBUG_BINFMT have to be - * defined or NXFLAT_DUMPBUFFER does nothing. + * defined or CONFIG_NXFLAT_DUMPBUFFER does nothing. */ #if !defined(CONFIG_DEBUG_VERBOSE) || !defined (CONFIG_DEBUG_BINFMT) -# undef NXFLAT_DUMPBUFFER +# undef CONFIG_NXFLAT_DUMPBUFFER #endif -#ifdef NXFLAT_DUMPBUFFER +#ifdef CONFIG_NXFLAT_DUMPBUFFER # define nxflat_dumpbuffer(m,b,n) bvdbgdumpbuffer(m,b,n) #else # define nxflat_dumpbuffer(m,b,n) @@ -319,7 +317,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo) /* Dump the relocation got */ -#ifdef NXFLAT_DUMPBUFFER +#ifdef CONFIG_NXFLAT_DUMPBUFFER if (ret == OK && nrelocs > 0) { relocs = (FAR struct nxflat_reloc_s*)(offset - loadinfo->isize + loadinfo->dspace->region); @@ -421,14 +419,14 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo, imports[i].i_funcaddress = (uint32)symbol->sym_value; - bvdbg("Bound import %d (%08p) to export 's' (%08x)\n", + bvdbg("Bound import %d (%08p) to export '%s' (%08x)\n", i, &imports[i], symname, imports[i].i_funcaddress); } } /* Dump the relocation import table */ -#ifdef NXFLAT_DUMPBUFFER +#ifdef CONFIG_NXFLAT_DUMPBUFFER if (nimports > 0) { nxflat_dumpbuffer("Imports", (FAR const ubyte*)imports, nimports * sizeof(struct nxflat_import_s)); diff --git a/nuttx/binfmt/libnxflat/libnxflat_init.c b/nuttx/binfmt/libnxflat/libnxflat_init.c index 6a7a98748..321c90e51 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_init.c +++ b/nuttx/binfmt/libnxflat/libnxflat_init.c @@ -54,6 +54,20 @@ * Pre-Processor Definitions ****************************************************************************/ +/* CONFIG_DEBUG, CONFIG_DEBUG_VERBOSE, and CONFIG_DEBUG_BINFMT have to be + * defined or CONFIG_NXFLAT_DUMPBUFFER does nothing. + */ + +#if !defined(CONFIG_DEBUG_VERBOSE) || !defined (CONFIG_DEBUG_BINFMT) +# undef CONFIG_NXFLAT_DUMPBUFFER +#endif + +#ifdef CONFIG_NXFLAT_DUMPBUFFER +# define nxflat_dumpbuffer(m,b,n) bvdbgdumpbuffer(m,b,n) +#else +# define nxflat_dumpbuffer(m,b,n) +#endif + /**************************************************************************** * Private Constant Data ****************************************************************************/ @@ -79,8 +93,7 @@ * ****************************************************************************/ -int nxflat_init(const char *filename, struct nxflat_hdr_s *header, - struct nxflat_loadinfo_s *loadinfo) +int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo) { uint32 datastart; uint32 dataend; @@ -88,7 +101,7 @@ int nxflat_init(const char *filename, struct nxflat_hdr_s *header, uint32 bssend; int ret; - bvdbg("filename: %s header: %p loadinfo: %p\n", filename, header, loadinfo); + bvdbg("filename: %s loadinfo: %p\n", filename, loadinfo); /* Clear the load info structure */ @@ -105,16 +118,19 @@ int nxflat_init(const char *filename, struct nxflat_hdr_s *header, /* Read the NXFLAT header from offset 0 */ - ret = nxflat_read(loadinfo, (char*)header, sizeof(struct nxflat_hdr_s), 0); + ret = nxflat_read(loadinfo, (char*)&loadinfo->header, + sizeof(struct nxflat_hdr_s), 0); if (ret < 0) { bdbg("Failed to read NXFLAT header: %d\n", ret); return ret; } - + nxflat_dumpbuffer("NXFLAT header", (FAR const ubyte*)&loadinfo->header, + sizeof(struct nxflat_hdr_s)); + /* Verify the NXFLAT header */ - if (nxflat_verifyheader(header) != 0) + if (nxflat_verifyheader(&loadinfo->header) != 0) { /* This is not an error because we will be called to attempt loading * EVERY binary. Returning -ENOEXEC simply informs the system that @@ -127,19 +143,16 @@ int nxflat_init(const char *filename, struct nxflat_hdr_s *header, return -ENOEXEC; } - /* Save all of the input values in the loadinfo structure */ - - loadinfo->header = header; - - /* And extract some additional information from the xflat + /* Save all of the input values in the loadinfo structure + * and extract some additional information from the xflat * header. Note that the information in the xflat header is in * network order. */ - datastart = ntohl(header->h_datastart); - dataend = ntohl(header->h_dataend); + datastart = ntohl(loadinfo->header.h_datastart); + dataend = ntohl(loadinfo->header.h_dataend); bssstart = dataend; - bssend = ntohl(header->h_bssend); + bssend = ntohl(loadinfo->header.h_bssend); /* And put this information into the loadinfo structure as well. * @@ -150,12 +163,12 @@ int nxflat_init(const char *filename, struct nxflat_hdr_s *header, * bsssize = the address range from dataend up to bssend. */ - loadinfo->entryoffs = ntohl(header->h_entry); + loadinfo->entryoffs = ntohl(loadinfo->header.h_entry); loadinfo->isize = datastart; loadinfo->datasize = dataend - datastart; loadinfo->bsssize = bssend - dataend; - loadinfo->stacksize = ntohl(header->h_stacksize); + loadinfo->stacksize = ntohl(loadinfo->header.h_stacksize); /* This is the initial dspace size. We'll re-calculate this later * after the memory has been allocated. @@ -167,8 +180,8 @@ int nxflat_init(const char *filename, struct nxflat_hdr_s *header, * this later). */ - loadinfo->relocstart = ntohl(header->h_relocstart); - loadinfo->reloccount = ntohs(header->h_reloccount); + loadinfo->relocstart = ntohl(loadinfo->header.h_relocstart); + loadinfo->reloccount = ntohs(loadinfo->header.h_reloccount); return 0; } |