1 /* 2 * Copyright 2022 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef PMAP_PHYSICAL_PAGE_MAPPER_H 6 #define PMAP_PHYSICAL_PAGE_MAPPER_H 7 8 #include <arch_cpu_defs.h> 9 #include <vm/VMTranslationMap.h> 10 11 12 struct PMAPPhysicalPageMapper : public VMPhysicalPageMapper 13 { 14 virtual status_t GetPage(phys_addr_t physicalAddress, 15 addr_t* _virtualAddress, 16 void** _handle); 17 virtual status_t PutPage(addr_t virtualAddress, 18 void* handle); 19 20 virtual status_t GetPageCurrentCPU( 21 phys_addr_t physicalAddress, 22 addr_t* _virtualAddress, 23 void** _handle) 24 { 25 return GetPage(physicalAddress, _virtualAddress, _handle); 26 } 27 virtual status_t PutPageCurrentCPU(addr_t virtualAddress, 28 void* _handle) { return PutPage(virtualAddress, _handle); } 29 30 virtual status_t GetPageDebug(phys_addr_t physicalAddress, 31 addr_t* _virtualAddress, 32 void** _handle) { return GetPage(physicalAddress, 33 _virtualAddress, _handle); } 34 virtual status_t PutPageDebug(addr_t virtualAddress, 35 void* _handle) 36 { 37 return PutPage(virtualAddress, _handle); 38 } 39 40 virtual status_t MemsetPhysical(phys_addr_t address, int value, 41 phys_size_t length); 42 virtual status_t MemcpyFromPhysical(void* to, phys_addr_t from, 43 size_t length, bool user); 44 virtual status_t MemcpyToPhysical(phys_addr_t to, 45 const void* from, size_t length, 46 bool user); 47 virtual void MemcpyPhysicalPage(phys_addr_t to, 48 phys_addr_t from); 49 }; 50 51 #endif 52