WiiFlow_Lite/source/memory/mem_manager.hpp
fix94.1 18bab7faf5 -made most thread stacks static, that should increase speed and stability
-moved some memory positions so we have 45mb mem2 compared to 44mb mem2 previously
-slighly increased some timeouts and memory sizes for security
2014-03-17 17:38:32 +00:00

51 lines
1.4 KiB
C++

/****************************************************************************
* Copyright (C) 2013 FIX94
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef _MEM_MANAGER_HPP_
#define _MEM_MANAGER_HPP_
#include <ogcsys.h>
#include <ogc/mutex.h>
enum mem_states
{
MEM_FREE = (1<<0),
ALLOC_USED = (1<<1),
ALLOC_END = (1<<2),
MEM_END = (1<<3),
};
class MemManager {
public:
MemManager();
~MemManager();
void Init(u8 *start, u8 *list, u32 size);
void ClearMem();
void *Alloc(u32 size);
void Free(void *mem);
u32 MemBlockSize(void *mem);
u32 FreeSize();
void *ReAlloc(void *mem, u32 size);
private:
mutex_t memMutex;
u8 *startAddr;
u8 *memList;
u8 *memListEnd;
u32 memSize;
};
#endif