本文整理汇总了C++中LogFlow函数的典型用法代码示例。如果您正苦于以下问题:C++ LogFlow函数的具体用法?C++ LogFlow怎么用?C++ LogFlow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogFlow函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DECLCALLBACK
/**
* Asynchronous I/O thread for handling receive.
*
* @returns VINF_SUCCESS (ignored).
* @param Thread Thread handle.
* @param pvUser Pointer to a DRVNIC structure.
*/
static DECLCALLBACK(int) drvNicAsyncIoThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
{
PDRVNIC pThis = PDMINS_2_DATA(pDrvIns, PDRVNIC);
LogFlow(("drvNicAsyncIoThread: pThis=%p\n", pThis));
if (pThread->enmState == PDMTHREADSTATE_INITIALIZING)
return VINF_SUCCESS;
Genode::Signal_receiver &sig_rec = pThis->nic_client->sig_rec();
while (pThread->enmState == PDMTHREADSTATE_RUNNING)
{
Genode::Signal sig = sig_rec.wait_for_signal();
int num = sig.num();
Genode::Signal_dispatcher_base *dispatcher;
dispatcher = dynamic_cast<Genode::Signal_dispatcher_base *>(sig.context());
dispatcher->dispatch(num);
}
destruct_lock()->unlock();
return VINF_SUCCESS;
}
开发者ID:0xxx,项目名称:genode,代码行数:31,代码来源:network.cpp
示例2: pdmacFileTaskAlloc
/**
* Allocates a task segment
*
* @returns Pointer to the new task segment or NULL
* @param pEndpoint Pointer to the endpoint
*/
PPDMACTASKFILE pdmacFileTaskAlloc(PPDMASYNCCOMPLETIONENDPOINTFILE pEndpoint)
{
PPDMACTASKFILE pTask = NULL;
/* Try the small per endpoint cache first. */
if (pEndpoint->pTasksFreeHead == pEndpoint->pTasksFreeTail)
{
/* Try the bigger endpoint class cache. */
PPDMASYNCCOMPLETIONEPCLASSFILE pEndpointClass = (PPDMASYNCCOMPLETIONEPCLASSFILE)pEndpoint->Core.pEpClass;
/*
* Allocate completely new.
* If this fails we return NULL.
*/
int rc = MMR3HeapAllocZEx(pEndpointClass->Core.pVM, MM_TAG_PDM_ASYNC_COMPLETION,
sizeof(PDMACTASKFILE),
(void **)&pTask);
if (RT_FAILURE(rc))
pTask = NULL;
LogFlow(("Allocated task %p\n", pTask));
}
else
{
/* Grab a free task from the head. */
AssertMsg(pEndpoint->cTasksCached > 0, ("No tasks cached but list contains more than one element\n"));
pTask = pEndpoint->pTasksFreeHead;
pEndpoint->pTasksFreeHead = pTask->pNext;
ASMAtomicDecU32(&pEndpoint->cTasksCached);
}
pTask->pNext = NULL;
return pTask;
}
开发者ID:bayasist,项目名称:vbox,代码行数:42,代码来源:PDMAsyncCompletionFile.cpp
示例3: RTDECL
RTDECL(int) RTDirRemove(const char *pszPath)
{
/*
* Convert to UTF-16.
*/
PRTUTF16 pwszString;
int rc = RTStrToUtf16(pszPath, &pwszString);
AssertRC(rc);
if (RT_SUCCESS(rc))
{
/*
* Remove the directory.
*/
if (RemoveDirectoryW((LPCWSTR)pwszString))
rc = VINF_SUCCESS;
else
rc = RTErrConvertFromWin32(GetLastError());
RTUtf16Free(pwszString);
}
LogFlow(("RTDirRemove(%p:{%s}): returns %Rrc\n", pszPath, pszPath, rc));
return rc;
}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:24,代码来源:dir-win.cpp
示例4: usbProxySolarisIOCtl
/**
* The client driver IOCtl Wrapper function.
*
* @returns VBox status code.
* @param pDevSol The Solaris device instance.
* @param Function The Function.
* @param pvData Opaque pointer to the data.
* @param cbData Size of the data pointed to by pvData.
*/
static int usbProxySolarisIOCtl(PUSBPROXYDEVSOL pDevSol, unsigned Function, void *pvData, size_t cbData)
{
if (RT_UNLIKELY(pDevSol->hFile == NIL_RTFILE))
{
LogFlow((USBPROXY ":usbProxySolarisIOCtl connection to driver gone!\n"));
return VERR_VUSB_DEVICE_NOT_ATTACHED;
}
VBOXUSBREQ Req;
Req.u32Magic = VBOXUSB_MAGIC;
Req.rc = -1;
Req.cbData = cbData;
Req.pvDataR3 = pvData;
int Ret = -1;
int rc = RTFileIoCtl(pDevSol->hFile, Function, &Req, sizeof(Req), &Ret);
if (RT_SUCCESS(rc))
{
if (RT_FAILURE(Req.rc))
{
if (Req.rc == VERR_VUSB_DEVICE_NOT_ATTACHED)
{
pDevSol->pProxyDev->fDetached = true;
usbProxySolarisCloseFile(pDevSol);
LogRel((USBPROXY ":Command %#x failed, USB Device '%s' disconnected!\n", Function, pDevSol->pProxyDev->pUsbIns->pszName));
}
else
LogRel((USBPROXY ":Command %#x failed. Req.rc=%Rrc\n", Function, Req.rc));
}
return Req.rc;
}
LogRel((USBPROXY ":Function %#x failed. rc=%Rrc\n", Function, rc));
return rc;
}
开发者ID:Klanly,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:45,代码来源:USBProxyDevice-solaris.cpp
示例5: DECLCALLBACK
DECLCALLBACK(int) HostPowerServiceDarwin::powerChangeNotificationThread(RTTHREAD /* ThreadSelf */, void *pInstance)
{
HostPowerServiceDarwin *pPowerObj = static_cast<HostPowerServiceDarwin *>(pInstance);
/* We have to initial set the critical state of the battery, cause we want
* not the HostPowerService to inform about that state when a VM starts.
* See lowPowerHandler for more info. */
pPowerObj->checkBatteryCriticalLevel();
/* Register to receive system sleep notifications */
pPowerObj->mRootPort = IORegisterForSystemPower(pPowerObj, &pPowerObj->mNotifyPort,
HostPowerServiceDarwin::powerChangeNotificationHandler,
&pPowerObj->mNotifierObject);
if (pPowerObj->mRootPort == MACH_PORT_NULL)
{
LogFlow(("IORegisterForSystemPower failed\n"));
return VERR_NOT_SUPPORTED;
}
pPowerObj->mRunLoop = CFRunLoopGetCurrent();
/* Add the notification port to the application runloop */
CFRunLoopAddSource(pPowerObj->mRunLoop,
IONotificationPortGetRunLoopSource(pPowerObj->mNotifyPort),
kCFRunLoopCommonModes);
/* Register for all battery change events. The handler will check for low
* power events itself. */
CFRunLoopSourceRef runLoopSource = IOPSNotificationCreateRunLoopSource(HostPowerServiceDarwin::lowPowerHandler,
pPowerObj);
CFRunLoopAddSource(pPowerObj->mRunLoop,
runLoopSource,
kCFRunLoopCommonModes);
/* Start the run loop. This blocks. */
CFRunLoopRun();
return VINF_SUCCESS;
}
开发者ID:jeppeter,项目名称:vbox,代码行数:36,代码来源:HostPowerDarwin.cpp
示例6: DECLCALLBACK
/**
* Reap URBs in-flight on a device.
*
* @returns Pointer to a completed URB.
* @returns NULL if no URB was completed.
* @param pProxyDev The device.
* @param cMillies Number of milliseconds to wait. Use 0 to not wait at all.
*/
static DECLCALLBACK(PVUSBURB) usbProxyFreeBSDUrbReap(PUSBPROXYDEV pProxyDev, RTMSINTERVAL cMillies)
{
struct usb_fs_endpoint *pXferEndpoint;
PUSBPROXYDEVFBSD pDevFBSD = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVFBSD);
PUSBENDPOINTFBSD pEndpointFBSD;
PVUSBURB pUrb;
struct usb_fs_complete UsbFsComplete;
struct pollfd pfd[2];
int rc;
LogFlow(("usbProxyFreeBSDUrbReap: pProxyDev=%p, cMillies=%u\n",
pProxyDev, cMillies));
repeat:
pUrb = NULL;
/* check for cancelled transfers */
if (pDevFBSD->fCancelling)
{
for (unsigned n = 0; n < USBFBSD_MAXENDPOINTS; n++)
{
pEndpointFBSD = &pDevFBSD->aSwEndpoint[n];
if (pEndpointFBSD->fCancelling)
{
pEndpointFBSD->fCancelling = false;
pUrb = pEndpointFBSD->pUrb;
pEndpointFBSD->pUrb = NULL;
if (pUrb != NULL)
break;
}
}
if (pUrb != NULL)
{
pUrb->enmStatus = VUSBSTATUS_INVALID;
pUrb->Dev.pvPrivate = NULL;
switch (pUrb->enmType)
{
case VUSBXFERTYPE_MSG:
pUrb->cbData = 0;
break;
case VUSBXFERTYPE_ISOC:
pUrb->cbData = 0;
for (int n = 0; n < (int)pUrb->cIsocPkts; n++)
pUrb->aIsocPkts[n].cb = 0;
break;
default:
pUrb->cbData = 0;
break;
}
return pUrb;
}
pDevFBSD->fCancelling = false;
}
/* Zero default */
memset(&UsbFsComplete, 0, sizeof(UsbFsComplete));
/* Check if any endpoints are complete */
rc = usbProxyFreeBSDDoIoCtl(pProxyDev, USB_FS_COMPLETE, &UsbFsComplete, true);
if (RT_SUCCESS(rc))
{
pXferEndpoint = &pDevFBSD->aHwEndpoint[UsbFsComplete.ep_index];
pEndpointFBSD = &pDevFBSD->aSwEndpoint[UsbFsComplete.ep_index];
LogFlow(("usbProxyFreeBSDUrbReap: Reaped "
"URB %#p\n", pEndpointFBSD->pUrb));
if (pXferEndpoint->status == USB_ERR_CANCELLED)
goto repeat;
pUrb = pEndpointFBSD->pUrb;
pEndpointFBSD->pUrb = NULL;
if (pUrb == NULL)
goto repeat;
switch (pXferEndpoint->status)
{
case USB_ERR_NORMAL_COMPLETION:
pUrb->enmStatus = VUSBSTATUS_OK;
break;
case USB_ERR_STALLED:
pUrb->enmStatus = VUSBSTATUS_STALL;
break;
default:
pUrb->enmStatus = VUSBSTATUS_INVALID;
break;
}
//.........这里部分代码省略.........
开发者ID:svn2github,项目名称:virtualbox,代码行数:101,代码来源:USBProxyDevice-freebsd.cpp
示例7: usbProxyFreeBSDEndpointOpen
static int usbProxyFreeBSDEndpointOpen(PUSBPROXYDEV pProxyDev, int Endpoint, bool fIsoc, int index)
{
PUSBPROXYDEVFBSD pDevFBSD = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVFBSD);
PUSBENDPOINTFBSD pEndpointFBSD = NULL; /* shut up gcc */
struct usb_fs_endpoint *pXferEndpoint;
struct usb_fs_open UsbFsOpen;
int rc;
LogFlow(("usbProxyFreeBSDEndpointOpen: pProxyDev=%p Endpoint=%d\n",
(void *)pProxyDev, Endpoint));
for (; index < USBFBSD_MAXENDPOINTS; index++)
{
pEndpointFBSD = &pDevFBSD->aSwEndpoint[index];
if (pEndpointFBSD->fCancelling)
continue;
if ( pEndpointFBSD->fOpen
&& !pEndpointFBSD->pUrb
&& (int)pEndpointFBSD->iEpNum == Endpoint)
return index;
}
if (index == USBFBSD_MAXENDPOINTS)
{
for (index = 0; index != USBFBSD_MAXENDPOINTS; index++)
{
pEndpointFBSD = &pDevFBSD->aSwEndpoint[index];
if (pEndpointFBSD->fCancelling)
continue;
if (!pEndpointFBSD->fOpen)
break;
}
if (index == USBFBSD_MAXENDPOINTS)
return -1;
}
/* set ppBuffer and pLength */
pXferEndpoint = &pDevFBSD->aHwEndpoint[index];
pXferEndpoint->ppBuffer = &pEndpointFBSD->apvData[0];
pXferEndpoint->pLength = &pEndpointFBSD->acbData[0];
LogFlow(("usbProxyFreeBSDEndpointOpen: ep_index=%d ep_num=%d\n",
index, Endpoint));
memset(&UsbFsOpen, 0, sizeof(UsbFsOpen));
UsbFsOpen.ep_index = index;
UsbFsOpen.ep_no = Endpoint;
UsbFsOpen.max_bufsize = 256 * 1024;
/* Hardcoded assumption about the URBs we get. */
UsbFsOpen.max_frames = fIsoc ? USBFBSD_MAXFRAMES : 2;
rc = usbProxyFreeBSDDoIoCtl(pProxyDev, USB_FS_OPEN, &UsbFsOpen, true);
if (RT_FAILURE(rc))
{
if (rc == VERR_RESOURCE_BUSY)
LogFlow(("usbProxyFreeBSDEndpointOpen: EBUSY\n"));
return -1;
}
pEndpointFBSD->fOpen = true;
pEndpointFBSD->pUrb = NULL;
pEndpointFBSD->iEpNum = Endpoint;
pEndpointFBSD->cMaxIo = UsbFsOpen.max_bufsize;
pEndpointFBSD->cMaxFrames = UsbFsOpen.max_frames;
return index;
}
开发者ID:svn2github,项目名称:virtualbox,代码行数:69,代码来源:USBProxyDevice-freebsd.cpp
示例8: VMMR3_INT_DECL
/**
* Executes instruction in HM mode if we can.
*
* This is somewhat comparable to REMR3EmulateInstruction.
*
* @returns VBox strict status code.
* @retval VINF_EM_DBG_STEPPED on success.
* @retval VERR_EM_CANNOT_EXEC_GUEST if we cannot execute guest instructions in
* HM right now.
*
* @param pVM The cross context VM structure.
* @param pVCpu The cross context virtual CPU structure for the calling EMT.
* @param fFlags Combinations of EM_ONE_INS_FLAGS_XXX.
* @thread EMT.
*/
VMMR3_INT_DECL(VBOXSTRICTRC) EMR3HmSingleInstruction(PVM pVM, PVMCPU pVCpu, uint32_t fFlags)
{
PCPUMCTX pCtx = pVCpu->em.s.pCtx;
Assert(!(fFlags & ~EM_ONE_INS_FLAGS_MASK));
if (!HMR3CanExecuteGuest(pVM, pCtx))
return VINF_EM_RESCHEDULE;
uint64_t const uOldRip = pCtx->rip;
for (;;)
{
/*
* Service necessary FFs before going into HM.
*/
if ( VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK)
|| VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK))
{
VBOXSTRICTRC rcStrict = emR3HmForcedActions(pVM, pVCpu, pCtx);
if (rcStrict != VINF_SUCCESS)
{
Log(("EMR3HmSingleInstruction: FFs before -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
return rcStrict;
}
}
/*
* Go execute it.
*/
bool fOld = HMSetSingleInstruction(pVM, pVCpu, true);
VBOXSTRICTRC rcStrict = VMMR3HmRunGC(pVM, pVCpu);
HMSetSingleInstruction(pVM, pVCpu, fOld);
LogFlow(("EMR3HmSingleInstruction: %Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
/*
* Handle high priority FFs and informational status codes. We don't do
* normal FF processing the caller or the next call can deal with them.
*/
VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK);
if ( VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK)
|| VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK))
{
rcStrict = emR3HighPriorityPostForcedActions(pVM, pVCpu, VBOXSTRICTRC_TODO(rcStrict));
LogFlow(("EMR3HmSingleInstruction: FFs after -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
}
if (rcStrict != VINF_SUCCESS && (rcStrict < VINF_EM_FIRST || rcStrict > VINF_EM_LAST))
{
rcStrict = emR3HmHandleRC(pVM, pVCpu, pCtx, VBOXSTRICTRC_TODO(rcStrict));
Log(("EMR3HmSingleInstruction: emR3HmHandleRC -> %Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
}
/*
* Done?
*/
if ( (rcStrict != VINF_SUCCESS && rcStrict != VINF_EM_DBG_STEPPED)
|| !(fFlags & EM_ONE_INS_FLAGS_RIP_CHANGE)
|| pCtx->rip != uOldRip)
{
if (rcStrict == VINF_SUCCESS && pCtx->rip != uOldRip)
rcStrict = VINF_EM_DBG_STEPPED;
Log(("EMR3HmSingleInstruction: returns %Rrc (rip %llx -> %llx)\n", VBOXSTRICTRC_VAL(rcStrict), uOldRip, pCtx->rip));
return rcStrict;
}
}
}
开发者ID:jeppeter,项目名称:vbox,代码行数:80,代码来源:EMHM.cpp
示例9: VMMRCDECL
/**
* \#PF Virtual Handler callback for Guest write access to the Guest's own current TSS.
*
* @returns VBox status code (appropriate for trap handling and GC return).
* @param pVM VM Handle.
* @param uErrorCode CPU Error code.
* @param pRegFrame Trap register frame.
* @param pvFault The fault address (cr2).
* @param pvRange The base address of the handled virtual range.
* @param offRange The offset of the access into this range.
* (If it's a EIP range this is the EIP, if not it's pvFault.)
*/
VMMRCDECL(int) selmRCGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
{
PVMCPU pVCpu = VMMGetCpu0(pVM);
LogFlow(("selmRCGuestTSSWriteHandler errcode=%x fault=%RGv offRange=%08x\n", (uint32_t)uErrorCode, pvFault, offRange));
/*
* Try emulate the access.
*/
uint32_t cb;
int rc = EMInterpretInstruction(pVM, pVCpu, pRegFrame, (RTGCPTR)(RTRCUINTPTR)pvFault, &cb);
if (RT_SUCCESS(rc) && cb)
{
rc = VINF_SUCCESS;
/*
* If it's on the same page as the esp0 and ss0 fields or actually one of them,
* then check if any of these has changed.
*/
PCVBOXTSS pGuestTss = (PVBOXTSS)(uintptr_t)pVM->selm.s.GCPtrGuestTss;
if ( PAGE_ADDRESS(&pGuestTss->esp0) == PAGE_ADDRESS(&pGuestTss->padding_ss0)
&& PAGE_ADDRESS(&pGuestTss->esp0) == PAGE_ADDRESS((uint8_t *)pGuestTss + offRange)
&& ( pGuestTss->esp0 != pVM->selm.s.Tss.esp1
|| pGuestTss->ss0 != (pVM->selm.s.Tss.ss1 & ~1)) /* undo raw-r0 */
)
{
Log(("selmRCGuestTSSWriteHandler: R0 stack: %RTsel:%RGv -> %RTsel:%RGv\n",
(RTSEL)(pVM->selm.s.Tss.ss1 & ~1), (RTGCPTR)pVM->selm.s.Tss.esp1, (RTSEL)pGuestTss->ss0, (RTGCPTR)pGuestTss->esp0));
pVM->selm.s.Tss.esp1 = pGuestTss->esp0;
pVM->selm.s.Tss.ss1 = pGuestTss->ss0 | 1;
STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestTSSHandledChanged);
}
/* Handle misaligned TSS in a safe manner (just in case). */
else if ( offRange >= RT_UOFFSETOF(VBOXTSS, esp0)
&& offRange < RT_UOFFSETOF(VBOXTSS, padding_ss0))
{
struct
{
uint32_t esp0;
uint16_t ss0;
uint16_t padding_ss0;
} s;
AssertCompileSize(s, 8);
rc = selmRCReadTssBits(pVM, &s, &pGuestTss->esp0, sizeof(s));
if ( rc == VINF_SUCCESS
&& ( s.esp0 != pVM->selm.s.Tss.esp1
|| s.ss0 != (pVM->selm.s.Tss.ss1 & ~1)) /* undo raw-r0 */
)
{
Log(("selmRCGuestTSSWriteHandler: R0 stack: %RTsel:%RGv -> %RTsel:%RGv [x-page]\n",
(RTSEL)(pVM->selm.s.Tss.ss1 & ~1), (RTGCPTR)pVM->selm.s.Tss.esp1, (RTSEL)s.ss0, (RTGCPTR)s.esp0));
pVM->selm.s.Tss.esp1 = s.esp0;
pVM->selm.s.Tss.ss1 = s.ss0 | 1;
STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestTSSHandledChanged);
}
}
/*
* If VME is enabled we need to check if the interrupt redirection bitmap
* needs updating.
*/
if ( offRange >= RT_UOFFSETOF(VBOXTSS, offIoBitmap)
&& (CPUMGetGuestCR4(pVCpu) & X86_CR4_VME))
{
if (offRange - RT_UOFFSETOF(VBOXTSS, offIoBitmap) < sizeof(pGuestTss->offIoBitmap))
{
uint16_t offIoBitmap = pGuestTss->offIoBitmap;
if (offIoBitmap != pVM->selm.s.offGuestIoBitmap)
{
Log(("TSS offIoBitmap changed: old=%#x new=%#x -> resync in ring-3\n", pVM->selm.s.offGuestIoBitmap, offIoBitmap));
VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS);
VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3);
}
else
Log(("TSS offIoBitmap: old=%#x new=%#x [unchanged]\n", pVM->selm.s.offGuestIoBitmap, offIoBitmap));
}
else
{
/** @todo not sure how the partial case is handled; probably not allowed */
uint32_t offIntRedirBitmap = pVM->selm.s.offGuestIoBitmap - sizeof(pVM->selm.s.Tss.IntRedirBitmap);
if ( offIntRedirBitmap <= offRange
&& offIntRedirBitmap + sizeof(pVM->selm.s.Tss.IntRedirBitmap) >= offRange + cb
&& offIntRedirBitmap + sizeof(pVM->selm.s.Tss.IntRedirBitmap) <= pVM->selm.s.cbGuestTss)
{
Log(("TSS IntRedirBitmap Changed: offIoBitmap=%x offIntRedirBitmap=%x cbTSS=%x offRange=%x cb=%x\n",
pVM->selm.s.offGuestIoBitmap, offIntRedirBitmap, pVM->selm.s.cbGuestTss, offRange, cb));
/** @todo only update the changed part. */
//.........这里部分代码省略.........
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:101,代码来源:SELMRC.cpp
示例10: DECLCALLBACK
/**
* @interface_method_impl{PDMDRVREG,pfnConstruct}
*/
DECLCALLBACK(int) VMMDev::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
{
PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
PDRVMAINVMMDEV pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINVMMDEV);
LogFlow(("Keyboard::drvConstruct: iInstance=%d\n", pDrvIns->iInstance));
/*
* Validate configuration.
*/
if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
("Configuration error: Not possible to attach anything to this driver!\n"),
VERR_PDM_DRVINS_NO_ATTACH);
/*
* IBase.
*/
pDrvIns->IBase.pfnQueryInterface = VMMDev::drvQueryInterface;
pThis->Connector.pfnUpdateGuestStatus = vmmdevUpdateGuestStatus;
pThis->Connector.pfnUpdateGuestUserState = vmmdevUpdateGuestUserState;
pThis->Connector.pfnUpdateGuestInfo = vmmdevUpdateGuestInfo;
pThis->Connector.pfnUpdateGuestInfo2 = vmmdevUpdateGuestInfo2;
pThis->Connector.pfnUpdateGuestCapabilities = vmmdevUpdateGuestCapabilities;
pThis->Connector.pfnUpdateMouseCapabilities = vmmdevUpdateMouseCapabilities;
pThis->Connector.pfnUpdatePointerShape = vmmdevUpdatePointerShape;
pThis->Connector.pfnVideoAccelEnable = iface_VideoAccelEnable;
pThis->Connector.pfnVideoAccelFlush = iface_VideoAccelFlush;
pThis->Connector.pfnVideoModeSupported = vmmdevVideoModeSupported;
pThis->Connector.pfnGetHeightReduction = vmmdevGetHeightReduction;
pThis->Connector.pfnSetCredentialsJudgementResult = vmmdevSetCredentialsJudgementResult;
pThis->Connector.pfnSetVisibleRegion = vmmdevSetVisibleRegion;
pThis->Connector.pfnQueryVisibleRegion = vmmdevQueryVisibleRegion;
pThis->Connector.pfnReportStatistics = vmmdevReportStatistics;
pThis->Connector.pfnQueryStatisticsInterval = vmmdevQueryStatisticsInterval;
pThis->Connector.pfnQueryBalloonSize = vmmdevQueryBalloonSize;
pThis->Connector.pfnIsPageFusionEnabled = vmmdevIsPageFusionEnabled;
#ifdef VBOX_WITH_HGCM
pThis->HGCMConnector.pfnConnect = iface_hgcmConnect;
pThis->HGCMConnector.pfnDisconnect = iface_hgcmDisconnect;
pThis->HGCMConnector.pfnCall = iface_hgcmCall;
#endif
/*
* Get the IVMMDevPort interface of the above driver/device.
*/
pThis->pUpPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIVMMDEVPORT);
AssertMsgReturn(pThis->pUpPort, ("Configuration error: No VMMDev port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
#ifdef VBOX_WITH_HGCM
pThis->pHGCMPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIHGCMPORT);
AssertMsgReturn(pThis->pHGCMPort, ("Configuration error: No HGCM port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
#endif
/*
* Get the Console object pointer and update the mpDrv member.
*/
void *pv;
int rc = CFGMR3QueryPtr(pCfgHandle, "Object", &pv);
if (RT_FAILURE(rc))
{
AssertMsgFailed(("Configuration error: No/bad \"Object\" value! rc=%Rrc\n", rc));
return rc;
}
pThis->pVMMDev = (VMMDev*)pv; /** @todo Check this cast! */
pThis->pVMMDev->mpDrv = pThis;
#ifdef VBOX_WITH_HGCM
rc = pThis->pVMMDev->hgcmLoadService(VBOXSHAREDFOLDERS_DLL,
"VBoxSharedFolders");
pThis->pVMMDev->fSharedFolderActive = RT_SUCCESS(rc);
if (RT_SUCCESS(rc))
{
PPDMLED pLed;
PPDMILEDPORTS pLedPort;
LogRel(("Shared Folders service loaded.\n"));
pLedPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMILEDPORTS);
AssertMsgReturn(pLedPort, ("Configuration error: No LED port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
rc = pLedPort->pfnQueryStatusLed(pLedPort, 0, &pLed);
if (RT_SUCCESS(rc) && pLed)
{
VBOXHGCMSVCPARM parm;
parm.type = VBOX_HGCM_SVC_PARM_PTR;
parm.u.pointer.addr = pLed;
parm.u.pointer.size = sizeof(*pLed);
rc = HGCMHostCall("VBoxSharedFolders", SHFL_FN_SET_STATUS_LED, 1, &parm);
}
else
AssertMsgFailed(("pfnQueryStatusLed failed with %Rrc (pLed=%x)\n", rc, pLed));
}
else
//.........这里部分代码省略.........
开发者ID:eaas-framework,项目名称:virtualbox,代码行数:101,代码来源:VMMDevInterface.cpp
示例11: DECLCALLBACK
static DECLCALLBACK(int) drvHostALSAAudioCaptureIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
uint32_t *pcSamplesCaptured)
{
NOREF(pInterface);
AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
PALSAAUDIOSTREAMIN pThisStrmIn = (PALSAAUDIOSTREAMIN)pHstStrmIn;
snd_pcm_sframes_t cAvail;
int rc = drvHostALSAAudioGetAvail(pThisStrmIn->phPCM, &cAvail);
if (RT_FAILURE(rc))
{
LogFunc(("Error getting number of captured frames, rc=%Rrc\n", rc));
return rc;
}
if (!cAvail) /* No data yet? */
{
snd_pcm_state_t state = snd_pcm_state(pThisStrmIn->phPCM);
switch (state)
{
case SND_PCM_STATE_PREPARED:
cAvail = AudioMixBufFree(&pHstStrmIn->MixBuf);
break;
case SND_PCM_STATE_SUSPENDED:
{
rc = drvHostALSAAudioResume(pThisStrmIn->phPCM);
if (RT_FAILURE(rc))
break;
LogFlow(("Resuming suspended input stream\n"));
break;
}
default:
LogFlow(("No frames available, state=%d\n", state));
break;
}
if (!cAvail)
{
if (pcSamplesCaptured)
*pcSamplesCaptured = 0;
return VINF_SUCCESS;
}
}
/*
* Check how much we can read from the capture device without overflowing
* the mixer buffer.
*/
Assert(cAvail);
size_t cbMixFree = AudioMixBufFreeBytes(&pHstStrmIn->MixBuf);
size_t cbToRead = RT_MIN((size_t)AUDIOMIXBUF_S2B(&pHstStrmIn->MixBuf, cAvail), cbMixFree);
LogFlowFunc(("cbToRead=%zu, cAvail=%RI32\n", cbToRead, cAvail));
uint32_t cWrittenTotal = 0;
snd_pcm_uframes_t cToRead;
snd_pcm_sframes_t cRead;
while ( cbToRead
&& RT_SUCCESS(rc))
{
cToRead = RT_MIN(AUDIOMIXBUF_B2S(&pHstStrmIn->MixBuf, cbToRead),
AUDIOMIXBUF_B2S(&pHstStrmIn->MixBuf, pThisStrmIn->cbBuf));
AssertBreakStmt(cToRead, rc = VERR_NO_DATA);
cRead = snd_pcm_readi(pThisStrmIn->phPCM, pThisStrmIn->pvBuf, cToRead);
if (cRead <= 0)
{
switch (cRead)
{
case 0:
{
LogFunc(("No input frames available\n"));
rc = VERR_ACCESS_DENIED;
break;
}
case -EAGAIN:
/*
* Don't set error here because EAGAIN means there are no further frames
* available at the moment, try later. As we might have read some frames
* already these need to be processed instead.
*/
cbToRead = 0;
break;
case -EPIPE:
{
rc = drvHostALSAAudioRecover(pThisStrmIn->phPCM);
if (RT_FAILURE(rc))
break;
LogFlowFunc(("Recovered from capturing\n"));
continue;
}
default:
//.........这里部分代码省略.........
开发者ID:stefano-garzarella,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:101,代码来源:DrvHostALSAAudio.cpp
示例12: VMMR3DECL
/**
* Halted VM Wait.
* Any external event will unblock the thread.
*
* @returns VINF_SUCCESS unless a fatal error occurred. In the latter
* case an appropriate status code is returned.
* @param pVM Pointer to the VM.
* @param pVCpu Pointer to the VMCPU.
* @param fIgnoreInterrupts If set the VM_FF_INTERRUPT flags is ignored.
* @thread The emulation thread.
*/
VMMR3DECL(int) VMR3WaitHalted(PVM pVM, PVMCPU pVCpu, bool fIgnoreInterrupts)
{
LogFlow(("VMR3WaitHalted: fIgnoreInterrupts=%d\n", fIgnoreInterrupts));
/*
* Check Relevant FFs.
*/
const uint32_t fMask = !fIgnoreInterrupts
? VMCPU_FF_EXTERNAL_HALTED_MASK
: VMCPU_FF_EXTERNAL_HALTED_MASK & ~(VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC);
if ( VM_FF_ISPENDING(pVM, VM_FF_EXTERNAL_HALTED_MASK)
|| VMCPU_FF_ISPENDING(pVCpu, fMask))
{
LogFlow(("VMR3WaitHalted: returns VINF_SUCCESS (FF %#x FFCPU %#x)\n", pVM->fGlobalForcedActions, pVCpu->fLocalForcedActions));
return VINF_SUCCESS;
}
/*
* The yielder is suspended while we're halting, while TM might have clock(s) running
* only at certain times and need to be notified..
*/
if (pVCpu->idCpu == 0)
VMMR3YieldSuspend(pVM);
TMNotifyStartOfHalt(pVCpu);
/*
* Record halt averages for the last second.
*/
PUVMCPU pUVCpu = pVCpu->pUVCpu;
uint64_t u64Now = RTTimeNanoTS();
int64_t off = u64Now - pUVCpu->vm.s.u64HaltsStartTS;
if (off > 1000000000)
{
if (off > _4G || !pUVCpu->vm.s.cHalts)
{
pUVCpu->vm.s.HaltInterval = 1000000000 /* 1 sec */;
pUVCpu->vm.s.HaltFrequency = 1;
}
else
{
pUVCpu->vm.s.HaltInterval = (uint32_t)off / pUVCpu->vm.s.cHalts;
pUVCpu->vm.s.HaltFrequency = ASMMultU64ByU32DivByU32(pUVCpu->vm.s.cHalts, 1000000000, (uint32_t)off);
}
pUVCpu->vm.s.u64HaltsStartTS = u64Now;
pUVCpu->vm.s.cHalts = 0;
}
pUVCpu->vm.s.cHalts++;
/*
* Do the halt.
*/
Assert(VMCPU_GET_STATE(pVCpu) == VMCPUSTATE_STARTED);
VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_HALTED);
PUVM pUVM = pUVCpu->pUVM;
int rc = g_aHaltMethods[pUVM->vm.s.iHaltMethod].pfnHalt(pUVCpu, fMask, u64Now);
VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED);
/*
* Notify TM and resume the yielder
*/
TMNotifyEndOfHalt(pVCpu);
if (pVCpu->idCpu == 0)
VMMR3YieldResume(pVM);
LogFlow(("VMR3WaitHalted: returns %Rrc (FF %#x)\n", rc, pVM->fGlobalForcedActions));
return rc;
}
开发者ID:greg100795,项目名称:virtualbox,代码行数:78,代码来源:VMEmt.cpp
示例13: hgcmObjMake
uint32_t hgcmObjMake (HGCMObject *pObject, uint32_t u32HandleIn)
{
int handle = 0;
LogFlow(("MAIN::hgcmObjGenerateHandle: pObject %p\n", pObject));
int rc = hgcmObjEnter ();
if (RT_SUCCESS(rc))
{
ObjectAVLCore *pCore = &pObject->m_core;
/* Generate a new handle value. */
uint32_t volatile *pu32HandleCountSource = pObject->Type () == HGCMOBJ_CLIENT?
&g_u32ClientHandleCount:
&g_u32InternalHandleCount;
uint32_t u32Start = *pu32HandleCountSource;
for (;;)
{
uint32_t Key;
if (u32HandleIn == 0)
{
Key = ASMAtomicIncU32 (pu32HandleCountSource);
if (Key == u32Start)
{
/* Rollover. Something is wrong. */
AssertReleaseFailed ();
break;
}
/* 0 and 0x80000000 are not valid handles. */
if ((Key & 0x7FFFFFFF) == 0)
{
/* Over the invalid value, reinitialize the source. */
*pu32HandleCountSource = pObject->Type () == HGCMOBJ_CLIENT?
0:
0x80000000;
continue;
}
}
else
{
Key = u32HandleIn;
}
/* Insert object to AVL tree. */
pCore->AvlCore.Key = Key;
bool bRC = RTAvlULInsert(&g_pTree, &pCore->AvlCore);
/* Could not insert a handle. */
if (!bRC)
{
if (u32HandleIn == 0)
{
/* Try another generated handle. */
continue;
}
else
{
/* Could not use the specified handle. */
break;
}
}
/* Initialize backlink. */
pCore->pSelf = pObject;
/* Reference the object for time while it resides in the tree. */
pObject->Reference ();
/* Store returned handle. */
handle = Key;
Log(("Object key inserted 0x%08X\n", Key));
break;
}
hgcmObjLeave ();
}
else
{
AssertReleaseMsgFailed (("MAIN::hgcmObjGenerateHandle: Failed to acquire object pool semaphore"));
}
LogFlow(("MAIN::hgcmObjGenerateHandle: handle = 0x%08X, rc = %Rrc, return void\n", handle, rc));
return handle;
}
开发者ID:gvsurenderreddy,项目名称:virtualbox,代码行数:95,代码来源:HGCMObjects.cpp
示例14: VMM_INT_DECL
/**
* Restores virtualized flags.
*
* This function is called from CPUMRawLeave(). It will update the eflags register.
*
** @note Only here we are allowed to switch back to guest code (without a special reason such as a trap in patch code)!!
*
* @param pVM Pointer to the VM.
* @param pCtxCore The cpu context core.
* @param rawRC Raw mode return code
* @see @ref pg_raw
*/
VMM_INT_DECL(void) PATMRawLeave(PVM pVM, PCPUMCTXCORE pCtxCore, int rawRC)
{
bool fPatchCode = PATMIsPatchGCAddr(pVM, pCtxCore->eip);
/*
* We will only be called if PATMRawEnter was previously called.
*/
register uint32_t efl = pCtxCore->eflags.u32;
efl = (efl & ~PATM_VIRTUAL_FLAGS_MASK) | (CTXSUFF(pVM->patm.s.pGCState)->uVMFlags & PATM_VIRTUAL_FLAGS_MASK);
pCtxCore->eflags.u32 = efl;
CTXSUFF(pVM->patm.s.pGCState)->uVMFlags = X86_EFL_IF;
AssertReleaseMsg((efl & X86_EFL_IF) || fPatchCode || rawRC == VINF_PATM_PENDING_IRQ_AFTER_IRET || RT_FAILURE(rawRC), ("Inconsistent state at %RRv rc=%Rrc\n", pCtxCore->eip, rawRC));
AssertReleaseMsg(CTXSUFF(pVM->patm.s.pGCState)->fPIF || fPatchCode || RT_FAILURE(rawRC), ("fPIF=%d eip=%RRv rc=%Rrc\n", CTXSUFF(pVM->patm.s.pGCState)->fPIF, pCtxCore->eip, rawRC));
#ifdef IN_RING3
if ( (efl & X86_EFL_IF)
&& fPatchCode
)
{
if ( rawRC < VINF_PATM_LEAVE_RC_FIRST
|| rawRC > VINF_PATM_LEAVE_RC_LAST)
{
/*
* Golden rules:
* - Don't interrupt special patch streams that replace special instructions
* - Don't break instruction fusing (sti, pop ss, mov ss)
* - Don't go back to an instruction that has been overwritten by a patch jump
* - Don't interrupt an idt handler on entry (1st instruction); technically incorrect
*
*/
if (CTXSUFF(pVM->patm.s.pGCState)->fPIF == 1) /* consistent patch instruction state */
{
PATMTRANSSTATE enmState;
RTRCPTR pOrgInstrGC = PATMR3PatchToGCPtr(pVM, pCtxCore->eip, &enmState);
AssertRelease(pOrgInstrGC);
Assert(enmState != PATMTRANS_OVERWRITTEN);
if (enmState == PATMTRANS_SAFE)
{
Assert(!patmFindActivePatchByEntrypoint(pVM, pOrgInstrGC));
Log(("Switchback from %RRv to %RRv (Psp=%x)\n", pCtxCore->eip, pOrgInstrGC, CTXSUFF(pVM->patm.s.pGCState)->Psp));
STAM_COUNTER_INC(&pVM->patm.s.StatSwitchBack);
pCtxCore->eip = pOrgInstrGC;
fPatchCode = false; /* to reset the stack ptr */
CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts = 0; /* reset this pointer; safe otherwise the state would be PATMTRANS_INHIBITIRQ */
}
else
{
LogFlow(("Patch address %RRv can't be interrupted (state=%d)!\n", pCtxCore->eip, enmState));
STAM_COUNTER_INC(&pVM->patm.s.StatSwitchBackFail);
}
}
else
{
LogFlow(("Patch address %RRv can't be interrupted (fPIF=%d)!\n", pCtxCore->eip, CTXSUFF(pVM->patm.s.pGCState)->fPIF));
STAM_COUNTER_INC(&pVM->patm.s.StatSwitchBackFail);
}
}
}
#else /* !IN_RING3 */
AssertMsgFailed(("!IN_RING3"));
#endif /* !IN_RING3 */
if (!fPatchCode)
{
if (CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts == (RTRCPTR)pCtxCore->eip)
{
EMSetInhibitInterruptsPC(VMMGetCpu0(pVM), pCtxCore->eip);
}
CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts = 0;
/* Reset the stack pointer to the top of the stack. */
#ifdef DEBUG
if (CTXSUFF(pVM->patm.s.pGCState)->Psp != PATM_STACK_SIZE)
{
LogFlow(("PATMRawLeave: Reset PATM stack (Psp = %x)\n", CTXSUFF(pVM->patm.s.pGCState)->Psp));
}
#endif
CTXSUFF(pVM->patm.s.pGCState)->Psp = PATM_STACK_SIZE;
}
}
开发者ID:ryenus,项目名称:vbox,代码行数:95,代码来源:PATMAll.cpp
示例15: VMMR3_INT_DECL
/**
* Interface that PDMR3Suspend, PDMR3PowerOff and PDMR3Reset uses when they wait
* for the handling of asynchronous notifications to complete.
*
* @returns VINF_SUCCESS unless a fatal error occurred. In the latter
* case an appropriate status code is returned.
* @param pUVCpu Pointer to the user mode VMCPU structure.
* @thread The emulation thread.
*/
VMMR3_INT_DECL(int) VMR3AsyncPdmNotificationWaitU(PUVMCPU pUVCpu)
{
LogFlow(("VMR3AsyncPdmNotificationWaitU:\n"));
return VMR3WaitU(pUVCpu);
}
开发者ID:greg100795,项目名称:virtualbox,代码行数:14,代码来源:VMEmt.cpp
示例16: usbProxyFreeBSDUrbReap
/**
* Reap URBs in-flight on a device.
*
* @returns Pointer to a completed URB.
* @returns NULL if no URB was completed.
* @param pProxyDev The device.
* @param cMillies Number of milliseconds to wait. Use 0 to not wait at all.
*/
static PVUSBURB usbProxyFreeBSDUrbReap(PUSBPROXYDEV pProxyDev, RTMSINTERVAL cMillies)
{
struct usb_fs_endpoint *pXferEndpoint;
PUSBPROXYDEVFBSD pDevFBSD = (PUSBPROXYDEVFBSD) pProxyDev->Backend.pv;
PUSBENDPOINTFBSD pEndpointFBSD;
PVUSBURB pUrb;
struct usb_fs_complete UsbFsComplete;
struct pollfd PollFd;
int rc;
LogFlow(("usbProxyFreeBSDUrbReap: pProxyDev=%p, cMillies=%u\n",
pProxyDev, cMillies));
repeat:
pUrb = NULL;
/* check for cancelled transfers */
if (pDevFBSD->fCancelling)
{
for (unsigned n = 0; n < USBFBSD_MAXENDPOINTS; n++)
{
pEndpointFBSD = &pDevFBSD->aSwEndpoint[n];
if (pEndpointFBSD->fCancelling)
{
pEndpointFBSD->fCancelling = false;
pUrb = pEndpointFBSD->pUrb;
pEndpointFBSD->pUrb = NULL;
if (pUrb != NULL)
break;
}
}
if (pUrb != NULL)
{
pUrb->enmStatus = VUSBSTATUS_INVALID;
pUrb->Dev.pvPrivate = NULL;
switch (pUrb->enmType)
{
case VUSBXFERTYPE_MSG:
pUrb->cbData = 0;
break;
case VUSBXFERTYPE_ISOC:
pUrb->cbData = 0;
for (int n = 0; n < (int)pUrb->cIsocPkts; n++)
pUrb->aIsocPkts[n].cb = 0;
break;
default:
pUrb->cbData = 0;
break;
}
return pUrb;
}
pDevFBSD->fCancelling = false;
}
/* Zero default */
memset(&UsbFsComplete, 0, sizeof(UsbFsComplete));
/* Check if any endpoints are complete */
rc = usbProxyFreeBSDDoIoCtl(pProxyDev, USB_FS_COMPLETE, &UsbFsComplete, true);
if (RT_SUCCESS(rc))
{
pXferEndpoint = &pDevFBSD->aHwEndpoint[UsbFsComplete.ep_index];
pEndpointFBSD = &pDevFBSD->aSwEndpoint[UsbFsComplete.ep_index];
LogFlow(("usbProxyFreeBSDUrbReap: Reaped "
"URB %#p\n", pEndpointFBSD->pUrb));
if (pXferEndpoint->status == USB_ERR_CANCELLED)
goto repeat;
pUrb = pEndpointFBSD->pUrb;
pEndpointFBSD->pUrb = NULL;
if (pUrb == NULL)
goto repeat;
switch (pXferEndpoint->status)
{
case USB_ERR_NORMAL_COMPLETION:
pUrb->enmStatus = VUSBSTATUS_OK;
break;
case USB_ERR_STALLED:
pUrb->enmStatus = VUSBSTATUS_STALL;
break;
default:
pUrb->enmStatus = VUSBSTATUS_INVALID;
break;
}
//.........这里部分代码省略......
|
请发表评论