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