Changeset 052da81 in mainline for generic/src/mm/frame.c


Ignore:
Timestamp:
2006-02-18T14:40:15Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
daea4bf
Parents:
ede493e
Message:

Fixes in memory allocator

  • proper kernel blacklisting, when kernel not loaded on page boundary
  • correct zone adding in zone list (how could this work??)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/mm/frame.c

    rede493e r052da81  
    137137        if (zones.count+1 == ZONES_MAX)
    138138                panic("Maximum zone(%d) count exceeded.", ZONES_MAX);
    139 
    140139        for (i=0; i < zones.count; i++) {
    141140                /* Check for overflow */
    142                 z = zones.info[zones.count];
     141                z = zones.info[i];
    143142                if (overlaps(newzone->base,newzone->count,
    144143                             z->base, z->count)) {
     
    146145                        return -1;
    147146                }
    148                 if (z->base < newzone->base)
     147                if (newzone->base < z->base)
    149148                        break;
    150149        }
     
    152151        for (j=i;j < zones.count;j++)
    153152                zones.info[j+1] = zones.info[j];
    154 
    155153        zones.info[i] = newzone;
    156154        zones.count++;
    157 
    158155        spinlock_unlock(&zones.lock);
    159156        interrupts_restore(ipl);
     
    768765                frame_initialize(&z->frames[i]);
    769766        }
    770 
     767       
    771768        /* Stuffing frames */
    772769        for (i = 0; i < count; i++) {
     
    844841                        zone_mark_unavailable(z, i - z->base);
    845842                }
    846 
    847843        return znum;
    848844}
     
    972968        zone_t *zone;
    973969        int prefzone = 0;
    974 
     970       
    975971        for (i=0; i < count; i++) {
    976972                zone = find_zone_and_lock(start+i,&prefzone);
     
    996992        frame_arch_init();
    997993        if (config.cpu_active == 1) {
    998                 frame_mark_unavailable(ADDR2PFN(KA2PA(config.base)),
    999                                        SIZE2FRAMES(config.kernel_size));
     994                pfn_t firstframe = ADDR2PFN(KA2PA(config.base));
     995                pfn_t lastframe = ADDR2PFN(KA2PA(config.base+config.kernel_size));
     996                frame_mark_unavailable(firstframe,lastframe-firstframe+1);
    1000997                if (config.init_size > 0)
    1001998                        frame_mark_unavailable(ADDR2PFN(KA2PA(config.init_addr)),
Note: See TracChangeset for help on using the changeset viewer.