20 #ifndef MEMORY_MAPPED_FILE_H 21 #define MEMORY_MAPPED_FILE_H 23 #include "pedigree/kernel/Spinlock.h" 24 #include "pedigree/kernel/compiler.h" 25 #include "pedigree/kernel/process/MemoryPressureManager.h" 26 #include "pedigree/kernel/processor/PageFaultHandler.h" 27 #include "pedigree/kernel/processor/state_forward.h" 28 #include "pedigree/kernel/processor/types.h" 29 #include "pedigree/kernel/utilities/List.h" 30 #include "pedigree/kernel/utilities/String.h" 31 #include "pedigree/kernel/utilities/Tree.h" 32 #include "pedigree/kernel/utilities/new" 120 static const int None = 0x0;
121 static const int Read = 0x1;
122 static const int Write = 0x2;
123 static const int Exec = 0x4;
127 uintptr_t
address,
bool bCopyOnWrite,
size_t length, Permissions perms)
163 virtual bool remove(
size_t length) = 0;
175 virtual void sync(uintptr_t at,
bool async)
193 virtual void unmap() = 0;
202 virtual bool trap(uintptr_t
address,
bool bWrite) = 0;
295 virtual bool remove(
size_t length);
299 virtual void unmap();
301 virtual bool trap(uintptr_t address,
bool bWrite);
304 static physical_uintptr_t m_Zero;
306 void unmapUnlocked();
334 virtual bool remove(
size_t length);
338 virtual void sync(uintptr_t at,
bool async);
341 virtual void unmap();
343 virtual bool trap(uintptr_t address,
bool bWrite);
363 void unmapUnlocked();
366 void trackMapping(uintptr_t, physical_uintptr_t);
369 void untrackMapping(uintptr_t);
372 physical_uintptr_t getMapping(uintptr_t);
375 size_t getMappingCount();
378 void clearMappings();
415 bool bCopyOnWrite =
true);
421 uintptr_t &address,
size_t length,
440 size_t remove(uintptr_t base,
size_t length);
455 bool contains(uintptr_t base,
size_t length);
461 void sync(uintptr_t base,
size_t length,
bool async);
467 void invalidate(uintptr_t base,
size_t length);
482 virtual bool trap(InterruptState &state, uintptr_t address,
bool bIsWrite);
491 virtual const String getMemoryPressureDescription()
493 return String(
"Unmap safe pages from memory mapped files.");
502 void unmapAllUnlocked();
525 bool sanitiseAddress(uintptr_t &address,
size_t length);
533 void op(Ops what, uintptr_t base,
size_t length,
bool async);
static MemoryMapManager m_Instance
virtual bool trap(uintptr_t address, bool bWrite)=0
virtual void setPermissions(Permissions perms)=0
Permissions m_Permissions
List< void * > m_Mappings
Tree< VirtualAddressSpace *, MmObjectList * > m_MmObjectLists
MemoryMappedObject(uintptr_t address, bool bCopyOnWrite, size_t length, Permissions perms)
bool matches(uintptr_t address)
virtual void sync(uintptr_t at, bool async)
uintptr_t address() const
Tree< uintptr_t, physical_uintptr_t > m_Mappings
static MemoryMapManager & instance()
virtual MemoryMappedObject * split(uintptr_t at)=0
virtual MemoryMappedObject * clone()=0
virtual void invalidate(uintptr_t at)