Exemplo n.º 1
0
gmgr_surface_t *GmgrCreateMemorySurface(const videomode_t *mode, uint32_t flags)
{
	gmgr_surface_t *surf;

	surf = malloc(sizeof(*surf));
	if (surf == NULL)
		return NULL;

	surf->device = NULL;
	surf->flags = flags;
	surf->mode = *mode;
	surf->base = VmmAlloc(PAGE_ALIGN_UP(mode->bytesPerLine * mode->height) / PAGE_SIZE,
		NULL,
		VM_MEM_USER | VM_MEM_READ | VM_MEM_WRITE);
	if (surf->base == NULL)
	{
		free(surf);
		return NULL;
	}

	if (!FramebufCreateSurface(mode, surf->base, &surf->surf))
	{
		VmmFree(surf->base);
		free(surf);
		return NULL;
	}

	return surf;
}
Exemplo n.º 2
0
void *__morecore(size_t *bytes)
{
	*bytes = max(PAGE_ALIGN_UP(*bytes), 4 * PAGE_SIZE);
	return VmmAlloc(*bytes / PAGE_SIZE,
		0,
		VM_MEM_USER | VM_MEM_READ | VM_MEM_WRITE);
}
Exemplo n.º 3
0
Arquivo: v86.c Projeto: 1tgr/mobius
static void *aligned_alloc(size_t bytes)
{
    return VmmAlloc(PAGE_ALIGN_UP(bytes) / PAGE_SIZE, NULL, VM_MEM_READ | VM_MEM_WRITE);
}