Changeset 7978177c in mainline


Ignore:
Timestamp:
2011-11-20T23:08:43Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
25c51c8
Parents:
3a4ac81b
Message:

Add ppc32 support for frame_low/high_arch_init().

File:
1 edited

Legend:

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

    r3a4ac81b r7978177c  
    4040#include <print.h>
    4141
     42// XXX: remove me
    4243uintptr_t last_frame = 0;
     44
    4345memmap_t memmap;
    4446
     
    5456}
    5557
    56 void frame_low_arch_init(void)
     58static void frame_common_arch_init(bool low)
    5759{
    5860        pfn_t minconf = 2;
     
    6163        for (i = 0; i < memmap.cnt; i++) {
    6264                /* To be safe, make the available zone possibly smaller */
    63                 uintptr_t new_start = ALIGN_UP((uintptr_t) memmap.zones[i].start,
     65                uintptr_t base = ALIGN_UP((uintptr_t) memmap.zones[i].start,
    6466                    FRAME_SIZE);
    65                 size_t new_size = ALIGN_DOWN(memmap.zones[i].size -
    66                     (new_start - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
     67                size_t size = ALIGN_DOWN(memmap.zones[i].size -
     68                    (base - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
    6769               
    68                 pfn_t pfn = ADDR2PFN(new_start);
    69                 size_t count = SIZE2FRAMES(new_size);
     70                // XXX: remove me
     71                if (last_frame < ALIGN_UP(base + size, FRAME_SIZE))
     72                        last_frame = ALIGN_UP(base + size, FRAME_SIZE);
    7073               
     74                if (!frame_adjust_zone_bounds(low, &base, &size))
     75                        return;
     76
     77                pfn_t pfn = ADDR2PFN(base);
     78                size_t count = SIZE2FRAMES(size);
    7179                pfn_t conf;
    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);
     80
     81                if (low) {
     82                        if ((minconf < pfn) || (minconf >= pfn + count))
     83                                conf = pfn;
     84                        else
     85                                conf = minconf;
     86                        zone_create(pfn, count, conf,
     87                            ZONE_AVAILABLE | ZONE_LOWMEM);
     88                } else {
     89                        conf = zone_external_conf_alloc(count);
     90                        zone_create(pfn, count, conf,
     91                            ZONE_AVAILABLE | ZONE_HIGHMEM);
     92                }
    8193        }
     94       
     95}
     96
     97void frame_low_arch_init(void)
     98{
     99        frame_common_arch_init(true);
    82100       
    83101        /* First is exception vector, second is 'implementation specific',
     
    94112void frame_high_arch_init(void)
    95113{
     114        frame_common_arch_init(false);
    96115}
    97116
Note: See TracChangeset for help on using the changeset viewer.