diff --git a/src/system/kernel/vm/VMUserAddressSpace.cpp b/src/system/kernel/vm/VMUserAddressSpace.cpp index 94b266466f..038a45cbc6 100644 --- a/src/system/kernel/vm/VMUserAddressSpace.cpp +++ b/src/system/kernel/vm/VMUserAddressSpace.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -95,8 +96,9 @@ VMArea* VMUserAddressSpace::LookupArea(addr_t address) const { // check the area hint first - if (fAreaHint != NULL && fAreaHint->ContainsAddress(address)) - return fAreaHint; + VMArea* areaHint = atomic_pointer_get(&fAreaHint); + if (areaHint != NULL && areaHint->ContainsAddress(address)) + return areaHint; for (VMUserAreaList::ConstIterator it = fAreas.GetIterator(); VMUserArea* area = it.Next();) { @@ -104,7 +106,7 @@ VMUserAddressSpace::LookupArea(addr_t address) const continue; if (area->ContainsAddress(address)) { - fAreaHint = area; + atomic_pointer_set(&fAreaHint, area); return area; } } diff --git a/src/system/kernel/vm/VMUserAddressSpace.h b/src/system/kernel/vm/VMUserAddressSpace.h index 052c399373..fc51459a14 100644 --- a/src/system/kernel/vm/VMUserAddressSpace.h +++ b/src/system/kernel/vm/VMUserAddressSpace.h @@ -58,8 +58,8 @@ private: VMUserArea* area, uint32 allocationFlags); private: - VMUserAreaList fAreas; - mutable VMArea* fAreaHint; + VMUserAreaList fAreas; + mutable VMUserArea* fAreaHint; };