* VMArea: Made memory_type private and added setter and getter methods.

* Don't set the VMArea's memory type in arch_vm_set_memory_type(), but let the
  callers do that.
* vm_set_area_memory_type(): Does nothing, if the memory type doesn't change.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36573 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-05-01 20:41:57 +00:00
parent 907886143f
commit 3b0c1b5227
3 changed files with 42 additions and 8 deletions
+24 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2009-2010, Ingo Weinhold, [email protected].
* Copyright 2002-2009, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*
@@ -10,6 +10,8 @@
#define _KERNEL_VM_VM_AREA_H
#include <vm_defs.h>
#include <lock.h>
#include <util/DoublyLinkedList.h>
#include <util/SinglyLinkedList.h>
@@ -91,8 +93,11 @@ struct VMArea {
area_id id;
uint32 protection;
uint16 wiring;
uint16 memory_type;
private:
uint16 memory_type; // >> shifted by MEMORY_TYPE_SHIFT
public:
VMCache* cache;
vint32 no_cache_change;
off_t cache_offset;
@@ -108,6 +113,9 @@ struct VMArea {
addr_t Base() const { return fBase; }
size_t Size() const { return fSize; }
inline uint32 MemoryType() const;
inline void SetMemoryType(uint32 memoryType);
bool ContainsAddress(addr_t address) const
{ return address >= fBase
&& address <= fBase + (fSize - 1); }
@@ -204,4 +212,18 @@ private:
};
uint32
VMArea::MemoryType() const
{
return (uint32)memory_type << MEMORY_TYPE_SHIFT;
}
void
VMArea::SetMemoryType(uint32 memoryType)
{
memory_type = memoryType >> MEMORY_TYPE_SHIFT;
}
#endif // _KERNEL_VM_VM_AREA_H