Exemplo n.º 1
0
	void *MEM1_realloc(void *p, unsigned int s)
	{
		if((u32)p < (u32)&__init_start - 0x100 && (u32)p >= 0x80004000)
			return g_mem1Lgp.reallocate(p, s);
		else if((u32)p > (u32)APPLOADER_START && (u32)p < (u32)APPLOADER_END)
			return g_mem1Ugp.reallocate(p, s);
		
		return NULL;
	}
Exemplo n.º 2
0
void *__wrap_realloc(void *p, size_t size)
{
	void *n;
	// ptr from mem2
	if(((u32)p & 0x10000000) != 0 || (p == 0 && size > MEM2_PRIORITY_SIZE))
	{
		n = g_mem2gp.reallocate(p, size);
		if(n != 0)
			return n;
		n = __real_malloc(size);
		if(n == 0)
			return 0;
		if(p != 0)
		{
			memcpy(n, p, MEM2_usableSize(p) < size ? MEM2_usableSize(p) : size);
			g_mem2gp.release(p);
		}
		return n;
	}
	// ptr from malloc
	n = __real_realloc(p, size);
	if(n != 0)
		return n;
	n = g_mem2gp.allocate(size);
	if(n == 0)
		return 0;
	if(p != 0)
	{
		memcpy(n, p, __real_malloc_usable_size(p) < size ? __real_malloc_usable_size(p) : size);
		__real_free(p);
	}
	return n;
}
Exemplo n.º 3
0
void *MEM2_realloc(void *p, unsigned int s)
{
	return g_mem2gp.reallocate(p, s);
}