VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h@ 86576

Last change on this file since 86576 was 85121, checked in by vboxsync, 4 years ago

iprt/cdefs.h: Refactored the typedef use of DECLCALLBACK as well as DECLCALLBACKMEMBER to wrap the whole expression, similar to the DECLR?CALLBACKMEMBER macros. This allows adding a throw() at the end when compiling with the VC++ compiler to indicate that the callbacks won't throw anything, so we can stop supressing the C5039 warning about passing functions that can potential throw C++ exceptions to extern C code that can't necessarily cope with such (unwind,++). Introduced a few _EX variations that allows specifying different/no calling convention too, as that's handy when dynamically resolving host APIs. Fixed numerous places missing DECLCALLBACK and such. Left two angry @todos regarding use of CreateThread. bugref:9794

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: HGSMIHost.h 85121 2020-07-08 19:33:26Z vboxsync $ */
2/** @file
3 * VBox Host Guest Shared Memory Interface (HGSMI), host part.
4 */
5
6/*
7 * Copyright (C) 2006-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#ifndef VBOX_INCLUDED_SRC_Graphics_HGSMI_HGSMIHost_h
19#define VBOX_INCLUDED_SRC_Graphics_HGSMI_HGSMIHost_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <VBox/types.h>
25#include <HGSMI.h>
26#include <HGSMIChSetup.h>
27
28struct HGSMIINSTANCE;
29typedef struct HGSMIINSTANCE *PHGSMIINSTANCE;
30
31/** Callback for the guest notification about a new host buffer. */
32typedef DECLCALLBACKTYPE(void, FNHGSMINOTIFYGUEST,(void *pvCallback));
33typedef FNHGSMINOTIFYGUEST *PFNHGSMINOTIFYGUEST;
34
35/*
36 * Public Host API for virtual devices.
37 */
38
39int HGSMICreate(PHGSMIINSTANCE *ppIns,
40 PVM pVM,
41 const char *pszName,
42 HGSMIOFFSET offBase,
43 uint8_t *pu8MemBase,
44 HGSMISIZE cbMem,
45 PFNHGSMINOTIFYGUEST pfnNotifyGuest,
46 void *pvNotifyGuest,
47 size_t cbContext);
48void HGSMIDestroy(PHGSMIINSTANCE pIns);
49void *HGSMIContext(PHGSMIINSTANCE pIns);
50
51void RT_UNTRUSTED_VOLATILE_GUEST *HGSMIOffsetToPointerHost(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
52HGSMIOFFSET HGSMIPointerToOffsetHost(PHGSMIINSTANCE pIns, const void RT_UNTRUSTED_VOLATILE_GUEST *pv);
53bool HGSMIIsOffsetValid(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
54HGSMIOFFSET HGSMIGetAreaOffset(PHGSMIINSTANCE pIns);
55HGSMIOFFSET HGSMIGetAreaSize(PHGSMIINSTANCE pIns);
56
57
58int HGSMIHostChannelRegister(PHGSMIINSTANCE pIns, uint8_t u8Channel,
59 PFNHGSMICHANNELHANDLER pfnChannelHandler, void *pvChannelHandler);
60#if 0 /* unused */
61int HGSMIChannelRegisterName (PHGSMIINSTANCE pIns,
62 const char *pszChannel,
63 PFNHGSMICHANNELHANDLER pfnChannelHandler,
64 void *pvChannelHandler,
65 uint8_t *pu8Channel);
66#endif
67
68int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns, HGSMIOFFSET RT_UNTRUSTED_GUEST offHeap, HGSMISIZE RT_UNTRUSTED_GUEST cbHeap);
69
70/*
71 * Virtual hardware IO handlers.
72 */
73
74/* Guests passes a new command buffer to the host. */
75void HGSMIGuestWrite(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
76
77/* Guest reads information about guest buffers. */
78HGSMIOFFSET HGSMIGuestRead(PHGSMIINSTANCE pIns);
79
80/* Guest reads the host FIFO to get a command. */
81HGSMIOFFSET HGSMIHostRead(PHGSMIINSTANCE pIns);
82
83/* Guest reports that the command at this offset has been processed. */
84void HGSMIHostWrite(PHGSMIINSTANCE pIns, HGSMIOFFSET offBuffer);
85
86void HGSMISetHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags);
87uint32_t HGSMIGetHostGuestFlags(HGSMIINSTANCE *pIns);
88
89void HGSMIClearHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags);
90
91/*
92 * Low level interface for submitting buffers to the guest.
93 *
94 * These functions are not directly available for anyone but the
95 * virtual hardware device.
96 */
97
98/* Allocate a buffer in the host heap. */
99int HGSMIHostCommandAlloc(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST **ppvData, HGSMISIZE cbData,
100 uint8_t u8Channel, uint16_t u16ChannelInfo);
101int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData, bool fDoIrq);
102int HGSMIHostCommandFree(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData);
103
104int HGSMIHostLoadStateExec(const struct PDMDEVHLPR3 *pHlp, PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Version);
105int HGSMIHostSaveStateExec(const struct PDMDEVHLPR3 *pHlp, PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
106
107#ifdef VBOX_WITH_WDDM
108int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvMem, bool fDoIrq);
109#endif
110
111#endif /* !VBOX_INCLUDED_SRC_Graphics_HGSMI_HGSMIHost_h */
112
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette