btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / system / kernel / arch / x86 / paging / X86VMTranslationMap.h
bloba07b314b6967053e2b1cdfd278de6cd34e5630e5
1 /*
2 * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef KERNEL_ARCH_X86_X86_VM_TRANSLATION_MAP_H
6 #define KERNEL_ARCH_X86_X86_VM_TRANSLATION_MAP_H
9 #include <vm/VMTranslationMap.h>
12 #if __GNUC__ < 4
13 #define final
14 #endif
17 #define PAGE_INVALIDATE_CACHE_SIZE 64
20 struct X86PagingStructures;
21 class TranslationMapPhysicalPageMapper;
24 struct X86VMTranslationMap : VMTranslationMap {
25 X86VMTranslationMap();
26 virtual ~X86VMTranslationMap();
28 status_t Init(bool kernel);
30 virtual bool Lock() final;
31 virtual void Unlock() final;
33 virtual addr_t MappedSize() const final;
35 virtual void Flush() final;
37 virtual X86PagingStructures* PagingStructures() const = 0;
39 inline void InvalidatePage(addr_t address);
41 protected:
42 TranslationMapPhysicalPageMapper* fPageMapper;
43 int fInvalidPagesCount;
44 addr_t fInvalidPages[PAGE_INVALIDATE_CACHE_SIZE];
45 bool fIsKernelMap;
49 void
50 X86VMTranslationMap::InvalidatePage(addr_t address)
52 if (fInvalidPagesCount < PAGE_INVALIDATE_CACHE_SIZE)
53 fInvalidPages[fInvalidPagesCount] = address;
55 fInvalidPagesCount++;
59 #endif // KERNEL_ARCH_X86_X86_VM_TRANSLATION_MAP_H