Author: bonefish Date: 2010-05-25 23:34:08 +0200 (Tue, 25 May 2010) New Revision: 36937 Changeset: http://dev.haiku-os.org/changeset/36937/haiku Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_vm_translation_map.h haiku/trunk/headers/private/kernel/arch/mipsel/arch_vm_translation_map.h haiku/trunk/headers/private/kernel/arch/ppc/arch_vm_translation_map.h haiku/trunk/headers/private/kernel/arch/vm.h haiku/trunk/headers/private/kernel/arch/vm_translation_map.h haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h haiku/trunk/headers/private/kernel/vm/VMArea.h haiku/trunk/headers/private/kernel/vm/VMTranslationMap.h haiku/trunk/headers/private/kernel/vm/vm.h haiku/trunk/headers/private/kernel/vm/vm_page.h haiku/trunk/headers/private/kernel/vm/vm_types.h haiku/trunk/src/system/kernel/arch/arm/arch_vm.cpp haiku/trunk/src/system/kernel/arch/arm/arch_vm_translation_map.cpp haiku/trunk/src/system/kernel/arch/generic/GenericVMPhysicalPageMapper.cpp haiku/trunk/src/system/kernel/arch/generic/GenericVMPhysicalPageMapper.h haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.cpp haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.h haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_ops.cpp haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_ops.h haiku/trunk/src/system/kernel/arch/mipsel/arch_vm.cpp haiku/trunk/src/system/kernel/arch/mipsel/arch_vm_translation_map.cpp haiku/trunk/src/system/kernel/arch/ppc/arch_int.cpp haiku/trunk/src/system/kernel/arch/ppc/arch_vm.cpp haiku/trunk/src/system/kernel/arch/ppc/arch_vm_translation_map.cpp haiku/trunk/src/system/kernel/arch/x86/X86VMTranslationMap.h haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp haiku/trunk/src/system/kernel/arch/x86/arch_thread.cpp haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp haiku/trunk/src/system/kernel/arch/x86/arch_x86.S haiku/trunk/src/system/kernel/arch/x86/timers/x86_hpet.cpp haiku/trunk/src/system/kernel/arch/x86/x86_paging.h haiku/trunk/src/system/kernel/arch/x86/x86_physical_page_mapper.h haiku/trunk/src/system/kernel/arch/x86/x86_physical_page_mapper_large_memory.cpp haiku/trunk/src/system/kernel/vm/vm.cpp haiku/trunk/src/system/kernel/vm/vm_page.cpp Log: * 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}. Modified: haiku/trunk/headers/private/kernel/arch/m68k/arch_vm_translation_map.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/m68k/arch_vm_translation_map.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/arch/m68k/arch_vm_translation_map.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -13,8 +13,8 @@ void m68k_translation_map_change_asid(vm_translation_map *map); -status_t m68k_map_address_range(addr_t virtualAddress, addr_t physicalAddress, - size_t size); +status_t m68k_map_address_range(addr_t virtualAddress, + phys_addr_t physicalAddress, size_t size); void m68k_unmap_address_range(addr_t virtualAddress, size_t size); status_t m68k_remap_address_range(addr_t *virtualAddress, size_t size, bool unmap); Modified: haiku/trunk/headers/private/kernel/arch/mipsel/arch_vm_translation_map.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/mipsel/arch_vm_translation_map.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/arch/mipsel/arch_vm_translation_map.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -11,8 +11,8 @@ extern "C" { #endif -status_t mipsel_map_address_range(addr_t virtualAddress, addr_t physicalAddress, - size_t size); +status_t mipsel_map_address_range(addr_t virtualAddress, + phys_addr_t physicalAddress, size_t size); void mipsel_unmap_address_range(addr_t virtualAddress, size_t size); Modified: haiku/trunk/headers/private/kernel/arch/ppc/arch_vm_translation_map.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/ppc/arch_vm_translation_map.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/arch/ppc/arch_vm_translation_map.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -13,8 +13,8 @@ void ppc_translation_map_change_asid(VMTranslationMap *map); -status_t ppc_map_address_range(addr_t virtualAddress, addr_t physicalAddress, - size_t size); +status_t ppc_map_address_range(addr_t virtualAddress, + phys_addr_t physicalAddress, size_t size); void ppc_unmap_address_range(addr_t virtualAddress, size_t size); status_t ppc_remap_address_range(addr_t *virtualAddress, size_t size, bool unmap); Modified: haiku/trunk/headers/private/kernel/arch/vm.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/vm.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/arch/vm.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -31,7 +31,7 @@ struct VMAddressSpace *to); bool arch_vm_supports_protection(uint32 protection); -status_t arch_vm_set_memory_type(struct VMArea *area, addr_t physicalBase, +status_t arch_vm_set_memory_type(struct VMArea *area, phys_addr_t physicalBase, uint32 type); void arch_vm_unset_memory_type(struct VMArea *area); Modified: haiku/trunk/headers/private/kernel/arch/vm_translation_map.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/vm_translation_map.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/arch/vm_translation_map.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -27,7 +27,8 @@ // Quick function to map a page in regardless of map context. Used in VM // initialization before most vm data structures exist. status_t arch_vm_translation_map_early_map(struct kernel_args *args, addr_t va, - addr_t pa, uint8 attributes, addr_t (*get_free_page)(struct kernel_args *)); + phys_addr_t pa, uint8 attributes, + phys_addr_t (*get_free_page)(struct kernel_args *)); bool arch_vm_translation_map_is_kernel_page_accessible(addr_t virtualAddress, uint32 protection); Modified: haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h =================================================================== --- haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/arch/x86/arch_cpu.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -269,12 +269,12 @@ void __x86_setup_system_time(uint32 conversionFactor, uint32 conversionFactorNsecs, bool conversionFactorNsecsShift); void i386_context_switch(struct arch_thread* oldState, - struct arch_thread* newState, addr_t newPageDir); + struct arch_thread* newState, uint32 newPageDir); void x86_userspace_thread_exit(void); void x86_end_userspace_thread_exit(void); void x86_enter_userspace(addr_t entry, addr_t stackTop); void i386_set_tss_and_kstack(addr_t kstack); -void i386_swap_pgdir(addr_t newPageDir); +void i386_swap_pgdir(uint32 newPageDir); void i386_fnsave(void* fpuState); void i386_fxsave(void* fpuState); void i386_frstor(const void* fpuState); Modified: haiku/trunk/headers/private/kernel/vm/VMArea.h =================================================================== --- haiku/trunk/headers/private/kernel/vm/VMArea.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/vm/VMArea.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -80,7 +80,7 @@ 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) Modified: haiku/trunk/headers/private/kernel/vm/VMTranslationMap.h =================================================================== --- haiku/trunk/headers/private/kernel/vm/VMTranslationMap.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/vm/VMTranslationMap.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -33,8 +33,8 @@ 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 @@ 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 @@ // 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 @@ // 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; }; Modified: haiku/trunk/headers/private/kernel/vm/vm.h =================================================================== --- haiku/trunk/headers/private/kernel/vm/vm.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/vm/vm.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -77,7 +77,7 @@ // 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 @@ 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 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 @@ 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_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); Modified: haiku/trunk/headers/private/kernel/vm/vm_page.h =================================================================== --- haiku/trunk/headers/private/kernel/vm/vm_page.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/vm/vm_page.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -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_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 @@ 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 Modified: haiku/trunk/headers/private/kernel/vm/vm_types.h =================================================================== --- haiku/trunk/headers/private/kernel/vm/vm_types.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/headers/private/kernel/vm/vm_types.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -70,7 +70,7 @@ 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 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; Modified: haiku/trunk/src/system/kernel/arch/arm/arch_vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/arm/arch_vm.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/arm/arch_vm.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -94,7 +94,7 @@ status_t -arch_vm_set_memory_type(VMArea *area, addr_t physicalBase, uint32 type) +arch_vm_set_memory_type(VMArea *area, phys_addr_t physicalBase, uint32 type) { if (type == 0) return B_OK; Modified: haiku/trunk/src/system/kernel/arch/arm/arch_vm_translation_map.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/arm/arch_vm_translation_map.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/arm/arch_vm_translation_map.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -48,7 +48,7 @@ status_t arch_vm_translation_map_create_map(bool kernel, VMTranslationMap** _map) -{ +{ return NULL; #warning ARM:WRITEME } @@ -100,8 +100,9 @@ */ status_t -arch_vm_translation_map_early_map(kernel_args *ka, addr_t virtualAddress, addr_t physicalAddress, - uint8 attributes, addr_t (*get_free_page)(kernel_args *)) +arch_vm_translation_map_early_map(kernel_args *ka, addr_t virtualAddress, + phys_addr_t physicalAddress, uint8 attributes, + phys_addr_t (*get_free_page)(kernel_args *)) { return NULL; #warning ARM:WRITEME @@ -114,7 +115,7 @@ // XXX currently assumes this translation map is active status_t -arch_vm_translation_map_early_query(addr_t va, addr_t *out_physical) +arch_vm_translation_map_early_query(addr_t va, phys_addr_t *out_physical) { return NULL; #warning ARM:WRITEME Modified: haiku/trunk/src/system/kernel/arch/generic/GenericVMPhysicalPageMapper.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/generic/GenericVMPhysicalPageMapper.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/generic/GenericVMPhysicalPageMapper.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -23,7 +23,7 @@ status_t -GenericVMPhysicalPageMapper::GetPage(addr_t physicalAddress, +GenericVMPhysicalPageMapper::GetPage(phys_addr_t physicalAddress, addr_t* _virtualAddress, void** _handle) { return generic_get_physical_page(physicalAddress, _virtualAddress, 0); @@ -38,7 +38,7 @@ status_t -GenericVMPhysicalPageMapper::GetPageCurrentCPU(addr_t physicalAddress, +GenericVMPhysicalPageMapper::GetPageCurrentCPU(phys_addr_t physicalAddress, addr_t* _virtualAddress, void** _handle) { // TODO:... @@ -56,7 +56,7 @@ status_t -GenericVMPhysicalPageMapper::GetPageDebug(addr_t physicalAddress, +GenericVMPhysicalPageMapper::GetPageDebug(phys_addr_t physicalAddress, addr_t* _virtualAddress, void** _handle) { // TODO:... @@ -73,15 +73,15 @@ status_t -GenericVMPhysicalPageMapper::MemsetPhysical(addr_t address, int value, - size_t length) +GenericVMPhysicalPageMapper::MemsetPhysical(phys_addr_t address, int value, + phys_size_t length) { return generic_vm_memset_physical(address, value, length); } status_t -GenericVMPhysicalPageMapper::MemcpyFromPhysical(void* to, addr_t from, +GenericVMPhysicalPageMapper::MemcpyFromPhysical(void* to, phys_addr_t from, size_t length, bool user) { return generic_vm_memcpy_from_physical(to, from, length, user); @@ -89,7 +89,7 @@ status_t -GenericVMPhysicalPageMapper::MemcpyToPhysical(addr_t to, const void* from, +GenericVMPhysicalPageMapper::MemcpyToPhysical(phys_addr_t to, const void* from, size_t length, bool user) { return generic_vm_memcpy_to_physical(to, from, length, user); @@ -97,7 +97,8 @@ void -GenericVMPhysicalPageMapper::MemcpyPhysicalPage(addr_t to, addr_t from) +GenericVMPhysicalPageMapper::MemcpyPhysicalPage(phys_addr_t to, + phys_addr_t from) { generic_vm_memcpy_physical_page(to, from); } Modified: haiku/trunk/src/system/kernel/arch/generic/GenericVMPhysicalPageMapper.h =================================================================== --- haiku/trunk/src/system/kernel/arch/generic/GenericVMPhysicalPageMapper.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/generic/GenericVMPhysicalPageMapper.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -13,32 +13,33 @@ GenericVMPhysicalPageMapper(); virtual ~GenericVMPhysicalPageMapper(); - virtual status_t GetPage(addr_t physicalAddress, + virtual status_t GetPage(phys_addr_t physicalAddress, addr_t* _virtualAddress, void** _handle); virtual status_t PutPage(addr_t virtualAddress, void* handle); virtual status_t GetPageCurrentCPU( - addr_t physicalAddress, + phys_addr_t physicalAddress, addr_t* _virtualAddress, void** _handle); virtual status_t PutPageCurrentCPU(addr_t virtualAddress, void* _handle); - virtual status_t GetPageDebug(addr_t physicalAddress, + virtual status_t GetPageDebug(phys_addr_t physicalAddress, addr_t* _virtualAddress, void** _handle); virtual status_t PutPageDebug(addr_t virtualAddress, void* handle); - virtual status_t MemsetPhysical(addr_t address, int value, - size_t length); - virtual status_t MemcpyFromPhysical(void* to, addr_t from, + virtual status_t MemsetPhysical(phys_addr_t address, int value, + phys_size_t length); + virtual status_t MemcpyFromPhysical(void* to, phys_addr_t from, size_t length, bool user); - virtual status_t MemcpyToPhysical(addr_t to, const void* from, - size_t length, bool user); - virtual void MemcpyPhysicalPage(addr_t to, addr_t from); + virtual status_t MemcpyToPhysical(phys_addr_t to, + const void* from, size_t length, bool user); + virtual void MemcpyPhysicalPage(phys_addr_t to, + phys_addr_t from); }; Modified: haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -54,7 +54,7 @@ status_t -generic_get_physical_page(addr_t pa, addr_t *va, uint32 flags) +generic_get_physical_page(phys_addr_t pa, addr_t *va, uint32 flags) { int index; paddr_chunk_desc *replaced_pchunk; Modified: haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.h =================================================================== --- haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_mapper.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -1,11 +1,11 @@ /* - * Copyright 2006-2008, Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>. + * Copyright 2006-2010, Ingo Weinhold <ingo_weinhold@xxxxxx>. * All rights reserved. Distributed under the terms of the MIT License. */ - #ifndef _KERNEL_GENERIC_VM_PHYSICAL_PAGE_MAPPER_H #define _KERNEL_GENERIC_VM_PHYSICAL_PAGE_MAPPER_H + #include <boot/kernel_args.h> @@ -19,9 +19,9 @@ #endif typedef status_t (*generic_map_iospace_chunk_func)(addr_t virtualAddress, - addr_t physicalAddress, uint32 flags); + phys_addr_t physicalAddress, uint32 flags); -status_t generic_get_physical_page(addr_t pa, addr_t *va, uint32 flags); +status_t generic_get_physical_page(phys_addr_t pa, addr_t *va, uint32 flags); status_t generic_put_physical_page(addr_t va); status_t generic_vm_physical_page_mapper_init(kernel_args *args, generic_map_iospace_chunk_func mapIOSpaceChunk, addr_t *ioSpaceBase, @@ -33,4 +33,5 @@ } #endif + #endif // _KERNEL_GENERIC_VM_PHYSICAL_PAGE_MAPPER_H Modified: haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_ops.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_ops.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_ops.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -1,8 +1,9 @@ /* - * Copyright 2008, Ingo Weinhold <ingo_weinhold@xxxxxx>. + * Copyright 2008-2010, Ingo Weinhold <ingo_weinhold@xxxxxx>. * All rights reserved. Distributed under the terms of the MIT License. */ + #include "generic_vm_physical_page_ops.h" #include <vm/vm.h> @@ -10,12 +11,12 @@ status_t -generic_vm_memset_physical(addr_t address, int value, size_t length) +generic_vm_memset_physical(phys_addr_t address, int value, phys_size_t length) { ThreadCPUPinner _(thread_get_current_thread()); while (length > 0) { - addr_t pageOffset = address % B_PAGE_SIZE; + phys_addr_t pageOffset = address % B_PAGE_SIZE; addr_t virtualAddress; void* handle; status_t error = vm_get_physical_page_current_cpu(address - pageOffset, @@ -37,11 +38,11 @@ status_t -generic_vm_memcpy_from_physical(void* _to, addr_t from, size_t length, +generic_vm_memcpy_from_physical(void* _to, phys_addr_t from, size_t length, bool user) { uint8* to = (uint8*)_to; - addr_t pageOffset = from % B_PAGE_SIZE; + phys_addr_t pageOffset = from % B_PAGE_SIZE; ThreadCPUPinner _(thread_get_current_thread()); @@ -77,11 +78,11 @@ status_t -generic_vm_memcpy_to_physical(addr_t to, const void* _from, size_t length, +generic_vm_memcpy_to_physical(phys_addr_t to, const void* _from, size_t length, bool user) { const uint8* from = (const uint8*)_from; - addr_t pageOffset = to % B_PAGE_SIZE; + phys_addr_t pageOffset = to % B_PAGE_SIZE; ThreadCPUPinner _(thread_get_current_thread()); @@ -120,7 +121,7 @@ be blocking, since we need to call it twice and could thus deadlock. */ void -generic_vm_memcpy_physical_page(addr_t to, addr_t from) +generic_vm_memcpy_physical_page(phys_addr_t to, phys_addr_t from) { ThreadCPUPinner _(thread_get_current_thread()); Modified: haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_ops.h =================================================================== --- haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_ops.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/generic/generic_vm_physical_page_ops.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -1,25 +1,29 @@ /* - * Copyright 2008, Ingo Weinhold <ingo_weinhold@xxxxxx>. + * Copyright 2008-2010, Ingo Weinhold <ingo_weinhold@xxxxxx>. * All rights reserved. Distributed under the terms of the MIT License. */ #ifndef _KERNEL_GENERIC_VM_PHYSICAL_PAGE_OPS_H #define _KERNEL_GENERIC_VM_PHYSICAL_PAGE_OPS_H + #include <SupportDefs.h> + #ifdef __cplusplus extern "C" { #endif -status_t generic_vm_memset_physical(addr_t address, int value, size_t length); -status_t generic_vm_memcpy_from_physical(void* to, addr_t from, size_t length, - bool user); -status_t generic_vm_memcpy_to_physical(addr_t to, const void* from, +status_t generic_vm_memset_physical(phys_addr_t address, int value, + phys_size_t length); +status_t generic_vm_memcpy_from_physical(void* to, phys_addr_t from, size_t length, bool user); -void generic_vm_memcpy_physical_page(addr_t to, addr_t from); +status_t generic_vm_memcpy_to_physical(phys_addr_t to, const void* from, + size_t length, bool user); +void generic_vm_memcpy_physical_page(phys_addr_t to, phys_addr_t from); #ifdef __cplusplus } #endif + #endif // _KERNEL_GENERIC_VM_PHYSICAL_PAGE_OPS_H Modified: haiku/trunk/src/system/kernel/arch/mipsel/arch_vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/mipsel/arch_vm.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/mipsel/arch_vm.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -88,7 +88,7 @@ status_t -arch_vm_set_memory_type(VMArea* area, addr_t physicalBase, uint32 type) +arch_vm_set_memory_type(VMArea* area, phys_addr_t physicalBase, uint32 type) { #warning IMPLEMENT arch_vm_set_memory_type return B_ERROR; Modified: haiku/trunk/src/system/kernel/arch/mipsel/arch_vm_translation_map.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/mipsel/arch_vm_translation_map.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/mipsel/arch_vm_translation_map.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -68,8 +68,8 @@ status_t arch_vm_translation_map_early_map(kernel_args* ka, addr_t virtualAddress, - addr_t physicalAddress, uint8 attributes, - addr_t (*get_free_page)(kernel_args* )) + phys_addr_t physicalAddress, uint8 attributes, + phys_addr_t (*get_free_page)(kernel_args* )) { #warning IMPLEMENT arch_vm_translation_map_early_map return NULL; @@ -77,7 +77,7 @@ status_t -arch_vm_translation_map_early_query(addr_t va, addr_t* out_physical) +arch_vm_translation_map_early_query(addr_t va, phys_addr_t* out_physical) { #warning IMPLEMENT arch_vm_translation_map_early_query return NULL; @@ -97,7 +97,7 @@ status_t -mipsel_map_address_range(addr_t virtualAddress, addr_t physicalAddress, +mipsel_map_address_range(addr_t virtualAddress, phys_addr_t physicalAddress, size_t size) { #warning IMPLEMENT mipsel_map_address_range Modified: haiku/trunk/src/system/kernel/arch/ppc/arch_int.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/ppc/arch_int.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/ppc/arch_int.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -549,7 +549,7 @@ ppc_set_current_cpu_exception_context(struct ppc_cpu_exception_context *context) { // translate to physical address - addr_t physicalPage; + phys_addr_t physicalPage; addr_t inPageOffset = (addr_t)context & (B_PAGE_SIZE - 1); status_t error = vm_get_page_mapping(VMAddressSpace::KernelID(), (addr_t)context - inPageOffset, &physicalPage); Modified: haiku/trunk/src/system/kernel/arch/ppc/arch_vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/ppc/arch_vm.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/ppc/arch_vm.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -163,7 +163,7 @@ status_t -arch_vm_set_memory_type(VMArea *area, addr_t physicalBase, uint32 type) +arch_vm_set_memory_type(VMArea *area, phys_addr_t physicalBase, uint32 type) { if (type == 0) return B_OK; Modified: haiku/trunk/src/system/kernel/arch/ppc/arch_vm_translation_map.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/ppc/arch_vm_translation_map.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/ppc/arch_vm_translation_map.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -146,8 +146,8 @@ addr_t end) const; 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); virtual status_t Unmap(addr_t start, addr_t end); @@ -155,10 +155,10 @@ bool updatePageQueue); virtual status_t Query(addr_t virtualAddress, - addr_t* _physicalAddress, + phys_addr_t* _physicalAddress, uint32* _flags); virtual status_t QueryInterrupt(addr_t virtualAddress, - addr_t* _physicalAddress, + phys_addr_t* _physicalAddress, uint32* _flags); virtual status_t Protect(addr_t base, addr_t top, @@ -202,7 +202,7 @@ static void fill_page_table_entry(page_table_entry *entry, uint32 virtualSegmentID, - addr_t virtualAddress, addr_t physicalAddress, uint8 protection, + addr_t virtualAddress, phys_addr_t physicalAddress, uint8 protection, bool secondaryHash) { // lower 32 bit - set at once @@ -289,7 +289,7 @@ static status_t -map_iospace_chunk(addr_t va, addr_t pa, uint32 flags) +map_iospace_chunk(addr_t va, phys_addr_t pa, uint32 flags) { pa &= ~(B_PAGE_SIZE - 1); // make sure it's page aligned va &= ~(B_PAGE_SIZE - 1); // make sure it's page aligned @@ -395,7 +395,7 @@ status_t -PPCVMTranslationMap::Map(addr_t virtualAddress, addr_t physicalAddress, +PPCVMTranslationMap::Map(addr_t virtualAddress, phys_addr_t physicalAddress, uint32 attributes, uint32 memoryType, vm_page_reservation* reservation) { // TODO: Support memory types! @@ -549,7 +549,8 @@ status_t -PPCVMTranslationMap::Query(addr_t va, addr_t *_outPhysical, uint32 *_outFlags) +PPCVMTranslationMap::Query(addr_t va, phys_addr_t *_outPhysical, + uint32 *_outFlags) { page_table_entry *entry; @@ -579,7 +580,7 @@ status_t PPCVMTranslationMap::QueryInterrupt(addr_t virtualAddress, - addr_t* _physicalAddress, uint32* _flags) + phys_addr_t* _physicalAddress, uint32* _flags) { return PPCVMTranslationMap::Query(virtualAddress, _physicalAddress, _flags); } @@ -642,7 +643,7 @@ RecursiveLocker locker(fLock); uint32 flags; - addr_t physicalAddress; + phys_addr_t physicalAddress; if (Query(address, &physicalAddress, &flags) != B_OK || (flags & PAGE_PRESENT) == 0) { return false; @@ -690,7 +691,7 @@ static status_t -get_physical_page_tmap(addr_t physicalAddress, addr_t *_virtualAddress, +get_physical_page_tmap(phys_addr_t physicalAddress, addr_t *_virtualAddress, void **handle) { return generic_get_physical_page(physicalAddress, _virtualAddress, 0); @@ -802,8 +803,9 @@ */ status_t -arch_vm_translation_map_early_map(kernel_args *ka, addr_t virtualAddress, addr_t physicalAddress, - uint8 attributes, addr_t (*get_free_page)(kernel_args *)) +arch_vm_translation_map_early_map(kernel_args *ka, addr_t virtualAddress, + phys_addr_t physicalAddress, uint8 attributes, + phys_addr_t (*get_free_page)(kernel_args *)) { uint32 virtualSegmentID = get_sr((void *)virtualAddress) & 0xffffff; @@ -837,7 +839,7 @@ // XXX currently assumes this translation map is active status_t -arch_vm_translation_map_early_query(addr_t va, addr_t *out_physical) +arch_vm_translation_map_early_query(addr_t va, phys_addr_t *out_physical) { //PANIC_UNIMPLEMENTED(); panic("vm_translation_map_quick_query(): not yet implemented\n"); @@ -849,7 +851,7 @@ status_t -ppc_map_address_range(addr_t virtualAddress, addr_t physicalAddress, +ppc_map_address_range(addr_t virtualAddress, phys_addr_t physicalAddress, size_t size) { addr_t virtualEnd = ROUNDUP(virtualAddress + size, B_PAGE_SIZE); @@ -913,7 +915,7 @@ page_table_entry *entry = map->LookupPageTableEntry(virtualAddress); if (!entry) return B_ERROR; - addr_t physicalBase = entry->physical_page_number << 12; + phys_addr_t physicalBase = (phys_addr_t)entry->physical_page_number << 12; // map the pages error = ppc_map_address_range((addr_t)newAddress, physicalBase, size); Modified: haiku/trunk/src/system/kernel/arch/x86/X86VMTranslationMap.h =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/X86VMTranslationMap.h 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/x86/X86VMTranslationMap.h 2010-05-25 21:34:08 UTC (rev 36937) @@ -30,8 +30,8 @@ addr_t end) const; 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); virtual status_t Unmap(addr_t start, addr_t end); @@ -44,10 +44,10 @@ bool ignoreTopCachePageFlags); virtual status_t Query(addr_t virtualAddress, - addr_t* _physicalAddress, + phys_addr_t* _physicalAddress, uint32* _flags); virtual status_t QueryInterrupt(addr_t virtualAddress, - addr_t* _physicalAddress, + phys_addr_t* _physicalAddress, uint32* _flags); virtual status_t Protect(addr_t base, addr_t top, Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -394,7 +394,7 @@ if (id != thread_get_current_thread_id()) { // switch to the page directory of the new thread to be // able to follow the stack trace into userland - addr_t newPageDirectory = (addr_t)x86_next_page_directory( + uint32 newPageDirectory = (uint32)x86_next_page_directory( thread_get_current_thread(), thread); if (newPageDirectory != 0) { @@ -601,7 +601,7 @@ uint32 previousLocations[NUM_PREVIOUS_LOCATIONS]; struct thread *thread = NULL; - addr_t oldPageDirectory = 0; + uint32 oldPageDirectory = 0; uint32 ebp = x86_read_ebp(); int32 num = 0, last = 0; @@ -755,7 +755,7 @@ } struct thread *thread = NULL; - addr_t oldPageDirectory = 0; + uint32 oldPageDirectory = 0; addr_t ebp = x86_read_ebp(); int32 argCount = 0; @@ -929,9 +929,9 @@ } // switch the page directory, if necessary - addr_t oldPageDirectory = 0; + uint32 oldPageDirectory = 0; if (thread != thread_get_current_thread()) { - addr_t newPageDirectory = (addr_t)x86_next_page_directory( + uint32 newPageDirectory = (uint32)x86_next_page_directory( thread_get_current_thread(), thread); if (newPageDirectory != 0) { Modified: haiku/trunk/src/system/kernel/arch/x86/arch_thread.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_thread.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/x86/arch_thread.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -370,7 +370,7 @@ = cpuData->arch.active_translation_map; VMAddressSpace* toAddressSpace = to->team->address_space; - addr_t newPageDirectory; + uint32 newPageDirectory; vm_translation_map_arch_info* toMap; if (toAddressSpace != NULL && (toMap = static_cast<X86VMTranslationMap*>( @@ -389,7 +389,7 @@ cpuData->arch.active_translation_map = toMap; // get the new page directory - newPageDirectory = (addr_t)toMap->pgdir_phys; + newPageDirectory = (uint32)toMap->pgdir_phys; } else { newPageDirectory = 0; // this means no change Modified: haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -740,7 +740,8 @@ status_t -arch_vm_set_memory_type(struct VMArea *area, addr_t physicalBase, uint32 type) +arch_vm_set_memory_type(struct VMArea *area, phys_addr_t physicalBase, + uint32 type) { return add_memory_type_range(area->id, physicalBase, area->Size(), type); } Modified: haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp 2010-05-25 19:24:25 UTC (rev 36936) +++ haiku/trunk/src/system/kernel/arch/x86/arch_vm_translation_map.cpp 2010-05-25 21:34:08 UTC (rev 36937) @@ -115,9 +115,9 @@ #if 0 // this sanity check can be enabled when corruption due to // overwriting an active page directory is suspected - addr_t activePageDirectory; + uint32 activePageDirectory; read_cr3(activePageDirectory); - if (activePageDirectory == (addr_t)pgdir_phys) + if (activePageDirectory == (uint32)pgdir_phys) [... truncated: 1069 lines follow ...]