GenericRequest.cpp revision e64031e20c39650a7bc902a3e1aba613b9415dee
/* $Revision$ */
/** @file
* VBoxGuestLibR0 - Generic VMMDev request management.
*/
/*
* Copyright (C) 2006-2009 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#include "VBGLInternal.h"
{
{
return VERR_INVALID_PARAMETER;
}
{
return VERR_INVALID_PARAMETER;
}
/* The request size must correspond to the request type. */
if (cbReq < cbReqExpected)
{
return VERR_INVALID_PARAMETER;
}
if (cbReqExpected == cbReq)
{
/* This is most likely a fixed size request, and in this case the request size
* must be also equal to the expected size.
*/
{
return VERR_INVALID_PARAMETER;
}
return VINF_SUCCESS;
}
/* This can be a variable size request. Check the request type and limit the size
* to VMMDEV_MAX_VMMDEVREQ_SIZE, which is max size supported by the host.
*/
#ifdef VBOX_WITH_64_BITS_GUESTS
#else
#endif /* VBOX_WITH_64_BITS_GUESTS */
{
if (cbReq > VMMDEV_MAX_VMMDEVREQ_SIZE)
{
return VERR_BUFFER_OVERFLOW; /* @todo is this error code ok? */
}
}
else
{
return VERR_IO_BAD_LENGTH; /* @todo is this error code ok? */
}
return VINF_SUCCESS;
}
{
int rc = vbglR0Enter ();
if (RT_FAILURE(rc))
return rc;
{
return VERR_INVALID_PARAMETER;
}
if (!pReq)
{
AssertMsgFailed(("VbglGRAlloc: no memory\n"));
rc = VERR_NO_MEMORY;
}
else
{
}
return rc;
}
{
int rc = vbglR0Enter ();
if (RT_FAILURE(rc))
return rc;
if (!pReq)
return VERR_INVALID_PARAMETER;
if ( !physaddr
{
}
else
{
/* Make the compiler aware that the host has changed memory. */
}
return rc;
}
{
int rc = vbglR0Enter ();
if (RT_FAILURE(rc))
return;
}