/* * Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the NewOS License. */ #ifndef VM_USER_AREA_H #define VM_USER_AREA_H #include #include struct VMUserAddressSpace; struct VMUserArea : VMArea, AVLTreeNode { VMUserArea(VMAddressSpace* addressSpace, uint32 wiring, uint32 protection); ~VMUserArea(); static VMUserArea* Create(VMAddressSpace* addressSpace, const char* name, uint32 wiring, uint32 protection, uint32 allocationFlags); static VMUserArea* CreateReserved(VMAddressSpace* addressSpace, uint32 flags, uint32 allocationFlags); }; struct VMUserAreaTreeDefinition { typedef addr_t Key; typedef VMUserArea Value; AVLTreeNode* GetAVLTreeNode(Value* value) const { return value; } Value* GetValue(AVLTreeNode* node) const { return static_cast(node); } int Compare(addr_t a, const Value* _b) const { addr_t b = _b->Base(); if (a == b) return 0; return a < b ? -1 : 1; } int Compare(const Value* a, const Value* b) const { return Compare(a->Base(), b); } }; typedef AVLTree VMUserAreaTree; #endif // VM_USER_AREA_H