#include "ProcessMem.h"


ProcessMem::ProcessMem(void):minfo(0)
{
}


ProcessMem::~ProcessMem(void)
{
}


void *ProcessMem::sys_malloc(size_t size){
	count++;
	minfo[count - 1].size = (size + 0x1000 - 1) / 0x1000 * 0x1000;
	//return (void *)(minfo[count - 1].addr = alloc(minfo[count - 1].size));
	return 0;
}

void ProcessMem::sys_free(void *p){
	int i = 0;
	for(i = 0; i < count; i++){
		if(minfo[i].addr == (DWORD)p){
			break;
		}
	}
	if(i == count){
		debugprint("sys_free error");
		hung();
		return;
	}
	for(; i < count; i++){
		minfo[i] = minfo[i + 1];
	}
	count--;
}
