binfmt/: More spacing/alignment fixes

This commit is contained in:
Gregory Nutt
2015-10-08 19:20:17 -06:00
parent fcb55102f9
commit 45eebacbb4
21 changed files with 61 additions and 54 deletions
+1 -1
View File
@@ -244,7 +244,7 @@ FAR char *exepath_next(EXEPATH_HANDLE handle, FAR const char *relpath)
/* Verify that a regular file exists at this path */
ret = stat(fullpath, &buf);;
ret = stat(fullpath, &buf);
if (ret == OK && S_ISREG(buf.st_mode))
{
return fullpath;
+1 -1
View File
@@ -84,7 +84,7 @@ FAR struct binary_s *g_unloadhead;
* pid - The task ID of the child task
* bin - This structure must have been allocated with kmm_malloc() and must
* persist until the task unloads
*
*
* Returned Value:
* None
+2 -2
View File
@@ -68,9 +68,9 @@
****************************************************************************/
#if defined(ELF_DUMP_READDATA)
static inline void elf_dumpreaddata(char *buffer, int buflen)
static inline void elf_dumpreaddata(FAR char *buffer, int buflen)
{
uint32_t *buf32 = (uint32_t*)buffer;
FAR uint32_t *buf32 = (FAR uint32_t *)buffer;
int i;
int j;
+5 -3
View File
@@ -211,16 +211,18 @@ int elf_loadshdrs(FAR struct elf_loadinfo_s *loadinfo)
/* Allocate memory to hold a working copy of the sector header table */
loadinfo->shdr = (FAR Elf32_Shdr*)kmm_malloc(shdrsize);
loadinfo->shdr = (FAR FAR Elf32_Shdr *)kmm_malloc(shdrsize);
if (!loadinfo->shdr)
{
bdbg("Failed to allocate the section header table. Size: %ld\n", (long)shdrsize);
bdbg("Failed to allocate the section header table. Size: %ld\n",
(long)shdrsize);
return -ENOMEM;
}
/* Read the section header table into memory */
ret = elf_read(loadinfo, (FAR uint8_t*)loadinfo->shdr, shdrsize, loadinfo->ehdr.e_shoff);
ret = elf_read(loadinfo, (FAR uint8_t *)loadinfo->shdr, shdrsize,
loadinfo->ehdr.e_shoff);
if (ret < 0)
{
bdbg("Failed to read section header table: %d\n", ret);
+4 -1
View File
@@ -53,7 +53,10 @@
* Private Constant Data
****************************************************************************/
static const char g_elfmagic[EI_MAGIC_SIZE] = { 0x7f, 'E', 'L', 'F' };
static const char g_elfmagic[EI_MAGIC_SIZE] =
{
0x7f, 'E', 'L', 'F'
};
/****************************************************************************
* Private Functions
+9 -9
View File
@@ -102,14 +102,14 @@
static inline int nxflat_bindrel32i(FAR struct nxflat_loadinfo_s *loadinfo,
uint32_t offset)
{
uint32_t *addr;
FAR uint32_t *addr;
bvdbg("NXFLAT_RELOC_TYPE_REL32I Offset: %08x I-Space: %p\n",
offset, loadinfo->ispace + sizeof(struct nxflat_hdr_s));
if (offset < loadinfo->dsize)
{
addr = (uint32_t*)(offset + loadinfo->dspace->region);
addr = (FAR uint32_t *)(offset + loadinfo->dspace->region);
bvdbg(" Before: %08x\n", *addr);
*addr += (uint32_t)(loadinfo->ispace + sizeof(struct nxflat_hdr_s));
bvdbg(" After: %08x\n", *addr);
@@ -141,14 +141,14 @@ static inline int nxflat_bindrel32i(FAR struct nxflat_loadinfo_s *loadinfo,
static inline int nxflat_bindrel32d(FAR struct nxflat_loadinfo_s *loadinfo,
uint32_t offset)
{
uint32_t *addr;
FAR uint32_t *addr;
bvdbg("NXFLAT_RELOC_TYPE_REL32D Offset: %08x D-Space: %p\n",
offset, loadinfo->dspace->region);
if (offset < loadinfo->dsize)
{
addr = (uint32_t*)(offset + loadinfo->dspace->region);
addr = (FAR uint32_t *)(offset + loadinfo->dspace->region);
bvdbg(" Before: %08x\n", *addr);
*addr += (uint32_t)(loadinfo->dspace->region);
bvdbg(" After: %08x\n", *addr);
@@ -183,14 +183,14 @@ static inline int nxflat_bindrel32d(FAR struct nxflat_loadinfo_s *loadinfo,
static inline int nxflat_bindrel32id(FAR struct nxflat_loadinfo_s *loadinfo,
uint32_t offset)
{
uint32_t *addr;
FAR uint32_t *addr;
bvdbg("NXFLAT_RELOC_TYPE_REL32D Offset: %08x D-Space: %p\n",
offset, loadinfo->dspace->region);
if (offset < loadinfo->dsize)
{
addr = (uint32_t*)(offset + loadinfo->dspace->region);
addr = (FAR uint32_t *)(offset + loadinfo->dspace->region);
bvdbg(" Before: %08x\n", *addr);
*addr += ((uint32_t)loadinfo->ispace - (uint32_t)(loadinfo->dspace->region));
bvdbg(" After: %08x\n", *addr);
@@ -440,7 +440,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
DEBUGASSERT(offset >= loadinfo->isize &&
offset < loadinfo->isize + loadinfo->dsize);
imports = (struct nxflat_import_s*)
imports = (FAR struct nxflat_import_s *)
(offset - loadinfo->isize + loadinfo->dspace->region);
/* Now, traverse the list of imported symbols and attempt to bind
@@ -462,7 +462,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
offset = imports[i].i_funcname;
DEBUGASSERT(offset < loadinfo->isize);
symname = (char*)(offset + loadinfo->ispace + sizeof(struct nxflat_hdr_s));
symname = (FAR char *)(offset + loadinfo->ispace + sizeof(struct nxflat_hdr_s));
/* Find the exported symbol value for this this symbol name. */
@@ -549,7 +549,7 @@ static inline int nxflat_clearbss(FAR struct nxflat_loadinfo_s *loadinfo)
/* Zero the BSS area */
memset((void*)(loadinfo->dspace->region + loadinfo->datasize), 0,
memset((FAR void *)(loadinfo->dspace->region + loadinfo->datasize), 0,
loadinfo->bsssize);
/* Restore the original address environment */
+2 -1
View File
@@ -118,13 +118,14 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo)
/* Read the NXFLAT header from offset 0 */
ret = nxflat_read(loadinfo, (char*)&loadinfo->header,
ret = nxflat_read(loadinfo, (FAR 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 uint8_t *)&loadinfo->header,
sizeof(struct nxflat_hdr_s));
+2 -1
View File
@@ -189,7 +189,8 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
* DSpace memory.
*/
ret = nxflat_read(loadinfo, (char*)loadinfo->dspace->region, dreadsize, doffset);
ret = nxflat_read(loadinfo, (FAR char *)loadinfo->dspace->region,
dreadsize, doffset);
if (ret < 0)
{
bdbg("Failed to read .data section: %d\n", ret);
+2 -2
View File
@@ -69,9 +69,9 @@
****************************************************************************/
#if defined(NXFLAT_DUMP_READDATA)
static inline void nxflat_dumpreaddata(char *buffer, int buflen)
static inline void nxflat_dumpreaddata(FAR char *buffer, int buflen)
{
uint32_t *buf32 = (uint32_t*)buffer;
FAR uint32_t *buf32 = (FAR uint32_t *)buffer;
int i;
int j;
+2 -2
View File
@@ -79,14 +79,14 @@
*
****************************************************************************/
int nxflat_unload(struct nxflat_loadinfo_s *loadinfo)
int nxflat_unload(FAR struct nxflat_loadinfo_s *loadinfo)
{
/* Release the memory segments */
/* Release the I-Space mmap'ed file */
if (loadinfo->ispace)
{
munmap((void*)loadinfo->ispace, loadinfo->isize);
munmap((FAR void *)loadinfo->ispace, loadinfo->isize);
loadinfo->ispace = 0;
}
+2 -2
View File
@@ -187,7 +187,7 @@ static int nxflat_loadbinary(struct binary_s *binp)
*/
binp->entrypt = (main_t)(loadinfo.ispace + loadinfo.entryoffs);
binp->mapped = (void*)loadinfo.ispace;
binp->mapped = (FAR void *)loadinfo.ispace;
binp->mapsize = loadinfo.isize;
binp->stacksize = loadinfo.stacksize;
@@ -202,7 +202,7 @@ static int nxflat_loadbinary(struct binary_s *binp)
#ifdef CONFIG_ARCH_ADDRENV
# warning "REVISIT"
#else
binp->alloc[0] = (void*)loadinfo.dspace;
binp->alloc[0] = (FAR void *)loadinfo.dspace;
#endif
#ifdef CONFIG_ARCH_ADDRENV