xref: /haiku/src/system/kernel/arch/m68k/paging/M68KVMTranslationMap.h (revision 02354704729d38c3b078c696adc1bbbd33cbcf72)
1 /*
2  * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef KERNEL_ARCH_M68K_M68K_VM_TRANSLATION_MAP_H
6 #define KERNEL_ARCH_M68K_M68K_VM_TRANSLATION_MAP_H
7 
8 
9 #include <vm/VMTranslationMap.h>
10 
11 
12 #define PAGE_INVALIDATE_CACHE_SIZE 64
13 
14 
15 struct M68KPagingStructures;
16 class TranslationMapPhysicalPageMapper;
17 
18 
19 struct M68KVMTranslationMap : VMTranslationMap {
20 								M68KVMTranslationMap();
21 	virtual						~M68KVMTranslationMap();
22 
23 			status_t			Init(bool kernel);
24 
25 	virtual	bool 				Lock();
26 	virtual	void				Unlock();
27 
28 	virtual	addr_t				MappedSize() const;
29 
30 	virtual	void				Flush();
31 
32 	virtual	M68KPagingStructures* PagingStructures() const = 0;
33 
34 	inline	void				InvalidatePage(addr_t address);
35 
36 protected:
37 			TranslationMapPhysicalPageMapper* fPageMapper;
38 			int					fInvalidPagesCount;
39 			addr_t				fInvalidPages[PAGE_INVALIDATE_CACHE_SIZE];
40 			bool				fIsKernelMap;
41 };
42 
43 
44 void
45 M68KVMTranslationMap::InvalidatePage(addr_t address)
46 {
47 	if (fInvalidPagesCount < PAGE_INVALIDATE_CACHE_SIZE)
48 		fInvalidPages[fInvalidPagesCount] = address;
49 
50 	fInvalidPagesCount++;
51 }
52 
53 
54 #endif	// KERNEL_ARCH_M68K_M68K_VM_TRANSLATION_MAP_H
55