Ejemplo n.º 1
0
int HGSMIHeapSetup (HGSMIHEAP *pHeap,
                    void *pvBase,
                    HGSMISIZE cbArea,
                    HGSMIOFFSET offBase,
                    bool fOffsetBased)
{
    if (   !pHeap
        || !pvBase)
    {
        return VERR_INVALID_PARAMETER;
    }

    int rc = HGSMIAreaInitialize (&pHeap->area, pvBase, cbArea, offBase);

    if (RT_SUCCESS (rc))
    {
        if (!fOffsetBased)
            rc = RTHeapSimpleInit (&pHeap->u.hPtr, pvBase, cbArea);
        else
            rc = RTHeapOffsetInit (&pHeap->u.hOff, pvBase, cbArea);

        if (RT_SUCCESS (rc))
        {
            pHeap->cRefs = 0;
            pHeap->fOffsetBased = fOffsetBased;
        }
        else
        {
            HGSMIAreaClear (&pHeap->area);
        }
    }

    return rc;
}
Ejemplo n.º 2
0
void HGSMIHeapDestroy (HGSMIHEAP *pHeap)
{
    if (pHeap)
    {
        Assert(!pHeap->cRefs);
        pHeap->u.hPtr = NIL_RTHEAPSIMPLE;
        HGSMIAreaClear (&pHeap->area);
        pHeap->cRefs = 0;
    }
}
Ejemplo n.º 3
0
/* Called for IOCTL_VIDEO_UNMAP_VIDEO_MEMORY.
 * Unmaps previously mapped FrameBuffer and video RAM from caller's virtual adress space.
 */
BOOLEAN VBoxMPUnmapVideoMemory(PVBOXMP_DEVEXT pExt, PVIDEO_MEMORY VideoMemory, PSTATUS_BLOCK pStatus)
{
    LOGF_ENTER();

    HGSMIAreaClear(&pExt->areaDisplay);
    pStatus->Status = VideoPortUnmapMemory(pExt, VideoMemory->RequestedVirtualAddress, NULL);

    LOGF_LEAVE();
    return TRUE;
}
int HGSMIHeapSetup(HGSMIHEAP *pHeap,
                   void *pvBase,
                   HGSMISIZE cbArea,
                   HGSMIOFFSET offBase,
                   const HGSMIENV *pEnv)
{
    AssertPtrReturn(pHeap, VERR_INVALID_PARAMETER);
    AssertPtrReturn(pvBase, VERR_INVALID_PARAMETER);

    int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase);
    if (RT_SUCCESS(rc))
    {
        rc = HGSMIMAInit(&pHeap->ma, &pHeap->area, NULL, 0, 0, pEnv);
        if (RT_FAILURE(rc))
        {
            HGSMIAreaClear(&pHeap->area);
        }
    }

    return rc;
}
Ejemplo n.º 5
0
int HGSMIHeapRelocate (HGSMIHEAP *pHeap,
                       void *pvBase,
                       uint32_t offHeapHandle,
                       uintptr_t offDelta,
                       HGSMISIZE cbArea,
                       HGSMIOFFSET offBase,
                       bool fOffsetBased
                       )
{
    if (   !pHeap
        || !pvBase)
    {
        return VERR_INVALID_PARAMETER;
    }

    int rc = HGSMIAreaInitialize (&pHeap->area, pvBase, cbArea, offBase);

    if (RT_SUCCESS (rc))
    {
        if (fOffsetBased)
            pHeap->u.hOff = (RTHEAPOFFSET)((uint8_t *)pvBase + offHeapHandle);
        else
        {
            pHeap->u.hPtr = (RTHEAPSIMPLE)((uint8_t *)pvBase + offHeapHandle);
            rc = RTHeapSimpleRelocate (pHeap->u.hPtr, offDelta); AssertRC(rc);
        }
        if (RT_SUCCESS (rc))
        {
            pHeap->cRefs = 0;
            pHeap->fOffsetBased = fOffsetBased;
        }
        else
        {
            HGSMIAreaClear (&pHeap->area);
        }
    }

    return rc;
}