Changeset a35b458 in mainline for kernel/generic/src/lib/elf.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/lib/elf.c

    r3061bc1 ra35b458  
    8080            (header->e_ident[EI_MAG3] != ELFMAG3))
    8181                return EE_INVALID;
    82        
     82
    8383        /* Identify ELF compatibility */
    8484        if ((header->e_ident[EI_DATA] != ELF_DATA_ENCODING) ||
     
    8888            (header->e_ident[EI_CLASS] != ELF_CLASS))
    8989                return EE_INCOMPATIBLE;
    90        
     90
    9191        if (header->e_phentsize != sizeof(elf_segment_header_t))
    9292                return EE_INCOMPATIBLE;
    93        
     93
    9494        if (header->e_shentsize != sizeof(elf_section_header_t))
    9595                return EE_INCOMPATIBLE;
    96        
     96
    9797        /* Check if the object type is supported. */
    9898        if (header->e_type != ET_EXEC)
    9999                return EE_UNSUPPORTED;
    100        
     100
    101101        /* Check if the ELF image starts on a page boundary */
    102102        if (ALIGN_UP((uintptr_t) header, PAGE_SIZE) != (uintptr_t) header)
    103103                return EE_UNSUPPORTED;
    104        
     104
    105105        /* Walk through all segment headers and process them. */
    106106        elf_half i;
     
    109109                    &((elf_segment_header_t *)(((uint8_t *) header) +
    110110                    header->e_phoff))[i];
    111                
     111
    112112                int rc = segment_header(seghdr, header, as, flags);
    113113                if (rc != EE_OK)
    114114                        return rc;
    115115        }
    116        
     116
    117117        /* Inspect all section headers and process them. */
    118118        for (i = 0; i < header->e_shnum; i++) {
     
    120120                    &((elf_section_header_t *)(((uint8_t *) header) +
    121121                    header->e_shoff))[i];
    122                
     122
    123123                int rc = section_header(sechdr, header, as);
    124124                if (rc != EE_OK)
    125125                        return rc;
    126126        }
    127        
     127
    128128        return EE_OK;
    129129}
     
    139139{
    140140        assert(rc < sizeof(error_codes) / sizeof(char *));
    141        
     141
    142142        return error_codes[rc];
    143143}
     
    199199        backend_data.elf = elf;
    200200        backend_data.segment = entry;
    201        
     201
    202202        if (entry->p_align > 1) {
    203203                if ((entry->p_offset % entry->p_align) !=
     
    205205                        return EE_INVALID;
    206206        }
    207        
     207
    208208        unsigned int flags = 0;
    209        
     209
    210210        if (entry->p_flags & PF_X)
    211211                flags |= AS_AREA_EXEC;
    212        
     212
    213213        if (entry->p_flags & PF_W)
    214214                flags |= AS_AREA_WRITE;
    215        
     215
    216216        if (entry->p_flags & PF_R)
    217217                flags |= AS_AREA_READ;
    218        
     218
    219219        flags |= AS_AREA_CACHEABLE;
    220        
     220
    221221        /*
    222222         * Align vaddr down, inserting a little "gap" at the beginning.
     
    226226        uintptr_t base = ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE);
    227227        size_t mem_sz = entry->p_memsz + (entry->p_vaddr - base);
    228        
     228
    229229        as_area_t *area = as_area_create(as, flags, mem_sz,
    230230            AS_AREA_ATTR_NONE, &elf_backend, &backend_data, &base, 0);
    231231        if (!area)
    232232                return EE_MEMORY;
    233        
     233
    234234        /*
    235235         * The segment will be mapped on demand by elf_page_fault().
    236236         *
    237237         */
    238        
     238
    239239        return EE_OK;
    240240}
     
    266266                break;
    267267        }
    268        
     268
    269269        return EE_OK;
    270270}
Note: See TracChangeset for help on using the changeset viewer.