Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 7c3e482 in mainline


Ignore:
Timestamp:
2011-12-09T23:15:30Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
404be7c
Parents:
c24b272f
Message:

Create arena for kernel non-identity mapping and
provide km wrappers around ra_alloc() and ra_free().

Location:
kernel/generic
Files:
2 edited

Legend:

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

    rc24b272f r7c3e482  
    4343extern void km_non_identity_span_add(uintptr_t, size_t);
    4444
     45extern uintptr_t km_page_alloc(size_t, size_t);
     46extern void km_page_free(uintptr_t, size_t);
     47
    4548#endif
    4649
  • kernel/generic/src/mm/km.c

    rc24b272f r7c3e482  
    4040#include <config.h>
    4141#include <typedefs.h>
     42#include <lib/ra.h>
     43#include <debug.h>
     44
     45static ra_arena_t *km_ni_arena;
    4246
    4347/** Architecture dependent setup of identity-mapped kernel memory. */
     
    5155void km_non_identity_init(void)
    5256{
     57        km_ni_arena = ra_arena_create();
     58        ASSERT(km_ni_arena != NULL);
    5359        km_non_identity_arch_init();
    5460        config.non_identity_configured = true;
     
    5763void km_non_identity_span_add(uintptr_t base, size_t size)
    5864{
     65        bool span_added;
     66
     67        span_added = ra_span_add(km_ni_arena, base, size);
     68        ASSERT(span_added);
    5969}
     70
     71uintptr_t km_page_alloc(size_t size, size_t align)
     72{
     73        return ra_alloc(km_ni_arena, size, align);
     74}
     75
     76void km_page_free(uintptr_t page, size_t size)
     77{
     78        ra_free(km_ni_arena, page, size);
     79}
     80
    6081
    6182/** @}
Note: See TracChangeset for help on using the changeset viewer.