/** @file
*
* VBox Host Guest Shared Memory Interface (HGSMI).
*/
/*
* Copyright (C) 2006-2015 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.
*/
#ifndef ___VBox_HGSMI_HGSMI_h
#define ___VBox_HGSMI_HGSMI_h
/*
* Basic mechanism for the HGSMI is to prepare and pass data buffer to the host and the guest.
* Data inside these buffers are opaque for the HGSMI and are interpreted by higher levels.
*
*
* HGSMIBUFFERHEADER header;
* uint8_t data[header.u32BufferSize];
* HGSMIBUFFERTAIL tail;
*
* Note: Offset of the 'header' in the memory is used for virtual hardware IO.
*
* Buffers are verifyed using the offset and the content of the header and the tail,
* which are constant during a call.
*
* Invalid buffers are ignored.
*
* Actual 'data' is not verifyed, as it is expected that the data can be changed by the
* called function.
*
* Since only the offset of the buffer is passed in a IO operation, the header and tail
* must contain:
* * size of data in this buffer;
* * checksum for buffer verification.
*
* For segmented transfers:
* * the sequence identifier;
* * offset of the current segment in the sequence;
* * total bytes in the transfer.
*
* Additionally contains:
* * the channel ID;
* * the channel information.
*/
/* Heap types. */
#pragma pack(1)
typedef struct HGSMIHEAP
{
union
{
} u;
} HGSMIHEAP;
#pragma pack()
#pragma pack(1)
/* The size of the array of channels. Array indexes are uint8_t. Note: the value must not be changed. */
/* Channel handler called when the guest submits a buffer. */
typedef DECLCALLBACK(int) FNHGSMICHANNELHANDLER(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer);
/* Information about a handler: pfn + context. */
typedef struct _HGSMICHANNELHANDLER
{
void *pvHandler;
/* Channel description. */
typedef struct _HGSMICHANNEL
{
} HGSMICHANNEL;
typedef struct _HGSMICHANNELINFO
{
* The array is accessed under the instance lock.
*/
#pragma pack()
{
return (HGSMIBUFFERHEADER *)pvBuffer;
}
{
}
{
}
{
return sizeof (HGSMIBUFFERHEADER) + sizeof (HGSMIBUFFERTAIL);
}
{
}
{
}
{
}
{
return HGSMIBufferMinimumSize () + u32DataSize;
}
const void *pv)
{
}
{
}
{
if(pHeader)
return HGSMIBufferData(pHeader);
return NULL;
}
DECLINLINE(uint8_t *) HGSMIBufferDataAndChInfoFromOffset (const HGSMIAREA *pArea, HGSMIOFFSET offBuffer, uint16_t * pChInfo)
{
if(pHeader)
{
return HGSMIBufferData(pHeader);
}
return NULL;
}
const HGSMIBUFFERHEADER *pHeader,
const HGSMIBUFFERTAIL *pTail);
void *pvBase,
{
}
{
return (uintptr_t)pv >= (uintptr_t)pArea->pu8Base && (uintptr_t)pv - (uintptr_t)pArea->pu8Base < pArea->cbArea;
}
void *pvBase,
void *pvBase,
void *pvBase,
void *pvBuf);
void *pvData);
void *pvData);
{
}
#ifdef IN_RING3
/* Needed for heap relocation: offset of the heap handle relative to the start of heap area. */
{
{
}
{
}
else
{
}
return offHeapHandle;
}
#endif /* IN_RING3 */
{
}
const char *pszName,
void *pvChannelHandler);
#endif /* !___VBox_HGSMI_HGSMI_h */