metalsvm/include/metalsvm/vma.h
Jacek Galowicz 6c6d77cfa6 Committed the rest. There is only few stuff missing.
Embedded nice pictures.
2011-04-05 14:44:42 +02:00

84 lines
2.1 KiB
C

/*
* Copyright 2011 Stefan Lankes, Chair for Operating Systems,
* RWTH Aachen University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of MetalSVM.
*/
/**
* @author Stefan Lankes
* @file include/metalsvm/vma.h
* @brief VMA related sructure and functions
*/
#ifndef __VMA_H__
#define __VMA_H__
#include <metalsvm/stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#define VMA_READ 0x01
#define VMA_WRITE 0x02
#define VMA_EXECUTE 0x04
#define VMA_CACHEABLE 0x08
struct vma;
/** @brief VMA structure definition */
typedef struct vma {
/// Start address of the memory area
size_t start;
/// End address of the memory area
size_t end;
/// Type flags field
uint32_t type;
/// Pointer of next VMA element in the list
struct vma* next;
/// Pointer to previous VMA element in the list
struct vma* prev;
} vma_t;
/** @brief Add a new virtual memory region to the list of VMAs
*
* @param task Pointer to the task_t structure of the task
* @param start Start address of the new region
* @param end End address of the new region
* @param type Type flags the new region shall have
*
* @return
* - 0 on success
* - -EINVAL (-22) or -EINVAL (-12) on failure
*/
int vma_add(struct task* task, size_t start, size_t end, uint32_t type);
/** @brief Dump information about this task's VMAs into the terminal.
*
* This will print out Start, end and flags for each VMA in the task's list
*
* @param task The task's task_t structure
* @return
* - 0 on success
* - -EINVAL (-22) on failure
*/
int vma_dump(struct task* task);
#ifdef __cplusplus
}
#endif
#endif