1c917cd62SIthamar R. Adema/*
2c917cd62SIthamar R. Adema * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3c917cd62SIthamar R. Adema * Distributed under the terms of the MIT License.
4c917cd62SIthamar R. Adema */
5c917cd62SIthamar R. Adema#ifndef KERNEL_ARCH_ARM_ARM_VM_TRANSLATION_MAP_H
6c917cd62SIthamar R. Adema#define KERNEL_ARCH_ARM_ARM_VM_TRANSLATION_MAP_H
7c917cd62SIthamar R. Adema
8c917cd62SIthamar R. Adema
9c917cd62SIthamar R. Adema#include <vm/VMTranslationMap.h>
10c917cd62SIthamar R. Adema
11c917cd62SIthamar R. Adema
121819aa71SIthamar R. Adema#if __GNUC__ < 4
131819aa71SIthamar R. Adema#define final
141819aa71SIthamar R. Adema#endif
151819aa71SIthamar R. Adema
161819aa71SIthamar R. Adema
17c917cd62SIthamar R. Adema#define PAGE_INVALIDATE_CACHE_SIZE 64
18c917cd62SIthamar R. Adema
19c917cd62SIthamar R. Adema
20c917cd62SIthamar R. Ademastruct ARMPagingStructures;
21c917cd62SIthamar R. Ademaclass TranslationMapPhysicalPageMapper;
22c917cd62SIthamar R. Adema
23c917cd62SIthamar R. Adema
24c917cd62SIthamar R. Ademastruct ARMVMTranslationMap : VMTranslationMap {
25c917cd62SIthamar R. Adema								ARMVMTranslationMap();
26c917cd62SIthamar R. Adema	virtual						~ARMVMTranslationMap();
27c917cd62SIthamar R. Adema
28c917cd62SIthamar R. Adema			status_t			Init(bool kernel);
29c917cd62SIthamar R. Adema
301819aa71SIthamar R. Adema	virtual	bool 				Lock() final;
311819aa71SIthamar R. Adema	virtual	void				Unlock() final;
32c917cd62SIthamar R. Adema
331819aa71SIthamar R. Adema	virtual	addr_t				MappedSize() const final;
34c917cd62SIthamar R. Adema
351819aa71SIthamar R. Adema	virtual	void				Flush() final;
36c917cd62SIthamar R. Adema
37c917cd62SIthamar R. Adema	virtual	ARMPagingStructures* PagingStructures() const = 0;
38c917cd62SIthamar R. Adema
39c917cd62SIthamar R. Adema	inline	void				InvalidatePage(addr_t address);
40c917cd62SIthamar R. Adema
41c917cd62SIthamar R. Ademaprotected:
42c917cd62SIthamar R. Adema			TranslationMapPhysicalPageMapper* fPageMapper;
43c917cd62SIthamar R. Adema			int					fInvalidPagesCount;
44c917cd62SIthamar R. Adema			addr_t				fInvalidPages[PAGE_INVALIDATE_CACHE_SIZE];
45c917cd62SIthamar R. Adema			bool				fIsKernelMap;
46c917cd62SIthamar R. Adema};
47c917cd62SIthamar R. Adema
48c917cd62SIthamar R. Adema
49c917cd62SIthamar R. Ademavoid
50c917cd62SIthamar R. AdemaARMVMTranslationMap::InvalidatePage(addr_t address)
51c917cd62SIthamar R. Adema{
52c917cd62SIthamar R. Adema	if (fInvalidPagesCount < PAGE_INVALIDATE_CACHE_SIZE)
53c917cd62SIthamar R. Adema		fInvalidPages[fInvalidPagesCount] = address;
54c917cd62SIthamar R. Adema
55c917cd62SIthamar R. Adema	fInvalidPagesCount++;
56c917cd62SIthamar R. Adema}
57c917cd62SIthamar R. Adema
58c917cd62SIthamar R. Adema
59c917cd62SIthamar R. Adema#endif	// KERNEL_ARCH_ARM_ARM_VM_TRANSLATION_MAP_H
60