Ignore:
File:
1 edited

Legend:

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

    r7852625 r7e752b2  
    4040#include <print.h>
    4141
     42uintptr_t last_frame = 0;
    4243memmap_t memmap;
    4344
     
    5354}
    5455
    55 static void frame_common_arch_init(bool low)
     56void frame_arch_init(void)
    5657{
    5758        pfn_t minconf = 2;
     
    6061        for (i = 0; i < memmap.cnt; i++) {
    6162                /* To be safe, make the available zone possibly smaller */
    62                 uintptr_t base = ALIGN_UP((uintptr_t) memmap.zones[i].start,
     63                uintptr_t new_start = ALIGN_UP((uintptr_t) memmap.zones[i].start,
    6364                    FRAME_SIZE);
    64                 size_t size = ALIGN_DOWN(memmap.zones[i].size -
    65                     (base - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
     65                size_t new_size = ALIGN_DOWN(memmap.zones[i].size -
     66                    (new_start - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
    6667               
    67                 if (!frame_adjust_zone_bounds(low, &base, &size))
    68                         return;
    69 
    70                 pfn_t pfn = ADDR2PFN(base);
    71                 size_t count = SIZE2FRAMES(size);
     68                pfn_t pfn = ADDR2PFN(new_start);
     69                size_t count = SIZE2FRAMES(new_size);
     70               
    7271                pfn_t conf;
    73 
    74                 if (low) {
    75                         if ((minconf < pfn) || (minconf >= pfn + count))
    76                                 conf = pfn;
    77                         else
    78                                 conf = minconf;
    79                         zone_create(pfn, count, conf,
    80                             ZONE_AVAILABLE | ZONE_LOWMEM);
    81                 } else {
    82                         conf = zone_external_conf_alloc(count);
    83                         if (conf != 0)
    84                                 zone_create(pfn, count, conf,
    85                                     ZONE_AVAILABLE | ZONE_HIGHMEM);
    86                 }
     72                if ((minconf < pfn) || (minconf >= pfn + count))
     73                        conf = pfn;
     74                else
     75                        conf = minconf;
     76               
     77                zone_create(pfn, count, conf, 0);
     78               
     79                if (last_frame < ALIGN_UP(new_start + new_size, FRAME_SIZE))
     80                        last_frame = ALIGN_UP(new_start + new_size, FRAME_SIZE);
    8781        }
    88        
    89 }
    90 
    91 void frame_low_arch_init(void)
    92 {
    93         frame_common_arch_init(true);
    9482       
    9583        /* First is exception vector, second is 'implementation specific',
     
    10492}
    10593
    106 void frame_high_arch_init(void)
    107 {
    108         frame_common_arch_init(false);
    109 }
    110 
    11194/** @}
    11295 */
Note: See TracChangeset for help on using the changeset viewer.