Changeset d078c9b9 in mainline


Ignore:
Timestamp:
2016-09-02T19:48:36Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4c3602c4
Parents:
3233adb
Message:

Add implementation details to user_backend

Forbid sharing and resizing, and implement freeing frames.

File:
1 edited

Legend:

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

    r3233adb rd078c9b9  
    3939#include <mm/as.h>
    4040#include <mm/page.h>
     41#include <mm/frame.h>
    4142#include <abi/mm/as.h>
    4243#include <abi/ipc/methods.h>
     
    5051
    5152static bool user_create(as_area_t *);
    52 static bool user_resize(as_area_t *, size_t);
    53 static void user_share(as_area_t *);
    5453static void user_destroy(as_area_t *);
    5554
     
    6261mem_backend_t user_backend = {
    6362        .create = user_create,
    64         .resize = user_resize,
    65         .share = user_share,
     63        .resize = NULL,
     64        .share = NULL,
    6665        .destroy = user_destroy,
    6766
     
    8180}
    8281
    83 bool user_resize(as_area_t *area, size_t new_pages)
    84 {
    85         return true;
    86 }
    87 
    88 /** Share the user-paged address space area.
    89  *
    90  * The address space and address space area must be already locked.
    91  *
    92  * @param area Address space area to be shared.
    93  */
    94 void user_share(as_area_t *area)
    95 {
    96         ASSERT(mutex_locked(&area->as->lock));
    97         ASSERT(mutex_locked(&area->lock));
    98 }
    99 
    10082void user_destroy(as_area_t *area)
    10183{
     
    10587bool user_is_resizable(as_area_t *area)
    10688{
    107         return true;
     89        return false;
    10890}
    10991
    11092bool user_is_shareable(as_area_t *area)
    11193{
    112         return true;
     94        return false;
    11395}
    11496
     
    182164        ASSERT(page_table_locked(area->as));
    183165        ASSERT(mutex_locked(&area->lock));
     166
     167        pfn_t pfn = ADDR2PFN(frame);
     168        if (find_zone(pfn, 1, 0) != (size_t) -1) {
     169                frame_free(frame, 1);
     170        } else {
     171                /* Nothing to do */
     172        }
     173               
    184174}
    185175
Note: See TracChangeset for help on using the changeset viewer.