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_PPC_VM_TRANSLATION_MAP_H 6*62caef87SFrançois Revol #define KERNEL_ARCH_PPC_PPC_VM_TRANSLATION_MAP_H 7*62caef87SFrançois Revol 8*62caef87SFrançois Revol 9*62caef87SFrançois Revol #include <vm/VMTranslationMap.h> 10*62caef87SFrançois Revol 11*62caef87SFrançois Revol 12*62caef87SFrançois Revol #define PAGE_INVALIDATE_CACHE_SIZE 64 13*62caef87SFrançois Revol 14*62caef87SFrançois Revol 15*62caef87SFrançois Revol struct PPCPagingStructures; 16*62caef87SFrançois Revol class TranslationMapPhysicalPageMapper; 17*62caef87SFrançois Revol 18*62caef87SFrançois Revol 19*62caef87SFrançois Revol struct PPCVMTranslationMap : VMTranslationMap { 20*62caef87SFrançois Revol PPCVMTranslationMap(); 21*62caef87SFrançois Revol virtual ~PPCVMTranslationMap(); 22*62caef87SFrançois Revol 23*62caef87SFrançois Revol status_t Init(bool kernel); 24*62caef87SFrançois Revol 25*62caef87SFrançois Revol virtual bool Lock(); 26*62caef87SFrançois Revol virtual void Unlock(); 27*62caef87SFrançois Revol 28*62caef87SFrançois Revol virtual addr_t MappedSize() const; 29*62caef87SFrançois Revol 30*62caef87SFrançois Revol virtual void Flush(); 31*62caef87SFrançois Revol 32*62caef87SFrançois Revol virtual PPCPagingStructures* PagingStructures() const = 0; 33*62caef87SFrançois Revol 34*62caef87SFrançois Revol inline void InvalidatePage(addr_t address); 35*62caef87SFrançois Revol 36*62caef87SFrançois Revol virtual status_t RemapAddressRange(addr_t *_virtualAddress, 37*62caef87SFrançois Revol size_t size, bool unmap) = 0; 38*62caef87SFrançois Revol 39*62caef87SFrançois Revol 40*62caef87SFrançois Revol virtual void ChangeASID() = 0; 41*62caef87SFrançois Revol 42*62caef87SFrançois Revol protected: 43*62caef87SFrançois Revol //X86:TranslationMapPhysicalPageMapper* fPageMapper; 44*62caef87SFrançois Revol int fInvalidPagesCount; 45*62caef87SFrançois Revol addr_t fInvalidPages[PAGE_INVALIDATE_CACHE_SIZE]; 46*62caef87SFrançois Revol bool fIsKernelMap; 47*62caef87SFrançois Revol }; 48*62caef87SFrançois Revol 49*62caef87SFrançois Revol 50*62caef87SFrançois Revol void InvalidatePage(addr_t address)51*62caef87SFrançois RevolPPCVMTranslationMap::InvalidatePage(addr_t address) 52*62caef87SFrançois Revol { 53*62caef87SFrançois Revol if (fInvalidPagesCount < PAGE_INVALIDATE_CACHE_SIZE) 54*62caef87SFrançois Revol fInvalidPages[fInvalidPagesCount] = address; 55*62caef87SFrançois Revol 56*62caef87SFrançois Revol fInvalidPagesCount++; 57*62caef87SFrançois Revol } 58*62caef87SFrançois Revol 59*62caef87SFrançois Revol 60*62caef87SFrançois Revol #endif // KERNEL_ARCH_PPC_PPC_VM_TRANSLATION_MAP_H 61