2002-07-09 16:24:59 +04:00
|
|
|
/*
|
2006-04-30 21:45:33 +04:00
|
|
|
* Copyright 2002-2006, Haiku. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
|
|
|
* Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
2003-05-03 20:03:26 +04:00
|
|
|
#ifndef KERNEL_VM_TRANSLATION_MAP_H
|
|
|
|
#define KERNEL_VM_TRANSLATION_MAP_H
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
#include <kernel.h>
|
|
|
|
#include <lock.h>
|
|
|
|
|
2003-10-29 00:10:00 +03:00
|
|
|
|
2003-05-03 20:03:26 +04:00
|
|
|
struct kernel_args;
|
|
|
|
|
|
|
|
|
2004-10-20 03:19:10 +04:00
|
|
|
typedef struct vm_translation_map {
|
|
|
|
struct vm_translation_map *next;
|
|
|
|
struct vm_translation_map_ops *ops;
|
|
|
|
recursive_lock lock;
|
|
|
|
int32 map_count;
|
|
|
|
struct vm_translation_map_arch_info *arch_data;
|
2002-07-09 16:24:59 +04:00
|
|
|
} vm_translation_map;
|
|
|
|
|
2003-10-29 00:10:00 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
// table of operations the vm may want to do to this mapping
|
2004-10-20 03:19:10 +04:00
|
|
|
typedef struct vm_translation_map_ops {
|
2006-04-30 21:45:33 +04:00
|
|
|
void (*destroy)(vm_translation_map *map);
|
|
|
|
status_t (*lock)(vm_translation_map *map);
|
|
|
|
status_t (*unlock)(vm_translation_map *map);
|
2004-06-17 17:22:05 +04:00
|
|
|
status_t (*map)(vm_translation_map *map, addr_t va, addr_t pa, uint32 attributes);
|
|
|
|
status_t (*unmap)(vm_translation_map *map, addr_t start, addr_t end);
|
|
|
|
status_t (*query)(vm_translation_map *map, addr_t va, addr_t *_outPhysical, uint32 *_outFlags);
|
2006-04-30 21:45:33 +04:00
|
|
|
status_t (*query_interrupt)(vm_translation_map *map, addr_t va, addr_t *_outPhysical);
|
2004-06-17 17:22:05 +04:00
|
|
|
addr_t (*get_mapped_size)(vm_translation_map*);
|
|
|
|
status_t (*protect)(vm_translation_map *map, addr_t base, addr_t top, uint32 attributes);
|
|
|
|
status_t (*clear_flags)(vm_translation_map *map, addr_t va, uint32 flags);
|
2002-07-09 16:24:59 +04:00
|
|
|
void (*flush)(vm_translation_map *map);
|
2004-10-20 03:19:10 +04:00
|
|
|
status_t (*get_physical_page)(addr_t physicalAddress, addr_t *_virtualAddress, uint32 flags);
|
|
|
|
status_t (*put_physical_page)(addr_t virtualAddress);
|
2002-07-09 16:24:59 +04:00
|
|
|
} vm_translation_map_ops;
|
|
|
|
|
2003-10-29 00:10:00 +03:00
|
|
|
#include <arch/vm_translation_map.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2003-05-03 20:03:26 +04:00
|
|
|
#endif /* KERNEL_VM_TRANSLATION_MAP_H */
|