btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / system / kernel / arch / x86 / paging / x86_physical_page_mapper.h
blobb9c7cb4eaf3ef40611c49166448a929c0007c3ed
1 /*
2 * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
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>
12 struct kernel_args;
15 #ifndef __x86_64__
18 class TranslationMapPhysicalPageMapper {
19 public:
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 {
30 public:
31 virtual status_t CreateTranslationMapPhysicalPageMapper(
32 TranslationMapPhysicalPageMapper** _mapper)
33 = 0;
35 virtual void* InterruptGetPageTableAt(
36 phys_addr_t physicalAddress) = 0;
40 #else
43 class TranslationMapPhysicalPageMapper {
44 public:
45 void Delete();
47 void* GetPageTableAt(phys_addr_t physicalAddress);
48 // Must be invoked with thread pinned to current CPU.
52 class X86PhysicalPageMapper final : public VMPhysicalPageMapper {
53 public:
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,
74 bool user) override;
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"
84 #endif // __x86_64__
87 #endif // KERNEL_ARCH_X86_PAGING_X86_PHYSICAL_PAGE_MAPPER_H