void UIMachineLogicNormal::sltOpenStatusBarSettings() { /* Do not process if window(s) missed! */ AssertReturnVoid(isMachineWindowsCreated()); /* Make sure status-bar is enabled: */ const bool fEnabled = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->isChecked(); AssertReturnVoid(fEnabled); /* Prevent user from opening another one editor or toggle status-bar: */ actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings)->setEnabled(false); actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->setEnabled(false); /* Create status-bar editor: */ UIStatusBarEditorWindow *pStatusBarEditor = new UIStatusBarEditorWindow(activeMachineWindow()); AssertPtrReturnVoid(pStatusBarEditor); { /* Configure status-bar editor: */ connect(pStatusBarEditor, SIGNAL(destroyed(QObject*)), this, SLOT(sltStatusBarSettingsClosed())); #ifdef Q_WS_MAC connect(this, SIGNAL(sigNotifyAbout3DOverlayVisibilityChange(bool)), pStatusBarEditor, SLOT(sltActivateWindow())); #endif /* Q_WS_MAC */ /* Show window: */ pStatusBarEditor->show(); } }
/** * Free resources allocated by vboxvfs_path_internal() and vboxvfs_guest_vnode_to_shflstring_path_internal(). * * @param ppHandle Reference to object to be freed. */ void vboxvfs_put_path_internal(void **ppHandle) { AssertReturnVoid(ppHandle); AssertReturnVoid(*ppHandle); RTMemFree(*ppHandle); }
/** * @note Locks this object for writing, together with the peer object * represented by @a aThat (locked for reading). */ void USBController::i_copyFrom(USBController *aThat) { AssertReturnVoid(aThat != NULL); /* sanity */ AutoCaller autoCaller(this); AssertComRCReturnVoid(autoCaller.rc()); /* sanity too */ AutoCaller thatCaller(aThat); AssertComRCReturnVoid(thatCaller.rc()); /* even more sanity */ AutoAnyStateDependency adep(m->pParent); AssertComRCReturnVoid(adep.rc()); /* Machine::copyFrom() may not be called when the VM is running */ AssertReturnVoid(!Global::IsOnline(adep.machineState())); /* peer is not modified, lock it for reading (aThat is "master" so locked * first) */ AutoReadLock rl(aThat COMMA_LOCKVAL_SRC_POS); AutoWriteLock wl(this COMMA_LOCKVAL_SRC_POS); /* this will back up current data */ m->bd.assignCopy(aThat->m->bd); }
/** * Performs the required actions when a device has been added. * * This means things like running filters and subsequent capturing and * VM attaching. This may result in IPC and temporary lock abandonment. * * @param aDevice The device in question. * @param aUSBDevice The USB device structure. */ void USBProxyService::deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines, PUSBDEVICE aUSBDevice) { /* * Validate preconditions. */ AssertReturnVoid(!isWriteLockOnCurrentThread()); AssertReturnVoid(!aDevice->isWriteLockOnCurrentThread()); AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS); LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid}\n", (HostUSBDevice *)aDevice, aDevice->getName().c_str(), aDevice->getStateName(), aDevice->getId().raw())); /* * Run filters on the device. */ if (aDevice->isCapturableOrHeld()) { devLock.release(); HRESULT rc = runAllFiltersOnDevice(aDevice, llOpenedMachines, NULL /* aIgnoreMachine */); AssertComRC(rc); } NOREF(aUSBDevice); }
void Guest::facilityUpdate(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS) { AssertReturnVoid( a_enmFacility < VBoxGuestFacilityType_All && a_enmFacility > VBoxGuestFacilityType_Unknown); FacilityMapIter it = mData.mFacilityMap.find((AdditionsFacilityType_T)a_enmFacility); if (it != mData.mFacilityMap.end()) { AdditionsFacility *pFac = it->second; pFac->update((AdditionsFacilityStatus_T)a_enmStatus, a_fFlags, a_pTimeSpecTS); } else { if (mData.mFacilityMap.size() > 64) { /* The easy way out for now. We could automatically destroy inactive facilities like VMMDev does if we like... */ AssertFailedReturnVoid(); } ComObjPtr<AdditionsFacility> ptrFac; ptrFac.createObject(); AssertReturnVoid(!ptrFac.isNull()); HRESULT hrc = ptrFac->init(this, (AdditionsFacilityType_T)a_enmFacility, (AdditionsFacilityStatus_T)a_enmStatus, a_fFlags, a_pTimeSpecTS); if (SUCCEEDED(hrc)) mData.mFacilityMap.insert(std::make_pair((AdditionsFacilityType_T)a_enmFacility, ptrFac)); } }
/** * Handle a device which state changed in some significant way. * * This means things like running filters and subsequent capturing and * VM attaching. This may result in IPC and temporary lock abandonment. * * @param aDevice The device. * @param pllOpenedMachines list of running session machines (VirtualBox::getOpenedMachines()); if NULL, we don't run filters * @param aIgnoreMachine Machine to ignore when running filters. */ void USBProxyService::deviceChanged(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList *pllOpenedMachines, SessionMachine *aIgnoreMachine) { /* * Validate preconditions. */ AssertReturnVoid(!isWriteLockOnCurrentThread()); AssertReturnVoid(!aDevice->isWriteLockOnCurrentThread()); AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS); LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid} aRunFilters=%RTbool aIgnoreMachine=%p\n", (HostUSBDevice *)aDevice, aDevice->getName().c_str(), aDevice->getStateName(), aDevice->getId().raw(), (pllOpenedMachines != NULL), // used to be "bool aRunFilters" aIgnoreMachine)); devLock.release(); /* * Run filters if requested to do so. */ if (pllOpenedMachines) { HRESULT rc = runAllFiltersOnDevice(aDevice, *pllOpenedMachines, aIgnoreMachine); AssertComRC(rc); } }
/** * Puts a queue and destroys the instance. * * @param pDevice Pointer to the Virtio device instance. * @param pQueue Pointer to the Virtio queue. */ void VirtioPutQueue(PVIRTIODEVICE pDevice, PVIRTIOQUEUE pQueue) { AssertReturnVoid(pDevice); AssertReturnVoid(pQueue); pDevice->pHyperOps->pfnPutQueue(pDevice, pQueue); RTMemFree(pQueue); }
void UIMainEventListener::registerSource(const CEventSource &comSource, const CEventListener &comListener) { /* Make sure source and listener are valid: */ AssertReturnVoid(!comSource.isNull()); AssertReturnVoid(!comListener.isNull()); /* Create thread for passed source: */ m_threads << new UIMainEventListeningThread(comSource, comListener); /* And start it: */ m_threads.last()->start(); }
DECLINLINE(void) tftpProcessRRQ(PNATState pData, PCTFTPIPHDR pTftpIpHeader, int pktlen) { PTFTPSESSION pTftpSession = NULL; uint8_t *pu8Payload = NULL; int cbPayload = 0; size_t cbFileName = 0; int rc = VINF_SUCCESS; AssertPtrReturnVoid(pTftpIpHeader); AssertPtrReturnVoid(pData); AssertReturnVoid(pktlen > sizeof(TFTPIPHDR)); LogFlowFunc(("ENTER: pTftpIpHeader:%p, pktlen:%d\n", pTftpIpHeader, pktlen)); rc = tftpAllocateSession(pData, pTftpIpHeader, &pTftpSession); if ( RT_FAILURE(rc) || pTftpSession == NULL) { LogFlowFuncLeave(); return; } pu8Payload = (uint8_t *)&pTftpIpHeader->Core; cbPayload = pktlen - sizeof(TFTPIPHDR); cbFileName = RTStrNLen((char *)pu8Payload, cbPayload); /* We assume that file name should finish with '\0' and shouldn't bigger * than buffer for name storage. */ AssertReturnVoid( cbFileName < cbPayload && cbFileName < TFTP_FILENAME_MAX /* current limit in tftp session handle */ && cbFileName); /* Dont't bother with rest processing in case of invalid access */ if (RT_FAILURE(tftpSecurityFilenameCheck(pData, pTftpSession))) { tftpSendError(pData, pTftpSession, 2, "Access violation", pTftpIpHeader); LogFlowFuncLeave(); return; } if (RT_UNLIKELY(!tftpIsSupportedTransferMode(pTftpSession))) { tftpSendError(pData, pTftpSession, 4, "Unsupported transfer mode", pTftpIpHeader); LogFlowFuncLeave(); return; } tftpSendOACK(pData, pTftpSession, pTftpIpHeader); LogFlowFuncLeave(); return; }
/** * Updates the cached keyboard data. * * @todo The current implementation is very brute force... * Rewrite it so that it doesn't flush the cache completely but simply checks whether * anything has changed in the HID config. With any luck, there might even be a callback * or something we can poll for HID config changes... * setRemovalCallback() is a start... */ static void darwinHIDKeyboardCacheDoUpdate(void) { g_u64KeyboardTS = RTTimeMilliTS(); /* * Dispense with the old cache data. */ darwinHIDKeyboardCacheZap(); /* * Open the master port on the first invocation. */ if (!g_MasterPort) { kern_return_t krc = IOMasterPort(MACH_PORT_NULL, &g_MasterPort); AssertReturnVoid(krc == KERN_SUCCESS); } /* * Create a matching dictionary for searching for keyboards devices. */ static const UInt32 s_Page = kHIDPage_GenericDesktop; static const UInt32 s_Usage = kHIDUsage_GD_Keyboard; CFMutableDictionaryRef RefMatchingDict = IOServiceMatching(kIOHIDDeviceKey); AssertReturnVoid(RefMatchingDict); CFDictionarySetValue(RefMatchingDict, CFSTR(kIOHIDPrimaryUsagePageKey), CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &s_Page)); CFDictionarySetValue(RefMatchingDict, CFSTR(kIOHIDPrimaryUsageKey), CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &s_Usage)); /* * Perform the search and get a collection of keyboard devices. */ io_iterator_t Keyboards = NULL; IOReturn rc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &Keyboards); AssertMsgReturnVoid(rc == kIOReturnSuccess, ("rc=%d\n", rc)); RefMatchingDict = NULL; /* the reference is consumed by IOServiceGetMatchingServices. */ /* * Enumerate the keyboards and query the cache data. */ unsigned i = 0; io_object_t KeyboardDevice; while ( i < RT_ELEMENTS(g_aKeyboards) && (KeyboardDevice = IOIteratorNext(Keyboards)) != 0) { if (darwinHIDKeyboardCacheCreateEntry(&g_aKeyboards[i], KeyboardDevice)) i++; IOObjectRelease(KeyboardDevice); } g_cKeyboards = i; IOObjectRelease(Keyboards); }
VBGLR3DECL(void) VbglR3Term(void) { /* * Decrement the reference count and see if we're the last one out. */ uint32_t cInits = ASMAtomicDecU32(&g_cInits); if (cInits > 0) return; #if !defined(VBOX_VBGLR3_XSERVER) AssertReturnVoid(!cInits); # if defined(RT_OS_WINDOWS) HANDLE hFile = g_hFile; g_hFile = INVALID_HANDLE_VALUE; AssertReturnVoid(hFile != INVALID_HANDLE_VALUE); BOOL fRc = CloseHandle(hFile); Assert(fRc); NOREF(fRc); # elif defined(RT_OS_OS2) RTFILE File = g_File; g_File = NIL_RTFILE; AssertReturnVoid(File != NIL_RTFILE); APIRET rc = DosClose((uintptr_t)File); AssertMsg(!rc, ("%ld\n", rc)); #elif defined(RT_OS_DARWIN) io_connect_t uConnection = g_uConnection; RTFILE hFile = g_File; g_uConnection = 0; g_File = NIL_RTFILE; kern_return_t kr = IOServiceClose(uConnection); AssertMsg(kr == kIOReturnSuccess, ("%#x (%d)\n", kr, kr)); int rc = RTFileClose(hFile); AssertRC(rc); # else /* The IPRT case. */ RTFILE File = g_File; g_File = NIL_RTFILE; AssertReturnVoid(File != NIL_RTFILE); int rc = RTFileClose(File); AssertRC(rc); # endif #else /* VBOX_VBGLR3_XSERVER */ int File = g_File; g_File = -1; if (File == -1) return; xf86close(File); #endif /* VBOX_VBGLR3_XSERVER */ }
/** * Mount and unmount helper: Release VBoxVFS internal resources. * Deallocates ppMount as well. * * @param ppMount Pointer to reference of VBoxVFS internal data. */ static void vboxvfs_destroy_internal_data(vboxvfs_mount_t **ppMount) { AssertReturnVoid(ppMount); AssertReturnVoid(*ppMount); AssertReturnVoid((*ppMount)->pShareName); RTMemFree((*ppMount)->pShareName); (*ppMount)->pShareName = NULL; vboxvfs_destroy_locking(*ppMount); RTMemFree(*ppMount); *ppMount = NULL; }
void UIMediumEnumerator::deleteMedium(const QString &strMediumID) { /* Do not delete UIMedium(s) with incorrect ID: */ AssertReturnVoid(!strMediumID.isNull()); AssertReturnVoid(strMediumID != UIMedium::nullID()); /* Make sure medium still exists: */ AssertReturnVoid(m_mediums.contains(strMediumID)); /* Remove medium: */ m_mediums.remove(strMediumID); LogRel(("GUI: UIMediumEnumerator: Medium with key={%s} deleted\n", strMediumID.toUtf8().constData())); /* Notify listener: */ emit sigMediumDeleted(strMediumID); }
/** * @callback_method_impl{dtrace_pops_t,dtps_destroy} */ static void vboxDtPOps_Destroy(void *pvProv, dtrace_id_t idProbe, void *pvProbe) { PSUPDRVVDTPROVIDERCORE pProv = (PSUPDRVVDTPROVIDERCORE)pvProv; AssertPtrReturnVoid(pProv); LOG_DTRACE(("%s: %p / %p - %#x / %p\n", __FUNCTION__, pProv, pProv->TracerData.DTrace.idProvider, idProbe, pvProbe)); AssertReturnVoid(pProv->TracerData.DTrace.cProvidedProbes > 0); AssertPtrReturnVoid(pProv->TracerData.DTrace.idProvider); if (!pProv->TracerData.DTrace.fZombie) { uint32_t idxProbeLoc = (uint32_t)(uintptr_t)pvProbe; PCVTGPROBELOC pProbeLocRO = (PVTGPROBELOC)&pProv->paProbeLocsRO[idxProbeLoc]; uint32_t *pidProbe; if (!pProv->fUmod) { pidProbe = (uint32_t *)&pProbeLocRO->idProbe; Assert(!pProbeLocRO->fEnabled); Assert(*pidProbe == idProbe); } else { pidProbe = &pProv->paR0ProbeLocs[idxProbeLoc].idProbe; Assert(!pProv->paR0ProbeLocs[idxProbeLoc].fEnabled); Assert(*pidProbe == idProbe); NOREF(idProbe); } *pidProbe = 0; } pProv->TracerData.DTrace.cProvidedProbes--; }
void NetworkAdapter::applyDefaults(GuestOSType *aOsType) { AssertReturnVoid(aOsType != NULL); /* sanity */ AutoCaller autoCaller(this); AssertComRCReturnVoid(autoCaller.rc()); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); bool e1000enabled = false; #ifdef VBOX_WITH_E1000 e1000enabled = true; #endif // VBOX_WITH_E1000 NetworkAdapterType_T defaultType = aOsType->networkAdapterType(); /* Set default network adapter for this OS type */ if (defaultType == NetworkAdapterType_I82540EM || defaultType == NetworkAdapterType_I82543GC || defaultType == NetworkAdapterType_I82545EM) { if (e1000enabled) mData->mAdapterType = defaultType; } else mData->mAdapterType = defaultType; /* Enable and connect the first one adapter to the NAT */ if (mData->mSlot == 0) { mData->mEnabled = true; mData->mAttachmentType = NetworkAttachmentType_NAT; mData->mCableConnected = true; } }
void UIMediumEnumerator::enumerateMediums() { /* Make sure we are not already in progress: */ AssertReturnVoid(!m_fMediumEnumerationInProgress); /* Compose new map of all currently known mediums & their children. * While composing we are using data from already existing mediums. */ UIMediumMap mediums; addNullMediumToMap(mediums); addHardDisksToMap(vboxGlobal().virtualBox().GetHardDisks(), mediums); addMediumsToMap(vboxGlobal().host().GetDVDDrives(), mediums, UIMediumType_DVD); addMediumsToMap(vboxGlobal().virtualBox().GetDVDImages(), mediums, UIMediumType_DVD); addMediumsToMap(vboxGlobal().host().GetFloppyDrives(), mediums, UIMediumType_Floppy); addMediumsToMap(vboxGlobal().virtualBox().GetFloppyImages(), mediums, UIMediumType_Floppy); m_mediums = mediums; /* Notify listener: */ LogRelFlow(("UIMediumEnumerator: Medium-enumeration started...\n")); m_fMediumEnumerationInProgress = true; emit sigMediumEnumerationStarted(); /* Start enumeration for all the new mediums: */ QList<QString> mediumIDs = m_mediums.keys(); foreach (QString strMediumID, mediumIDs) createMediumEnumerationTask(m_mediums[strMediumID]); }
/** * Sends a signal to the thread to rescan the clients/VMs having open sessions. */ void VirtualBox::ClientWatcher::update() { AssertReturnVoid(mThread != NIL_RTTHREAD); LogFlowFunc(("ping!\n")); /* sent an update request */ #if defined(RT_OS_WINDOWS) ASMAtomicWriteBool(&mfUpdateReq, true); ::SetEvent(mUpdateReq); #elif defined(RT_OS_OS2) RTSemEventSignal(mUpdateReq); #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) /* use short timeouts, as we expect changes */ ASMAtomicUoWriteU8(&mUpdateAdaptCtr, RT_ELEMENTS(s_aUpdateTimeoutSteps) - 1); RTSemEventSignal(mUpdateReq); #elif defined(VBOX_WITH_GENERIC_SESSION_WATCHER) RTSemEventSignal(mUpdateReq); #else # error "Port me!" #endif }
/** * Set current state of a keyboard modifier. * * @param idModifier Modifier to set (VK_CAPITAL, VK_SCROLL or VK_NUMLOCK) * @param fState State to set */ static void winSetModifierState(int idModifier, bool fState) { AssertReturnVoid((idModifier == VK_CAPITAL) || (idModifier == VK_SCROLL) || (idModifier == VK_NUMLOCK)); /* If the modifier is already in desired state, just do nothing. Otherwise, toggle it. */ if (winGetModifierState(idModifier) != fState) { /* Simulate KeyUp+KeyDown keystroke */ keybd_event(idModifier, 0, KEYEVENTF_EXTENDEDKEY, 0); keybd_event(idModifier, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); /* Process posted above keyboard events immediately: */ MSG msg; while (::PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE)) ::DispatchMessage(&msg); LogRel2(("HID LEDs sync: setting %s state to %s (0x%X).\n", VBOX_CONTROL_TO_STR_NAME(idModifier), VBOX_BOOL_TO_STR_STATE(fState), MapVirtualKey(idModifier, MAPVK_VK_TO_VSC))); } else { LogRel2(("HID LEDs sync: setting %s state: skipped: state is already %s (0x%X).\n", VBOX_CONTROL_TO_STR_NAME(idModifier), VBOX_BOOL_TO_STR_STATE(fState), MapVirtualKey(idModifier, MAPVK_VK_TO_VSC))); } }
void UIMachineWindowFullscreen::sltEnterNativeFullscreen(UIMachineWindow *pMachineWindow) { /* Make sure this slot is called only under ML and next: */ AssertReturnVoid(vboxGlobal().osRelease() > MacOSXRelease_Lion); /* Make sure it is NULL or 'this' window passed: */ if (pMachineWindow && pMachineWindow != this) return; /* Make sure this window has fullscreen logic: */ UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic()); AssertPtrReturnVoid(pFullscreenLogic); /* Make sure this window should be shown and mapped to host-screen: */ if (!uisession()->isScreenVisible(m_uScreenId) || !pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId)) return; /* Mark window 'transitioned to fullscreen': */ m_fIsInFullscreenTransition = true; /* Enter native fullscreen mode if necessary: */ if ( (pFullscreenLogic->screensHaveSeparateSpaces() || m_uScreenId == 0) && !darwinIsInFullscreenMode(this)) darwinToggleFullscreenMode(this); }
void ErrorInfo::init(IUnknown *aI, const GUID &aIID, bool aKeepObj /* = false */) { AssertReturnVoid(aI); #if !defined(VBOX_WITH_XPCOM) ComPtr<IUnknown> iface = aI; ComPtr<ISupportErrorInfo> serr; HRESULT rc = iface.queryInterfaceTo(serr.asOutParam()); if (SUCCEEDED(rc)) { rc = serr->InterfaceSupportsErrorInfo(aIID); if (SUCCEEDED(rc)) init(aKeepObj); } #else init(aKeepObj); #endif if (mIsBasicAvailable) { mCalleeIID = aIID; GetInterfaceNameByIID(aIID, mCalleeName.asOutParam()); } }
void QITableView::sltEditorDestroyed(QObject *pEditor) { /* Clear destroyed editor from the table: */ const QModelIndex index = m_editors.key(pEditor); AssertReturnVoid(index.isValid()); m_editors.remove(index); }
void UIMediumEnumerator::enumerateMediums() { /* Make sure we are not already in progress: */ AssertReturnVoid(!m_fMediumEnumerationInProgress); /* Compose new map of all currently known mediums & their children. * While composing we are using data from already existing mediums. */ UIMediumMap mediums; addNullMediumToMap(mediums); addHardDisksToMap(vboxGlobal().virtualBox().GetHardDisks(), mediums); addMediumsToMap(vboxGlobal().host().GetDVDDrives(), mediums, UIMediumType_DVD); addMediumsToMap(vboxGlobal().virtualBox().GetDVDImages(), mediums, UIMediumType_DVD); addMediumsToMap(vboxGlobal().host().GetFloppyDrives(), mediums, UIMediumType_Floppy); addMediumsToMap(vboxGlobal().virtualBox().GetFloppyImages(), mediums, UIMediumType_Floppy); if (vboxGlobal().isCleaningUp()) return; /* VBoxGlobal is cleaning up, abort immediately. */ m_mediums = mediums; /* Notify listener: */ LogRel(("GUI: UIMediumEnumerator: Medium-enumeration started...\n")); m_fMediumEnumerationInProgress = true; emit sigMediumEnumerationStarted(); /* Start enumeration for UIMedium(s) with correct ID: */ foreach (const QString &strMediumID, m_mediums.keys()) if (!strMediumID.isNull() && strMediumID != UIMedium::nullID()) createMediumEnumerationTask(m_mediums[strMediumID]); }
/** * Stop this service. */ void org_virtualbox_VBoxVFS::stop(IOService *pProvider) { int rc; AssertReturnVoid(ASMAtomicReadBool(&g_fInstantiated)); rc = VBoxVFSUnRegisterFilesystem(); if (RT_FAILURE(rc)) { PERROR("VBoxVFS filesystem is busy. Make sure all " "shares are unmounted (%d)", rc); } vboxDisconnect(&g_vboxSFClient); PINFO("VBox client disconnected"); vboxUninit(); PINFO("Low level uninit done"); coreService->release(); PINFO("VBoxGuest service released"); IOService::stop(pProvider); ASMAtomicWriteBool(&g_fInstantiated, false); PINFO("Successfully stopped I/O kit class instance"); }
/** @interface_method_impl{PDMAPICHLPR0,pfnClearInterruptFF} */ static DECLCALLBACK(void) pdmR0ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu) { PDMDEV_ASSERT_DEVINS(pDevIns); PVM pVM = pDevIns->Internal.s.pVMR0; PVMCPU pVCpu = &pVM->aCpus[idCpu]; AssertReturnVoid(idCpu < pVM->cCpus); LogFlow(("pdmR0ApicHlp_ClearInterruptFF: caller=%p/%d: VM_FF_INTERRUPT %d -> 0\n", pDevIns, pDevIns->iInstance, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC))); /* Note: NMI/SMI can't be cleared. */ switch (enmType) { case PDMAPICIRQ_HARDWARE: VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); break; case PDMAPICIRQ_EXTINT: VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); break; default: AssertMsgFailed(("enmType=%d\n", enmType)); break; } }
/** * A device was added, we need to adjust mUdevPolls. * * See USBProxyService::deviceAdded for details. */ void USBProxyBackendLinux::deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines, PUSBDEVICE aUSBDevice) { AssertReturnVoid(aDevice); AssertReturnVoid(!aDevice->isWriteLockOnCurrentThread()); AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS); if (aUSBDevice->enmState == USBDEVICESTATE_USED_BY_HOST) { LogRel(("USBProxy: Device %04x:%04x (%s) isn't accessible. giving udev a few seconds to fix this...\n", aUSBDevice->idVendor, aUSBDevice->idProduct, aUSBDevice->pszAddress)); mUdevPolls = 10; /* (10 * 500ms = 5s) */ } devLock.release(); USBProxyBackend::deviceAdded(aDevice, llOpenedMachines, aUSBDevice); }
DECLHIDDEN(void) rtR0PowerNotificationTerm(void) { PRTPOWERNOTIFYREG pHead; RTSPINLOCK hSpinlock = g_hRTPowerNotifySpinLock; AssertReturnVoid(hSpinlock != NIL_RTSPINLOCK); /** @todo OS specific term here */ /* pick up the list and the spinlock. */ RTSpinlockAcquire(hSpinlock); ASMAtomicWriteHandle(&g_hRTPowerNotifySpinLock, NIL_RTSPINLOCK); pHead = g_pRTPowerCallbackHead; g_pRTPowerCallbackHead = NULL; ASMAtomicIncU32(&g_iRTPowerGeneration); RTSpinlockRelease(hSpinlock); /* free the list. */ while (pHead) { PRTPOWERNOTIFYREG pFree = pHead; pHead = pHead->pNext; pFree->pNext = NULL; pFree->pfnCallback = NULL; RTMemFree(pFree); } RTSpinlockDestroy(hSpinlock); }
/** @interface_method_impl{PDMAPICHLPR3,pfnClearInterruptFF} */ static DECLCALLBACK(void) pdmR3ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu) { PDMDEV_ASSERT_DEVINS(pDevIns); PVM pVM = pDevIns->Internal.s.pVMR3; PVMCPU pVCpu = &pVM->aCpus[idCpu]; AssertReturnVoid(idCpu < pVM->cCpus); LogFlow(("pdmR3ApicHlp_ClearInterruptFF: caller='%s'/%d: VMCPU_FF_INTERRUPT_APIC(%d) %d -> 0\n", pDevIns->pReg->szName, pDevIns->iInstance, idCpu, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC))); /* Note: NMI/SMI can't be cleared. */ switch (enmType) { case PDMAPICIRQ_UPDATE_PENDING: VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu); VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_UPDATE_APIC); break; case PDMAPICIRQ_HARDWARE: VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_APIC); break; case PDMAPICIRQ_EXTINT: VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_PIC); break; default: AssertMsgFailed(("enmType=%d\n", enmType)); break; } #ifdef VBOX_WITH_REM REMR3NotifyInterruptClear(pVM, pVCpu); #endif }
DECLHIDDEN(void) rtR0MpNotificationTerm(void) { PRTMPNOTIFYREG pHead; RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; RTSPINLOCK hSpinlock = g_hRTMpNotifySpinLock; AssertReturnVoid(hSpinlock != NIL_RTSPINLOCK); rtR0MpNotificationNativeTerm(); /* pick up the list and the spinlock. */ RTSpinlockAcquire(hSpinlock, &Tmp); ASMAtomicWriteHandle(&g_hRTMpNotifySpinLock, NIL_RTSPINLOCK); pHead = g_pRTMpCallbackHead; g_pRTMpCallbackHead = NULL; ASMAtomicIncU32(&g_iRTMpGeneration); RTSpinlockRelease(hSpinlock, &Tmp); /* free the list. */ while (pHead) { PRTMPNOTIFYREG pFree = pHead; pHead = pHead->pNext; pFree->pNext = NULL; pFree->pfnCallback = NULL; RTMemFree(pFree); } RTSpinlockDestroy(hSpinlock); }
/** @interface_method_impl{PDMAPICHLPR3,pfnSetInterruptFF} */ static DECLCALLBACK(void) pdmR3ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu) { PDMDEV_ASSERT_DEVINS(pDevIns); PVM pVM = pDevIns->Internal.s.pVMR3; PVMCPU pVCpu = &pVM->aCpus[idCpu]; AssertReturnVoid(idCpu < pVM->cCpus); LogFlow(("pdmR3ApicHlp_SetInterruptFF: caller='%s'/%d: VMCPU_FF_INTERRUPT_APIC(%d) %d -> 1\n", pDevIns->pReg->szName, pDevIns->iInstance, idCpu, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC))); switch (enmType) { case PDMAPICIRQ_HARDWARE: VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC); break; case PDMAPICIRQ_NMI: VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_NMI); break; case PDMAPICIRQ_SMI: VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_SMI); break; case PDMAPICIRQ_EXTINT: VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); break; default: AssertMsgFailed(("enmType=%d\n", enmType)); break; } #ifdef VBOX_WITH_REM REMR3NotifyInterruptSet(pVM, pVCpu); #endif VMR3NotifyCpuFFU(pVCpu->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM | VMNOTIFYFF_FLAGS_POKE); }
/** @interface_method_impl{PDMAPICHLPR0,pfnSetInterruptFF} */ static DECLCALLBACK(void) pdmR0ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns, PDMAPICIRQ enmType, VMCPUID idCpu) { PDMDEV_ASSERT_DEVINS(pDevIns); PVM pVM = pDevIns->Internal.s.pVMR0; PVMCPU pVCpu = &pVM->aCpus[idCpu]; AssertReturnVoid(idCpu < pVM->cCpus); LogFlow(("pdmR0ApicHlp_SetInterruptFF: CPU%d=caller=%p/%d: VM_FF_INTERRUPT %d -> 1 (CPU%d)\n", VMMGetCpuId(pVM), pDevIns, pDevIns->iInstance, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC), idCpu)); switch (enmType) { case PDMAPICIRQ_UPDATE_PENDING: VMCPU_FF_SET(pVCpu, VMCPU_FF_UPDATE_APIC); break; case PDMAPICIRQ_HARDWARE: #ifdef VBOX_WITH_NEW_APIC VMCPU_ASSERT_EMT_OR_NOT_RUNNING(pVCpu); #endif VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_APIC); break; case PDMAPICIRQ_NMI: VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_NMI); break; case PDMAPICIRQ_SMI: VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_SMI); break; case PDMAPICIRQ_EXTINT: VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); break; default: AssertMsgFailed(("enmType=%d\n", enmType)); break; } /* We need to wake up the target CPU. */ if ( #ifdef VBOX_WITH_NEW_APIC /* We are already on EMT if enmType is PDMAPICIRQ_HARDWARE. Don't bother with poking! */ enmType != PDMAPICIRQ_HARDWARE && #endif VMMGetCpuId(pVM) != idCpu) { switch (VMCPU_GET_STATE(pVCpu)) { case VMCPUSTATE_STARTED_EXEC: GVMMR0SchedPokeEx(pVM, pVCpu->idCpu, false /* don't take the used lock */); break; case VMCPUSTATE_STARTED_HALTED: GVMMR0SchedWakeUpEx(pVM, pVCpu->idCpu, false /* don't take the used lock */); break; default: break; /* nothing to do in other states. */ } } }