2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FBaseRtMemoryManager.cpp
19 * @brief This is the implementation file for the MemoryManager class.
26 #include <FBaseRtMemoryManager.h>
28 #include <FBaseSysLog.h>
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Runtime;
34 namespace Tizen { namespace Base { namespace Runtime {
36 MemoryManager::MemoryManager()
40 MemoryManager::~MemoryManager()
46 MemoryManager::ProtectMemory(const void* pAddress, long long length, unsigned long protection)
52 if (protection & MEMORY_PROTECTION_MODE_READ)
57 if (protection & MEMORY_PROTECTION_MODE_WRITE)
62 if (protection & MEMORY_PROTECTION_MODE_EXEC)
67 ret = mprotect((void*)pAddress, length, prot);
73 SysLogException(NID_BASE_RT, r, "[E_INVALID_ARG] pAddress(0x%x) is not a valid address or length is not a multiple of the system page size.");
78 SysLogException(NID_BASE_RT, r, "[E_SYSTEM] pAddress(0x%x) is not a valid address or length is not a multiple of the system page size.");