Files
lk/kernel/include/kernel/novm.h
Travis Geiselbrecht 85a50ea3f4 [kernel][license] try out using a smaller version of the license header
Replace the body of the MIT license with a reference to the LICENSE file
and a URL with the MIT license. Replaces 20 something lines with 3.

No functional change.
2019-06-19 23:28:14 -07:00

41 lines
1.1 KiB
C

/*
* Copyright (c) 2015 Google, Inc. All rights reserved
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#ifndef __KERNEL_NOVM_H
#define __KERNEL_NOVM_H
#include <stddef.h>
#include <stdlib.h>
#include <arch.h>
#define PAGE_ALIGN(x) ALIGN(x, PAGE_SIZE)
#define IS_PAGE_ALIGNED(x) IS_ALIGNED(x, PAGE_SIZE)
// arena bitmaps for novm_alloc_pages
#define NOVM_ARENA_ANY (UINT32_MAX)
#define NOVM_ARENA_MAIN (1<<0)
#define NOVM_ARENA_SECONDARY (~NOVM_ARENA_MAIN)
void *novm_alloc_pages(size_t pages, uint32_t arena_bitmap);
void novm_free_pages(void *address, size_t pages);
status_t novm_alloc_specific_pages(void *address, size_t pages);
// You can call this once and it will give you some possibly unaligned memory
// that would otherwise go to waste. The memory can't be freed.
void *novm_alloc_unaligned(size_t *size_return);
void novm_add_arena(const char *name, uintptr_t arena_start, uintptr_t arena_size);
struct page_range {
void *address;
size_t size;
};
int novm_get_arenas(struct page_range *ranges, int number_of_ranges);
#endif