Changeset 2c0b348 in mainline


Ignore:
Timestamp:
2013-04-06T17:11:05Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
78aca91b
Parents:
3545c56
Message:

kernel: free memory in dmamem_unmap

Location:
kernel/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/mm/as.h

    r3545c56 r2c0b348  
    250250extern int as_area_change_flags(as_t *, unsigned int, uintptr_t);
    251251
     252//TODO REMOVE!
     253extern as_area_t * find_locked_area(as_t *as, uintptr_t va);
     254
    252255extern unsigned int as_area_get_flags(as_area_t *);
    253256extern bool as_area_check_access(as_area_t *, pf_access_t);
  • kernel/generic/src/ddi/ddi.c

    r3545c56 r2c0b348  
    361361NO_TRACE static int dmamem_unmap_anonymous(uintptr_t virt)
    362362{
    363         // TODO: implement unlocking & unmap
    364         return EOK;
     363        // TODO: This is an ugly hack
     364        as_t *as = TASK->as;
     365
     366        mutex_lock(&as->lock);
     367        as_area_t *area = find_locked_area(as, virt);
     368        if (!area) {
     369                mutex_unlock(&as->lock);
     370                return ENOENT;
     371        }
     372        frame_free_noreserve(area->backend_data.base);
     373        area->backend_data.base = 0;
     374        area->backend_data.frames = 0;
     375        mutex_unlock(&area->lock);
     376        mutex_unlock(&as->lock);
     377
     378        return as_area_destroy(as, virt);
    365379}
    366380
  • kernel/generic/src/mm/as.c

    r3545c56 r2c0b348  
    672672       
    673673        return NULL;
     674}
     675
     676/** UGLY! UGLY! UGLY! */
     677// TODO: REMOVE ASAP!
     678as_area_t * find_locked_area(as_t *as, uintptr_t va)
     679{
     680        return find_area_and_lock(as, va);
    674681}
    675682
Note: See TracChangeset for help on using the changeset viewer.