Changeset da1bafb in mainline for kernel/arch/ppc32/src/mm/frame.c


Ignore:
Timestamp:
2010-05-24T18:57:31Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0095368
Parents:
666f492
Message:

major code revision

  • replace spinlocks taken with interrupts disabled with irq_spinlocks
  • change spacing (not indendation) to be tab-size independent
  • use unsigned integer types where appropriate (especially bit flags)
  • visual separation
  • remove argument names in function prototypes
  • string changes
  • correct some formating directives
  • replace various cryptic single-character variables (t, a, m, c, b, etc.) with proper identifiers (thread, task, timeout, as, itm, itc, etc.)
  • unify some assembler constructs
  • unused page table levels are now optimized out in compile time
  • replace several ints (with boolean semantics) with bools
  • use specifically sized types instead of generic types where appropriate (size_t, uint32_t, btree_key_t)
  • improve comments
  • split asserts with conjuction into multiple independent asserts
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ppc32/src/mm/frame.c

    r666f492 rda1bafb  
    4545void physmem_print(void)
    4646{
    47         unsigned int i;
    48        
    4947        printf("Base       Size\n");
    5048        printf("---------- ----------\n");
    51                
     49       
     50        size_t i;
    5251        for (i = 0; i < memmap.cnt; i++) {
    5352                printf("%#10x %#10x\n", memmap.zones[i].start,
    54                         memmap.zones[i].size);
     53                    memmap.zones[i].size);
    5554        }
    5655}
     
    6059        pfn_t minconf = 2;
    6160        size_t i;
    62         pfn_t start, conf;
    63         size_t size;
    6461       
    6562        for (i = 0; i < memmap.cnt; i++) {
    66                 start = ADDR2PFN(ALIGN_UP((uintptr_t) memmap.zones[i].start, FRAME_SIZE));
    67                 size = SIZE2FRAMES(ALIGN_DOWN(memmap.zones[i].size, FRAME_SIZE));
     63                pfn_t start = ADDR2PFN(ALIGN_UP((uintptr_t) memmap.zones[i].start,
     64                    FRAME_SIZE));
     65                size_t size = SIZE2FRAMES(ALIGN_DOWN(memmap.zones[i].size, FRAME_SIZE));
    6866               
     67                pfn_t conf;
    6968                if ((minconf < start) || (minconf >= start + size))
    7069                        conf = start;
     
    7372               
    7473                zone_create(start, size, conf, 0);
    75                 if (last_frame < ALIGN_UP((uintptr_t) memmap.zones[i].start + memmap.zones[i].size, FRAME_SIZE))
    76                         last_frame = ALIGN_UP((uintptr_t) memmap.zones[i].start + memmap.zones[i].size, FRAME_SIZE);
     74                if (last_frame < ALIGN_UP((uintptr_t) memmap.zones[i].start
     75                    + memmap.zones[i].size, FRAME_SIZE))
     76                        last_frame = ALIGN_UP((uintptr_t) memmap.zones[i].start
     77                            + memmap.zones[i].size, FRAME_SIZE);
    7778        }
    7879       
     
    8283       
    8384        /* Mark the Page Hash Table frames as unavailable */
    84         uint32_t sdr1;
    85         asm volatile (
    86                 "mfsdr1 %0\n"
    87                 : "=r" (sdr1)
    88         );
    89         frame_mark_unavailable(ADDR2PFN(sdr1 & 0xffff000), 16); // FIXME
     85        uint32_t sdr1 = sdr1_get();
     86       
     87        // FIXME: compute size of PHT exactly
     88        frame_mark_unavailable(ADDR2PFN(sdr1 & 0xffff000), 16);
    9089}
    9190
Note: See TracChangeset for help on using the changeset viewer.