2 * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef KERNEL_ARCH_X86_PAGING_X86_PHYSICAL_PAGE_MAPPER_H
6 #define KERNEL_ARCH_X86_PAGING_X86_PHYSICAL_PAGE_MAPPER_H
9 #include <vm/VMTranslationMap.h>
18 class TranslationMapPhysicalPageMapper
{
20 virtual ~TranslationMapPhysicalPageMapper() { }
22 virtual void Delete() = 0;
24 virtual void* GetPageTableAt(phys_addr_t physicalAddress
) = 0;
25 // Must be invoked with thread pinned to current CPU.
29 class X86PhysicalPageMapper
: public VMPhysicalPageMapper
{
31 virtual status_t
CreateTranslationMapPhysicalPageMapper(
32 TranslationMapPhysicalPageMapper
** _mapper
)
35 virtual void* InterruptGetPageTableAt(
36 phys_addr_t physicalAddress
) = 0;
43 class TranslationMapPhysicalPageMapper
{
47 void* GetPageTableAt(phys_addr_t physicalAddress
);
48 // Must be invoked with thread pinned to current CPU.
52 class X86PhysicalPageMapper final
: public VMPhysicalPageMapper
{
54 status_t
CreateTranslationMapPhysicalPageMapper(
55 TranslationMapPhysicalPageMapper
** _mapper
);
57 void* InterruptGetPageTableAt(phys_addr_t physicalAddress
);
59 status_t
GetPage(phys_addr_t physicalAddress
, addr_t
* virtualAddress
,
60 void** handle
) override
;
61 status_t
PutPage(addr_t virtualAddress
, void* handle
) override
;
63 status_t
GetPageCurrentCPU(phys_addr_t physicalAddress
,
64 addr_t
* virtualAddress
, void** handle
) override
;
65 status_t
PutPageCurrentCPU(addr_t virtualAddress
, void* handle
) override
;
67 status_t
GetPageDebug(phys_addr_t physicalAddress
,
68 addr_t
* virtualAddress
, void** handle
) override
;
69 status_t
PutPageDebug(addr_t virtualAddress
, void* handle
) override
;
71 status_t
MemsetPhysical(phys_addr_t address
, int value
,
72 phys_size_t length
) override
;
73 status_t
MemcpyFromPhysical(void* to
, phys_addr_t from
, size_t length
,
75 status_t
MemcpyToPhysical(phys_addr_t to
, const void* from
,
76 size_t length
, bool user
) override
;
77 void MemcpyPhysicalPage(phys_addr_t to
, phys_addr_t from
) override
;
81 #include "paging/x86_physical_page_mapper_mapped.h"
87 #endif // KERNEL_ARCH_X86_PAGING_X86_PHYSICAL_PAGE_MAPPER_H