xref: /haiku/src/system/kernel/arch/ppc/paging/classic/PPCVMTranslationMapClassic.h (revision 62caef87ce6f8e548727fe6561f3d47f46577abd)
1*62caef87SFrançois Revol /*
2*62caef87SFrançois Revol  * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3*62caef87SFrançois Revol  * Distributed under the terms of the MIT License.
4*62caef87SFrançois Revol  */
5*62caef87SFrançois Revol #ifndef KERNEL_ARCH_PPC_PAGING_CLASSIC_PPC_VM_TRANSLATION_MAP_CLASSIC_H
6*62caef87SFrançois Revol #define KERNEL_ARCH_PPC_PAGING_CLASSIC_PPC_VM_TRANSLATION_MAP_CLASSIC_H
7*62caef87SFrançois Revol 
8*62caef87SFrançois Revol 
9*62caef87SFrançois Revol #include "paging/PPCVMTranslationMap.h"
10*62caef87SFrançois Revol #include <arch_mmu.h>
11*62caef87SFrançois Revol 
12*62caef87SFrançois Revol 
13*62caef87SFrançois Revol struct PPCPagingStructuresClassic;
14*62caef87SFrançois Revol 
15*62caef87SFrançois Revol 
16*62caef87SFrançois Revol struct PPCVMTranslationMapClassic : PPCVMTranslationMap {
17*62caef87SFrançois Revol 								PPCVMTranslationMapClassic();
18*62caef87SFrançois Revol 	virtual						~PPCVMTranslationMapClassic();
19*62caef87SFrançois Revol 
20*62caef87SFrançois Revol 			status_t			Init(bool kernel);
21*62caef87SFrançois Revol 
VSIDBasePPCVMTranslationMapClassic22*62caef87SFrançois Revol 	inline	int					VSIDBase() const	{ return fVSIDBase; }
23*62caef87SFrançois Revol 
24*62caef87SFrançois Revol 	virtual void				ChangeASID();
25*62caef87SFrançois Revol 
26*62caef87SFrançois Revol 			page_table_entry*	LookupPageTableEntry(addr_t virtualAddress);
27*62caef87SFrançois Revol 			bool				RemovePageTableEntry(addr_t virtualAddress);
28*62caef87SFrançois Revol 
29*62caef87SFrançois Revol 	virtual	size_t				MaxPagesNeededToMap(addr_t start,
30*62caef87SFrançois Revol 									addr_t end) const;
31*62caef87SFrançois Revol 
32*62caef87SFrançois Revol 	virtual	status_t			Map(addr_t virtualAddress,
33*62caef87SFrançois Revol 									phys_addr_t physicalAddress,
34*62caef87SFrançois Revol 									uint32 attributes, uint32 memoryType,
35*62caef87SFrançois Revol 									vm_page_reservation* reservation);
36*62caef87SFrançois Revol 	virtual	status_t			Unmap(addr_t start, addr_t end);
37*62caef87SFrançois Revol 
38*62caef87SFrançois Revol 	virtual status_t			RemapAddressRange(addr_t *_virtualAddress,
39*62caef87SFrançois Revol 									size_t size, bool unmap);
40*62caef87SFrançois Revol 
41*62caef87SFrançois Revol 	virtual	status_t			DebugMarkRangePresent(addr_t start, addr_t end,
42*62caef87SFrançois Revol 									bool markPresent);
43*62caef87SFrançois Revol 
44*62caef87SFrançois Revol 	virtual	status_t			UnmapPage(VMArea* area, addr_t address,
45*62caef87SFrançois Revol 									bool updatePageQueue);
46*62caef87SFrançois Revol 	virtual	void				UnmapPages(VMArea* area, addr_t base,
47*62caef87SFrançois Revol 									size_t size, bool updatePageQueue);
48*62caef87SFrançois Revol 	virtual	void				UnmapArea(VMArea* area,
49*62caef87SFrançois Revol 									bool deletingAddressSpace,
50*62caef87SFrançois Revol 									bool ignoreTopCachePageFlags);
51*62caef87SFrançois Revol 
52*62caef87SFrançois Revol 	virtual	status_t			Query(addr_t virtualAddress,
53*62caef87SFrançois Revol 									phys_addr_t* _physicalAddress,
54*62caef87SFrançois Revol 									uint32* _flags);
55*62caef87SFrançois Revol 	virtual	status_t			QueryInterrupt(addr_t virtualAddress,
56*62caef87SFrançois Revol 									phys_addr_t* _physicalAddress,
57*62caef87SFrançois Revol 									uint32* _flags);
58*62caef87SFrançois Revol 
59*62caef87SFrançois Revol 	virtual	status_t			Protect(addr_t base, addr_t top,
60*62caef87SFrançois Revol 									uint32 attributes, uint32 memoryType);
61*62caef87SFrançois Revol 
62*62caef87SFrançois Revol 	virtual	status_t			ClearFlags(addr_t virtualAddress,
63*62caef87SFrançois Revol 									uint32 flags);
64*62caef87SFrançois Revol 
65*62caef87SFrançois Revol 	virtual	bool				ClearAccessedAndModified(
66*62caef87SFrançois Revol 									VMArea* area, addr_t address,
67*62caef87SFrançois Revol 									bool unmapIfUnaccessed,
68*62caef87SFrançois Revol 									bool& _modified);
69*62caef87SFrançois Revol 
70*62caef87SFrançois Revol 	virtual	PPCPagingStructures* PagingStructures() const;
PagingStructuresClassicPPCVMTranslationMapClassic71*62caef87SFrançois Revol 	inline	PPCPagingStructuresClassic* PagingStructuresClassic() const
72*62caef87SFrançois Revol 									{ return fPagingStructures; }
73*62caef87SFrançois Revol 
74*62caef87SFrançois Revol private:
75*62caef87SFrançois Revol 			PPCPagingStructuresClassic* fPagingStructures;
76*62caef87SFrançois Revol 			//XXX:move to fPagingStructures?
77*62caef87SFrançois Revol 			int					fVSIDBase;
78*62caef87SFrançois Revol };
79*62caef87SFrançois Revol 
80*62caef87SFrançois Revol 
81*62caef87SFrançois Revol #endif	// KERNEL_ARCH_PPC_PAGING_CLASSIC_PPC_VM_TRANSLATION_MAP_CLASSIC_H
82