Changeset a35b458 in mainline for kernel/genarch/src/mm


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.

Location:
kernel/genarch/src/mm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/mm/as_ht.c

    r3061bc1 ra35b458  
    7979                    NULL, NULL, SLAB_CACHE_MAGDEFERRED);
    8080        }
    81        
     81
    8282        return NULL;
    8383}
  • kernel/genarch/src/mm/as_pt.c

    r3061bc1 ra35b458  
    7575        pte_t *dst_ptl0 = (pte_t *)
    7676            PA2KA(frame_alloc(PTL0_FRAMES, FRAME_LOWMEM, PTL0_SIZE - 1));
    77        
     77
    7878        if (flags & FLAG_AS_KERNEL)
    7979                memsetb(dst_ptl0, PTL0_SIZE, 0);
     
    8282                 * Copy the kernel address space portion to new PTL0.
    8383                 */
    84                
     84
    8585                mutex_lock(&AS_KERNEL->lock);
    86                
     86
    8787                pte_t *src_ptl0 =
    8888                    (pte_t *) PA2KA((uintptr_t) AS_KERNEL->genarch.page_table);
    89                
     89
    9090                uintptr_t src = (uintptr_t)
    9191                    &src_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];
    9292                uintptr_t dst = (uintptr_t)
    9393                    &dst_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];
    94                
     94
    9595                memsetb(dst_ptl0, PTL0_SIZE, 0);
    9696                memcpy((void *) dst, (void *) src,
    9797                    PTL0_SIZE - (src - (uintptr_t) src_ptl0));
    98                
     98
    9999                mutex_unlock(&AS_KERNEL->lock);
    100100        }
    101        
     101
    102102        return (pte_t *) KA2PA((uintptr_t) dst_ptl0);
    103103}
  • kernel/genarch/src/mm/asid.c

    r3061bc1 ra35b458  
    8484         * Check if there is an unallocated ASID.
    8585         */
    86        
     86
    8787        if (asids_allocated == ASIDS_ALLOCABLE) {
    8888
     
    9191                 * Resort to stealing.
    9292                 */
    93                
     93
    9494                /*
    9595                 * Remove the first item on the list.
     
    100100                assert(tmp != NULL);
    101101                list_remove(tmp);
    102                
     102
    103103                as = list_get_instance(tmp, as_t, inactive_as_with_asid_link);
    104104
     
    115115                 */
    116116                as->asid = ASID_INVALID;
    117                
     117
    118118                /*
    119119                 * If the architecture uses some software cache
     
    122122                 */
    123123                as_invalidate_translation_cache(as, 0, (size_t) -1);
    124                
     124
    125125                /*
    126126                 * Get the system rid of the stolen ASID.
     
    146146                tlb_shootdown_finalize(ipl);
    147147        }
    148        
     148
    149149        return asid;
    150150}
  • kernel/genarch/src/mm/asid_fifo.c

    r3061bc1 ra35b458  
    3030 * @{
    3131 */
    32  
     32
    3333/**
    3434 * @file
     
    6666        fifo_create(free_asids);
    6767#endif
    68                
     68
    6969        for (i = 0; i < ASIDS_ALLOCABLE; i++) {
    7070                fifo_push(free_asids, ASID_START + i);
  • kernel/genarch/src/mm/page_ht.c

    r3061bc1 ra35b458  
    135135{
    136136        assert(item);
    137        
     137
    138138        pte_t *pte = hash_table_get_inst(item, pte_t, link);
    139139        slab_free(pte_cache, pte);
     
    162162
    163163        irq_spinlock_lock(&page_ht_lock, true);
    164        
     164
    165165        if (!hash_table_find(&page_ht, key)) {
    166166                pte_t *pte = slab_alloc(pte_cache, FRAME_LOWMEM | FRAME_ATOMIC);
    167167                assert(pte != NULL);
    168                
     168
    169169                pte->g = (flags & PAGE_GLOBAL) != 0;
    170170                pte->x = (flags & PAGE_EXEC) != 0;
     
    175175                pte->a = false;
    176176                pte->d = false;
    177                
     177
    178178                pte->as = as;
    179179                pte->page = ALIGN_DOWN(page, PAGE_SIZE);
     
    185185                 */
    186186                write_barrier();
    187                
     187
    188188                hash_table_insert(&page_ht, &pte->link);
    189189        }
     
    210210
    211211        assert(page_table_locked(as));
    212        
     212
    213213        irq_spinlock_lock(&page_ht_lock, true);
    214214
     
    235235        if (cur)
    236236                return hash_table_get_inst(cur, pte_t, link);
    237        
     237
    238238        return NULL;
    239239}
     
    257257
    258258        irq_spinlock_unlock(&page_ht_lock, true);
    259        
     259
    260260        return t != NULL;
    261261}
     
    275275        if (!t)
    276276                panic("Updating non-existent PTE");
    277        
     277
    278278        assert(pte->as == t->as);
    279279        assert(pte->page == t->page);
  • kernel/genarch/src/mm/page_pt.c

    r3061bc1 ra35b458  
    8383
    8484        assert(page_table_locked(as));
    85        
     85
    8686        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) {
    8787                pte_t *newpt = (pte_t *)
     
    100100                SET_PTL1_PRESENT(ptl0, PTL0_INDEX(page));
    101101        }
    102        
     102
    103103        pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
    104        
     104
    105105        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) {
    106106                pte_t *newpt = (pte_t *)
     
    117117                SET_PTL2_PRESENT(ptl1, PTL1_INDEX(page));
    118118        }
    119        
     119
    120120        pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
    121        
     121
    122122        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) {
    123123                pte_t *newpt = (pte_t *)
     
    134134                SET_PTL3_PRESENT(ptl2, PTL2_INDEX(page));
    135135        }
    136        
     136
    137137        pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
    138        
     138
    139139        SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame);
    140140        SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags | PAGE_NOT_PRESENT);
     
    165165         * First, remove the mapping, if it exists.
    166166         */
    167        
     167
    168168        pte_t *ptl0 = (pte_t *) PA2KA((uintptr_t) as->genarch.page_table);
    169169        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT)
    170170                return;
    171        
     171
    172172        pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
    173173        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT)
    174174                return;
    175        
     175
    176176        pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
    177177        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT)
    178178                return;
    179        
     179
    180180        pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
    181        
     181
    182182        /*
    183183         * Destroy the mapping.
     
    189189        SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), PAGE_NOT_PRESENT);
    190190        memsetb(&ptl3[PTL3_INDEX(page)], sizeof(pte_t), 0);
    191        
     191
    192192        /*
    193193         * Second, free all empty tables along the way from PTL3 down to PTL0
    194194         * except those needed for sharing the kernel non-identity mappings.
    195195         */
    196        
     196
    197197        /* Check PTL3 */
    198198        bool empty = true;
    199        
     199
    200200        unsigned int i;
    201201        for (i = 0; i < PTL3_ENTRIES; i++) {
     
    205205                }
    206206        }
    207        
     207
    208208        if (empty) {
    209209                /*
     
    232232                return;
    233233        }
    234        
     234
    235235        /* Check PTL2, empty is still true */
    236236#if (PTL2_ENTRIES != 0)
     
    241241                }
    242242        }
    243        
     243
    244244        if (empty) {
    245245                /*
     
    267267        }
    268268#endif /* PTL2_ENTRIES != 0 */
    269        
     269
    270270        /* check PTL1, empty is still true */
    271271#if (PTL1_ENTRIES != 0)
     
    276276                }
    277277        }
    278        
     278
    279279        if (empty) {
    280280                /*
     
    301301
    302302        read_barrier();
    303        
     303
    304304        pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
    305305        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT)
     
    312312        read_barrier();
    313313#endif
    314        
     314
    315315        pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
    316316        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT)
     
    323323        read_barrier();
    324324#endif
    325        
     325
    326326        pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
    327        
     327
    328328        return &ptl3[PTL3_INDEX(page)];
    329329}
     
    400400{
    401401        assert(size > 0);
    402        
     402
    403403        uintptr_t ptl0 = PA2KA((uintptr_t) AS_KERNEL->genarch.page_table);
    404404        uintptr_t ptl0_step = ptl0_step_get();
    405405        size_t frames;
    406        
     406
    407407#if (PTL1_ENTRIES != 0)
    408408        frames = PTL1_FRAMES;
     
    412412        frames = PTL3_FRAMES;
    413413#endif
    414        
     414
    415415        for (uintptr_t addr = ALIGN_DOWN(base, ptl0_step);
    416416            addr - 1 < base + size - 1;
Note: See TracChangeset for help on using the changeset viewer.