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