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


Ignore:
Timestamp:
2010-06-26T23:00:54Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
68667ce
Parents:
cae5404
Message:

fix erroneous resizing of physical zones (ticket #240)

File:
1 edited

Legend:

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

    rcae5404 r720db0c  
    6060       
    6161        for (i = 0; i < memmap.cnt; i++) {
    62                 pfn_t start = ADDR2PFN(ALIGN_UP((uintptr_t) memmap.zones[i].start,
    63                     FRAME_SIZE));
    64                 size_t size = SIZE2FRAMES(ALIGN_DOWN(memmap.zones[i].size, FRAME_SIZE));
     62                /* To be safe, make the available zone possibly smaller */
     63                uintptr_t new_start = ALIGN_UP((uintptr_t) memmap.zones[i].start,
     64                    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               
     68                pfn_t pfn = ADDR2PFN(new_start);
     69                size_t count = SIZE2FRAMES(new_size);
    6570               
    6671                pfn_t conf;
    67                 if ((minconf < start) || (minconf >= start + size))
    68                         conf = start;
     72                if ((minconf < pfn) || (minconf >= pfn + count))
     73                        conf = pfn;
    6974                else
    7075                        conf = minconf;
    7176               
    72                 zone_create(start, size, conf, 0);
    73                 if (last_frame < ALIGN_UP((uintptr_t) memmap.zones[i].start
    74                     + memmap.zones[i].size, FRAME_SIZE))
    75                         last_frame = ALIGN_UP((uintptr_t) memmap.zones[i].start
    76                             + memmap.zones[i].size, FRAME_SIZE);
     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);
    7781        }
    7882       
Note: See TracChangeset for help on using the changeset viewer.