本文整理汇总了C++中AssertRelease函数的典型用法代码示例。如果您正苦于以下问题:C++ AssertRelease函数的具体用法?C++ AssertRelease怎么用?C++ AssertRelease使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AssertRelease函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DECLHIDDEN
/**
* Allocates physical memory which satisfy the given constraints.
*
* @param uPhysHi The upper physical address limit (inclusive).
* @param puPhys Where to store the physical address of the allocated
* memory. Optional, can be NULL.
* @param cb Size of allocation.
* @param uAlignment Alignment.
* @param fContig Whether the memory must be physically contiguous or
* not.
*
* @returns Virtual address of allocated memory block or NULL if allocation
* failed.
*/
DECLHIDDEN(void *) rtR0SolMemAlloc(uint64_t uPhysHi, uint64_t *puPhys, size_t cb, uint64_t uAlignment, bool fContig)
{
if ((cb & PAGEOFFSET) != 0)
return NULL;
size_t cPages = (cb + PAGESIZE - 1) >> PAGESHIFT;
if (!cPages)
return NULL;
ddi_dma_attr_t DmaAttr = s_rtR0SolDmaAttr;
DmaAttr.dma_attr_addr_hi = uPhysHi;
DmaAttr.dma_attr_align = uAlignment;
if (!fContig)
DmaAttr.dma_attr_sgllen = cPages > INT_MAX ? INT_MAX - 1 : cPages;
else
AssertRelease(DmaAttr.dma_attr_sgllen == 1);
void *pvMem = contig_alloc(cb, &DmaAttr, PAGESIZE, 1 /* can sleep */);
if (!pvMem)
{
LogRel(("rtR0SolMemAlloc failed. cb=%u Align=%u fContig=%d\n", (unsigned)cb, (unsigned)uAlignment, fContig));
return NULL;
}
pfn_t PageFrameNum = hat_getpfnum(kas.a_hat, (caddr_t)pvMem);
AssertRelease(PageFrameNum != PFN_INVALID);
if (puPhys)
*puPhys = (uint64_t)PageFrameNum << PAGESHIFT;
return pvMem;
}
示例2: VMMDECL
/**
* Flushes the physical handler notifications if the queue is almost full.
*
* This is for avoiding trouble in RC when changing CR3.
*
* @param pVM Pointer to the VM.
* @param pVCpu Pointer to the VMCPU of the calling EMT.
*/
VMMDECL(void) REMNotifyHandlerPhysicalFlushIfAlmostFull(PVM pVM, PVMCPU pVCpu)
{
Assert(pVM->cCpus == 1); NOREF(pVCpu);
/*
* Less than 48 items means we should flush.
*/
uint32_t cFree = 0;
for (uint32_t idx = pVM->rem.s.idxFreeList;
idx != UINT32_MAX;
idx = pVM->rem.s.aHandlerNotifications[idx].idxNext)
{
Assert(idx < RT_ELEMENTS(pVM->rem.s.aHandlerNotifications));
if (++cFree >= 48)
return;
}
AssertRelease(VM_FF_IS_SET(pVM, VM_FF_REM_HANDLER_NOTIFY));
AssertRelease(pVM->rem.s.idxPendingList != UINT32_MAX);
/* Ok, we gotta flush them. */
VMMRZCallRing3NoCpu(pVM, VMMCALLRING3_REM_REPLAY_HANDLER_NOTIFICATIONS, 0);
AssertRelease(pVM->rem.s.idxPendingList == UINT32_MAX);
AssertRelease(pVM->rem.s.idxFreeList != UINT32_MAX);
}
示例3: vmmR3Switcher32On64IdtInit
/**
* Initializes the 64-bit IDT for 64-bit guest on 32-bit host switchers.
*
* This is only used as a debugging aid when we cannot find out why something
* goes haywire in the intermediate context.
*
* @param pVM The cross context VM structure.
* @param pSwitcher The switcher descriptor.
* @param pbDst Where the switcher code was just copied.
* @param HCPhysDst The host physical address corresponding to @a pbDst.
*/
static void vmmR3Switcher32On64IdtInit(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pbDst, RTHCPHYS HCPhysDst)
{
AssertRelease(pSwitcher->offGCCode > 0 && pSwitcher->offGCCode < pSwitcher->cbCode);
AssertRelease(pSwitcher->cbCode < _64K);
RTSEL uCs64 = SELMGetHyperCS64(pVM);
PX86DESC64GATE paIdt = (PX86DESC64GATE)(pbDst + pSwitcher->offGCCode);
for (uint32_t i = 0 ; i < 256; i++)
{
AssertRelease(((uint64_t *)&paIdt[i])[0] < pSwitcher->cbCode);
AssertRelease(((uint64_t *)&paIdt[i])[1] == 0);
uint64_t uHandler = HCPhysDst + paIdt[i].u16OffsetLow;
paIdt[i].u16OffsetLow = (uint16_t)uHandler;
paIdt[i].u16Sel = uCs64;
paIdt[i].u3IST = 0;
paIdt[i].u5Reserved = 0;
paIdt[i].u4Type = AMD64_SEL_TYPE_SYS_INT_GATE;
paIdt[i].u1DescType = 0 /* system */;
paIdt[i].u2Dpl = 3;
paIdt[i].u1Present = 1;
paIdt[i].u16OffsetHigh = (uint16_t)(uHandler >> 16);
paIdt[i].u32Reserved = (uint32_t)(uHandler >> 32);
}
for (VMCPUID iCpu = 0; iCpu < pVM->cCpus; iCpu++)
{
uint64_t uIdtr = HCPhysDst + pSwitcher->offGCCode; AssertRelease(uIdtr < UINT32_MAX);
CPUMSetHyperIDTR(&pVM->aCpus[iCpu], uIdtr, 16*256 + iCpu);
}
}
示例4: dbgfR3TraceEnable
/**
* Initializes the tracing.
*
* @returns VBox status code
* @param pVM The cross context VM structure.
* @param cbEntry The trace entry size.
* @param cEntries The number of entries.
*/
static int dbgfR3TraceEnable(PVM pVM, uint32_t cbEntry, uint32_t cEntries)
{
/*
* Don't enable it twice.
*/
if (pVM->hTraceBufR3 != NIL_RTTRACEBUF)
return VERR_ALREADY_EXISTS;
/*
* Resolve default parameter values.
*/
int rc;
if (!cbEntry)
{
rc = CFGMR3QueryU32Def(CFGMR3GetChild(CFGMR3GetRoot(pVM), "DBGF"), "TraceBufEntrySize", &cbEntry, 128);
AssertRCReturn(rc, rc);
}
if (!cEntries)
{
rc = CFGMR3QueryU32Def(CFGMR3GetChild(CFGMR3GetRoot(pVM), "DBGF"), "TraceBufEntries", &cEntries, 4096);
AssertRCReturn(rc, rc);
}
/*
* Figure the required size.
*/
RTTRACEBUF hTraceBuf;
size_t cbBlock = 0;
rc = RTTraceBufCarve(&hTraceBuf, cEntries, cbEntry, 0 /*fFlags*/, NULL, &cbBlock);
if (rc != VERR_BUFFER_OVERFLOW)
{
AssertReturn(!RT_SUCCESS_NP(rc), VERR_IPE_UNEXPECTED_INFO_STATUS);
return rc;
}
/*
* Allocate a hyper heap block and carve a trace buffer out of it.
*
* Note! We ASSUME that the returned trace buffer handle has the same value
* as the heap block.
*/
cbBlock = RT_ALIGN_Z(cbBlock, PAGE_SIZE);
void *pvBlock;
rc = MMR3HyperAllocOnceNoRel(pVM, cbBlock, PAGE_SIZE, MM_TAG_DBGF, &pvBlock);
if (RT_FAILURE(rc))
return rc;
rc = RTTraceBufCarve(&hTraceBuf, cEntries, cbEntry, 0 /*fFlags*/, pvBlock, &cbBlock);
AssertRCReturn(rc, rc);
AssertRelease(hTraceBuf == (RTTRACEBUF)pvBlock);
AssertRelease((void *)hTraceBuf == pvBlock);
pVM->hTraceBufR3 = hTraceBuf;
pVM->hTraceBufR0 = MMHyperCCToR0(pVM, hTraceBuf);
pVM->hTraceBufRC = MMHyperCCToRC(pVM, hTraceBuf);
return VINF_SUCCESS;
}
示例5: VMMR3DECL
/**
* Gets the HC pointer to the dummy page.
*
* The dummy page is used as a place holder to prevent potential bugs
* from doing really bad things to the system.
*
* @returns Pointer to the dummy page.
* @param pVM The cross context VM structure.
* @thread The Emulation Thread.
*/
VMMR3DECL(void *) MMR3PageDummyHCPtr(PVM pVM)
{
VM_ASSERT_EMT(pVM);
if (!pVM->mm.s.pvDummyPage)
{
pVM->mm.s.pvDummyPage = mmR3PagePoolAlloc(pVM->mm.s.pPagePoolR3);
AssertRelease(pVM->mm.s.pvDummyPage);
pVM->mm.s.HCPhysDummyPage = mmPagePoolPtr2Phys(pVM->mm.s.pPagePoolR3, pVM->mm.s.pvDummyPage);
AssertRelease(!(pVM->mm.s.HCPhysDummyPage & ~X86_PTE_PAE_PG_MASK));
}
return pVM->mm.s.pvDummyPage;
}
示例6: DECLEXPORT
DECLEXPORT(EGLSurface) eglCreatePixmapSurface(EGLDisplay hDisplay, EGLConfig config, EGLNativePixmapType hPixmap,
const EGLint *paAttributes)
{
Display *pDisplay = (Display *)hDisplay;
GLXPixmap hGLXPixmap;
if (!VALID_PTR(hDisplay))
{
setEGLError(EGL_NOT_INITIALIZED);
return EGL_NO_SURFACE;
}
if (paAttributes != NULL) /* Sanity test only. */
if (*paAttributes != EGL_NONE)
{
if (*paAttributes == EGL_VG_COLORSPACE || *paAttributes == EGL_VG_ALPHA_FORMAT)
{
setEGLError(EGL_BAD_MATCH);
return EGL_NO_SURFACE;
}
else
{
setEGLError(EGL_BAD_ATTRIBUTE);
return EGL_NO_SURFACE;
}
}
hGLXPixmap = glXCreatePixmap(pDisplay, (GLXFBConfig)config, (Pixmap)hPixmap, NULL);
if (hGLXPixmap == None)
{
setEGLError(EGL_BAD_MATCH);
return EGL_NO_SURFACE;
}
AssertRelease(hGLXPixmap < VBEGL_WINDOW_SURFACE); /* Greater than the maximum XID. */
clearEGLError();
return (EGLSurface)(hGLXPixmap | VBEGL_PIXMAP_SURFACE);
}
示例7: AssertReturn
RTCString &RTCString::appendCodePoint(RTUNICP uc)
{
/*
* Single byte encoding.
*/
if (uc < 0x80)
return RTCString::append((char)uc);
/*
* Multibyte encoding.
* Assume max encoding length when resizing the string, that's simpler.
*/
AssertReturn(uc <= UINT32_C(0x7fffffff), *this);
if (m_cch + 6 >= m_cbAllocated)
{
reserve(RT_ALIGN_Z(m_cch + 6 + 1, IPRT_MINISTRING_APPEND_ALIGNMENT));
// calls realloc(cbBoth) and sets m_cbAllocated; may throw bad_alloc.
#ifndef RT_EXCEPTIONS_ENABLED
AssertRelease(capacity() > m_cch + 6);
#endif
}
char *pszNext = RTStrPutCp(&m_psz[m_cch], uc);
m_cch = pszNext - m_psz;
*pszNext = '\0';
return *this;
}
示例8: hgcmObjDeleteHandle
void hgcmObjDeleteHandle (uint32_t handle)
{
int rc = VINF_SUCCESS;
LogFlow(("MAIN::hgcmObjDeleteHandle: handle 0x%08X\n", handle));
if (handle)
{
rc = hgcmObjEnter ();
if (RT_SUCCESS(rc))
{
ObjectAVLCore *pCore = (ObjectAVLCore *)RTAvlULRemove (&g_pTree, handle);
if (pCore)
{
AssertRelease(pCore->pSelf);
pCore->pSelf->Dereference ();
}
hgcmObjLeave ();
}
else
{
AssertReleaseMsgFailed (("Failed to acquire object pool semaphore, rc = %Rrc", rc));
}
}
LogFlow(("MAIN::hgcmObjDeleteHandle: rc = %Rrc, return void\n", rc));
return;
}
示例9: DECLINLINE
/**
* Insert a block from the tree.
*/
DECLINLINE(void) rtmemBlockInsert(PRTMEMBLOCK pBlock, void *pv)
{
pBlock->Core.Key = pv;
rtmemBlockLock();
bool fRc = RTAvlPVInsert(&g_BlocksTree, &pBlock->Core);
rtmemBlockUnlock();
AssertRelease(fRc);
}
示例10: vmmR3Switcher32On64IdtRelocate
/**
* Relocates the 64-bit IDT for 64-bit guest on 32-bit host switchers.
*
* @param pVM The cross context VM structure.
* @param pSwitcher The switcher descriptor.
* @param pbDst Where the switcher code was just copied.
* @param HCPhysDst The host physical address corresponding to @a pbDst.
*/
static void vmmR3Switcher32On64IdtRelocate(PVM pVM, PVMMSWITCHERDEF pSwitcher, uint8_t *pbDst, RTHCPHYS HCPhysDst)
{
AssertRelease(pSwitcher->offGCCode > 0 && pSwitcher->offGCCode < pSwitcher->cbCode && pSwitcher->cbCode < _64K);
/* The intermediate context doesn't move, but the CS may. */
RTSEL uCs64 = SELMGetHyperCS64(pVM);
PX86DESC64GATE paIdt = (PX86DESC64GATE)(pbDst + pSwitcher->offGCCode);
for (uint32_t i = 0 ; i < 256; i++)
paIdt[i].u16Sel = uCs64;
/* Just in case... */
for (VMCPUID iCpu = 0; iCpu < pVM->cCpus; iCpu++)
{
uint64_t uIdtr = HCPhysDst + pSwitcher->offGCCode; AssertRelease(uIdtr < UINT32_MAX);
CPUMSetHyperIDTR(&pVM->aCpus[iCpu], uIdtr, 16*256 + iCpu);
}
}
示例11: crVBoxHGSMIInit
bool crVBoxHGSMIInit(CRNetReceiveFuncList *rfl, CRNetCloseFuncList *cfl, unsigned int mtu)
{
/* static */ int bHasHGSMI = -1; /* do it for all connections */
(void) mtu;
if (bHasHGSMI < 0)
{
int rc;
VBOXCRHGSMI_CALLBACKS Callbacks;
Callbacks.pfnClientCreate = _crVBoxHGSMIClientCreate;
Callbacks.pfnClientDestroy = _crVBoxHGSMIClientDestroy;
rc = VBoxCrHgsmiInit(&Callbacks);
AssertRC(rc);
if (RT_SUCCESS(rc))
bHasHGSMI = 1;
else
bHasHGSMI = 0;
}
Assert(bHasHGSMI);
if (!bHasHGSMI)
{
#ifdef DEBUG_misha
AssertRelease(0);
#endif
return false;
}
g_crvboxhgsmi.recv_list = rfl;
g_crvboxhgsmi.close_list = cfl;
if (g_crvboxhgsmi.initialized)
{
return true;
}
g_crvboxhgsmi.initialized = 1;
g_crvboxhgsmi.num_conns = 0;
g_crvboxhgsmi.conns = NULL;
g_crvboxhgsmi.mempool = crBufferPoolInit(16);
/* Can't open VBox guest driver here, because it gets called for host side as well */
/*@todo as we have 2 dll versions, can do it now.*/
#ifdef RT_OS_WINDOWS
g_crvboxhgsmi.hGuestDrv = INVALID_HANDLE_VALUE;
#else
g_crvboxhgsmi.iGuestDrv = INVALID_HANDLE_VALUE;
#endif
#ifdef CHROMIUM_THREADSAFE
crInitMutex(&g_crvboxhgsmi.mutex);
crInitMutex(&g_crvboxhgsmi.recvmutex);
#endif
return true;
}
示例12: RTDECL
RTDECL(void) RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock)
{
#if 1
if (RT_UNLIKELY(!(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)))
RTAssertMsg2("RTSpinlockReleaseNoInts: %p (magic=%#x)\n", Spinlock, Spinlock->u32Magic);
#else
AssertRelease(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE);
#endif
RTSpinlockRelease(Spinlock);
}
示例13: fillTestShflString
static void fillTestShflString(struct TESTSHFLSTRING *pDest,
const char *pcszSource)
{
AssertRelease( strlen(pcszSource) * 2 + 2
< sizeof(*pDest) - RT_UOFFSETOF(SHFLSTRING, String));
pDest->string.u16Length = (uint16_t)(strlen(pcszSource) * sizeof(RTUTF16));
pDest->string.u16Size = pDest->string.u16Length + sizeof(RTUTF16);
for (unsigned i = 0; i <= pDest->string.u16Length; ++i)
pDest->string.String.ucs2[i] = (uint16_t)pcszSource[i];
}
示例14: hgcmObjDereference
void hgcmObjDereference (HGCMObject *pObject)
{
LogFlow(("MAIN::hgcmObjDereference: pObject %p\n", pObject));
AssertRelease(pObject);
pObject->Dereference ();
LogFlow(("MAIN::hgcmObjDereference: return\n"));
}
示例15: DECLCALLBACK
/** @interface_method_impl{PDMPCIRAWHLPR3,pfnGetR0Helpers} */
static DECLCALLBACK(PCPDMPCIRAWHLPR0) pdmR3PciRawHlp_GetR0Helpers(PPDMDEVINS pDevIns)
{
PDMDEV_ASSERT_DEVINS(pDevIns);
VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
PCPDMHPETHLPR0 pR0Helpers = NIL_RTR0PTR;
int rc = PDMR3LdrGetSymbolR0(pDevIns->Internal.s.pVMR3, NULL, "g_pdmR0PciRawHlp", &pR0Helpers);
AssertReleaseRC(rc);
AssertRelease(pR0Helpers);
LogFlow(("pdmR3PciRawHlp_GetR0Helpers: caller='%s'/%d: returns %RHv\n",
pDevIns->pReg->szName, pDevIns->iInstance, pR0Helpers));
return pR0Helpers;
}