2020-05-24 15:30:55 -05:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#ifndef VMEM_H
|
|
|
|
#define VMEM_H
|
2022-02-19 10:17:40 -06:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
*
|
2020-05-24 15:30:55 -05:00
|
|
|
* Provides functions to handle physical memory page mapping into virtual
|
|
|
|
* memory.
|
|
|
|
*
|
2022-02-19 10:17:40 -06:00
|
|
|
* Copyright (C) 2020-2022 Martin Whitaker.
|
2020-05-24 15:30:55 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "memsize.h"
|
|
|
|
|
|
|
|
#define VM_WINDOW_SIZE PAGE_C(1,GB)
|
|
|
|
|
2021-12-23 11:23:28 -06:00
|
|
|
uintptr_t map_device(uintptr_t base_addr, size_t size);
|
2020-05-24 15:30:55 -05:00
|
|
|
|
|
|
|
bool map_window(uintptr_t start_page);
|
|
|
|
|
|
|
|
void *first_word_mapping(uintptr_t page);
|
|
|
|
|
|
|
|
void *last_word_mapping(uintptr_t page, size_t word_size);
|
|
|
|
|
|
|
|
uintptr_t page_of(void *addr);
|
|
|
|
|
|
|
|
#endif // VMEM_H
|