1 | /* $Id: SHGSMIHost.cpp 82968 2020-02-04 10:35:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Missing description.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include "SHGSMIHost.h"
|
---|
19 | #include <VBoxVideo.h>
|
---|
20 |
|
---|
21 | /*
|
---|
22 | * VBOXSHGSMI made on top HGSMI and allows receiving notifications
|
---|
23 | * about G->H command completion
|
---|
24 | */
|
---|
25 |
|
---|
26 | static int vboxSHGSMICommandCompleteAsynch (PHGSMIINSTANCE pIns, VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr)
|
---|
27 | {
|
---|
28 | bool fDoIrq = !!(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ)
|
---|
29 | || !!(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE);
|
---|
30 | return HGSMICompleteGuestCommand(pIns, pHdr, fDoIrq);
|
---|
31 | }
|
---|
32 |
|
---|
33 | void VBoxSHGSMICommandMarkAsynchCompletion(void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
|
---|
34 | {
|
---|
35 | VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr = VBoxSHGSMIBufferHeader(pvData);
|
---|
36 | Assert(!(pHdr->fFlags & VBOXSHGSMI_FLAG_HG_ASYNCH));
|
---|
37 | pHdr->fFlags |= VBOXSHGSMI_FLAG_HG_ASYNCH;
|
---|
38 | }
|
---|
39 |
|
---|
40 | int VBoxSHGSMICommandComplete(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
|
---|
41 | {
|
---|
42 | VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr = VBoxSHGSMIBufferHeader(pvData);
|
---|
43 | uint32_t fFlags = pHdr->fFlags;
|
---|
44 | ASMCompilerBarrier();
|
---|
45 | if ( !(fFlags & VBOXSHGSMI_FLAG_HG_ASYNCH) /* <- check if synchronous completion */
|
---|
46 | && !(fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE)) /* <- check if can complete synchronously */
|
---|
47 | return VINF_SUCCESS;
|
---|
48 |
|
---|
49 | pHdr->fFlags = fFlags | VBOXSHGSMI_FLAG_HG_ASYNCH;
|
---|
50 | return vboxSHGSMICommandCompleteAsynch(pIns, pHdr);
|
---|
51 | }
|
---|