Changeset 03523dc in mainline for kernel/generic/src/mm/backend_phys.c


Ignore:
Timestamp:
2011-01-15T16:12:46Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6b9e85b
Parents:
630a8ef
Message:

Add more hooks to address space area backends so that each backend can
take action also on:

  • as_area_create()
  • as_area_resize()
  • as_area_destroy()

Add basic memory reservation code to anonymous and elf address space
area backends.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/backend_phys.c

    r630a8ef r03523dc  
    4848#include <align.h>
    4949
     50static bool phys_create(as_area_t *);
     51static void phys_share(as_area_t *area);
     52static void phys_destroy(as_area_t *);
     53
    5054static int phys_page_fault(as_area_t *area, uintptr_t addr, pf_access_t access);
    51 static void phys_share(as_area_t *area);
    5255
    5356mem_backend_t phys_backend = {
     57        .create = phys_create,
     58        .resize = NULL,
     59        .share = phys_share,
     60        .destroy = phys_destroy,
     61
    5462        .page_fault = phys_page_fault,
    5563        .frame_free = NULL,
    56         .share = phys_share
    5764};
     65
     66bool phys_create(as_area_t *area)
     67{
     68        return true;
     69}
     70
     71/** Share address space area backed by physical memory.
     72 *
     73 * Do actually nothing as sharing of address space areas
     74 * that are backed up by physical memory is very easy.
     75 * Note that the function must be defined so that
     76 * as_area_share() will succeed.
     77 */
     78void phys_share(as_area_t *area)
     79{
     80        ASSERT(mutex_locked(&area->as->lock));
     81        ASSERT(mutex_locked(&area->lock));
     82}
     83
     84
     85void phys_destroy(as_area_t *area)
     86{
     87        /* Nothing to do. */
     88}
    5889
    5990/** Service a page fault in the address space area backed by physical memory.
     
    87118}
    88119
    89 /** Share address space area backed by physical memory.
    90  *
    91  * Do actually nothing as sharing of address space areas
    92  * that are backed up by physical memory is very easy.
    93  * Note that the function must be defined so that
    94  * as_area_share() will succeed.
    95  */
    96 void phys_share(as_area_t *area)
    97 {
    98         ASSERT(mutex_locked(&area->as->lock));
    99         ASSERT(mutex_locked(&area->lock));
    100 }
    101 
    102120/** @}
    103121 */
Note: See TracChangeset for help on using the changeset viewer.