Commit 7f9f2b22 authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Kamal Mostafa
parent bdb9a8f8
Source: http://ports.ubuntu.com/pool/multiverse/v/virtualbox/virtualbox-guest-dkms_5.0.16-dfsg-2_all.deb
Version: 5.0.16-dfsg-2
Source: http://ports.ubuntu.com/pool/multiverse/v/virtualbox/virtualbox-guest-dkms_5.0.18-dfsg-2build1_all.deb
Version: 5.0.18-dfsg-2build1
PACKAGE_NAME="virtualbox-guest"
PACKAGE_VERSION="5.0.16"
PACKAGE_VERSION="5.0.18"
CLEAN="rm -f *.*o"
BUILT_MODULE_NAME[0]="vboxguest"
BUILT_MODULE_LOCATION[0]="vboxguest"
......
/** @file
*
* VBox Host Guest Shared Memory Interface (HGSMI).
* Host/Guest shared part.
*/
/*
* 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;
* you can redistribute it and/or modify it under the terms of the GNU
* 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
#include <iprt/assert.h>
#include <iprt/types.h>
#include <VBox/HGSMI/HGSMIDefs.h>
#include <VBox/HGSMI/HGSMIChannels.h>
#include <VBox/HGSMI/HGSMIMemAlloc.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.
*
* Every shared memory buffer passed between the guest/host has the following structure:
*
* 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.
*/
typedef struct HGSMIHEAP
{
HGSMIAREA area; /* Description. */
HGSMIMADATA ma; /* Memory allocator */
} HGSMIHEAP;
/* The size of the array of channels. Array indexes are uint8_t. Note: the value must not be changed. */
#define HGSMI_NUMBER_OF_CHANNELS 0x100
/* Channel handler called when the guest submits a buffer. */
typedef DECLCALLBACK(int) FNHGSMICHANNELHANDLER(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer);
typedef FNHGSMICHANNELHANDLER *PFNHGSMICHANNELHANDLER;
/* Information about a handler: pfn + context. */
typedef struct _HGSMICHANNELHANDLER
{
PFNHGSMICHANNELHANDLER pfnHandler;
void *pvHandler;
} HGSMICHANNELHANDLER;
/* Channel description. */
typedef struct _HGSMICHANNEL
{
HGSMICHANNELHANDLER handler; /* The channel handler. */
const char *pszName; /* NULL for hardcoded channels or RTStrDup'ed name. */
uint8_t u8Channel; /* The channel id, equal to the channel index in the array. */
uint8_t u8Flags; /* HGSMI_CH_F_* */
} HGSMICHANNEL;
typedef struct _HGSMICHANNELINFO
{
HGSMICHANNEL Channels[HGSMI_NUMBER_OF_CHANNELS]; /* Channel handlers indexed by the channel id.
* The array is accessed under the instance lock.
*/
} HGSMICHANNELINFO;
RT_C_DECLS_BEGIN
DECLINLINE(HGSMIBUFFERHEADER *) HGSMIBufferHeaderFromPtr(void *pvBuffer)
{
return (HGSMIBUFFERHEADER *)pvBuffer;
}
DECLINLINE(uint8_t *) HGSMIBufferDataFromPtr(void *pvBuffer)
{
return (uint8_t *)pvBuffer + sizeof(HGSMIBUFFERHEADER);
}
DECLINLINE(HGSMIBUFFERTAIL *) HGSMIBufferTailFromPtr(void *pvBuffer,
uint32_t u32DataSize)
{
return (HGSMIBUFFERTAIL *)(HGSMIBufferDataFromPtr(pvBuffer) + u32DataSize);
}
DECLINLINE(HGSMISIZE) HGSMIBufferMinimumSize(void)
{
return sizeof(HGSMIBUFFERHEADER) + sizeof(HGSMIBUFFERTAIL);
}
DECLINLINE(HGSMIBUFFERHEADER *) HGSMIBufferHeaderFromData(const void *pvData)
{
return (HGSMIBUFFERHEADER *)((uint8_t *)pvData - sizeof(HGSMIBUFFERHEADER));
}
DECLINLINE(HGSMISIZE) HGSMIBufferRequiredSize(uint32_t u32DataSize)
{
return HGSMIBufferMinimumSize() + u32DataSize;
}
DECLINLINE(HGSMIOFFSET) HGSMIPointerToOffset(const HGSMIAREA *pArea,
const void *pv)
{
return pArea->offBase + (HGSMIOFFSET)((uint8_t *)pv - pArea->pu8Base);
}
DECLINLINE(void *) HGSMIOffsetToPointer(const HGSMIAREA *pArea,
HGSMIOFFSET offBuffer)
{
return pArea->pu8Base + (offBuffer - pArea->offBase);
}
DECLINLINE(uint8_t *) HGSMIBufferDataFromOffset(const HGSMIAREA *pArea,
HGSMIOFFSET offBuffer)
{
void *pvBuffer = HGSMIOffsetToPointer(pArea, offBuffer);
return HGSMIBufferDataFromPtr(pvBuffer);
}
DECLINLINE(HGSMIOFFSET) HGSMIBufferOffsetFromData(const HGSMIAREA *pArea,
void *pvData)
{
HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData);
return HGSMIPointerToOffset(pArea, pHeader);
}
DECLINLINE(uint8_t *) HGSMIBufferDataAndChInfoFromOffset(const HGSMIAREA *pArea,
HGSMIOFFSET offBuffer,
uint16_t *pu16ChannelInfo)
{
HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIOffsetToPointer(pArea, offBuffer);
*pu16ChannelInfo = pHeader->u16ChannelInfo;
return HGSMIBufferDataFromPtr(pHeader);
}
uint32_t HGSMIChecksum(HGSMIOFFSET offBuffer,
const HGSMIBUFFERHEADER *pHeader,
const HGSMIBUFFERTAIL *pTail);
int HGSMIAreaInitialize(HGSMIAREA *pArea,
void *pvBase,
HGSMISIZE cbArea,
HGSMIOFFSET offBase);
void HGSMIAreaClear(HGSMIAREA *pArea);
DECLINLINE(bool) HGSMIAreaContainsOffset(const HGSMIAREA *pArea, HGSMIOFFSET off)
{
return off >= pArea->offBase && off - pArea->offBase < pArea->cbArea;
}
DECLINLINE(bool) HGSMIAreaContainsPointer(const HGSMIAREA *pArea, const void *pv)
{
return (uintptr_t)pv >= (uintptr_t)pArea->pu8Base && (uintptr_t)pv - (uintptr_t)pArea->pu8Base < pArea->cbArea;
}
HGSMIOFFSET HGSMIBufferInitializeSingle(const HGSMIAREA *pArea,
HGSMIBUFFERHEADER *pHeader,
HGSMISIZE cbBuffer,
uint8_t u8Channel,
uint16_t u16ChannelInfo);
int HGSMIHeapSetup(HGSMIHEAP *pHeap,
void *pvBase,
HGSMISIZE cbArea,
HGSMIOFFSET offBase,
const HGSMIENV *pEnv);
void HGSMIHeapDestroy(HGSMIHEAP *pHeap);
void *HGSMIHeapBufferAlloc(HGSMIHEAP *pHeap,
HGSMISIZE cbBuffer);
void HGSMIHeapBufferFree(HGSMIHEAP *pHeap,
void *pvBuf);
void *HGSMIHeapAlloc(HGSMIHEAP *pHeap,
HGSMISIZE cbData,
uint8_t u8Channel,
uint16_t u16ChannelInfo);
void HGSMIHeapFree(HGSMIHEAP *pHeap,
void *pvData);
DECLINLINE(const HGSMIAREA *) HGSMIHeapArea(HGSMIHEAP *pHeap)
{
return &pHeap->area;
}
DECLINLINE(HGSMIOFFSET) HGSMIHeapOffset(HGSMIHEAP *pHeap)
{
return HGSMIHeapArea(pHeap)->offBase;
}
DECLINLINE(HGSMISIZE) HGSMIHeapSize(HGSMIHEAP *pHeap)
{
return HGSMIHeapArea(pHeap)->cbArea;
}
DECLINLINE(HGSMIOFFSET) HGSMIHeapBufferOffset(HGSMIHEAP *pHeap,
void *pvData)
{
return HGSMIBufferOffsetFromData(HGSMIHeapArea(pHeap), pvData);
}
HGSMICHANNEL *HGSMIChannelFindById(HGSMICHANNELINFO *pChannelInfo,
uint8_t u8Channel);
int HGSMIChannelRegister(HGSMICHANNELINFO *pChannelInfo,
uint8_t u8Channel,
const char *pszName,
PFNHGSMICHANNELHANDLER pfnChannelHandler,
void *pvChannelHandler);
int HGSMIBufferProcess(const HGSMIAREA *pArea,
HGSMICHANNELINFO *pChannelInfo,
HGSMIOFFSET offBuffer);
RT_C_DECLS_END
#endif /* !___VBox_HGSMI_HGSMI_h */
/** @file
* VBox Host Guest Shared Memory Interface (HGSMI), sHost/Guest shared part.
*/
/*
* 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;
* you can redistribute it and/or modify it under the terms of the GNU
* 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_HGSMIChSetup_h
#define ___VBox_HGSMI_HGSMIChSetup_h
#include <VBox/HGSMI/HGSMI.h>
/* HGSMI setup and configuration channel commands and data structures. */
#define HGSMI_CC_HOST_FLAGS_LOCATION 0 /* Tell the host the location of HGSMIHOSTFLAGS structure,
* where the host can write information about pending
* buffers, etc, and which can be quickly polled by
* the guest without a need to port IO.
*/
typedef struct _HGSMIBUFFERLOCATION
{
HGSMIOFFSET offLocation;
HGSMISIZE cbLocation;
} HGSMIBUFFERLOCATION;
AssertCompileSize(HGSMIBUFFERLOCATION, 8);
/* HGSMI setup and configuration data structures. */
/* host->guest commands pending, should be accessed under FIFO lock only */
#define HGSMIHOSTFLAGS_COMMANDS_PENDING 0x1
/* IRQ is fired, should be accessed under VGAState::lock only */
#define HGSMIHOSTFLAGS_IRQ 0x2
#ifdef VBOX_WITH_WDDM
/* one or more guest commands is completed, should be accessed under FIFO lock only */
# define HGSMIHOSTFLAGS_GCOMMAND_COMPLETED 0x4
/* watchdog timer interrupt flag (used for debugging), should be accessed under VGAState::lock only */
# define HGSMIHOSTFLAGS_WATCHDOG 0x8
#endif
/* vsync interrupt flag, should be accessed under VGAState::lock only */
#define HGSMIHOSTFLAGS_VSYNC 0x10
/** monitor hotplug flag, should be accessed under VGAState::lock only */
#define HGSMIHOSTFLAGS_HOTPLUG 0x20
/** Cursor capability state change flag, should be accessed under
* VGAState::lock only. @see VBVACONF32. */
#define HGSMIHOSTFLAGS_CURSOR_CAPABILITIES 0x40
typedef struct _HGSMIHOSTFLAGS
{
/* host flags can be accessed and modified in multiple threads concurrently,
* e.g. CrOpenGL HGCM and GUI threads when to completing HGSMI 3D and Video Accel respectively,
* EMT thread when dealing with HGSMI command processing, etc.
* Besides settings/cleaning flags atomically, some each flag has its own special sync restrictions,
* see commants for flags definitions above */
volatile uint32_t u32HostFlags;
uint32_t au32Reserved[3];
} HGSMIHOSTFLAGS;
AssertCompileSize(HGSMIHOSTFLAGS, 16);
#endif
/** @file
*
* VBox Host Guest Shared Memory Interface (HGSMI).
* Host/Guest shared part.
* Channel identifiers.
*/
/*
* 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;
* you can redistribute it and/or modify it under the terms of the GNU
* 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 __HGSMIChannels_h__
#define __HGSMIChannels_h__
/* Each channel has an 8 bit identifier. There are a number of predefined
* (hardcoded) channels.
*
* HGSMI_CH_HGSMI channel can be used to map a string channel identifier
* to a free 16 bit numerical value. values are allocated in range
* [HGSMI_CH_STRING_FIRST;HGSMI_CH_STRING_LAST].
*
*/
/* Predefined channel identifiers. Used internally by VBOX to simplify the channel setup. */
#define HGSMI_CH_RESERVED (0x00) /* A reserved channel value. */
#define HGSMI_CH_HGSMI (0x01) /* HGCMI: setup and configuration channel. */
#define HGSMI_CH_VBVA (0x02) /* Graphics: VBVA. */
#define HGSMI_CH_SEAMLESS (0x03) /* Graphics: Seamless with a single guest region. */
#define HGSMI_CH_SEAMLESS2 (0x04) /* Graphics: Seamless with separate host windows. */
#define HGSMI_CH_OPENGL (0x05) /* Graphics: OpenGL HW acceleration. */
/* Dynamically allocated channel identifiers. */
#define HGSMI_CH_STRING_FIRST (0x20) /* The first channel index to be used for string mappings (inclusive). */
#define HGSMI_CH_STRING_LAST (0xff) /* The last channel index for string mappings (inclusive). */
/* Check whether the channel identifier is allocated for a dynamic channel. */
#define HGSMI_IS_DYNAMIC_CHANNEL(_channel) (((uint8_t)(_channel) & 0xE0) != 0)
#endif /* !__HGSMIChannels_h__*/
/** @file
*
* VBox Host Guest Shared Memory Interface (HGSMI).
* Host/Guest shared part: types and defines.
*/
/*
* 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;
* you can redistribute it and/or modify it under the terms of the GNU
* 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_HGSMIDefs_h
#define ___VBox_HGSMI_HGSMIDefs_h
#include <iprt/assert.h>
#include <iprt/types.h>
/* HGSMI uses 32 bit offsets and sizes. */
typedef uint32_t HGSMISIZE;
typedef uint32_t HGSMIOFFSET;
#define HGSMIOFFSET_VOID ((HGSMIOFFSET)~0)
/* Describes a shared memory area buffer.
* Used for calculations with offsets and for buffers verification.
*/
typedef struct HGSMIAREA
{
uint8_t *pu8Base; /* The starting address of the area. Corresponds to offset 'offBase'. */
HGSMIOFFSET offBase; /* The starting offset of the area. */
HGSMIOFFSET offLast; /* The last valid offset:
* offBase + cbArea - 1 - (sizeof(header) + sizeof(tail)).
*/
HGSMISIZE cbArea; /* Size of the area. */
} HGSMIAREA;
/* The buffer description flags. */
#define HGSMI_BUFFER_HEADER_F_SEQ_MASK 0x03 /* Buffer sequence type mask. */
#define HGSMI_BUFFER_HEADER_F_SEQ_SINGLE 0x00 /* Single buffer, not a part of a sequence. */
#define HGSMI_BUFFER_HEADER_F_SEQ_START 0x01 /* The first buffer in a sequence. */
#define HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE 0x02 /* A middle buffer in a sequence. */
#define HGSMI_BUFFER_HEADER_F_SEQ_END 0x03 /* The last buffer in a sequence. */
#pragma pack(1)
/* 16 bytes buffer header. */
typedef struct HGSMIBUFFERHEADER
{
uint32_t u32DataSize; /* Size of data that follows the header. */
uint8_t u8Flags; /* The buffer description: HGSMI_BUFFER_HEADER_F_* */
uint8_t u8Channel; /* The channel the data must be routed to. */
uint16_t u16ChannelInfo; /* Opaque to the HGSMI, used by the channel. */
union {
uint8_t au8Union[8]; /* Opaque placeholder to make the union 8 bytes. */
struct
{ /* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */
uint32_t u32Reserved1; /* A reserved field, initialize to 0. */
uint32_t u32Reserved2; /* A reserved field, initialize to 0. */
} Buffer;
struct
{ /* HGSMI_BUFFER_HEADER_F_SEQ_START */
uint32_t u32SequenceNumber; /* The sequence number, the same for all buffers in the sequence. */
uint32_t u32SequenceSize; /* The total size of the sequence. */
} SequenceStart;
struct
{ /* HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE and HGSMI_BUFFER_HEADER_F_SEQ_END */
uint32_t u32SequenceNumber; /* The sequence number, the same for all buffers in the sequence. */
uint32_t u32SequenceOffset; /* Data offset in the entire sequence. */
} SequenceContinue;
} u;
} HGSMIBUFFERHEADER;
/* 8 bytes buffer tail. */
typedef struct HGSMIBUFFERTAIL
{
uint32_t u32Reserved; /* Reserved, must be initialized to 0. */
uint32_t u32Checksum; /* Verifyer for the buffer header and offset and for first 4 bytes of the tail. */
} HGSMIBUFFERTAIL;
#pragma pack()
AssertCompileSize(HGSMIBUFFERHEADER, 16);
AssertCompileSize(HGSMIBUFFERTAIL, 8);
/* The size of the array of channels. Array indexes are uint8_t. Note: the value must not be changed. */
#define HGSMI_NUMBER_OF_CHANNELS 0x100
typedef struct HGSMIENV
{
/* Environment context pointer. */
void *pvEnv;
/* Allocate system memory. */
DECLCALLBACKMEMBER(void *, pfnAlloc)(void *pvEnv, HGSMISIZE cb);
/* Free system memory. */
DECLCALLBACKMEMBER(void, pfnFree)(void *pvEnv, void *pv);
} HGSMIENV;
#endif /* !___VBox_HGSMI_HGSMIDefs_h */
/** @file
*
* VBox Host Guest Shared Memory Interface (HGSMI).
* Memory allocator.
*/
/*
* Copyright (C) 2014-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;
* you can redistribute it and/or modify it under the terms of the GNU
* 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_HGSMIMemAlloc_h
#define ___VBox_HGSMI_HGSMIMemAlloc_h
#include <VBox/HGSMI/HGSMIDefs.h>
#include <iprt/list.h>
/* Descriptor. */
#define HGSMI_MA_DESC_OFFSET_MASK UINT32_C(0xFFFFFFE0)
#define HGSMI_MA_DESC_FREE_MASK UINT32_C(0x00000010)
#define HGSMI_MA_DESC_ORDER_MASK UINT32_C(0x0000000F)
#define HGSMI_MA_DESC_OFFSET(d) ((d) & HGSMI_MA_DESC_OFFSET_MASK)
#define HGSMI_MA_DESC_IS_FREE(d) (((d) & HGSMI_MA_DESC_FREE_MASK) != 0)
#define HGSMI_MA_DESC_ORDER(d) ((d) & HGSMI_MA_DESC_ORDER_MASK)
#define HGSMI_MA_DESC_ORDER_BASE UINT32_C(5)
#define HGSMI_MA_BLOCK_SIZE_MIN (UINT32_C(1) << (HGSMI_MA_DESC_ORDER_BASE + 0))
#define HGSMI_MA_BLOCK_SIZE_MAX (UINT32_C(1) << (HGSMI_MA_DESC_ORDER_BASE + HGSMI_MA_DESC_ORDER_MASK))
/* HGSMI_MA_DESC_ORDER_BASE must correspond to HGSMI_MA_DESC_OFFSET_MASK. */
AssertCompile((~HGSMI_MA_DESC_OFFSET_MASK + 1) == HGSMI_MA_BLOCK_SIZE_MIN);
typedef struct HGSMIMABLOCK
{
RTLISTNODE nodeBlock;
RTLISTNODE nodeFree;
HGSMIOFFSET descriptor;
} HGSMIMABLOCK;
typedef struct HGSMIMADATA
{
HGSMIAREA area;
HGSMIENV env;
HGSMISIZE cbMaxBlock;
uint32_t cBlocks; /* How many blocks in the listBlocks. */
RTLISTANCHOR listBlocks; /* All memory blocks, sorted. */
RTLISTANCHOR aListFreeBlocks[HGSMI_MA_DESC_ORDER_MASK + 1]; /* For free blocks of each order. */
} HGSMIMADATA;
RT_C_DECLS_BEGIN
int HGSMIMAInit(HGSMIMADATA *pMA, const HGSMIAREA *pArea,
HGSMIOFFSET *paDescriptors, uint32_t cDescriptors, HGSMISIZE cbMaxBlock,
const HGSMIENV *pEnv);
void HGSMIMAUninit(HGSMIMADATA *pMA);
void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb);
void HGSMIMAFree(HGSMIMADATA *pMA, void *pv);
HGSMIMABLOCK *HGSMIMASearchOffset(HGSMIMADATA *pMA, HGSMIOFFSET off);
uint32_t HGSMIPopCnt32(uint32_t u32);
DECLINLINE(HGSMISIZE) HGSMIMAOrder2Size(HGSMIOFFSET order)
{
return (UINT32_C(1) << (HGSMI_MA_DESC_ORDER_BASE + order));
}
DECLINLINE(HGSMIOFFSET) HGSMIMASize2Order(HGSMISIZE cb)
{
HGSMIOFFSET order = HGSMIPopCnt32(cb - 1) - HGSMI_MA_DESC_ORDER_BASE;
Assert(HGSMIMAOrder2Size(order) == cb);
return order;
}
RT_C_DECLS_END
#endif /* !___VBox_HGSMI_HGSMIMemAlloc_h */
/** @file
* VirtualBox graphics card port I/O definitions
*/
/*
* 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;
* you can redistribute it and/or modify it under the terms of the GNU
* 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_Hardware_VBoxVideoVBE_h
#define ___VBox_Hardware_VBoxVideoVBE_h
/* GUEST <-> HOST Communication API */
/** @todo FIXME: Either dynamicly ask host for this or put somewhere high in
* physical memory like 0xE0000000. */
#define VBE_DISPI_BANK_ADDRESS 0xA0000
#define VBE_DISPI_BANK_SIZE_KB 64
#define VBE_DISPI_MAX_XRES 16384
#define VBE_DISPI_MAX_YRES 16384
#define VBE_DISPI_MAX_BPP 32
#define VBE_DISPI_IOPORT_INDEX 0x01CE
#define VBE_DISPI_IOPORT_DATA 0x01CF
#define VBE_DISPI_IOPORT_DAC_WRITE_INDEX 0x03C8
#define VBE_DISPI_IOPORT_DAC_DATA 0x03C9
#define VBE_DISPI_INDEX_ID 0x0
#define VBE_DISPI_INDEX_XRES 0x1
#define VBE_DISPI_INDEX_YRES 0x2
#define VBE_DISPI_INDEX_BPP 0x3
#define VBE_DISPI_INDEX_ENABLE 0x4
#define VBE_DISPI_INDEX_BANK 0x5
#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
#define VBE_DISPI_INDEX_X_OFFSET 0x8
#define VBE_DISPI_INDEX_Y_OFFSET 0x9
#define VBE_DISPI_INDEX_VBOX_VIDEO 0xa
#define VBE_DISPI_INDEX_FB_BASE_HI 0xb
#define VBE_DISPI_ID0 0xB0C0
#define VBE_DISPI_ID1 0xB0C1
#define VBE_DISPI_ID2 0xB0C2
#define VBE_DISPI_ID3 0xB0C3
#define VBE_DISPI_ID4 0xB0C4
#define VBE_DISPI_ID_VBOX_VIDEO 0xBE00
/* The VBOX interface id. Indicates support for VBVA shared memory interface. */
#define VBE_DISPI_ID_HGSMI 0xBE01
#define VBE_DISPI_ID_ANYX 0xBE02
#define VBE_DISPI_DISABLED 0x00
#define VBE_DISPI_ENABLED 0x01
#define VBE_DISPI_GETCAPS 0x02
#define VBE_DISPI_8BIT_DAC 0x20
/** @note this definition is a BOCHS legacy, used only in the video BIOS
* code and ignored by the emulated hardware. */
#define VBE_DISPI_LFB_ENABLED 0x40
#define VBE_DISPI_NOCLEARMEM 0x80
#define VGA_PORT_HGSMI_HOST 0x3b0
#define VGA_PORT_HGSMI_GUEST 0x3d0
/* this should be in sync with monitorCount <xsd:maxInclusive value="64"/> in src/VBox/Main/xml/VirtualBox-settings-common.xsd */
#define VBOX_VIDEO_MAX_SCREENS 64
#endif /* !___VBox_Hardware_VBoxVideoVBE_h */
......@@ -124,7 +124,7 @@ DECLVBGL(int) VbglInitClient(void);
/**
* The library termination function.
*/
DECLVBGL(void) VbglTerminate(void);
DECLVBGL(void) VbglTerminate (void);
/** @name Generic request functions.
......@@ -148,7 +148,7 @@ DECLVBGL(int) VbglGRAlloc(VMMDevRequestHeader **ppReq, size_t cbReq, VMMDevReque
*
* @return VBox status code.
*/
DECLVBGL(int) VbglGRPerform(VMMDevRequestHeader *pReq);
DECLVBGL(int) VbglGRPerform (VMMDevRequestHeader *pReq);
/**
* Free the generic request memory.
......@@ -157,7 +157,7 @@ DECLVBGL(int) VbglGRPerform(VMMDevRequestHeader *pReq);
*
* @return VBox status code.
*/
DECLVBGL(void) VbglGRFree(VMMDevRequestHeader *pReq);
DECLVBGL(void) VbglGRFree (VMMDevRequestHeader *pReq);
/**
* Verify the generic request header.
......@@ -169,7 +169,7 @@ DECLVBGL(void) VbglGRFree(VMMDevRequestHeader *pReq);
*
* @return VBox status code.
*/
DECLVBGL(int) VbglGRVerify(const VMMDevRequestHeader *pReq, size_t cbReq);
DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq);
/** @} */
# ifdef VBOX_WITH_HGCM
......@@ -204,7 +204,7 @@ typedef FNVBGLHGCMCALLBACK *PFNVBGLHGCMCALLBACK;
* @return VBox status code.
*/
DECLR0VBGL(int) VbglR0HGCMInternalConnect(VBoxGuestHGCMConnectInfo *pConnectInfo,
DECLR0VBGL(int) VbglR0HGCMInternalConnect (VBoxGuestHGCMConnectInfo *pConnectInfo,
PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
......@@ -225,7 +225,7 @@ DECLR0VBGL(int) VbglR0HGCMInternalConnect(VBoxGuestHGCMConnectInfo *pConnectInfo
* @return VBox status code.
*/
DECLR0VBGL(int) VbglR0HGCMInternalDisconnect(VBoxGuestHGCMDisconnectInfo *pDisconnectInfo,
DECLR0VBGL(int) VbglR0HGCMInternalDisconnect (VBoxGuestHGCMDisconnectInfo *pDisconnectInfo,
PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
/** Call a HGCM service.
......@@ -242,7 +242,7 @@ DECLR0VBGL(int) VbglR0HGCMInternalDisconnect(VBoxGuestHGCMDisconnectInfo *pDisco
*
* @return VBox status code.
*/
DECLR0VBGL(int) VbglR0HGCMInternalCall(VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
DECLR0VBGL(int) VbglR0HGCMInternalCall (VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
/** Call a HGCM service. (32 bits packet structure in a 64 bits guest)
......@@ -259,7 +259,7 @@ DECLR0VBGL(int) VbglR0HGCMInternalCall(VBoxGuestHGCMCallInfo *pCallInfo, uint32_
*
* @return VBox status code.
*/
DECLR0VBGL(int) VbglR0HGCMInternalCall32(VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
DECLR0VBGL(int) VbglR0HGCMInternalCall32 (VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData);
/** @name VbglR0HGCMInternalCall flags
......@@ -295,7 +295,7 @@ typedef struct VBGLHGCMHANDLEDATA *VBGLHGCMHANDLE;
*
* @return VBox status code.
*/
DECLVBGL(int) VbglHGCMConnect(VBGLHGCMHANDLE *pHandle, VBoxGuestHGCMConnectInfo *pData);
DECLVBGL(int) VbglHGCMConnect (VBGLHGCMHANDLE *pHandle, VBoxGuestHGCMConnectInfo *pData);
/**
* Connect to a service.
......@@ -305,7 +305,7 @@ DECLVBGL(int) VbglHGCMConnect(VBGLHGCMHANDLE *pHandle, VBoxGuestHGCMConnectInfo
*
* @return VBox status code.
*/
DECLVBGL(int) VbglHGCMDisconnect(VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData);
DECLVBGL(int) VbglHGCMDisconnect (VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectInfo *pData);
/**
* Call to a service.
......@@ -316,7 +316,7 @@ DECLVBGL(int) VbglHGCMDisconnect(VBGLHGCMHANDLE handle, VBoxGuestHGCMDisconnectI
*
* @return VBox status code.
*/
DECLVBGL(int) VbglHGCMCall(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
DECLVBGL(int) VbglHGCMCall (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
/**
* Call to a service with user-mode data received by the calling driver from the User-Mode process.
......@@ -328,7 +328,7 @@ DECLVBGL(int) VbglHGCMCall(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData,
*
* @return VBox status code.
*/
DECLVBGL(int) VbglHGCMCallUserData(VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
DECLVBGL(int) VbglHGCMCallUserData (VBGLHGCMHANDLE handle, VBoxGuestHGCMCallInfo *pData, uint32_t cbData);
/**
* Call to a service with timeout.
......@@ -364,12 +364,12 @@ DECLVBGL(int) VbglR0CrCtlConCallUserData(VBGLCRCTLHANDLE hCtl, struct VBoxGuestH
*
* @returns VBox status code.
*/
DECLVBGL(int) VbglPhysHeapInit(void);
DECLVBGL(int) VbglPhysHeapInit (void);
/**
* Shutdown the heap.
*/
DECLVBGL(void) VbglPhysHeapTerminate(void);
DECLVBGL(void) VbglPhysHeapTerminate (void);
/**
* Allocate a memory block.
......@@ -377,7 +377,7 @@ DECLVBGL(void) VbglPhysHeapTerminate(void);
* @returns Virtual address of the allocated memory block.
* @param cbSize Size of block to be allocated.
*/
DECLVBGL(void *) VbglPhysHeapAlloc(uint32_t cbSize);
DECLVBGL(void *) VbglPhysHeapAlloc (uint32_t cbSize);
/**
* Get physical address of memory block pointed by the virtual address.
......@@ -400,7 +400,7 @@ DECLVBGL(uint32_t) VbglPhysHeapGetPhysAddr(void *pv);
*/
DECLVBGL(void) VbglPhysHeapFree(void *pv);
DECLVBGL(int) VbglQueryVMMDevMemory(VMMDevMemory **ppVMMDevMemory);
DECLVBGL(int) VbglQueryVMMDevMemory (VMMDevMemory **ppVMMDevMemory);
DECLR0VBGL(bool) VbglR0CanUsePhysPageList(void);
# ifndef VBOX_GUEST
......@@ -757,12 +757,16 @@ typedef struct VBGLR3GUESTDNDCMDCTX
* a second communication channel, e.g. via TCP/IP.
* Use a union for the HGCM stuff then. */
/** IN: HGCM client ID to use for communication. */
/** HGCM client ID to use for communication. */
uint32_t uClientID;
/** IN: Protocol version to use. */
/** The VM's current session ID. */
uint64_t uSessionID;
/** Protocol version to use. */
uint32_t uProtocol;
/** OUT: Number of parameters retrieved. */
/** Number of parameters retrieved for the current command. */
uint32_t uNumParms;
/** Max chunk size (in bytes) for data transfers. */
uint32_t cbMaxChunkSize;
} VBGLR3GUESTDNDCMDCTX, *PVBGLR3GUESTDNDCMDCTX;
typedef struct VBGLR3DNDHGCMEVENT
......@@ -770,7 +774,7 @@ typedef struct VBGLR3DNDHGCMEVENT
uint32_t uType; /** The event type this struct contains. */
uint32_t uScreenId; /** Screen ID this request belongs to. */
char *pszFormats; /** Format list (\r\n separated). */
uint32_t cbFormats; /** Size of pszFormats (\0 included). */
uint32_t cbFormats; /** Size (in bytes) of pszFormats (\0 included). */
union
{
struct
......@@ -783,7 +787,7 @@ typedef struct VBGLR3DNDHGCMEVENT
struct
{
void *pvData; /** Data request. */
size_t cbData; /** Size of pvData. */
uint32_t cbData; /** Size (in bytes) of pvData. */
} b; /** Values used in drop data event type. */
} u;
} VBGLR3DNDHGCMEVENT;
......@@ -792,14 +796,13 @@ typedef const PVBGLR3DNDHGCMEVENT CPVBGLR3DNDHGCMEVENT;
VBGLR3DECL(int) VbglR3DnDConnect(PVBGLR3GUESTDNDCMDCTX pCtx);
VBGLR3DECL(int) VbglR3DnDDisconnect(PVBGLR3GUESTDNDCMDCTX pCtx);
VBGLR3DECL(int) VbglR3DnDProcessNextMessage(PVBGLR3GUESTDNDCMDCTX pCtx, CPVBGLR3DNDHGCMEVENT pEvent);
VBGLR3DECL(int) VbglR3DnDRecvNextMsg(PVBGLR3GUESTDNDCMDCTX pCtx, CPVBGLR3DNDHGCMEVENT pEvent);
VBGLR3DECL(int) VbglR3DnDHGAcknowledgeOperation(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uAction);
VBGLR3DECL(int) VbglR3DnDHGRequestData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat);
VBGLR3DECL(int) VbglR3DnDHGSetProgress(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uStatus, uint8_t uPercent, int rcErr);
VBGLR3DECL(int) VbglR3DnDHGSendAckOp(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uAction);
VBGLR3DECL(int) VbglR3DnDHGSendReqData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pcszFormat);
VBGLR3DECL(int) VbglR3DnDHGSendProgress(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uStatus, uint8_t uPercent, int rcErr);
# ifdef VBOX_WITH_DRAG_AND_DROP_GH
VBGLR3DECL(int) VbglR3DnDGHAcknowledgePending(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uDefAction,
uint32_t uAllActions, const char *pszFormats);
VBGLR3DECL(int) VbglR3DnDGHSendAckPending(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uDefAction, uint32_t uAllActions, const char* pcszFormats, uint32_t cbFormats);
VBGLR3DECL(int) VbglR3DnDGHSendData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat, void *pvData, uint32_t cbData);
VBGLR3DECL(int) VbglR3DnDGHSendError(PVBGLR3GUESTDNDCMDCTX pCtx, int rcOp);
# endif /* VBOX_WITH_DRAG_AND_DROP_GH */
......@@ -838,6 +841,12 @@ VBGLR3DECL(int) VbglR3WriteVideoMode(unsigned cDisplay, unsigned cx,
unsigned y, unsigned fEnabled);
/** @} */
/** @name Generic HGCM
* @{ */
VBGLR3DECL(int) VbglR3HGCMConnect(const char *pszServiceName, HGCMCLIENTID *pidClient);
VBGLR3DECL(int) VbglR3HGCMDisconnect(HGCMCLIENTID idClient);
/** @} */
#endif /* IN_RING3 */
/** @} */
......
This diff is collapsed.
This diff is collapsed.
......@@ -674,7 +674,7 @@ RT_C_DECLS_END
/** @def AssertBreak
* Assert that an expression is true and breaks if it isn't.
* In RT_STRICT mode it will hit a breakpoint before returning.
* In RT_STRICT mode it will hit a breakpoint before breaking.
*
* @param expr Expression which should be true.
*/
......@@ -696,6 +696,30 @@ RT_C_DECLS_END
break
#endif
/** @def AssertContinue
* Assert that an expression is true and continue if it isn't.
* In RT_STRICT mode it will hit a breakpoint before continuing.
*
* @param expr Expression which should be true.
*/
#ifdef RT_STRICT
# define AssertContinue(expr) \
if (RT_LIKELY(!!(expr))) \
{ /* likely */ } \
else if (1) \
{ \
RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
RTAssertPanic(); \
continue; \
} else do {} while (0)
#else
# define AssertContinue(expr) \
if (RT_LIKELY(!!(expr))) \
{ /* likely */ } \
else \
continue
#endif
/** @def AssertBreakStmt
* Assert that an expression is true and breaks if it isn't.
* In RT_STRICT mode it will hit a breakpoint before doing break.
......
......@@ -73,6 +73,8 @@ DECL_FORCE_INLINE(bool) RTLocCIsBlank(int ch)
*
* @returns true / false.
* @param ch The character to test.
*
* @note Will return true of ch is '\0'!
*/
DECL_FORCE_INLINE(bool) RTLocCIsCntrl(int ch)
{
......
......@@ -1452,6 +1452,8 @@ RT_C_DECLS_END
#define VERR_LDRPE_LOAD_CONFIG_SIZE (-626)
/** The PE loader encountered a lock prefix table, a feature which hasn't been implemented yet. */
#define VERR_LDRPE_LOCK_PREFIX_TABLE (-627)
/** The PE loader encountered some Guard CF stuff in the load config. */
#define VERR_LDRPE_GUARD_CF_STUFF (-628)
/** The ELF loader doesn't handle foreign endianness. */
#define VERR_LDRELF_ODD_ENDIAN (-630)
/** The ELF image is 'dynamic', the ELF loader can only deal with 'relocatable' images at present. */
......
......@@ -1878,18 +1878,21 @@
# define RTUriParsedQuery RT_MANGLER(RTUriParsedQuery)
# define RTUriIsSchemeMatch RT_MANGLER(RTUriIsSchemeMatch)
# define RTUtf16AllocTag RT_MANGLER(RTUtf16AllocTag)
# define RTUtf16ReallocTag RT_MANGLER(RTUtf16ReallocTag)
# define RTUtf16CalcLatin1Len RT_MANGLER(RTUtf16CalcLatin1Len)
# define RTUtf16CalcLatin1LenEx RT_MANGLER(RTUtf16CalcLatin1LenEx)
# define RTUtf16CalcUtf8Len RT_MANGLER(RTUtf16CalcUtf8Len)
# define RTUtf16CalcUtf8LenEx RT_MANGLER(RTUtf16CalcUtf8LenEx)
# define RTUtf16Cmp RT_MANGLER(RTUtf16Cmp)
# define RTUtf16CmpAscii RT_MANGLER(RTUtf16CmpAscii)
# define RTUtf16CmpUtf8 RT_MANGLER(RTUtf16CmpUtf8)
# define RTUtf16DupExTag RT_MANGLER(RTUtf16DupExTag)
# define RTUtf16DupTag RT_MANGLER(RTUtf16DupTag)
# define RTUtf16Free RT_MANGLER(RTUtf16Free)
# define RTUtf16GetCpExInternal RT_MANGLER(RTUtf16GetCpExInternal)
# define RTUtf16GetCpInternal RT_MANGLER(RTUtf16GetCpInternal)
# define RTUtf16ICmp RT_MANGLER(RTUtf16ICmp)
# define RTUtf16ICmpUtf8 RT_MANGLER(RTUtf16ICmpUtf8)
# define RTUtf16IsValidEncoding RT_MANGLER(RTUtf16IsValidEncoding)
# define RTUtf16Len RT_MANGLER(RTUtf16Len)
# define RTUtf16LocaleICmp RT_MANGLER(RTUtf16LocaleICmp)
......
......@@ -81,6 +81,78 @@ RT_C_DECLS_BEGIN
*/
RTDECL(PRTUTF16) RTUtf16AllocTag(size_t cb, const char *pszTag);
/**
* Reallocates the specified UTF-16 string (default tag).
*
* You should normally not use this function, except if there is some very
* custom string handling you need doing that isn't covered by any of the other
* APIs.
*
* @returns VINF_SUCCESS.
* @retval VERR_NO_UTF16_MEMORY if we failed to reallocate the string, @a
* *ppwsz remains unchanged.
*
* @param ppwsz Pointer to the string variable containing the
* input and output string.
*
* When not freeing the string, the result will
* always have the last RTUTF16 set to the
* terminator character so that when used for
* string truncation the result will be a valid
* C-style string (your job to keep it a valid
* UTF-16 string).
*
* When the input string is NULL and we're supposed
* to reallocate, the returned string will also
* have the first RTUTF16 set to the terminator
* char so it will be a valid C-style string.
*
* @param cbNew When @a cbNew is zero, we'll behave like
* RTUtf16Free and @a *ppwsz will be set to NULL.
*
* When not zero, this will be rounded up to a
* multiple of two, and used as the new size of the
* memory backing the string, i.e. it includes the
* terminator (RTUTF16) char.
*/
#define RTUtf16Realloc(ppwsz, cb) RTUtf16ReallocTag((ppwsz), (cb), RTSTR_TAG)
/**
* Reallocates the specified UTF-16 string (custom tag).
*
* You should normally not use this function, except if there is some very
* custom string handling you need doing that isn't covered by any of the other
* APIs.
*
* @returns VINF_SUCCESS.
* @retval VERR_NO_UTF16_MEMORY if we failed to reallocate the string, @a
* *ppwsz remains unchanged.
*
* @param ppwsz Pointer to the string variable containing the
* input and output string.
*
* When not freeing the string, the result will
* always have the last RTUTF16 set to the
* terminator character so that when used for
* string truncation the result will be a valid
* C-style string (your job to keep it a valid
* UTF-16 string).
*
* When the input string is NULL and we're supposed
* to reallocate, the returned string will also
* have the first RTUTF16 set to the terminator
* char so it will be a valid C-style string.
*
* @param cbNew When @a cbNew is zero, we'll behave like
* RTUtf16Free and @a *ppwsz will be set to NULL.
*
* When not zero, this will be rounded up to a
* multiple of two, and used as the new size of the
* memory backing the string, i.e. it includes the
* terminator (RTUTF16) char.
* @param pszTag Allocation tag used for statistics and such.
*/
RTDECL(int) RTUtf16ReallocTag(PRTUTF16 *ppwsz, size_t cbNew, const char *pszTag);
/**
* Free a UTF-16 string allocated by RTStrToUtf16(), RTStrToUtf16Ex(),
......@@ -331,6 +403,19 @@ RTDECL(int) RTUtf16Cmp(PCRTUTF16 pwsz1, PCRTUTF16 pwsz2);
*/
RTDECL(int) RTUtf16CmpAscii(PCRTUTF16 pwsz1, const char *psz2);
/**
* Performs a case sensitive string compare between an UTF-16 string and a UTF-8
* string.
*
* @returns < 0 if the first string less than the second string.s
* @returns 0 if the first string identical to the second string.
* @returns > 0 if the first string greater than the second string.
* @param pwsz1 First UTF-16 string. Null is allowed.
* @param psz2 Second string, UTF-8. Null is allowed.
* @remarks NULL and empty strings are treated equally.
*/
RTDECL(int) RTUtf16CmpUtf8(PCRTUTF16 pwsz1, const char *psz2);
/**
* Performs a case insensitive string compare between two UTF-16 strings.
*
......@@ -346,6 +431,19 @@ RTDECL(int) RTUtf16CmpAscii(PCRTUTF16 pwsz1, const char *psz2);
*/
RTDECL(int) RTUtf16ICmp(PCRTUTF16 pwsz1, PCRTUTF16 pwsz2);
/**
* Performs a case insensitive string compare between an UTF-16 string and a
* UTF-8 string.
*
* @returns < 0 if the first string less than the second string.s
* @returns 0 if the first string identical to the second string.
* @returns > 0 if the first string greater than the second string.
* @param pwsz1 First UTF-16 string. Null is allowed.
* @param psz2 Second string, UTF-8. Null is allowed.
* @remarks NULL and empty strings are treated equally.
*/
RTDECL(int) RTUtf16ICmpUtf8(PCRTUTF16 pwsz1, const char *psz2);
/**
* Performs a case insensitive string compare between an UTF-16 string and an
* pure ASCII string.
......
This diff is collapsed.
......@@ -372,11 +372,17 @@ static int rtR0MemObjLinuxAllocPages(PRTR0MEMOBJLNX *ppMemLnx, RTR0MEMOBJTYPE en
#endif /* < 2.4.22 */
pMemLnx->fContiguous = fContiguous;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
/*
* Reserve the pages.
*
* Linux >= 4.5 with CONFIG_DEBUG_VM panics when setting PG_reserved on compound
* pages. According to Michal Hocko this shouldn't be necessary anyway because
* as pages which are not on the LRU list are never evictable.
*/
for (iPage = 0; iPage < cPages; iPage++)
SetPageReserved(pMemLnx->apPages[iPage]);
#endif
/*
* Note that the physical address of memory allocated with alloc_pages(flags, order)
......@@ -423,7 +429,12 @@ static void rtR0MemObjLinuxFreePages(PRTR0MEMOBJLNX pMemLnx)
*/
while (iPage-- > 0)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
/*
* See SetPageReserved() in rtR0MemObjLinuxAllocPages()
*/
ClearPageReserved(pMemLnx->apPages[iPage]);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
#else
MY_SET_PAGES_NOEXEC(pMemLnx->apPages[iPage], 1);
......@@ -578,7 +589,11 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
{
if (!PageReserved(pMemLnx->apPages[iPage]))
SetPageDirty(pMemLnx->apPages[iPage]);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
put_page(pMemLnx->apPages[iPage]);
#else
page_cache_release(pMemLnx->apPages[iPage]);
#endif
}
if (pTask && pTask->mm)
......@@ -1029,6 +1044,29 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3P
/*
* Get user pages.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
if (R0Process == RTR0ProcHandleSelf())
rc = get_user_pages(R3Ptr, /* Where from. */
cPages, /* How many pages. */
fWrite, /* Write to memory. */
fWrite, /* force write access. */
&pMemLnx->apPages[0], /* Page array. */
papVMAs); /* vmas */
/*
* Actually this should not happen at the moment as call this function
* only for our own process.
*/
else
rc = get_user_pages_remote(
pTask, /* Task for fault accounting. */
pTask->mm, /* Whose pages. */
R3Ptr, /* Where from. */
cPages, /* How many pages. */
fWrite, /* Write to memory. */
fWrite, /* force write access. */
&pMemLnx->apPages[0], /* Page array. */
papVMAs); /* vmas */
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */
rc = get_user_pages(pTask, /* Task for fault accounting. */
pTask->mm, /* Whose pages. */
R3Ptr, /* Where from. */
......@@ -1037,6 +1075,7 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3P
fWrite, /* force write access. */
&pMemLnx->apPages[0], /* Page array. */
papVMAs); /* vmas */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) */
if (rc == cPages)
{
/*
......@@ -1081,7 +1120,11 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3P
{
if (!PageReserved(pMemLnx->apPages[rc]))
SetPageDirty(pMemLnx->apPages[rc]);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
put_page(pMemLnx->apPages[rc]);
#else
page_cache_release(pMemLnx->apPages[rc]);
#endif
}
up_read(&pTask->mm->mmap_sem);
......
#define VBOX_SVN_REV 105871
#define VBOX_SVN_REV 106667
......@@ -3,9 +3,9 @@
#define VBOX_VERSION_MAJOR 5
#define VBOX_VERSION_MINOR 0
#define VBOX_VERSION_BUILD 16
#define VBOX_VERSION_STRING_RAW "5.0.16"
#define VBOX_VERSION_STRING "5.0.16_Ubuntu"
#define VBOX_VERSION_BUILD 18
#define VBOX_VERSION_STRING_RAW "5.0.18"
#define VBOX_VERSION_STRING "5.0.18_Ubuntu"
#define VBOX_API_VERSION_STRING "5_0"
#define VBOX_PRIVATE_BUILD_DESC "Private build by root"
......
......@@ -712,7 +712,11 @@ int sf_write_end(struct file *file, struct address_space *mapping, loff_t pos,
}
unlock_page(page);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
put_page(page);
#else
page_cache_release(page);
#endif
return nwritten;
}
......
......@@ -3,9 +3,9 @@
#define VBOX_VERSION_MAJOR 5
#define VBOX_VERSION_MINOR 0
#define VBOX_VERSION_BUILD 16
#define VBOX_VERSION_STRING_RAW "5.0.16"
#define VBOX_VERSION_STRING "5.0.16_Ubuntu"
#define VBOX_VERSION_BUILD 18
#define VBOX_VERSION_STRING_RAW "5.0.18"
#define VBOX_VERSION_STRING "5.0.18_Ubuntu"
#define VBOX_API_VERSION_STRING "5_0"
#define VBOX_PRIVATE_BUILD_DESC "Private build by root"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
KBUILD_EXTMOD=${srctree}/ubuntu/vbox
# $Id: Makefile.module $
# $Id: Makefile.module.kms $
## @file
# VirtualBox Guest Additions Module Makefile.
#
......@@ -7,7 +7,7 @@ KBUILD_EXTMOD=${srctree}/ubuntu/vbox
#
#
# Copyright (C) 2006-2011 Oracle Corporation
# Copyright (C) 2006-2010 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
......@@ -24,7 +24,14 @@ include $(obj)/Makefile.include.header
MOD_NAME = vboxvideo
MOD_OBJS = vboxvideo_drm.o
ifeq ($(filter 1.% 2.% 3.0.% 3.1.% 3.2.% 3.3.% 3.4.% 3.5.% 3.6.% 3.7.% \
3.8.% 3.9.% 3.10.%,$(KERNELRELEASE)),)
MOD_OBJS = HGSMIBase.o HGSMICommon.o HGSMIMemAlloc.o heapoffset.o \
Modesetting.o vbox_drv.o vbox_fb.o vbox_irq.o vbox_main.o \
vbox_mode.o vbox_ttm.o VBVABase.o
else
MOD_OBJS = vbox_dummy.o
endif
ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxvideo),)
MANGLING := $(KBUILD_EXTMOD)/vboxvideo/include/VBox/VBoxGuestMangling.h
......@@ -32,15 +39,10 @@ else
MANGLING := $(KBUILD_EXTMOD)/include/VBox/VBoxGuestMangling.h
endif
MOD_CFLAGS = -Wno-declaration-after-statement -fshort-wchar -include $(MANGLING)
MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include)
# What on earth is this?
MOD_INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxvideo,/ /include /r0drv/linux)
# Enterprise Linux 6.5 does not include the drm user API headers with the kernel
# headers.
MOD_INCL += $(foreach inc,$(KERN_INCL) include,\
$(if $(wildcard $(inc)/linux/utsrelease.h),\
$(if $(shell grep '"2.6.32.*el6.*"' $(inc)/linux/utsrelease.h),\
-I/usr/include,),))
MOD_INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxvideo,/ /include)
MOD_INCL += -Iinclude/drm
MOD_DEFS := -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \
-DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DLOG_TO_BACKDOOR -DIN_MODULE \
-DIN_GUEST_R0
......@@ -54,4 +56,3 @@ endif
MOD_CLEAN = . linux r0drv r0drv/linux
include $(obj)/Makefile.include.footer
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
../r0drv
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/* $Id: vbox_dummy.c $ */
/** @file
* VirtualBox Additions Linux kernel video driver, dummy driver for
* older kernels.
*/
/*
* Copyright (C) 2016 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* 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.
*/
#include <linux/module.h>
static int __init vbox_init(void)
{
return -EINVAL;
}
static void __exit vbox_exit(void)
{
}
module_init(vbox_init);
module_exit(vbox_exit);
MODULE_LICENSE("GPL");
This diff is collapsed.
/* $Id: vbox_irq.c $ */
/** @file
* VirtualBox Additions Linux kernel video driver
*/
/*
* Copyright (C) 2016 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* 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.
* --------------------------------------------------------------------
*
* This code is based on
* qxl_irq.c
* with the following copyright and permission notice:
*
* Copyright 2013 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Dave Airlie
* Alon Levy
*/
#include "vbox_drv.h"
#include <VBox/VBoxVideo.h>
#include <drm/drm_crtc_helper.h>
static void vbox_clear_irq(void)
{
outl((uint32_t)~0, VGA_PORT_HGSMI_HOST);
}
static uint32_t vbox_get_flags(struct vbox_private *vbox)
{
return (uint32_t)readl(vbox->vram + vbox->host_flags_offset);
}
void vbox_report_hotplug(struct vbox_private *vbox)
{
schedule_work(&vbox->hotplug_work);
}
irqreturn_t vbox_irq_handler(int irq, void *arg)
{
struct drm_device *dev = (struct drm_device *) arg;
struct vbox_private *vbox = (struct vbox_private *)dev->dev_private;
uint32_t host_flags = vbox_get_flags(vbox);
if (!(host_flags & HGSMIHOSTFLAGS_IRQ))
return IRQ_NONE;
/* Due to a bug in the initial host implementation of hot-plug interrupts,
* the hot-plug and cursor capability flags were never cleared. Fortunately
* we can tell when they would have been set by checking that the VSYNC flag
* is not set. */
if ( host_flags & (HGSMIHOSTFLAGS_HOTPLUG | HGSMIHOSTFLAGS_CURSOR_CAPABILITIES)
&& !(host_flags & HGSMIHOSTFLAGS_VSYNC))
vbox_report_hotplug(vbox);
vbox_clear_irq();
return IRQ_HANDLED;
}
/**
* Query the host for
*/
static void vbox_update_mode_hints(struct vbox_private *vbox)
{
struct drm_device *dev = vbox->dev;
struct drm_connector *connector;
struct vbox_connector *vbox_connector;
struct VBVAMODEHINT *hints;
uint16_t flags;
bool disconnected;
unsigned crtc_id;
int rc;
rc = VBoxHGSMIGetModeHints(&vbox->submit_info, vbox->num_crtcs,
vbox->last_mode_hints);
AssertMsgRCReturnVoid(rc, ("VBoxHGSMIGetModeHints failed, rc=%Rrc.\n", rc));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
drm_modeset_lock_all(dev);
#else
mutex_lock(&dev->mode_config.mutex);
#endif
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
vbox_connector = to_vbox_connector(connector);
hints = &vbox->last_mode_hints[vbox_connector->vbox_crtc->crtc_id];
if (hints->magic == VBVAMODEHINT_MAGIC) {
LogFunc(("vboxvideo: %d: crtc_id=%u, mode %hdx%hd(enabled:%d),%hdx%hd\n",
__LINE__, (unsigned)vbox_connector->vbox_crtc->crtc_id,
(short)hints->cx, (short)hints->cy, (int)hints->fEnabled,
(short)hints->dx, (short)hints->dy));
disconnected = !(hints->fEnabled);
crtc_id = vbox_connector->vbox_crtc->crtc_id;
flags = VBVA_SCREEN_F_ACTIVE
| (disconnected ? VBVA_SCREEN_F_DISABLED : VBVA_SCREEN_F_BLANK);
vbox_connector->mode_hint.width = hints->cx & 0x8fff;
vbox_connector->mode_hint.height = hints->cy & 0x8fff;
vbox_connector->mode_hint.disconnected = disconnected;
if (vbox_connector->vbox_crtc->disconnected != disconnected) {
VBoxHGSMIProcessDisplayInfo(&vbox->submit_info, crtc_id,
0, 0, 0, hints->cx * 4, hints->cx,
hints->cy, 0, flags);
vbox_connector->vbox_crtc->disconnected = disconnected;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
if ((hints->dx < 0xffff) && (hints->dy < 0xffff)) {
drm_object_property_set_value(&connector->base,
dev->mode_config.suggested_x_property, hints->dx & 0x8fff);
drm_object_property_set_value(&connector->base,
dev->mode_config.suggested_y_property, hints->dy & 0x8fff);
}
#endif
}
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
drm_modeset_unlock_all(dev);
#else
mutex_unlock(&dev->mode_config.mutex);
#endif
}
static void vbox_hotplug_worker(struct work_struct *work)
{
struct vbox_private *vbox = container_of(work, struct vbox_private,
hotplug_work);
LogFunc(("vboxvideo: %d: vbox=%p\n", __LINE__, vbox));
vbox_update_mode_hints(vbox);
drm_kms_helper_hotplug_event(vbox->dev);
}
int vbox_irq_init(struct vbox_private *vbox)
{
int ret;
LogFunc(("vboxvideo: %d: vbox=%p\n", __LINE__, vbox));
vbox_update_mode_hints(vbox);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
ret = drm_irq_install(vbox->dev, vbox->dev->pdev->irq);
#else
ret = drm_irq_install(vbox->dev);
#endif
if (unlikely(ret != 0)) {
vbox_irq_fini(vbox);
DRM_ERROR("Failed installing irq: %d\n", ret);
return 1;
}
INIT_WORK(&vbox->hotplug_work, vbox_hotplug_worker);
vbox->isr_installed = true;
LogFunc(("vboxvideo: %d: vbox=%p\n", __LINE__, vbox));
return 0;
}
void vbox_irq_fini(struct vbox_private *vbox)
{
LogFunc(("vboxvideo: %d: vbox=%p\n", __LINE__, vbox));
if (vbox->isr_installed) {
drm_irq_uninstall(vbox->dev);
flush_work(&vbox->hotplug_work);
vbox->isr_installed = false;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment