* First run through the kernel's private parts to use phys_{addr,size}_t
where appropriate.
* Typedef'ed page_num_t to phys_addr_t and used it in more places in
vm_page.{h,cpp}.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36937 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -80,7 +80,7 @@ typedef SinglyLinkedList<VMAreaWiredRange> VMAreaWiredRangeList;
|
||||
|
||||
struct VMPageWiringInfo {
|
||||
VMAreaWiredRange range;
|
||||
addr_t physicalAddress;
|
||||
phys_addr_t physicalAddress;
|
||||
// the actual physical address corresponding to
|
||||
// the virtual address passed to vm_wire_page()
|
||||
// (i.e. with in-page offset)
|
||||
|
||||
@@ -33,8 +33,8 @@ struct VMTranslationMap {
|
||||
addr_t end) const = 0;
|
||||
|
||||
virtual status_t Map(addr_t virtualAddress,
|
||||
addr_t physicalAddress, uint32 attributes,
|
||||
uint32 memoryType,
|
||||
phys_addr_t physicalAddress,
|
||||
uint32 attributes, uint32 memoryType,
|
||||
vm_page_reservation* reservation) = 0;
|
||||
virtual status_t Unmap(addr_t start, addr_t end) = 0;
|
||||
|
||||
@@ -48,10 +48,10 @@ struct VMTranslationMap {
|
||||
bool ignoreTopCachePageFlags);
|
||||
|
||||
virtual status_t Query(addr_t virtualAddress,
|
||||
addr_t* _physicalAddress,
|
||||
phys_addr_t* _physicalAddress,
|
||||
uint32* _flags) = 0;
|
||||
virtual status_t QueryInterrupt(addr_t virtualAddress,
|
||||
addr_t* _physicalAddress,
|
||||
phys_addr_t* _physicalAddress,
|
||||
uint32* _flags) = 0;
|
||||
|
||||
virtual status_t Protect(addr_t base, addr_t top,
|
||||
@@ -83,7 +83,7 @@ struct VMPhysicalPageMapper {
|
||||
|
||||
// get/put virtual address for physical page -- will be usuable on all CPUs
|
||||
// (usually more expensive than the *_current_cpu() versions)
|
||||
virtual status_t GetPage(addr_t physicalAddress,
|
||||
virtual status_t GetPage(phys_addr_t physicalAddress,
|
||||
addr_t* _virtualAddress,
|
||||
void** _handle) = 0;
|
||||
virtual status_t PutPage(addr_t virtualAddress,
|
||||
@@ -92,27 +92,29 @@ struct VMPhysicalPageMapper {
|
||||
// get/put virtual address for physical page -- thread must be pinned the
|
||||
// whole time
|
||||
virtual status_t GetPageCurrentCPU(
|
||||
addr_t physicalAddress,
|
||||
phys_addr_t physicalAddress,
|
||||
addr_t* _virtualAddress,
|
||||
void** _handle) = 0;
|
||||
virtual status_t PutPageCurrentCPU(addr_t virtualAddress,
|
||||
void* _handle) = 0;
|
||||
|
||||
// get/put virtual address for physical in KDL
|
||||
virtual status_t GetPageDebug(addr_t physicalAddress,
|
||||
virtual status_t GetPageDebug(phys_addr_t physicalAddress,
|
||||
addr_t* _virtualAddress,
|
||||
void** _handle) = 0;
|
||||
virtual status_t PutPageDebug(addr_t virtualAddress,
|
||||
void* handle) = 0;
|
||||
|
||||
// memory operations on pages
|
||||
virtual status_t MemsetPhysical(addr_t address, int value,
|
||||
size_t length) = 0;
|
||||
virtual status_t MemcpyFromPhysical(void* to, addr_t from,
|
||||
virtual status_t MemsetPhysical(phys_addr_t address, int value,
|
||||
phys_size_t length) = 0;
|
||||
virtual status_t MemcpyFromPhysical(void* to, phys_addr_t from,
|
||||
size_t length, bool user) = 0;
|
||||
virtual status_t MemcpyToPhysical(addr_t to, const void* from,
|
||||
size_t length, bool user) = 0;
|
||||
virtual void MemcpyPhysicalPage(addr_t to, addr_t from) = 0;
|
||||
virtual status_t MemcpyToPhysical(phys_addr_t to,
|
||||
const void* from, size_t length,
|
||||
bool user) = 0;
|
||||
virtual void MemcpyPhysicalPage(phys_addr_t to,
|
||||
phys_addr_t from) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ void forbid_page_faults(void);
|
||||
// private kernel only extension (should be moved somewhere else):
|
||||
area_id create_area_etc(team_id team, const char *name, void **address,
|
||||
uint32 addressSpec, uint32 size, uint32 lock, uint32 protection,
|
||||
addr_t physicalAddress, uint32 flags);
|
||||
phys_addr_t physicalAddress, uint32 flags);
|
||||
area_id transfer_area(area_id id, void** _address, uint32 addressSpec,
|
||||
team_id target, bool kernel);
|
||||
|
||||
@@ -87,10 +87,10 @@ status_t vm_reserve_address_range(team_id team, void **_address,
|
||||
uint32 addressSpec, addr_t size, uint32 flags);
|
||||
area_id vm_create_anonymous_area(team_id team, const char *name, void **address,
|
||||
uint32 addressSpec, addr_t size, uint32 wiring, uint32 protection,
|
||||
addr_t physicalAddress, uint32 flags, bool kernel);
|
||||
phys_addr_t physicalAddress, uint32 flags, bool kernel);
|
||||
area_id vm_map_physical_memory(team_id team, const char *name, void **address,
|
||||
uint32 addressSpec, addr_t size, uint32 protection,
|
||||
addr_t physicalAddress, bool alreadyWired);
|
||||
phys_addr_t physicalAddress, bool alreadyWired);
|
||||
area_id vm_map_physical_memory_vecs(team_id team, const char* name,
|
||||
void** _address, uint32 addressSpec, addr_t* _size, uint32 protection,
|
||||
struct iovec* vecs, uint32 vecCount);
|
||||
@@ -108,8 +108,9 @@ area_id vm_clone_area(team_id team, const char *name, void **address,
|
||||
area_id sourceArea, bool kernel);
|
||||
status_t vm_delete_area(team_id teamID, area_id areaID, bool kernel);
|
||||
status_t vm_create_vnode_cache(struct vnode *vnode, struct VMCache **_cache);
|
||||
status_t vm_set_area_memory_type(area_id id, addr_t physicalBase, uint32 type);
|
||||
status_t vm_get_page_mapping(team_id team, addr_t vaddr, addr_t *paddr);
|
||||
status_t vm_set_area_memory_type(area_id id, phys_addr_t physicalBase,
|
||||
uint32 type);
|
||||
status_t vm_get_page_mapping(team_id team, addr_t vaddr, phys_addr_t *paddr);
|
||||
bool vm_test_map_modification(struct vm_page *page);
|
||||
void vm_clear_map_flags(struct vm_page *page, uint32 flags);
|
||||
void vm_remove_all_page_mappings(struct vm_page *page);
|
||||
@@ -119,12 +120,12 @@ status_t vm_wire_page(team_id team, addr_t address, bool writable,
|
||||
struct VMPageWiringInfo* info);
|
||||
void vm_unwire_page(struct VMPageWiringInfo* info);
|
||||
|
||||
status_t vm_get_physical_page(addr_t paddr, addr_t* vaddr, void** _handle);
|
||||
status_t vm_get_physical_page(phys_addr_t paddr, addr_t* vaddr, void** _handle);
|
||||
status_t vm_put_physical_page(addr_t vaddr, void* handle);
|
||||
status_t vm_get_physical_page_current_cpu(addr_t paddr, addr_t* vaddr,
|
||||
status_t vm_get_physical_page_current_cpu(phys_addr_t paddr, addr_t* vaddr,
|
||||
void** _handle);
|
||||
status_t vm_put_physical_page_current_cpu(addr_t vaddr, void* handle);
|
||||
status_t vm_get_physical_page_debug(addr_t paddr, addr_t* vaddr,
|
||||
status_t vm_get_physical_page_debug(phys_addr_t paddr, addr_t* vaddr,
|
||||
void** _handle);
|
||||
status_t vm_put_physical_page_debug(addr_t vaddr, void* handle);
|
||||
|
||||
@@ -134,12 +135,12 @@ off_t vm_available_memory(void);
|
||||
off_t vm_available_not_needed_memory(void);
|
||||
size_t vm_kernel_address_space_left(void);
|
||||
|
||||
status_t vm_memset_physical(addr_t address, int value, size_t length);
|
||||
status_t vm_memcpy_from_physical(void* to, addr_t from, size_t length,
|
||||
status_t vm_memset_physical(phys_addr_t address, int value, size_t length);
|
||||
status_t vm_memcpy_from_physical(void* to, phys_addr_t from, size_t length,
|
||||
bool user);
|
||||
status_t vm_memcpy_to_physical(addr_t to, const void* from, size_t length,
|
||||
status_t vm_memcpy_to_physical(phys_addr_t to, const void* from, size_t length,
|
||||
bool user);
|
||||
void vm_memcpy_physical_page(addr_t to, addr_t from);
|
||||
void vm_memcpy_physical_page(phys_addr_t to, phys_addr_t from);
|
||||
|
||||
status_t vm_debug_copy_page_memory(team_id teamID, void* unsafeMemory,
|
||||
void* buffer, size_t size, bool copyToUnsafe);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_types.h>
|
||||
|
||||
|
||||
struct kernel_args;
|
||||
@@ -31,17 +32,17 @@ status_t vm_page_init(struct kernel_args *args);
|
||||
status_t vm_page_init_post_area(struct kernel_args *args);
|
||||
status_t vm_page_init_post_thread(struct kernel_args *args);
|
||||
|
||||
status_t vm_mark_page_inuse(addr_t page);
|
||||
status_t vm_mark_page_range_inuse(addr_t startPage, addr_t length);
|
||||
status_t vm_mark_page_inuse(page_num_t page);
|
||||
status_t vm_mark_page_range_inuse(page_num_t startPage, page_num_t length);
|
||||
void vm_page_free(struct VMCache *cache, struct vm_page *page);
|
||||
void vm_page_set_state(struct vm_page *page, int state);
|
||||
void vm_page_requeue(struct vm_page *page, bool tail);
|
||||
|
||||
// get some data about the number of pages in the system
|
||||
size_t vm_page_num_pages(void);
|
||||
size_t vm_page_num_free_pages(void);
|
||||
size_t vm_page_num_available_pages(void);
|
||||
size_t vm_page_num_unused_pages(void);
|
||||
page_num_t vm_page_num_pages(void);
|
||||
page_num_t vm_page_num_free_pages(void);
|
||||
page_num_t vm_page_num_available_pages(void);
|
||||
page_num_t vm_page_num_unused_pages(void);
|
||||
void vm_page_get_stats(system_info *info);
|
||||
|
||||
status_t vm_page_write_modified_page_range(struct VMCache *cache,
|
||||
@@ -59,10 +60,10 @@ bool vm_page_try_reserve_pages(vm_page_reservation* reservation, uint32 count,
|
||||
|
||||
struct vm_page *vm_page_allocate_page(vm_page_reservation* reservation,
|
||||
uint32 flags);
|
||||
struct vm_page *vm_page_allocate_page_run(uint32 flags, addr_t base,
|
||||
size_t length, int priority);
|
||||
struct vm_page *vm_page_allocate_page_run(uint32 flags, phys_addr_t base,
|
||||
page_num_t length, int priority);
|
||||
struct vm_page *vm_page_at_index(int32 index);
|
||||
struct vm_page *vm_lookup_page(addr_t pageNumber);
|
||||
struct vm_page *vm_lookup_page(page_num_t pageNumber);
|
||||
bool vm_page_is_dummy(struct vm_page *page);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -70,7 +70,7 @@ typedef class DoublyLinkedQueue<vm_page_mapping, DoublyLinkedPageLink>
|
||||
typedef class DoublyLinkedQueue<vm_page_mapping, DoublyLinkedAreaLink>
|
||||
VMAreaMappings;
|
||||
|
||||
typedef uint32 page_num_t;
|
||||
typedef phys_addr_t page_num_t;
|
||||
|
||||
|
||||
struct VMCacheRef {
|
||||
@@ -84,13 +84,15 @@ struct VMCacheRef {
|
||||
struct vm_page {
|
||||
DoublyLinkedListLink<vm_page> queue_link;
|
||||
|
||||
addr_t physical_page_number;
|
||||
page_num_t physical_page_number;
|
||||
|
||||
private:
|
||||
VMCacheRef* cache_ref;
|
||||
public:
|
||||
page_num_t cache_offset;
|
||||
// in page size units
|
||||
// TODO: Only 32 bit on 32 bit platforms!
|
||||
// Introduce a new 64 bit type page_off_t!
|
||||
|
||||
SplayTreeLink<vm_page> cache_link;
|
||||
vm_page* cache_next;
|
||||
|
||||
Reference in New Issue
Block a user