Changeset f3ac636 in mainline for generic/src/mm/frame.c


Ignore:
Timestamp:
2006-04-26T11:57:43Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6fa476f7
Parents:
df0103f7
Message:

Add frame_reference_add().

File:
1 edited

Legend:

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

    rdf0103f7 rf3ac636  
    5959        link_t buddy_link;      /**< link to the next free block inside one order */
    6060        void *parent;           /**< If allocated by slab, this points there */
    61 }frame_t;
     61} frame_t;
    6262
    6363typedef struct {
    6464        SPINLOCK_DECLARE(lock); /**< this lock protects everything below */
    65         pfn_t base;     /**< frame_no of the first frame in the frames array */
     65        pfn_t base;             /**< frame_no of the first frame in the frames array */
    6666        count_t count;          /**< Size of zone */
    6767
     
    7272        buddy_system_t * buddy_system; /**< buddy system for the zone */
    7373        int flags;
    74 }zone_t;
     74} zone_t;
    7575
    7676/*
     
    8383        int count;
    8484        zone_t *info[ZONES_MAX];
    85 }zones;
     85} zones;
    8686
    8787
     
    945945/** Free a frame.
    946946 *
    947  * Find respective frame structure for supplied addr.
     947 * Find respective frame structure for supplied PFN.
    948948 * Decrement frame reference count.
    949949 * If it drops to zero, move the frame structure to free list.
    950950 *
    951  * @param frame Frame no to be freed.
     951 * @param frame Frame number to be freed.
    952952 */
    953953void frame_free(pfn_t pfn)
     
    970970}
    971971
    972 
     972/** Add reference to frame.
     973 *
     974 * Find respective frame structure for supplied PFN and
     975 * increment frame reference count.
     976 *
     977 * @param frame Frame no to be freed.
     978 */
     979void frame_reference_add(pfn_t pfn)
     980{
     981        ipl_t ipl;
     982        zone_t *zone;
     983        frame_t *frame;
     984
     985        ipl = interrupts_disable();
     986       
     987        /*
     988         * First, find host frame zone for addr.
     989         */
     990        zone = find_zone_and_lock(pfn,NULL);
     991        ASSERT(zone);
     992       
     993        frame = &zone->frames[pfn-zone->base];
     994        frame->refcount++;
     995       
     996        spinlock_unlock(&zone->lock);
     997        interrupts_restore(ipl);
     998}
    973999
    9741000/** Mark given range unavailable in frame zones */
Note: See TracChangeset for help on using the changeset viewer.