diff options
Diffstat (limited to 'src/VBox/Runtime/r0drv')
143 files changed, 1153 insertions, 771 deletions
diff --git a/src/VBox/Runtime/r0drv/alloc-r0drv.cpp b/src/VBox/Runtime/r0drv/alloc-r0drv.cpp index 17b9e8bcf..fe626d1fa 100644 --- a/src/VBox/Runtime/r0drv/alloc-r0drv.cpp +++ b/src/VBox/Runtime/r0drv/alloc-r0drv.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv.cpp $ */ +/* $Id: alloc-r0drv.cpp 37672 2011-06-28 19:48:17Z vboxsync $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver. */ @@ -179,43 +179,64 @@ RT_EXPORT_SYMBOL(RTMemAllocZVarTag); RTDECL(void *) RTMemReallocTag(void *pvOld, size_t cbNew, const char *pszTag) RT_NO_THROW { - if (!cbNew) + PRTMEMHDR pHdrOld; + + /* Free. */ + if (!cbNew && pvOld) + { RTMemFree(pvOld); - else if (!pvOld) + return NULL; + } + + /* Alloc. */ + if (!pvOld) return RTMemAllocTag(cbNew, pszTag); - else + + /* + * Realloc. + */ + pHdrOld = (PRTMEMHDR)pvOld - 1; + RT_ASSERT_PREEMPTIBLE(); + + if (pHdrOld->u32Magic == RTMEMHDR_MAGIC) { - PRTMEMHDR pHdrOld = (PRTMEMHDR)pvOld - 1; - RT_ASSERT_PREEMPTIBLE(); + PRTMEMHDR pHdrNew; + + /* If there is sufficient space in the old block and we don't cause + substantial internal fragmentation, reuse the old block. */ + if ( pHdrOld->cb >= cbNew + RTR0MEM_FENCE_EXTRA + && pHdrOld->cb - (cbNew + RTR0MEM_FENCE_EXTRA) <= 128) + { + pHdrOld->cbReq = (uint32_t)cbNew; Assert(pHdrOld->cbReq == cbNew); +#ifdef RTR0MEM_STRICT + memcpy((uint8_t *)(pHdrOld + 1) + cbNew, &g_abFence[0], RTR0MEM_FENCE_EXTRA); +#endif + return pvOld; + } - if (pHdrOld->u32Magic == RTMEMHDR_MAGIC) + /* Allocate a new block and copy over the content. */ + pHdrNew = rtR0MemAlloc(cbNew + RTR0MEM_FENCE_EXTRA, 0); + if (pHdrNew) { - PRTMEMHDR pHdrNew; - if (pHdrOld->cb >= cbNew && pHdrOld->cb - cbNew <= 128) - return pvOld; - pHdrNew = rtR0MemAlloc(cbNew + RTR0MEM_FENCE_EXTRA, 0); - if (pHdrNew) - { - size_t cbCopy = RT_MIN(pHdrOld->cb, pHdrNew->cb); - memcpy(pHdrNew + 1, pvOld, cbCopy); + size_t cbCopy = RT_MIN(pHdrOld->cb, pHdrNew->cb); + memcpy(pHdrNew + 1, pvOld, cbCopy); #ifdef RTR0MEM_STRICT - pHdrNew->cbReq = (uint32_t)cbNew; Assert(pHdrNew->cbReq == cbNew); - memcpy((uint8_t *)(pHdrNew + 1) + cbNew, &g_abFence[0], RTR0MEM_FENCE_EXTRA); - AssertReleaseMsg(!memcmp((uint8_t *)(pHdrOld + 1) + pHdrOld->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA), - ("pHdr=%p pvOld=%p cb=%zu cbNew=%zu\n" - "fence: %.*Rhxs\n" - "expected: %.*Rhxs\n", - pHdrOld, pvOld, pHdrOld->cb, cbNew, - RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdrOld + 1) + pHdrOld->cb, - RTR0MEM_FENCE_EXTRA, &g_abFence[0])); + pHdrNew->cbReq = (uint32_t)cbNew; Assert(pHdrNew->cbReq == cbNew); + memcpy((uint8_t *)(pHdrNew + 1) + cbNew, &g_abFence[0], RTR0MEM_FENCE_EXTRA); + AssertReleaseMsg(!memcmp((uint8_t *)(pHdrOld + 1) + pHdrOld->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA), + ("pHdr=%p pvOld=%p cbReq=%u cb=%u cbNew=%zu fFlags=%#x\n" + "fence: %.*Rhxs\n" + "expected: %.*Rhxs\n", + pHdrOld, pvOld, pHdrOld->cbReq, pHdrOld->cb, cbNew, pHdrOld->fFlags, + RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdrOld + 1) + pHdrOld->cbReq, + RTR0MEM_FENCE_EXTRA, &g_abFence[0])); #endif - rtR0MemFree(pHdrOld); - return pHdrNew + 1; - } + rtR0MemFree(pHdrOld); + return pHdrNew + 1; } - else - AssertMsgFailed(("pHdrOld->u32Magic=%RX32 pvOld=%p cbNew=%#zx\n", pHdrOld->u32Magic, pvOld, cbNew)); } + else + AssertMsgFailed(("pHdrOld->u32Magic=%RX32 pvOld=%p cbNew=%#zx\n", pHdrOld->u32Magic, pvOld, cbNew)); return NULL; } @@ -236,11 +257,11 @@ RTDECL(void) RTMemFree(void *pv) RT_NO_THROW Assert(!(pHdr->fFlags & RTMEMHDR_FLAG_EXEC)); #ifdef RTR0MEM_STRICT AssertReleaseMsg(!memcmp((uint8_t *)(pHdr + 1) + pHdr->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA), - ("pHdr=%p pv=%p cb=%zu\n" + ("pHdr=%p pv=%p cbReq=%u cb=%u fFlags=%#x\n" "fence: %.*Rhxs\n" "expected: %.*Rhxs\n", - pHdr, pv, pHdr->cb, - RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cb, + pHdr, pv, pHdr->cbReq, pHdr->cb, pHdr->fFlags, + RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cbReq, RTR0MEM_FENCE_EXTRA, &g_abFence[0])); #endif rtR0MemFree(pHdr); @@ -291,11 +312,11 @@ RTDECL(void) RTMemExecFree(void *pv, size_t cb) RT_NO_THROW Assert(!(pHdr->fFlags & RTMEMHDR_FLAG_ALLOC_EX)); #ifdef RTR0MEM_STRICT AssertReleaseMsg(!memcmp((uint8_t *)(pHdr + 1) + pHdr->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA), - ("pHdr=%p pv=%p cb=%zu\n" + ("pHdr=%p pv=%p cbReq=%u cb=%u fFlags=%#x\n" "fence: %.*Rhxs\n" "expected: %.*Rhxs\n", - pHdr, pv, pHdr->cb, - RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cb, + pHdr, pv, pHdr->cbReq, pHdr->cb, pHdr->fFlags, + RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cbReq, RTR0MEM_FENCE_EXTRA, &g_abFence[0])); #endif rtR0MemFree(pHdr); @@ -392,11 +413,11 @@ RTDECL(void) RTMemFreeEx(void *pv, size_t cb) RT_NO_THROW #ifdef RTR0MEM_STRICT AssertReleaseMsg(!memcmp((uint8_t *)(pHdr + 1) + pHdr->cbReq, &g_abFence[0], RTR0MEM_FENCE_EXTRA), - ("pHdr=%p pv=%p cb=%zu\n" + ("pHdr=%p pv=%p cbReq=%u cb=%u fFlags=%#x\n" "fence: %.*Rhxs\n" "expected: %.*Rhxs\n", - pHdr, pv, pHdr->cb, - RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cb, + pHdr, pv, pHdr->cbReq, pHdr->cb, pHdr->fFlags, + RTR0MEM_FENCE_EXTRA, (uint8_t *)(pHdr + 1) + pHdr->cbReq, RTR0MEM_FENCE_EXTRA, &g_abFence[0])); #endif rtR0MemFree(pHdr); diff --git a/src/VBox/Runtime/r0drv/alloc-r0drv.h b/src/VBox/Runtime/r0drv/alloc-r0drv.h index 3843e1cc9..024c64320 100644 --- a/src/VBox/Runtime/r0drv/alloc-r0drv.h +++ b/src/VBox/Runtime/r0drv/alloc-r0drv.h @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv.h $ */ +/* $Id: alloc-r0drv.h 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver. */ @@ -86,13 +86,13 @@ typedef struct RTMEMHDR * the backend might be using. * @param ppHdr Where to return the memory header on success. */ -int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr); +DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr); /** * Free memory allocated by rtR0MemAllocEx. * @param pHdr The memory block to free. (Never NULL.) */ -void rtR0MemFree(PRTMEMHDR pHdr); +DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr); RT_C_DECLS_END #endif diff --git a/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp index 9a65df825..ef63e351f 100644 --- a/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteDebugger-r0drv-darwin.cpp $ */ +/* $Id: RTLogWriteDebugger-r0drv-darwin.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Log To Debugger, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp index 57da5a760..0946d3b4c 100644 --- a/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/RTLogWriteStdOut-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteStdOut-r0drv-darwin.cpp $ */ +/* $Id: RTLogWriteStdOut-r0drv-darwin.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Log To StdOut, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp index 21c003279..be2d63145 100644 --- a/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/alloc-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-darwin.cpp $ */ +/* $Id: alloc-r0drv-darwin.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, Darwin. */ @@ -41,7 +41,7 @@ /** * OS specific allocation function. */ -int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) +DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) { if (RT_UNLIKELY(fFlags & RTMEMHDR_FLAG_ANY_CTX)) return VERR_NOT_SUPPORTED; @@ -65,7 +65,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) /** * OS specific free function. */ -void rtR0MemFree(PRTMEMHDR pHdr) +DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr) { pHdr->u32Magic += 1; IOFree(pHdr, pHdr->cb + sizeof(*pHdr)); diff --git a/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp index 14a40addf..3c9e8c0c5 100644 --- a/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/assert-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-darwin.cpp $ */ +/* $Id: assert-r0drv-darwin.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, Darwin. */ @@ -40,7 +40,7 @@ #include "internal/assert.h" -void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) +DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) { printf("\r\n!!Assertion Failed!!\r\n" "Expression: %s\r\n" @@ -49,7 +49,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi } -void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) +DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) { char szMsg[256]; diff --git a/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp index 253adaf35..d3ba0123f 100644 --- a/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/initterm-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-darwin.cpp $ */ +/* $Id: initterm-r0drv-darwin.cpp 37575 2011-06-21 12:40:01Z vboxsync $ */ /** @file * IPRT - Initialization & Termination, R0 Driver, Darwin. */ @@ -49,7 +49,7 @@ PFNR0DARWINASTPENDING g_pfnR0DarwinAstPending = NULL; PFNR0DARWINCPUINTERRUPT g_pfnR0DarwinCpuInterrupt = NULL; -int rtR0InitNative(void) +DECLHIDDEN(int) rtR0InitNative(void) { /* * Create the lock group. @@ -89,7 +89,7 @@ int rtR0InitNative(void) } -void rtR0TermNative(void) +DECLHIDDEN(void) rtR0TermNative(void) { /* * Preemption hacks before the lock group. diff --git a/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp index e69746daf..bbf3712d4 100644 --- a/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: mach_kernel-r0drv-darwin.cpp $ */ +/* $Id: mach_kernel-r0drv-darwin.cpp 37597 2011-06-22 20:54:05Z vboxsync $ */ /** @file * IPRT - mach_kernel symbol resolving hack, R0 Driver, Darwin. */ @@ -25,7 +25,6 @@ */ -#define RTMEM_WRAP_TO_EF_APIS /******************************************************************************* * Header Files * *******************************************************************************/ @@ -50,16 +49,6 @@ RT_C_DECLS_END #include "internal/iprt.h" #include <iprt/darwin/machkernel.h> -#ifdef IN_RING0 /* till RTFILE is changed in types.h */ -# include <iprt/types.h> -typedef struct RTFILENEWINT *RTFILENEW; -typedef RTFILENEW *PRTFILENEW; -# undef NIL_RTFILE -# define RTFILE RTFILENEW -# define PRTFILE PRTFILENEW -# define NIL_RTFILE ((RTFILENEW)-1) -#endif - #include <iprt/asm.h> #include <iprt/assert.h> #include <iprt/err.h> @@ -196,7 +185,7 @@ static bool g_fBreakpointOnError = false; /** * Darwin kernel file handle data. */ -typedef struct RTFILENEWINT +typedef struct RTFILEINT { /** Magic value (RTFILE_MAGIC). */ uint32_t u32Magic; @@ -208,14 +197,14 @@ typedef struct RTFILENEWINT vfs_context_t hVfsCtx; /** The vnode returned by vnode_open. */ vnode_t hVnode; -} RTFILENEWINT; -/** Magic number for RTFILENEWINT::u32Magic (To Be Determined). */ +} RTFILEINT; +/** Magic number for RTFILEINT::u32Magic (To Be Determined). */ #define RTFILE_MAGIC UINT32_C(0x01020304) -RTDECL(int) RTFileOpen(PRTFILE phFile, const char *pszFilename, uint32_t fOpen) +RTDECL(int) RTFileOpen(PRTFILE phFile, const char *pszFilename, uint64_t fOpen) { - RTFILENEWINT *pThis = (RTFILENEWINT *)RTMemAllocZ(sizeof(*pThis)); + RTFILEINT *pThis = (RTFILEINT *)RTMemAllocZ(sizeof(*pThis)); if (!pThis) return VERR_NO_MEMORY; @@ -285,7 +274,7 @@ RTDECL(int) RTFileClose(RTFILE hFile) if (hFile == NIL_RTFILE) return VINF_SUCCESS; - RTFILENEWINT *pThis = hFile; + RTFILEINT *pThis = hFile; AssertPtrReturn(pThis, VERR_INVALID_HANDLE); AssertReturn(pThis->u32Magic == RTFILE_MAGIC, VERR_INVALID_HANDLE); pThis->u32Magic = ~RTFILE_MAGIC; @@ -299,7 +288,7 @@ RTDECL(int) RTFileClose(RTFILE hFile) RTDECL(int) RTFileReadAt(RTFILE hFile, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead) { - RTFILENEWINT *pThis = hFile; + RTFILEINT *pThis = hFile; AssertPtrReturn(pThis, VERR_INVALID_HANDLE); AssertReturn(pThis->u32Magic == RTFILE_MAGIC, VERR_INVALID_HANDLE); diff --git a/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp index 7d7e27f7e..9fad7d833 100644 --- a/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-darwin.cpp $ */ +/* $Id: memobj-r0drv-darwin.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Ring-0 Memory Objects, Darwin. */ @@ -225,7 +225,7 @@ static void rtR0MemObjDarwinReadPhys(RTHCPHYS HCPhys, size_t cb, void *pvDst) * @returns the PTE. * @param pvPage The virtual address to get the PTE for. */ -uint64_t rtR0MemObjDarwinGetPTE(void *pvPage) +static uint64_t rtR0MemObjDarwinGetPTE(void *pvPage) { RTUINT64U u64; RTCCUINTREG cr3 = ASMGetCR3(); @@ -323,7 +323,7 @@ uint64_t rtR0MemObjDarwinGetPTE(void *pvPage) #endif /* RT_STRICT */ -int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) +DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) { PRTR0MEMOBJDARWIN pMemDarwin = (PRTR0MEMOBJDARWIN)pMem; @@ -523,14 +523,14 @@ static int rtR0MemObjNativeAllocWorker(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, } -int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { return rtR0MemObjNativeAllocWorker(ppMem, cb, fExecutable, false /* fContiguous */, 0 /* PhysMask */, UINT64_MAX, RTR0MEMOBJTYPE_PAGE); } -int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { /* * Try IOMallocPhysical/IOMallocAligned first. @@ -548,7 +548,7 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut } -int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { int rc = rtR0MemObjNativeAllocWorker(ppMem, cb, fExecutable, true /* fContiguous */, ~(uint32_t)PAGE_OFFSET_MASK, _4G - PAGE_SIZE, @@ -566,7 +566,7 @@ int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu } -int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) { /** @todo alignment */ if (uAlignment != PAGE_SIZE) @@ -595,7 +595,7 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph } -int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) { /** @todo rtR0MemObjNativeAllocPhys / darwin. * This might be a bit problematic and may very well require having to create our own @@ -606,7 +606,7 @@ int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS } -int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) +DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) { AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED); @@ -737,32 +737,32 @@ static int rtR0MemObjNativeLock(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, } -int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) { return rtR0MemObjNativeLock(ppMem, (void *)R3Ptr, cb, fAccess, (task_t)R0Process); } -int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) +DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) { return rtR0MemObjNativeLock(ppMem, pv, cb, fAccess, kernel_task); } -int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) +DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) { return VERR_NOT_SUPPORTED; } -int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) { return VERR_NOT_SUPPORTED; } -int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, - unsigned fProt, size_t offSub, size_t cbSub) +DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, + unsigned fProt, size_t offSub, size_t cbSub) { AssertReturn(pvFixed == (void *)-1, VERR_NOT_SUPPORTED); @@ -866,7 +866,7 @@ int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, } -int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) { /* * Check for unsupported things. @@ -925,7 +925,7 @@ int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RT } -int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) +DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) { /* Get the map for the object. */ vm_map_t pVmMap = rtR0MemObjDarwinGetMap(pMem); @@ -971,7 +971,7 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu } -RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) +DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) { RTHCPHYS PhysAddr; PRTR0MEMOBJDARWIN pMemDarwin = (PRTR0MEMOBJDARWIN)pMem; diff --git a/src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp index 9918f92ca..4dfbf5e7d 100644 --- a/src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/memuserkernel-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: memuserkernel-r0drv-darwin.cpp $ */ +/* $Id: memuserkernel-r0drv-darwin.cpp 36540 2011-04-04 15:58:26Z vboxsync $ */ /** @file * IPRT - User & Kernel Memory, Ring-0 Driver, Darwin. */ @@ -31,6 +31,7 @@ #include "the-darwin-kernel.h" #include "internal/iprt.h" #include <iprt/mem.h> +#include <iprt/assert.h> #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) # include <iprt/asm-amd64-x86.h> diff --git a/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp index f5a731661..173aa397b 100644 --- a/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-darwin.cpp $ */ +/* $Id: mp-r0drv-darwin.cpp 37575 2011-06-21 12:40:01Z vboxsync $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp index 355420304..215a009a2 100644 --- a/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/process-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-darwin.cpp $ */ +/* $Id: process-r0drv-darwin.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Process, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp index a2098bfd2..1d4848b73 100644 --- a/src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/semevent-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-darwin.cpp $ */ +/* $Id: semevent-r0drv-darwin.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Single Release Event Semaphores, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp index a77d41d0d..53ea3f258 100644 --- a/src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/semeventmulti-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-darwin.cpp $ */ +/* $Id: semeventmulti-r0drv-darwin.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/semfastmutex-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/semfastmutex-r0drv-darwin.cpp index 407381ec6..d286362b3 100644 --- a/src/VBox/Runtime/r0drv/darwin/semfastmutex-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/semfastmutex-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-r0drv-darwin.cpp $ */ +/* $Id: semfastmutex-r0drv-darwin.cpp 29255 2010-05-09 18:11:24Z vboxsync $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp index 2b01e760a..009be81d1 100644 --- a/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: semmutex-r0drv-darwin.cpp $ */ +/* $Id: semmutex-r0drv-darwin.cpp 36192 2011-03-07 16:33:55Z vboxsync $ */ /** @file * IPRT - Mutex Semaphores, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp index df46ce0d7..2f6986582 100644 --- a/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-darwin.cpp $ */ +/* $Id: spinlock-r0drv-darwin.cpp 29255 2010-05-09 18:11:24Z vboxsync $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h b/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h index 254b1468f..a2bd2b751 100644 --- a/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h +++ b/src/VBox/Runtime/r0drv/darwin/the-darwin-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-darwin-kernel.h $ */ +/* $Id: the-darwin-kernel.h 37575 2011-06-21 12:40:01Z vboxsync $ */ /** @file * IPRT - Include all necessary headers for the Darwing kernel. */ diff --git a/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp index c71476355..920065af5 100644 --- a/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/thread-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-darwin.cpp $ */ +/* $Id: thread-r0drv-darwin.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Threads, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp index 41e0f370f..48a10d4ca 100644 --- a/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-darwin.cpp $ */ +/* $Id: thread2-r0drv-darwin.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, Darwin. */ @@ -40,7 +40,7 @@ #include "internal/thread.h" -int rtThreadNativeInit(void) +DECLHIDDEN(int) rtThreadNativeInit(void) { /* No TLS in Ring-0. :-/ */ return VINF_SUCCESS; @@ -53,7 +53,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void) } -int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) +DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) { /* * Convert the priority type to scheduling policies. @@ -130,13 +130,13 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) } -int rtThreadNativeAdopt(PRTTHREADINT pThread) +DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread) { return VERR_NOT_IMPLEMENTED; } -void rtThreadNativeDestroy(PRTTHREADINT pThread) +DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread) { NOREF(pThread); } @@ -162,7 +162,7 @@ static void rtThreadNativeMain(void *pvArg, wait_result_t Ignored) } -int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) +DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) { RT_ASSERT_PREEMPTIBLE(); diff --git a/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp index 23b28a100..00effbd19 100644 --- a/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/threadpreempt-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: threadpreempt-r0drv-darwin.cpp $ */ +/* $Id: threadpreempt-r0drv-darwin.cpp 37575 2011-06-21 12:40:01Z vboxsync $ */ /** @file * IPRT - Thread Preemption, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp index 913fa711e..487099d07 100644 --- a/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp +++ b/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-darwin.cpp $ */ +/* $Id: time-r0drv-darwin.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Time, Ring-0 Driver, Darwin. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c index 93de62447..3ebf473a0 100644 --- a/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/alloc-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-freebsd.c $ */ +/* $Id: alloc-r0drv-freebsd.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, FreeBSD. */ @@ -51,7 +51,7 @@ MALLOC_DEFINE(M_IPRTHEAP, "iprtheap", "IPRT - heap"); MALLOC_DEFINE(M_IPRTCONT, "iprtcont", "IPRT - contiguous"); -int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) +DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) { size_t cbAllocated = cb; PRTMEMHDR pHdr = NULL; @@ -121,7 +121,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) } -void rtR0MemFree(PRTMEMHDR pHdr) +DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr) { pHdr->u32Magic += 1; diff --git a/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c index 56f6acaa8..ed8c8f246 100644 --- a/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/assert-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-freebsd.c $ */ +/* $Id: assert-r0drv-freebsd.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, FreeBSD. */ @@ -41,7 +41,7 @@ #include "internal/assert.h" -void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) +DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) { printf("\r\n!!Assertion Failed!!\r\n" "Expression: %s\r\n" @@ -50,7 +50,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi } -void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) +DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) { char szMsg[256]; diff --git a/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c index 591b77973..60c50be8f 100644 --- a/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/initterm-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-freebsd.c $ */ +/* $Id: initterm-r0drv-freebsd.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Initialization & Termination, Ring-0 Driver, FreeBSD. */ @@ -38,14 +38,14 @@ #include "internal/initterm.h" -int rtR0InitNative(void) +DECLHIDDEN(int) rtR0InitNative(void) { /* nothing to do */ return VINF_SUCCESS; } -void rtR0TermNative(void) +DECLHIDDEN(void) rtR0TermNative(void) { /* nothing to undo */ } diff --git a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c index 7959367f8..1f253f7c1 100644 --- a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-freebsd.c $ */ +/* $Id: memobj-r0drv-freebsd.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Ring-0 Memory Objects, FreeBSD. */ @@ -76,9 +76,7 @@ typedef struct RTR0MEMOBJFREEBSD MALLOC_DEFINE(M_IPRTMOBJ, "iprtmobj", "IPRT - R0MemObj"); -/******************************************************************************* -* Internal Functions * -*******************************************************************************/ + /** * Gets the virtual memory map the specified object is mapped into. @@ -119,7 +117,8 @@ static vm_map_t rtR0MemObjFreeBSDGetMap(PRTR0MEMOBJINTERNAL pMem) } } -int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) + +DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) { PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem; int rc; @@ -220,7 +219,8 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) return VINF_SUCCESS; } -int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) + +DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { int rc; size_t cPages = cb >> PAGE_SHIFT; @@ -308,7 +308,8 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu return rc; } -int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) + +DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { #ifdef USE_KMEM_ALLOC_ATTR /* @@ -360,7 +361,7 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut } -int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { /* create the object. */ PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb); @@ -387,6 +388,7 @@ int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu return VERR_NO_MEMORY; } + static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage) { pPage->wire_count = 1; @@ -397,6 +399,7 @@ static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage) atomic_add_int(&cnt.v_wire_count, 1); } + static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTYPE enmType, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment, @@ -474,7 +477,8 @@ static int rtR0MemObjFreeBSDAllocPhysPages(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOB return rc; } -int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) + +DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) { #if 1 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest, uAlignment, true); @@ -505,7 +509,7 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph } -int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) { #if 1 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest, PAGE_SIZE, false); @@ -515,7 +519,7 @@ int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS } -int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) +DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) { AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED); @@ -567,7 +571,7 @@ static int rtR0MemObjNativeLockInMap(PPRTR0MEMOBJINTERNAL ppMem, vm_map_t pVmMap } -int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) { return rtR0MemObjNativeLockInMap(ppMem, &((struct proc *)R0Process)->p_vmspace->vm_map, @@ -579,7 +583,7 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c } -int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) +DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) { return rtR0MemObjNativeLockInMap(ppMem, kernel_map, @@ -669,21 +673,22 @@ static int rtR0MemObjNativeReserveInMap(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixe } -int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) + +DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) { return rtR0MemObjNativeReserveInMap(ppMem, pvFixed, cb, uAlignment, NIL_RTR0PROCESS, kernel_map); } -int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) { return rtR0MemObjNativeReserveInMap(ppMem, (void *)R3PtrFixed, cb, uAlignment, R0Process, &((struct proc *)R0Process)->p_vmspace->vm_map); } -int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, - unsigned fProt, size_t offSub, size_t cbSub) +DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, + unsigned fProt, size_t offSub, size_t cbSub) { AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED); AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED); @@ -702,7 +707,7 @@ int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, /* see http://markmail.org/message/udhq33tefgtyfozs */ -int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) { /* * Check for unsupported stuff. @@ -808,7 +813,7 @@ int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RT } -int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) +DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) { vm_prot_t ProtectionFlags = 0; vm_offset_t AddrStart = (uintptr_t)pMem->pv + offSub; @@ -835,7 +840,7 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu } -RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) +DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) { PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)pMem; diff --git a/src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c index ce24fb5d3..6bd7c45b9 100644 --- a/src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/memuserkernel-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: memuserkernel-r0drv-freebsd.c $ */ +/* $Id: memuserkernel-r0drv-freebsd.c 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - User & Kernel Memory, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c index a2cffad86..c71c865ad 100644 --- a/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-freebsd.c $ */ +/* $Id: mp-r0drv-freebsd.c 37774 2011-07-04 21:19:27Z vboxsync $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, FreeBSD. */ @@ -163,8 +163,10 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) /* Will panic if no rendezvousing cpus, so check up front. */ if (RTMpGetOnlineCount() > 1) { -#if __FreeBSD_version >= 700000 - cpumask_t Mask = ~(cpumask_t)curcpu; +#if __FreeBSD_version >= 900000 + cpuset_t Mask; +#elif __FreeBSD_version >= 700000 + cpumask_t Mask; #endif RTMPARGS Args; @@ -174,6 +176,12 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) Args.idCpu = RTMpCpuId(); Args.cHits = 0; #if __FreeBSD_version >= 700000 +# if __FreeBSD_version >= 900000 + Mask = all_cpus; + CPU_CLR(curcpu, &Mask); +# else + Mask = ~(cpumask_t)curcpu; +# endif smp_rendezvous_cpus(Mask, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendevous_barrier, &Args); #else smp_rendezvous(NULL, rtmpOnOthersFreeBSDWrapper, NULL, &Args); @@ -203,8 +211,10 @@ static void rtmpOnSpecificFreeBSDWrapper(void *pvArg) RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) { -#if __FreeBSD_version >= 700000 - cpumask_t Mask = 1 << idCpu; +#if __FreeBSD_version >= 900000 + cpuset_t Mask; +#elif __FreeBSD_version >= 700000 + cpumask_t Mask; #endif RTMPARGS Args; @@ -218,7 +228,11 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1 Args.idCpu = idCpu; Args.cHits = 0; #if __FreeBSD_version >= 700000 +# if __FreeBSD_version >= 900000 + CPU_SETOF(idCpu, &Mask); +# else Mask = (cpumask_t)1 << idCpu; +# endif smp_rendezvous_cpus(Mask, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendevous_barrier, &Args); #else smp_rendezvous(NULL, rtmpOnSpecificFreeBSDWrapper, NULL, &Args); @@ -242,13 +256,21 @@ static void rtmpFreeBSDPokeCallback(void *pvArg) RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) { +#if __FreeBSD_version >= 900000 + cpuset_t Mask; +#elif __FreeBSD_version >= 700000 cpumask_t Mask; +#endif /* Will panic if no rendezvousing cpus, so make sure the cpu is online. */ if (!RTMpIsCpuOnline(idCpu)) return VERR_CPU_NOT_FOUND; +# if __FreeBSD_version >= 900000 + CPU_SETOF(idCpu, &Mask); +# else Mask = (cpumask_t)1 << idCpu; +# endif smp_rendezvous_cpus(Mask, NULL, rtmpFreeBSDPokeCallback, smp_no_rendevous_barrier, NULL); return VINF_SUCCESS; diff --git a/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c index 96af287aa..ac08c3e94 100644 --- a/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/process-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-freebsd.c $ */ +/* $Id: process-r0drv-freebsd.c 18972 2009-04-16 23:43:08Z vboxsync $ */ /** @file * IPRT - Process Management, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c index b2a9a5c91..435c255ce 100644 --- a/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-freebsd.c $ */ +/* $Id: semevent-r0drv-freebsd.c 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Single Release Event Semaphores, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c index 253a5b01d..f8ed7800f 100644 --- a/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-freebsd.c $ */ +/* $Id: semeventmulti-r0drv-freebsd.c 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c index 2f42336f0..7058b7fd0 100644 --- a/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-r0drv-freebsd.c $ */ +/* $Id: semfastmutex-r0drv-freebsd.c 25722 2010-01-11 14:22:03Z vboxsync $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c index b20b9603f..370f29a75 100644 --- a/src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/semmutex-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: semmutex-r0drv-freebsd.c $ */ +/* $Id: semmutex-r0drv-freebsd.c 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Mutex Semaphores, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h b/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h index 89e12087b..49d3d5393 100644 --- a/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h +++ b/src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h @@ -1,4 +1,4 @@ -/* $Id: sleepqueue-r0drv-freebsd.h $ */ +/* $Id: sleepqueue-r0drv-freebsd.h 37305 2011-06-02 12:32:20Z vboxsync $ */ /** @file * IPRT - FreeBSD Ring-0 Driver Helpers for Abstracting Sleep Queues, */ diff --git a/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c index 97a988e6a..f208aea90 100644 --- a/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-freebsd.c $ */ +/* $Id: spinlock-r0drv-freebsd.c 29500 2010-05-14 21:43:06Z vboxsync $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h b/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h index 718b6741a..4c9fb9261 100644 --- a/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h +++ b/src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-freebsd-kernel.h $ */ +/* $Id: the-freebsd-kernel.h 33540 2010-10-28 09:27:05Z vboxsync $ */ /** @file * IPRT - Ring-0 Driver, The FreeBSD Kernel Headers. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c index 38474aab3..f58d9dd7d 100644 --- a/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-freebsd.c $ */ +/* $Id: thread-r0drv-freebsd.c 35960 2011-02-14 14:52:34Z vboxsync $ */ /** @file * IPRT - Threads (Part 1), Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c index 0f42760a1..be9191727 100644 --- a/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-freebsd.c $ */ +/* $Id: thread2-r0drv-freebsd.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, FreeBSD. */ @@ -40,7 +40,7 @@ #include "internal/thread.h" -int rtThreadNativeInit(void) +DECLHIDDEN(int) rtThreadNativeInit(void) { return VINF_SUCCESS; } @@ -52,7 +52,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void) } -int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) +DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) { int iPriority; @@ -89,7 +89,7 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) } -int rtThreadNativeAdopt(PRTTHREADINT pThread) +DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread) { NOREF(pThread); /* There is nothing special that needs doing here, but the @@ -98,7 +98,7 @@ int rtThreadNativeAdopt(PRTTHREADINT pThread) } -void rtThreadNativeDestroy(PRTTHREADINT pThread) +DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread) { NOREF(pThread); } @@ -125,7 +125,7 @@ static void rtThreadNativeMain(void *pvThreadInt) } -int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) +DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) { int rc; struct proc *pProc; diff --git a/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c index 7f356a10c..3d1ff7e78 100644 --- a/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-freebsd.c $ */ +/* $Id: time-r0drv-freebsd.c 18972 2009-04-16 23:43:08Z vboxsync $ */ /** @file * IPRT - Time, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c index 43f693f48..d8981b9d5 100644 --- a/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c +++ b/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c @@ -1,4 +1,4 @@ -/* $Id: timer-r0drv-freebsd.c $ */ +/* $Id: timer-r0drv-freebsd.c 33540 2010-10-28 09:27:05Z vboxsync $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, FreeBSD. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp index 925842eb4..100e12e29 100644 --- a/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpIsCpuWorkPending-r0drv-generic.cpp $ */ +/* $Id: RTMpIsCpuWorkPending-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - RTMpIsCpuWorkPending, Generic. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp index a9844aceb..44114a12a 100644 --- a/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpOn-r0drv-generic.cpp $ */ +/* $Id: RTMpOn-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Generic Stubs. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp index 01835679e..e253d3ecf 100644 --- a/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTMpPokeCpu-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTMpPokeCpu-r0drv-generic.cpp $ */ +/* $Id: RTMpPokeCpu-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - RTMpPokeCpu, Generic Implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp index 0d943b3b2..afc70a258 100644 --- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptDisable-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTThreadPreemptDisable-r0drv-generic.cpp $ */ +/* $Id: RTThreadPreemptDisable-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - RTThreadPreemptDisable, Generic ring-0 driver implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp index 0e00439d0..d496cacfb 100644 --- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsEnabled-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTThreadPreemptIsEnabled-r0drv-generic.cpp $ */ +/* $Id: RTThreadPreemptIsEnabled-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - RTThreadPreemptIsEnabled, Generic ring-0 driver implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp index 1fc9b894f..88e91de25 100644 --- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPending-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTThreadPreemptIsPending-r0drv-generic.cpp $ */ +/* $Id: RTThreadPreemptIsPending-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - RTThreadPreemptIsPending, Generic ring-0 driver implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp index fe94d0226..2288b4d8c 100644 --- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp $ */ +/* $Id: RTThreadPreemptIsPendingTrusty-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - RTThreadPreemptIsPendingTrusty, Generic ring-0 driver implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp index 9fa8461e1..d327ea6ad 100644 --- a/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/RTThreadPreemptRestore-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: RTThreadPreemptRestore-r0drv-generic.cpp $ */ +/* $Id: RTThreadPreemptRestore-r0drv-generic.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - RTThreadPreemptRestore, Generic ring-0 driver implementation. */ diff --git a/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp index 0b22a8e57..f4336e557 100644 --- a/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp +++ b/src/VBox/Runtime/r0drv/generic/mpnotification-r0drv-generic.cpp @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv-generic.cpp $ */ +/* $Id: mpnotification-r0drv-generic.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Multiprocessor Notifications, Ring-0 Driver, Generic Stubs. */ @@ -53,13 +53,13 @@ RTDECL(int) RTMpNotificationDeregister(PFNRTMPNOTIFICATION pfnCallback, void *pv RT_EXPORT_SYMBOL(RTMpNotificationDeregister); -int rtR0MpNotificationInit(void) +DECLHIDDEN(int) rtR0MpNotificationInit(void) { return VINF_SUCCESS; } -void rtR0MpNotificationTerm(void) +DECLHIDDEN(void) rtR0MpNotificationTerm(void) { } diff --git a/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c b/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c index 69f29f24a..8bb2f9739 100644 --- a/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c +++ b/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c @@ -1,4 +1,4 @@ -/* $Id: semspinmutex-r0drv-generic.c $ */ +/* $Id: semspinmutex-r0drv-generic.c 33393 2010-10-24 16:17:00Z vboxsync $ */ /** @file * IPRT - Spinning Mutex Semaphores, Ring-0 Driver, Generic. */ diff --git a/src/VBox/Runtime/r0drv/initterm-r0drv.cpp b/src/VBox/Runtime/r0drv/initterm-r0drv.cpp index ba88e54ef..15ce42f88 100644 --- a/src/VBox/Runtime/r0drv/initterm-r0drv.cpp +++ b/src/VBox/Runtime/r0drv/initterm-r0drv.cpp @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv.cpp $ */ +/* $Id: initterm-r0drv.cpp 36233 2011-03-09 17:05:12Z vboxsync $ */ /** @file * IPRT - Initialization & Termination, R0 Driver, Common. */ @@ -78,9 +78,7 @@ RTR0DECL(int) RTR0Init(unsigned fReserved) rc = rtR0InitNative(); if (RT_SUCCESS(rc)) { -#if !defined(RT_OS_LINUX) /** @todo implement thread2-r0drv-linux.c */ rc = rtThreadInit(); -#endif if (RT_SUCCESS(rc)) { #ifndef IN_GUEST /* play safe for now */ @@ -96,9 +94,7 @@ RTR0DECL(int) RTR0Init(unsigned fReserved) if (RT_SUCCESS(rc)) return rc; #endif -#if !defined(RT_OS_LINUX) /** @todo implement thread2-r0drv-linux.c */ rtThreadTerm(); -#endif } rtR0TermNative(); } @@ -109,9 +105,7 @@ RT_EXPORT_SYMBOL(RTR0Init); static void rtR0Term(void) { -#if !defined(RT_OS_LINUX) /** @todo implement thread2-r0drv-linux.c */ rtThreadTerm(); -#endif #ifndef IN_GUEST /* play safe for now */ rtR0PowerNotificationTerm(); rtR0MpNotificationTerm(); diff --git a/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c index 144d637ea..0bb7b0181 100644 --- a/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteDebugger-r0drv-linux.c $ */ +/* $Id: RTLogWriteDebugger-r0drv-linux.c 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Log To Debugger, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c index 2534575bb..2300cff8c 100644 --- a/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-linux.c $ */ +/* $Id: alloc-r0drv-linux.c 36962 2011-05-04 17:43:50Z vboxsync $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, Linux. */ @@ -76,7 +76,7 @@ static size_t g_cPages; * API for cleaning up the heap spinlock on IPRT termination. * This is as RTMemExecDonate specific to AMD64 Linux/GNU. */ -void rtR0MemExecCleanup(void) +DECLHIDDEN(void) rtR0MemExecCleanup(void) { # ifdef RTMEMALLOC_EXEC_HEAP_VM_AREA unsigned i; @@ -203,7 +203,7 @@ RT_EXPORT_SYMBOL(RTR0MemExecInit); /** * OS specific allocation function. */ -int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) +DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) { PRTMEMHDR pHdr; @@ -239,11 +239,25 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) } else { - if (cb <= PAGE_SIZE || (fFlags & RTMEMHDR_FLAG_ANY_CTX)) + if ( +#if 1 /* vmalloc has serious performance issues, avoid it. */ + cb <= PAGE_SIZE*16 - sizeof(*pHdr) +#else + cb <= PAGE_SIZE +#endif + || (fFlags & RTMEMHDR_FLAG_ANY_CTX) + ) { fFlags |= RTMEMHDR_FLAG_KMALLOC; pHdr = kmalloc(cb + sizeof(*pHdr), (fFlags & RTMEMHDR_FLAG_ANY_CTX_ALLOC) ? GFP_ATOMIC : GFP_KERNEL); + if (RT_UNLIKELY( !pHdr + && cb > PAGE_SIZE + && !(fFlags & RTMEMHDR_FLAG_ANY_CTX) )) + { + fFlags &= ~RTMEMHDR_FLAG_KMALLOC; + pHdr = vmalloc(cb + sizeof(*pHdr)); + } } else pHdr = vmalloc(cb + sizeof(*pHdr)); @@ -267,7 +281,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) /** * OS specific free function. */ -void rtR0MemFree(PRTMEMHDR pHdr) +DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr) { pHdr->u32Magic += 1; if (pHdr->fFlags & RTMEMHDR_FLAG_KMALLOC) diff --git a/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c index db9a1257b..0d5351d14 100644 --- a/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-linux.c $ */ +/* $Id: assert-r0drv-linux.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, Linux. */ @@ -40,7 +40,7 @@ #include "internal/assert.h" -void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) +DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) { printk(KERN_EMERG "\r\n!!Assertion Failed!!\r\n" @@ -50,7 +50,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi } -void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) +DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) { char szMsg[256]; diff --git a/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c index 0d27c022c..d76a42d4c 100644 --- a/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-linux.c $ */ +/* $Id: initterm-r0drv-linux.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Initialization & Termination, R0 Driver, Linux. */ @@ -40,17 +40,17 @@ *******************************************************************************/ #ifdef RT_ARCH_AMD64 /* in alloc-r0drv0-linux.c */ -extern void rtR0MemExecCleanup(void); +DECLHIDDEN(void) rtR0MemExecCleanup(void); #endif -int rtR0InitNative(void) +DECLHIDDEN(int) rtR0InitNative(void) { return VINF_SUCCESS; } -void rtR0TermNative(void) +DECLHIDDEN(void) rtR0TermNative(void) { #ifdef RT_ARCH_AMD64 rtR0MemExecCleanup(); diff --git a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c index 82f938b0b..2db3df78e 100644 --- a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Revision: 69499 $ */ +/* $Revision: 36555 $ */ /** @file * IPRT - Ring-0 Memory Objects, Linux. */ @@ -97,7 +97,7 @@ static void rtR0MemObjLinuxFreePages(PRTR0MEMOBJLNX pMemLnx); * @returns The corresponding Linux task. * @param R0Process IPRT ring-0 process handle. */ -struct task_struct *rtR0ProcessToLinuxTask(RTR0PROCESS R0Process) +static struct task_struct *rtR0ProcessToLinuxTask(RTR0PROCESS R0Process) { /** @todo fix rtR0ProcessToLinuxTask!! */ return R0Process == RTR0ProcHandleSelf() ? current : NULL; @@ -442,7 +442,7 @@ static void rtR0MemObjLinuxVUnmap(PRTR0MEMOBJLNX pMemLnx) } -int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) +DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) { PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)pMem; @@ -534,7 +534,7 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) } -int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { PRTR0MEMOBJLNX pMemLnx; int rc; @@ -561,7 +561,7 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu } -int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { PRTR0MEMOBJLNX pMemLnx; int rc; @@ -598,7 +598,7 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut } -int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { PRTR0MEMOBJLNX pMemLnx; int rc; @@ -743,19 +743,19 @@ static int rtR0MemObjLinuxAllocPhysSub(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJTYP } -int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) { return rtR0MemObjLinuxAllocPhysSub(ppMem, RTR0MEMOBJTYPE_PHYS, cb, uAlignment, PhysHighest); } -int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) { return rtR0MemObjLinuxAllocPhysSub(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PAGE_SIZE, PhysHighest); } -int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) +DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) { /* * All we need to do here is to validate that we can use @@ -778,7 +778,7 @@ int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t } -int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) { const int cPages = cb >> PAGE_SHIFT; struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process); @@ -875,7 +875,7 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c } -int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) +DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) { void *pvLast = (uint8_t *)pv + cb - 1; size_t const cPages = cb >> PAGE_SHIFT; @@ -890,12 +890,26 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, * Classify the memory and check that we can deal with it. */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) - fLinearMapping = virt_addr_valid(pvLast) && virt_addr_valid(pv); + fLinearMapping = virt_addr_valid(pvLast) && virt_addr_valid(pv); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) fLinearMapping = VALID_PAGE(virt_to_page(pvLast)) && VALID_PAGE(virt_to_page(pv)); #else # error "not supported" #endif + /* + * kmap()'ed memory. Only relevant for 32-bit Linux kernels with HIGHMEM + * enabled. Unfortunately there is no easy way to retrieve the page object + * for such temporarily mapped memory, virt_to_page() does not work here. + * There is even no function to check if a virtual address is inside the + * kmap() area or not :-( kmap_atomic_to_page() looks promising but the test + * 'if (vaddr < FIXADDR_START)' if wrong -- the kmap() area is located + * below the fixmap area. vmalloc_to_page() would work but is only allowed + * for vmalloc'ed memory. + */ +#ifdef CONFIG_HIGHMEM + if (pv < PKMAP_BASE + LAST_PKMAP*PAGE_SIZE && pvLast >= PKMAP_BASE) + return VERR_INVALID_PARAMETER; +#endif if (!fLinearMapping) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 19) @@ -961,7 +975,7 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, } -int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) +DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22) const size_t cPages = cb >> PAGE_SHIFT; @@ -1076,7 +1090,7 @@ static void *rtR0MemObjLinuxDoMmap(RTR3PTR R3PtrFixed, size_t cb, size_t uAlignm } -int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) { PRTR0MEMOBJLNX pMemLnx; void *pv; @@ -1114,8 +1128,9 @@ int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, } -int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, - unsigned fProt, size_t offSub, size_t cbSub) +DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, + void *pvFixed, size_t uAlignment, + unsigned fProt, size_t offSub, size_t cbSub) { int rc = VERR_NO_MEMORY; PRTR0MEMOBJLNX pMemLnxToMap = (PRTR0MEMOBJLNX)pMemToMap; @@ -1249,7 +1264,8 @@ static int rtR0MemObjLinuxFixPte(struct mm_struct *mm, unsigned long ulAddr, RTH #endif /* VBOX_USE_PAE_HACK */ -int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, + size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) { struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process); PRTR0MEMOBJLNX pMemLnxToMap = (PRTR0MEMOBJLNX)pMemToMap; @@ -1413,7 +1429,7 @@ int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RT } -int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) +DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) { NOREF(pMem); NOREF(offSub); @@ -1423,7 +1439,7 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu } -RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) +DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) { PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)pMem; diff --git a/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c index 4517fea98..b9c470049 100644 --- a/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: memuserkernel-r0drv-linux.c $ */ +/* $Id: memuserkernel-r0drv-linux.c 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - User & Kernel Memory, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c index 8545960ed..58a8a9e08 100644 --- a/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-linux.c $ */ +/* $Id: mp-r0drv-linux.c 37672 2011-06-28 19:48:17Z vboxsync $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Linux. */ @@ -35,6 +35,7 @@ #include <iprt/cpuset.h> #include <iprt/err.h> #include <iprt/asm.h> +#include <iprt/thread.h> #include "r0drv/mp-r0drv.h" @@ -202,6 +203,9 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) int rc; RTMPARGS Args; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) + RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER; +#endif Args.pfnWorker = pfnWorker; Args.pvUser1 = pvUser1; Args.pvUser2 = pvUser2; @@ -212,19 +216,13 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) rc = on_each_cpu(rtmpLinuxWrapper, &Args, 1 /* wait */); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) rc = on_each_cpu(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */); - #else /* older kernels */ - -# ifdef preempt_disable - preempt_disable(); -# endif + RTThreadPreemptDisable(&PreemptState); rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */); local_irq_disable(); rtmpLinuxWrapper(&Args); local_irq_enable(); -# ifdef preempt_enable - preempt_enable(); -# endif + RTThreadPreemptRestore(&PreemptState); #endif /* older kernels */ Assert(rc == 0); NOREF(rc); return VINF_SUCCESS; @@ -237,23 +235,20 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) int rc; RTMPARGS Args; + RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER; Args.pfnWorker = pfnWorker; Args.pvUser1 = pvUser1; Args.pvUser2 = pvUser2; Args.idCpu = NIL_RTCPUID; Args.cHits = 0; -#ifdef preempt_disable - preempt_disable(); -#endif + RTThreadPreemptDisable(&PreemptState); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) rc = smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */); #else /* older kernels */ rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */); #endif /* older kernels */ -#ifdef preempt_enable - preempt_enable(); -#endif + RTThreadPreemptRestore(&PreemptState); Assert(rc == 0); NOREF(rc); return VINF_SUCCESS; @@ -287,6 +282,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1 int rc; RTMPARGS Args; + RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER; Args.pfnWorker = pfnWorker; Args.pvUser1 = pvUser1; Args.pvUser2 = pvUser2; @@ -296,9 +292,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1 if (!RTMpIsCpuPossible(idCpu)) return VERR_CPU_NOT_FOUND; -# ifdef preempt_disable - preempt_disable(); -# endif + RTThreadPreemptDisable(&PreemptState); if (idCpu != RTMpCpuId()) { if (RTMpIsCpuOnline(idCpu)) @@ -321,9 +315,7 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1 rtmpLinuxWrapper(&Args); rc = VINF_SUCCESS; } -# ifdef preempt_enable - preempt_enable(); -# endif + RTThreadPreemptRestore(&PreemptState);; NOREF(rc); return rc; diff --git a/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c index dd46f9eba..cd234d239 100644 --- a/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv-linux.c $ */ +/* $Id: mpnotification-r0drv-linux.c 37672 2011-06-28 19:48:17Z vboxsync $ */ /** @file * IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Linux. */ @@ -34,6 +34,7 @@ #include <iprt/mp.h> #include <iprt/err.h> #include <iprt/cpuset.h> +#include <iprt/thread.h> #include "r0drv/mp-r0drv.h" @@ -67,16 +68,63 @@ static RTCPUSET g_MpPendingOfflineSet; /** + * Notification wrapper that updates CPU states and invokes our notification + * callbacks. + * + * @param idCpu The CPU Id. + * @param pvUser1 Pointer to the notifier_block (unused). + * @param pvUser2 The notification event. + * @remarks This can be invoked in interrupt context. + */ +static void rtMpNotificationLinuxOnCurrentCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2) +{ + unsigned long ulNativeEvent = *(unsigned long *)pvUser2; + NOREF(pvUser1); + + AssertRelease(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); + AssertRelease(idCpu == RTMpCpuId()); /* ASSUMES iCpu == RTCPUID */ + + switch (ulNativeEvent) + { +# ifdef CPU_DOWN_FAILED + case CPU_DOWN_FAILED: +# if defined(CPU_TASKS_FROZEN) && defined(CPU_DOWN_FAILED_FROZEN) + case CPU_DOWN_FAILED_FROZEN: +# endif +# endif + case CPU_ONLINE: +# if defined(CPU_TASKS_FROZEN) && defined(CPU_ONLINE_FROZEN) + case CPU_ONLINE_FROZEN: +# endif + rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, idCpu); + break; + +# ifdef CPU_DOWN_PREPARE + case CPU_DOWN_PREPARE: +# if defined(CPU_TASKS_FROZEN) && defined(CPU_DOWN_PREPARE_FROZEN) + case CPU_DOWN_PREPARE_FROZEN: +# endif + rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, idCpu); + break; +# endif + } +} + + +/** * The native callback. * - * @returns 0. + * @returns NOTIFY_DONE. * @param pNotifierBlock Pointer to g_NotifierBlock. * @param ulNativeEvent The native event. * @param pvCpu The cpu id cast into a pointer value. + * @remarks This can fire with preemption enabled and on any CPU. */ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock, unsigned long ulNativeEvent, void *pvCpu) { - RTCPUID idCpu = (uintptr_t)pvCpu; + int rc; + bool fProcessEvent = false; + RTCPUID idCpu = (uintptr_t)pvCpu; NOREF(pNotifierBlock); /* @@ -85,8 +133,6 @@ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock, * use them. Thus we have to test for both CPU_TASKS_FROZEN and * the individual event variants. */ - - /* ASSUMES iCpu == RTCPUID */ switch (ulNativeEvent) { /* @@ -99,7 +145,7 @@ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock, case CPU_DOWN_FAILED_FROZEN: # endif if (!RTCpuSetIsMember(&g_MpPendingOfflineSet, idCpu)) - return 0; + break; /* fProcessEvents = false */ /* fall thru */ # endif case CPU_ONLINE: @@ -109,7 +155,7 @@ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock, # ifdef CPU_DOWN_FAILED RTCpuSetDel(&g_MpPendingOfflineSet, idCpu); # endif - rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, idCpu); + fProcessEvent = true; break; /* @@ -122,24 +168,33 @@ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock, # if defined(CPU_TASKS_FROZEN) && defined(CPU_DOWN_PREPARE_FROZEN) case CPU_DOWN_PREPARE_FROZEN: # endif + fProcessEvent = true; # else case CPU_DEAD: # if defined(CPU_TASKS_FROZEN) && defined(CPU_DEAD_FROZEN) case CPU_DEAD_FROZEN: # endif + /* Don't process CPU_DEAD notifications. */ # endif - rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, idCpu); # ifdef CPU_DOWN_FAILED RTCpuSetAdd(&g_MpPendingOfflineSet, idCpu); # endif break; } + if (!fProcessEvent) + return NOTIFY_DONE; + + /* + * Reschedule the callbacks to fire on the specific CPU with preemption disabled. + */ + rc = RTMpOnSpecific(idCpu, rtMpNotificationLinuxOnCurrentCpu, pNotifierBlock, &ulNativeEvent); + Assert(RT_SUCCESS(rc)); NOREF(rc); return NOTIFY_DONE; } -int rtR0MpNotificationNativeInit(void) +DECLHIDDEN(int) rtR0MpNotificationNativeInit(void) { int rc; @@ -153,19 +208,19 @@ int rtR0MpNotificationNativeInit(void) } -void rtR0MpNotificationNativeTerm(void) +DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void) { unregister_cpu_notifier(&g_NotifierBlock); } #else /* Not supported / Not needed */ -int rtR0MpNotificationNativeInit(void) +DECLHIDDEN(int) rtR0MpNotificationNativeInit(void) { return VINF_SUCCESS; } -void rtR0MpNotificationNativeTerm(void) +DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void) { } diff --git a/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c index e69aeace2..4c838081a 100644 --- a/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-linux.c $ */ +/* $Id: process-r0drv-linux.c 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Process, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c index 2506adc87..de9b2bd83 100644 --- a/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-linux.c $ */ +/* $Id: semevent-r0drv-linux.c 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Single Release Event Semaphores, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c index 74cc39002..23a248544 100644 --- a/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-linux.c $ */ +/* $Id: semeventmulti-r0drv-linux.c 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c index 45d1d5128..e23fdeb0d 100644 --- a/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c @@ -1,10 +1,10 @@ -/* $Id: semfastmutex-r0drv-linux.c $ */ +/* $Id: semfastmutex-r0drv-linux.c 36979 2011-05-06 11:55:42Z vboxsync $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, Linux. */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -35,7 +35,7 @@ #include <iprt/assert.h> #include <iprt/asm.h> #include <iprt/err.h> -#ifdef IPRT_DEBUG_SEMS +#if defined(RT_STRICT) || defined(IPRT_DEBUG_SEMS) # include <iprt/thread.h> #endif @@ -54,7 +54,7 @@ typedef struct RTSEMFASTMUTEXINTERNAL uint32_t u32Magic; /** the linux semaphore. */ struct semaphore Semaphore; -#ifdef IPRT_DEBUG_SEMS +#if defined(RT_STRICT) || defined(IPRT_DEBUG_SEMS) /** For check. */ RTNATIVETHREAD volatile Owner; #endif @@ -76,7 +76,7 @@ RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFastMtx) */ pThis->u32Magic = RTSEMFASTMUTEX_MAGIC; sema_init(&pThis->Semaphore, 1); -#ifdef IPRT_DEBUG_SEMS +#if defined(RT_STRICT) || defined(IPRT_DEBUG_SEMS) pThis->Owner = NIL_RTNATIVETHREAD; #endif @@ -115,7 +115,7 @@ RTDECL(int) RTSemFastMutexRequest(RTSEMFASTMUTEX hFastMtx) IPRT_DEBUG_SEMS_STATE(pThis, 'd'); down(&pThis->Semaphore); -#ifdef IPRT_DEBUG_SEMS +#if defined(RT_STRICT) || defined(IPRT_DEBUG_SEMS) IPRT_DEBUG_SEMS_STATE(pThis, 'o'); AssertRelease(pThis->Owner == NIL_RTNATIVETHREAD); ASMAtomicUoWriteSize(&pThis->Owner, RTThreadNativeSelf()); @@ -134,7 +134,7 @@ RTDECL(int) RTSemFastMutexRelease(RTSEMFASTMUTEX hFastMtx) AssertPtrReturn(pThis, VERR_INVALID_HANDLE); AssertMsgReturn(pThis->u32Magic == RTSEMFASTMUTEX_MAGIC, ("u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis), VERR_INVALID_HANDLE); -#ifdef IPRT_DEBUG_SEMS +#if defined(RT_STRICT) || defined(IPRT_DEBUG_SEMS) AssertRelease(pThis->Owner == RTThreadNativeSelf()); ASMAtomicUoWriteSize(&pThis->Owner, NIL_RTNATIVETHREAD); #endif diff --git a/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c index de257acc4..f8c6c8928 100644 --- a/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: semmutex-r0drv-linux.c $ */ +/* $Id: semmutex-r0drv-linux.c 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Mutex Semaphores, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c index e3be185f0..e68b5b0c8 100644 --- a/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-linux.c $ */ +/* $Id: spinlock-r0drv-linux.c 29250 2010-05-09 17:53:58Z vboxsync $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/string.h b/src/VBox/Runtime/r0drv/linux/string.h index f2f319411..b581ae53a 100644 --- a/src/VBox/Runtime/r0drv/linux/string.h +++ b/src/VBox/Runtime/r0drv/linux/string.h @@ -1,4 +1,4 @@ -/* $Id: string.h $ */ +/* $Id: string.h 33012 2010-10-08 15:46:40Z vboxsync $ */ /** @file * IPRT - wrapper for the linux kernel asm/string.h. */ diff --git a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h index 5bd9d0132..a993b5b21 100644 --- a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h +++ b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-linux-kernel.h $ */ +/* $Id: the-linux-kernel.h 36233 2011-03-09 17:05:12Z vboxsync $ */ /** @file * IPRT - Include all necessary headers for the Linux kernel. */ @@ -118,6 +118,10 @@ #include <asm/uaccess.h> #include <asm/div64.h> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) +# include <linux/kthread.h> +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) # ifndef page_to_pfn # define page_to_pfn(page) ((page) - mem_map) @@ -363,6 +367,4 @@ DECLINLINE(unsigned long) msecs_to_jiffies(unsigned int cMillies) # define IPRT_LINUX_HAS_HRTIMER #endif - #endif - diff --git a/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c index 44edbc2ac..7ada61e3d 100644 --- a/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-linux.c $ */ +/* $Id: thread-r0drv-linux.c 33358 2010-10-22 14:06:43Z vboxsync $ */ /** @file * IPRT - Threads, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c index 381bd2e82..1ac95ea52 100644 --- a/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c @@ -1,10 +1,10 @@ -/* $Id: thread2-r0drv-linux.c $ */ +/* $Id: thread2-r0drv-linux.c 36947 2011-05-03 19:49:12Z vboxsync $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, Linux. */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -37,10 +37,111 @@ #include "internal/thread.h" -/** @todo Later. RTDECL(RTTHREAD) RTThreadSelf(void) { return rtThreadGetByNative((RTNATIVETHREAD)current); } -*/ + + +DECLHIDDEN(int) rtThreadNativeInit(void) +{ + return VINF_SUCCESS; +} + + +DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) + /* See comment near MAX_RT_PRIO in linux/sched.h for details on + sched_priority. */ + int iSchedClass = SCHED_NORMAL; + struct sched_param Param = { .sched_priority = MAX_PRIO - 1 }; + switch (enmType) + { + case RTTHREADTYPE_INFREQUENT_POLLER: + Param.sched_priority = MAX_RT_PRIO + 5; + break; + + case RTTHREADTYPE_EMULATION: + Param.sched_priority = MAX_RT_PRIO + 4; + break; + + case RTTHREADTYPE_DEFAULT: + Param.sched_priority = MAX_RT_PRIO + 3; + break; + + case RTTHREADTYPE_MSG_PUMP: + Param.sched_priority = MAX_RT_PRIO + 2; + break; + + case RTTHREADTYPE_IO: + iSchedClass = SCHED_FIFO; + Param.sched_priority = MAX_RT_PRIO - 1; + break; + + case RTTHREADTYPE_TIMER: + iSchedClass = SCHED_FIFO; + Param.sched_priority = 1; /* not 0 just in case */ + break; + + default: + AssertMsgFailed(("enmType=%d\n", enmType)); + return VERR_INVALID_PARAMETER; + } + + sched_setscheduler(current, iSchedClass, &Param); +#endif + + return VINF_SUCCESS; +} + + +DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread) +{ + return VERR_NOT_IMPLEMENTED; +} + + +DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread) +{ + NOREF(pThread); +} + + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 4) +/** + * Native kernel thread wrapper function. + * + * This will forward to rtThreadMain and do termination upon return. + * + * @param pvArg Pointer to the argument package. + */ +static int rtThreadNativeMain(void *pvArg) +{ + PRTTHREADINT pThread = (PRTTHREADINT)pvArg; + + rtThreadMain(pThread, (RTNATIVETHREAD)current, &pThread->szName[0]); + return 0; +} +#endif + + +DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 4) + struct task_struct *NativeThread; + + RT_ASSERT_PREEMPTIBLE(); + + NativeThread = kthread_run(rtThreadNativeMain, pThreadInt, "iprt-%s", pThreadInt->szName); + + if (IS_ERR(NativeThread)) + return VERR_GENERAL_FAILURE; + + *pNativeThread = (RTNATIVETHREAD)NativeThread; + return VINF_SUCCESS; +#else + return VERR_NOT_IMPLEMENTED; +#endif +} diff --git a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c index c0fb357f2..28312e17c 100644 --- a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-linux.c $ */ +/* $Id: time-r0drv-linux.c 33540 2010-10-28 09:27:05Z vboxsync $ */ /** @file * IPRT - Time, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c index efad6b0a8..1d7042838 100644 --- a/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c +++ b/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c @@ -1,4 +1,4 @@ -/* $Id: timer-r0drv-linux.c $ */ +/* $Id: timer-r0drv-linux.c 33603 2010-10-29 12:42:24Z vboxsync $ */ /** @file * IPRT - Timers, Ring-0 Driver, Linux. */ diff --git a/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h b/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h index ba253c680..75c781f9e 100644 --- a/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h +++ b/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h @@ -1,4 +1,4 @@ -/* $Id: waitqueue-r0drv-linux.h $ */ +/* $Id: waitqueue-r0drv-linux.h 33630 2010-10-31 16:00:19Z vboxsync $ */ /** @file * IPRT - Linux Ring-0 Driver Helpers for Abstracting Wait Queues, */ diff --git a/src/VBox/Runtime/r0drv/memobj-r0drv.cpp b/src/VBox/Runtime/r0drv/memobj-r0drv.cpp index 14a4ed4f5..8ec15a27c 100644 --- a/src/VBox/Runtime/r0drv/memobj-r0drv.cpp +++ b/src/VBox/Runtime/r0drv/memobj-r0drv.cpp @@ -1,4 +1,4 @@ -/* $Revision: 67140 $ */ +/* $Revision: 36555 $ */ /** @file * IPRT - Ring-0 Memory Objects, Common Code. */ @@ -54,7 +54,7 @@ * @param pv The memory object mapping. * @param cb The size of the memory object. */ -PRTR0MEMOBJINTERNAL rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *pv, size_t cb) +DECLHIDDEN(PRTR0MEMOBJINTERNAL) rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *pv, size_t cb) { PRTR0MEMOBJINTERNAL pNew; @@ -63,6 +63,7 @@ PRTR0MEMOBJINTERNAL rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *p cbSelf = sizeof(*pNew); Assert(cbSelf >= sizeof(*pNew)); Assert(cbSelf == (uint32_t)cbSelf); + AssertMsg(RT_ALIGN_Z(cb, PAGE_SIZE) == cb, ("%#zx\n", cb)); /* * Allocate and initialize the object. @@ -88,7 +89,7 @@ PRTR0MEMOBJINTERNAL rtR0MemObjNew(size_t cbSelf, RTR0MEMOBJTYPE enmType, void *p * * @param pMem The incomplete memory object to delete. */ -void rtR0MemObjDelete(PRTR0MEMOBJINTERNAL pMem) +DECLHIDDEN(void) rtR0MemObjDelete(PRTR0MEMOBJINTERNAL pMem) { if (pMem) { @@ -225,7 +226,12 @@ RT_EXPORT_SYMBOL(RTR0MemObjAddressR3); /** * Gets the size of a ring-0 memory object. * - * @returns The address of the memory object. + * The returned value may differ from the one specified to the API creating the + * object because of alignment adjustments. The minimal alignment currently + * employed by any API is PAGE_SIZE, so the result can safely be shifted by + * PAGE_SHIFT to calculate a page count. + * + * @returns The object size. * @returns 0 if the handle is invalid (asserts in strict builds) or if there isn't any mapping. * @param MemObj The ring-0 memory object handle. */ @@ -240,6 +246,7 @@ RTR0DECL(size_t) RTR0MemObjSize(RTR0MEMOBJ MemObj) pMem = (PRTR0MEMOBJINTERNAL)MemObj; AssertMsgReturn(pMem->u32Magic == RTR0MEMOBJ_MAGIC, ("%p: %#x\n", pMem, pMem->u32Magic), 0); AssertMsgReturn(pMem->enmType > RTR0MEMOBJTYPE_INVALID && pMem->enmType < RTR0MEMOBJTYPE_END, ("%p: %d\n", pMem, pMem->enmType), 0); + AssertMsg(RT_ALIGN_Z(pMem->cb, PAGE_SIZE) == pMem->cb, ("%#zx\n", pMem->cb)); /* return the size. */ return pMem->cb; diff --git a/src/VBox/Runtime/r0drv/mp-r0drv.h b/src/VBox/Runtime/r0drv/mp-r0drv.h index a32ae5d65..81c4b742a 100644 --- a/src/VBox/Runtime/r0drv/mp-r0drv.h +++ b/src/VBox/Runtime/r0drv/mp-r0drv.h @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv.h $ */ +/* $Id: mp-r0drv.h 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Internal Header. */ @@ -58,13 +58,13 @@ typedef struct RTMPARGS typedef RTMPARGS *PRTMPARGS; /* Called from initterm-r0drv.cpp: */ -int rtR0MpNotificationInit(void); -void rtR0MpNotificationTerm(void); +DECLHIDDEN(int) rtR0MpNotificationInit(void); +DECLHIDDEN(void) rtR0MpNotificationTerm(void); /* The following is only relevant when using mpnotifcation-r0drv.cpp: */ -int rtR0MpNotificationNativeInit(void); -void rtR0MpNotificationNativeTerm(void); -void rtMpNotificationDoCallbacks(RTMPEVENT enmEvent, RTCPUID idCpu); +DECLHIDDEN(int) rtR0MpNotificationNativeInit(void); +DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void); +DECLHIDDEN(void) rtMpNotificationDoCallbacks(RTMPEVENT enmEvent, RTCPUID idCpu); RT_C_DECLS_END diff --git a/src/VBox/Runtime/r0drv/mpnotification-r0drv.c b/src/VBox/Runtime/r0drv/mpnotification-r0drv.c index ea5a3c11a..d9c7a2422 100644 --- a/src/VBox/Runtime/r0drv/mpnotification-r0drv.c +++ b/src/VBox/Runtime/r0drv/mpnotification-r0drv.c @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv.c $ */ +/* $Id: mpnotification-r0drv.c 37211 2011-05-25 11:37:52Z vboxsync $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Event Notifications. */ @@ -89,7 +89,7 @@ static uint32_t volatile g_iRTMpGeneration; * @param idCpu The CPU id the event applies to. * @param enmEvent The event. */ -void rtMpNotificationDoCallbacks(RTMPEVENT enmEvent, RTCPUID idCpu) +DECLHIDDEN(void) rtMpNotificationDoCallbacks(RTMPEVENT enmEvent, RTCPUID idCpu) { PRTMPNOTIFYREG pCur; RTSPINLOCK hSpinlock; @@ -277,7 +277,7 @@ RTDECL(int) RTMpNotificationDeregister(PFNRTMPNOTIFICATION pfnCallback, void *pv RT_EXPORT_SYMBOL(RTMpNotificationDeregister); -int rtR0MpNotificationInit(void) +DECLHIDDEN(int) rtR0MpNotificationInit(void) { int rc = RTSpinlockCreate((PRTSPINLOCK)&g_hRTMpNotifySpinLock); if (RT_SUCCESS(rc)) @@ -293,7 +293,7 @@ int rtR0MpNotificationInit(void) } -void rtR0MpNotificationTerm(void) +DECLHIDDEN(void) rtR0MpNotificationTerm(void) { PRTMPNOTIFYREG pHead; RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; @@ -304,7 +304,7 @@ void rtR0MpNotificationTerm(void) /* pick up the list and the spinlock. */ RTSpinlockAcquire(hSpinlock, &Tmp); - ASMAtomicWriteSize(&g_hRTMpNotifySpinLock, NIL_RTSPINLOCK); + ASMAtomicWriteHandle(&g_hRTMpNotifySpinLock, NIL_RTSPINLOCK); pHead = g_pRTMpCallbackHead; g_pRTMpCallbackHead = NULL; ASMAtomicIncU32(&g_iRTMpGeneration); diff --git a/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp index 95d6a112b..11c5143b3 100644 --- a/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteDebugger-r0drv-nt.cpp $ */ +/* $Id: RTLogWriteDebugger-r0drv-nt.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Log To Debugger, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp index fead7554d..2927d6771 100644 --- a/src/VBox/Runtime/r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/RTTimerGetSystemGranularity-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: RTTimerGetSystemGranularity-r0drv-nt.cpp $ */ +/* $Id: RTTimerGetSystemGranularity-r0drv-nt.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */ /** @file * IPRT - RTTimerGetSystemGranularity, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp index 9f7659a84..9f8e9c16b 100644 --- a/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/alloc-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-nt.cpp $ */ +/* $Id: alloc-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, NT. */ @@ -40,7 +40,7 @@ /** * OS specific allocation function. */ -int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) +DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) { if (fFlags & RTMEMHDR_FLAG_ANY_CTX) return VERR_NOT_SUPPORTED; @@ -61,7 +61,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) /** * OS specific free function. */ -void rtR0MemFree(PRTMEMHDR pHdr) +DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr) { pHdr->u32Magic += 1; ExFreePool(pHdr); diff --git a/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp index 056eabb7d..065ca9d93 100644 --- a/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/assert-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-nt.cpp $ */ +/* $Id: assert-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, NT. */ @@ -37,7 +37,7 @@ #include "internal/assert.h" -void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) +DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) { DbgPrint("\n!!Assertion Failed!!\n" "Expression: %s\n" @@ -46,7 +46,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi } -void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) +DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) { char szMsg[256]; diff --git a/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp index fc885b288..2c5137d65 100644 --- a/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-nt.cpp $ */ +/* $Id: initterm-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Initialization & Termination, R0 Driver, NT. */ @@ -71,7 +71,7 @@ uint32_t g_offrtNtPbDpcQueueDepth; -int rtR0InitNative(void) +DECLHIDDEN(int) rtR0InitNative(void) { /* * Init the Nt cpu set. @@ -263,7 +263,7 @@ int rtR0InitNative(void) } -void rtR0TermNative(void) +DECLHIDDEN(void) rtR0TermNative(void) { } diff --git a/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h b/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h index e04230faf..2d4c85aeb 100644 --- a/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h +++ b/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h @@ -1,4 +1,4 @@ -/* $Id: internal-r0drv-nt.h $ */ +/* $Id: internal-r0drv-nt.h 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Internal Header for the NT Ring-0 Driver Code. */ diff --git a/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp index 4a28cb726..0ffa3b2ba 100644 --- a/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-nt.cpp $ */ +/* $Id: memobj-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Ring-0 Memory Objects, NT. */ @@ -78,7 +78,7 @@ typedef struct RTR0MEMOBJNT } RTR0MEMOBJNT, *PRTR0MEMOBJNT; -int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) +DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) { PRTR0MEMOBJNT pMemNt = (PRTR0MEMOBJNT)pMem; @@ -215,7 +215,7 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) } -int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { AssertMsgReturn(cb <= _1G, ("%#x\n", cb), VERR_OUT_OF_RANGE); /* for safe size_t -> ULONG */ @@ -257,7 +257,7 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu } -int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { AssertMsgReturn(cb <= _1G, ("%#x\n", cb), VERR_OUT_OF_RANGE); /* for safe size_t -> ULONG */ @@ -396,13 +396,13 @@ static int rtR0MemObjNativeAllocContEx(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bo } -int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { return rtR0MemObjNativeAllocContEx(ppMem, cb, fExecutable, _4G-1, PAGE_SIZE /* alignment */); } -int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) { #ifndef IPRT_TARGET_NT4 /* @@ -462,7 +462,7 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph } -int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) { #ifndef IPRT_TARGET_NT4 PHYSICAL_ADDRESS Zero; @@ -494,7 +494,7 @@ int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS } -int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) +DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) { AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED); @@ -640,7 +640,8 @@ static int rtR0MemObjNtLock(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uin } -int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, + RTR0PROCESS R0Process) { AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); /* (Can use MmProbeAndLockProcessPages if we need to mess with other processes later.) */ @@ -648,13 +649,13 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c } -int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) +DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) { return rtR0MemObjNtLock(ppMem, pv, cb, fAccess, NIL_RTR0PROCESS); } -int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) +DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) { /* * MmCreateSection(SEC_RESERVE) + MmMapViewInSystemSpace perhaps? @@ -663,7 +664,8 @@ int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, siz } -int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, + RTR0PROCESS R0Process) { /* * ZeCreateSection(SEC_RESERVE) + ZwMapViewOfSection perhaps? @@ -799,7 +801,7 @@ static int rtR0MemObjNtMap(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, voi } -int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, +DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt, size_t offSub, size_t cbSub) { AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED); @@ -807,14 +809,14 @@ int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, } -int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) { AssertReturn(R0Process == RTR0ProcHandleSelf(), VERR_NOT_SUPPORTED); return rtR0MemObjNtMap(ppMem, pMemToMap, (void *)R3PtrFixed, uAlignment, fProt, R0Process); } -int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) +DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) { NOREF(pMem); NOREF(offSub); @@ -824,7 +826,7 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu } -RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) +DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) { PRTR0MEMOBJNT pMemNt = (PRTR0MEMOBJNT)pMem; diff --git a/src/VBox/Runtime/r0drv/nt/memuserkernel-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/memuserkernel-r0drv-nt.cpp index 9abfd83f5..02f411a8e 100644 --- a/src/VBox/Runtime/r0drv/nt/memuserkernel-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/memuserkernel-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: memuserkernel-r0drv-nt.cpp $ */ +/* $Id: memuserkernel-r0drv-nt.cpp 29705 2010-05-20 15:58:39Z vboxsync $ */ /** @file * IPRT - User & Kernel Memory, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp index fb7287720..da1dcae96 100644 --- a/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-nt.cpp $ */ +/* $Id: mp-r0drv-nt.cpp 37379 2011-06-08 14:21:34Z vboxsync $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, NT. */ @@ -344,11 +344,13 @@ static VOID rtMpNtPokeCpuDummy(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID #ifndef IPRT_TARGET_NT4 -ULONG_PTR rtMpIpiGenericCall(ULONG_PTR Argument) +ULONG_PTR rtMpIpiGenericCall(ULONG_PTR Argument) { + NOREF(Argument); return 0; } + int rtMpSendIpiVista(RTCPUID idCpu) { g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0); @@ -356,19 +358,23 @@ int rtMpSendIpiVista(RTCPUID idCpu) return VINF_SUCCESS; } + int rtMpSendIpiWin7(RTCPUID idCpu) { g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0); //// g_pfnrtNtHalSendSoftwareInterrupt(idCpu, DISPATCH_LEVEL); return VINF_SUCCESS; } + #endif /* IPRT_TARGET_NT4 */ + int rtMpSendIpiDummy(RTCPUID idCpu) { return VERR_NOT_IMPLEMENTED; } + RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) { if (!RTMpIsCpuOnline(idCpu)) diff --git a/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp index 5e7532447..629e1857a 100644 --- a/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/mpnotification-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv-nt.cpp $ */ +/* $Id: mpnotification-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Multiprocessor Event Notifications, Ring-0 Driver, NT. */ @@ -124,7 +124,7 @@ static VOID __stdcall rtMpNotificationNtCallback(PVOID pvUser, } -int rtR0MpNotificationNativeInit(void) +DECLHIDDEN(int) rtR0MpNotificationNativeInit(void) { /* * Try resolve the symbols. @@ -163,7 +163,7 @@ int rtR0MpNotificationNativeInit(void) } -void rtR0MpNotificationNativeTerm(void) +DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void) { if ( g_pfnKeDeregisterProcessorChangeCallback && g_hCallback) @@ -175,12 +175,12 @@ void rtR0MpNotificationNativeTerm(void) #else /* Not supported */ -int rtR0MpNotificationNativeInit(void) +DECLHIDDEN(int) rtR0MpNotificationNativeInit(void) { return VINF_SUCCESS; } -void rtR0MpNotificationNativeTerm(void) +DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void) { } diff --git a/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp index 934887659..30e5be609 100644 --- a/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-nt.cpp $ */ +/* $Id: process-r0drv-nt.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Process, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp index 8cda329eb..fb64eeb1b 100644 --- a/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/semevent-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-nt.cpp $ */ +/* $Id: semevent-r0drv-nt.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Single Release Event Semaphores, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp index 50830f754..8da0899b7 100644 --- a/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/semeventmulti-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-nt.cpp $ */ +/* $Id: semeventmulti-r0drv-nt.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp index bd3efc87c..62d7bc0b2 100644 --- a/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/semfastmutex-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-r0drv-nt.cpp $ */ +/* $Id: semfastmutex-r0drv-nt.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp index 71e02e35c..f3b1cc21b 100644 --- a/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/semmutex-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: semmutex-r0drv-nt.cpp $ */ +/* $Id: semmutex-r0drv-nt.cpp 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Mutex Semaphores, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp index 1dc11be23..8f9fdcf65 100644 --- a/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-nt.cpp $ */ +/* $Id: spinlock-r0drv-nt.cpp 32463 2010-09-14 07:30:11Z vboxsync $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h b/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h index 3da03794c..ada6354e3 100644 --- a/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h +++ b/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-nt-kernel.h $ */ +/* $Id: the-nt-kernel.h 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Include all necessary headers for the NT kernel. */ diff --git a/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp index f120040fa..36a6ea25a 100644 --- a/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/thread-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-nt.cpp $ */ +/* $Id: thread-r0drv-nt.cpp 30359 2010-06-22 09:21:33Z vboxsync $ */ /** @file * IPRT - Threads, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp index 03a3ffe0e..e9361862c 100644 --- a/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-nt.cpp $ */ +/* $Id: thread2-r0drv-nt.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, NT. */ @@ -36,7 +36,7 @@ #include "internal/thread.h" -int rtThreadNativeInit(void) +DECLHIDDEN(int) rtThreadNativeInit(void) { /* No TLS in Ring-0. :-/ */ return VINF_SUCCESS; @@ -49,7 +49,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void) } -int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) +DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) { /* * Convert the IPRT priority type to NT priority. @@ -81,13 +81,13 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) } -int rtThreadNativeAdopt(PRTTHREADINT pThread) +DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread) { return VERR_NOT_IMPLEMENTED; } -void rtThreadNativeDestroy(PRTTHREADINT pThread) +DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread) { NOREF(pThread); } @@ -111,7 +111,7 @@ static VOID __stdcall rtThreadNativeMain(PVOID pvArg) } -int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) +DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) { /* * PsCreateSysemThread create a thread an give us a handle in return. diff --git a/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp index 965f2cbb9..9545caa23 100644 --- a/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-nt.cpp $ */ +/* $Id: time-r0drv-nt.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Time, Ring-0 Driver, Nt. */ diff --git a/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp index 4f7c82db4..44aa52f46 100644 --- a/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp +++ b/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp @@ -1,4 +1,4 @@ -/* $Id: timer-r0drv-nt.cpp $ */ +/* $Id: timer-r0drv-nt.cpp 33155 2010-10-15 12:07:44Z vboxsync $ */ /** @file * IPRT - Timers, Ring-0 Driver, NT. */ diff --git a/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm b/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm index 17e370520..dedefeb81 100644 --- a/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm +++ b/src/VBox/Runtime/r0drv/os2/RTR0AssertPanicSystem-r0drv-os2.asm @@ -1,4 +1,4 @@ -; $Id: RTR0AssertPanicSystem-r0drv-os2.asm $ +; $Id: RTR0AssertPanicSystem-r0drv-os2.asm 13306 2008-10-15 21:17:04Z vboxsync $ ;; @file ; IPRT - RTR0AssertPanicSystem, Ring-0 Driver, OS/2. ; diff --git a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm index e0c94b7f2..2ad429f45 100644 --- a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm +++ b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHQueryDOSVar.asm @@ -1,4 +1,4 @@ -; $Id: RTR0Os2DHQueryDOSVar.asm $ +; $Id: RTR0Os2DHQueryDOSVar.asm 8256 2008-04-21 20:53:28Z vboxsync $ ;; @file ; IPRT - DevHelp_GetDOSVar, Ring-0 Driver, OS/2. ; diff --git a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm index e1b44d42b..82e221123 100644 --- a/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm +++ b/src/VBox/Runtime/r0drv/os2/RTR0Os2DHVMGlobalToProcess.asm @@ -1,4 +1,4 @@ -; $Id: RTR0Os2DHVMGlobalToProcess.asm $ +; $Id: RTR0Os2DHVMGlobalToProcess.asm 8256 2008-04-21 20:53:28Z vboxsync $ ;; @file ; IPRT - DevHelp_VMGlobalToProcess, Ring-0 Driver, OS/2. ; diff --git a/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp index 53da24771..c29724032 100644 --- a/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/alloc-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-os2.cpp $ */ +/* $Id: alloc-r0drv-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, OS/2. */ @@ -42,7 +42,7 @@ #include "r0drv/alloc-r0drv.h" /** @todo drop the r0drv/alloc-r0drv.cpp stuff on OS/2? */ -int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) +DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) { if (fFlags & RTMEMHDR_FLAG_ANY_CTX) return VERR_NOT_SUPPORTED; @@ -62,7 +62,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) } -void rtR0MemFree(PRTMEMHDR pHdr) +DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr) { pHdr->u32Magic += 1; APIRET rc = KernVMFree(pHdr); diff --git a/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp index c3b1a5e00..6eacf9d9a 100644 --- a/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/assert-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-os2.cpp $ */ +/* $Id: assert-r0drv-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, OS/2. */ @@ -57,7 +57,7 @@ extern size_t g_cchRTAssertMsg; static DECLCALLBACK(size_t) rtR0Os2AssertOutputCB(void *pvArg, const char *pachChars, size_t cbChars); -void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) +DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) { #if defined(DEBUG_bird) RTLogComPrintf("\n!!Assertion Failed!!\n" @@ -74,7 +74,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi } -void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) +DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) { #if defined(DEBUG_bird) va_list vaCopy; diff --git a/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm b/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm index 0e0808aab..4da5eea74 100644 --- a/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm +++ b/src/VBox/Runtime/r0drv/os2/assertA-r0drv-os2.asm @@ -1,4 +1,4 @@ -; $Id: assertA-r0drv-os2.asm $ +; $Id: assertA-r0drv-os2.asm 8256 2008-04-21 20:53:28Z vboxsync $ ;; @file ; IPRT - DevHelp_GetDOSVar, Ring-0 Driver, OS/2. ; diff --git a/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp index 9a1872a81..6cd80245e 100644 --- a/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/initterm-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-os2.cpp $ */ +/* $Id: initterm-r0drv-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Initialization & Termination, Ring-0 Driver, OS/2. */ @@ -54,7 +54,7 @@ PGINFOSEG g_pGIS = NULL; RTFAR16 g_fpLIS = {0, 0}; -int rtR0InitNative(void) +DECLHIDDEN(int) rtR0InitNative(void) { /* * Get the DOS Tables. @@ -80,7 +80,7 @@ int rtR0InitNative(void) } -void rtR0TermNative(void) +DECLHIDDEN(void) rtR0TermNative(void) { /* nothing to do here yet. */ } diff --git a/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp index 9dfdae72c..21dd2fe19 100644 --- a/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-os2.cpp $ */ +/* $Id: memobj-r0drv-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Ring-0 Memory Objects, OS/2. */ @@ -69,7 +69,7 @@ typedef struct RTR0MEMOBJDARWIN static void rtR0MemObjFixPageList(KernPageList_t *paPages, ULONG cPages, ULONG cPagesRet); -int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) +DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) { PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)pMem; int rc; @@ -112,7 +112,7 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) } -int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { NOREF(fExecutable); @@ -141,7 +141,7 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu } -int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { NOREF(fExecutable); @@ -170,7 +170,7 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut } -int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { NOREF(fExecutable); @@ -194,7 +194,7 @@ int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu } -int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) { AssertMsgReturn(PhysHighest >= 16 *_1M, ("PhysHigest=%RHp\n", PhysHighest), VERR_NOT_SUPPORTED); @@ -223,14 +223,14 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph } -int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) { /** @todo rtR0MemObjNativeAllocPhys / darwin. */ return rtR0MemObjNativeAllocPhys(ppMem, cb, PhysHighest, PAGE_SIZE); } -int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) +DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) { AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED); @@ -248,7 +248,8 @@ int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t } -int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, + RTR0PROCESS R0Process) { AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); @@ -276,7 +277,7 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c } -int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) +DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) { /* create the object. */ const ULONG cPages = cb >> PAGE_SHIFT; @@ -300,20 +301,21 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, } -int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) +DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) { return VERR_NOT_SUPPORTED; } -int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, + RTR0PROCESS R0Process) { return VERR_NOT_SUPPORTED; } -int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, - unsigned fProt, size_t offSub, size_t cbSub) +DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, + unsigned fProt, size_t offSub, size_t cbSub) { AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED); AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED); @@ -393,7 +395,7 @@ int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, } -int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) { AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED); @@ -483,7 +485,7 @@ int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RT } -int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) +DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) { NOREF(pMem); NOREF(offSub); @@ -493,7 +495,7 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu } -RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) +DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) { PRTR0MEMOBJOS2 pMemOs2 = (PRTR0MEMOBJOS2)pMem; diff --git a/src/VBox/Runtime/r0drv/os2/memuserkernel-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/memuserkernel-r0drv-os2.cpp index 888b5409a..fd742f134 100644 --- a/src/VBox/Runtime/r0drv/os2/memuserkernel-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/memuserkernel-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: memuserkernel-r0drv-os2.cpp $ */ +/* $Id: memuserkernel-r0drv-os2.cpp 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - User & Kernel Memory, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp index a05d0617e..eac1e4624 100644 --- a/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/process-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-os2.cpp $ */ +/* $Id: process-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ /** @file * IPRT - Process Management, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp index 74aaa2d26..5da10059b 100644 --- a/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/semevent-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-os2.cpp $ */ +/* $Id: semevent-r0drv-os2.cpp 33269 2010-10-20 15:42:28Z vboxsync $ */ /** @file * IPRT - Single Release Event Semaphores, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp index fb05a5007..0ef07282e 100644 --- a/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/semeventmulti-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-os2.cpp $ */ +/* $Id: semeventmulti-r0drv-os2.cpp 33155 2010-10-15 12:07:44Z vboxsync $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp index d2edff5e8..caf6ddc7a 100644 --- a/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/semfastmutex-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-r0drv-os2.cpp $ */ +/* $Id: semfastmutex-r0drv-os2.cpp 25722 2010-01-11 14:22:03Z vboxsync $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp index e239f766a..d2b7b5fc2 100644 --- a/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-os2.cpp $ */ +/* $Id: spinlock-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h b/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h index 2057b50bb..f08bd11bf 100644 --- a/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h +++ b/src/VBox/Runtime/r0drv/os2/the-os2-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-os2-kernel.h $ */ +/* $Id: the-os2-kernel.h 20374 2009-06-08 00:43:21Z vboxsync $ */ /** @file * IPRT - Ring-0 Driver, The OS/2 Kernel Headers. */ diff --git a/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp index 64c5308a2..bc68b7af0 100644 --- a/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/thread-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-os2.cpp $ */ +/* $Id: thread-r0drv-os2.cpp 33393 2010-10-24 16:17:00Z vboxsync $ */ /** @file * IPRT - Threads (Part 1), Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp index 29a7c94be..2e209860c 100644 --- a/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-os2.cpp $ */ +/* $Id: thread2-r0drv-os2.cpp 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, Generic Stubs. */ @@ -38,7 +38,7 @@ #include "internal/thread.h" -int rtThreadNativeInit(void) +DECLHIDDEN(int) rtThreadNativeInit(void) { return VINF_SUCCESS; } @@ -50,7 +50,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void) } -int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) +DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) { NOREF(pThread); NOREF(enmType); @@ -58,20 +58,20 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) } -int rtThreadNativeAdopt(PRTTHREADINT pThread) +DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread) { NOREF(pThread); return VERR_NOT_IMPLEMENTED; } -void rtThreadNativeDestroy(PRTTHREADINT pThread) +DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread) { NOREF(pThread); } -int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) +DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) { NOREF(pNativeThread); NOREF(pThreadInt); diff --git a/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp index 778ee2b0a..ab4bf1b9a 100644 --- a/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/time-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-os2.cpp $ */ +/* $Id: time-r0drv-os2.cpp 8245 2008-04-21 17:24:28Z vboxsync $ */ /** @file * IPRT - Time, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp index ba68fd127..e2d023352 100644 --- a/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp +++ b/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp @@ -1,4 +1,4 @@ -/* $Id: timer-r0drv-os2.cpp $ */ +/* $Id: timer-r0drv-os2.cpp 33540 2010-10-28 09:27:05Z vboxsync $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, OS/2. */ diff --git a/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm b/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm index 474f85767..788bcc907 100644 --- a/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm +++ b/src/VBox/Runtime/r0drv/os2/timerA-r0drv-os2.asm @@ -1,4 +1,4 @@ -; $Id: timerA-r0drv-os2.asm $ +; $Id: timerA-r0drv-os2.asm 8256 2008-04-21 20:53:28Z vboxsync $ ;; @file ; IPRT - DevHelp_VMGlobalToProcess, Ring-0 Driver, OS/2. ; diff --git a/src/VBox/Runtime/r0drv/power-r0drv.h b/src/VBox/Runtime/r0drv/power-r0drv.h index 11f5493be..7dacbc91e 100644 --- a/src/VBox/Runtime/r0drv/power-r0drv.h +++ b/src/VBox/Runtime/r0drv/power-r0drv.h @@ -1,4 +1,4 @@ -/* $Id: power-r0drv.h $ */ +/* $Id: power-r0drv.h 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Power Management, Ring-0 Driver, Internal Header. */ @@ -32,8 +32,8 @@ RT_C_DECLS_BEGIN /* Called from initterm-r0drv.cpp: */ -int rtR0PowerNotificationInit(void); -void rtR0PowerNotificationTerm(void); +DECLHIDDEN(int) rtR0PowerNotificationInit(void); +DECLHIDDEN(void) rtR0PowerNotificationTerm(void); RT_C_DECLS_END diff --git a/src/VBox/Runtime/r0drv/powernotification-r0drv.c b/src/VBox/Runtime/r0drv/powernotification-r0drv.c index 9e03da213..4ef59ef46 100644 --- a/src/VBox/Runtime/r0drv/powernotification-r0drv.c +++ b/src/VBox/Runtime/r0drv/powernotification-r0drv.c @@ -1,4 +1,4 @@ -/* $Id: powernotification-r0drv.c $ */ +/* $Id: powernotification-r0drv.c 37211 2011-05-25 11:37:52Z vboxsync $ */ /** @file * IPRT - Power Management, Ring-0 Driver, Event Notifications. */ @@ -273,7 +273,7 @@ RTDECL(int) RTPowerNotificationDeregister(PFNRTPOWERNOTIFICATION pfnCallback, vo RT_EXPORT_SYMBOL(RTPowerNotificationDeregister); -int rtR0PowerNotificationInit(void) +DECLHIDDEN(int) rtR0PowerNotificationInit(void) { int rc = RTSpinlockCreate((PRTSPINLOCK)&g_hRTPowerNotifySpinLock); if (RT_SUCCESS(rc)) @@ -289,7 +289,7 @@ int rtR0PowerNotificationInit(void) } -void rtR0PowerNotificationTerm(void) +DECLHIDDEN(void) rtR0PowerNotificationTerm(void) { PRTPOWERNOTIFYREG pHead; RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; @@ -300,7 +300,7 @@ void rtR0PowerNotificationTerm(void) /* pick up the list and the spinlock. */ RTSpinlockAcquire(hSpinlock, &Tmp); - ASMAtomicWriteSize(&g_hRTPowerNotifySpinLock, NIL_RTSPINLOCK); + ASMAtomicWriteHandle(&g_hRTPowerNotifySpinLock, NIL_RTSPINLOCK); pHead = g_pRTPowerCallbackHead; g_pRTPowerCallbackHead = NULL; ASMAtomicIncU32(&g_iRTPowerGeneration); diff --git a/src/VBox/Runtime/r0drv/solaris/RTLogWriteDebugger-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/RTLogWriteDebugger-r0drv-solaris.c index 5aa03da81..86b07c181 100644 --- a/src/VBox/Runtime/r0drv/solaris/RTLogWriteDebugger-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/RTLogWriteDebugger-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: RTLogWriteDebugger-r0drv-solaris.c $ */ +/* $Id: RTLogWriteDebugger-r0drv-solaris.c 29281 2010-05-09 23:40:43Z vboxsync $ */ /** @file * IPRT - Log To Debugger, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c index 55befdcaf..7c1876f9e 100644 --- a/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/assert-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: assert-r0drv-solaris.c $ */ +/* $Id: assert-r0drv-solaris.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Assertion Workers, Ring-0 Drivers, Solaris. */ @@ -40,7 +40,7 @@ #include "internal/assert.h" -void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) +DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) { uprintf("\r\n!!Assertion Failed!!\r\n" "Expression: %s\r\n" @@ -49,7 +49,7 @@ void rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFi } -void rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) +DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va) { char szMsg[256]; diff --git a/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c index fce305c06..fec13e31b 100644 --- a/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: initterm-r0drv-solaris.c $ */ +/* $Id: initterm-r0drv-solaris.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Initialization & Termination, R0 Driver, Solaris. */ @@ -53,7 +53,7 @@ PFNSOL_untimeout_generic g_pfnrtR0Sol_untimeout_generic = NULL; PFNSOL_cyclic_reprogram g_pfnrtR0Sol_cyclic_reprogram = NULL; -int rtR0InitNative(void) +DECLHIDDEN(int) rtR0InitNative(void) { /* * Initialize vbi (keeping it separate for now) @@ -102,7 +102,7 @@ int rtR0InitNative(void) } -void rtR0TermNative(void) +DECLHIDDEN(void) rtR0TermNative(void) { } diff --git a/src/VBox/Runtime/r0drv/solaris/memuserkernel-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/memuserkernel-r0drv-solaris.c index 11b24bd7a..88d50e4d1 100644 --- a/src/VBox/Runtime/r0drv/solaris/memuserkernel-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/memuserkernel-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: memuserkernel-r0drv-solaris.c $ */ +/* $Id: memuserkernel-r0drv-solaris.c 29284 2010-05-10 00:22:16Z vboxsync $ */ /** @file * IPRT - User & Kernel Memory, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c new file mode 100644 index 000000000..b3a171a23 --- /dev/null +++ b/src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c @@ -0,0 +1,55 @@ + + + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#include <sys/modctl.h> + + +/******************************************************************************* +* Global Variables * +*******************************************************************************/ +static struct modlmisc g_rtModuleStubMisc = +{ + &mod_miscops, /* extern from kernel */ + "platform agnostic module" +}; + + +static struct modlinkage g_rtModuleStubModLinkage = +{ + MODREV_1, /* loadable module system revision */ + { + &g_rtModuleStubMisc, + NULL /* terminate array of linkage structures */ + } +}; + + + +int _init(void); +int _init(void) +{ + /* Disable auto unloading. */ + modctl_t *pModCtl = mod_getctl(&g_rtModuleStubModLinkage); + if (pModCtl) + pModCtl->mod_loadflags |= MOD_NOAUTOUNLOAD; + + return mod_install(&g_rtModuleStubModLinkage); +} + + +int _fini(void); +int _fini(void) +{ + return mod_remove(&g_rtModuleStubModLinkage); +} + + +int _info(struct modinfo *pModInfo); +int _info(struct modinfo *pModInfo) +{ + return mod_info(&g_rtModuleStubModLinkage, pModInfo); +} + diff --git a/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c deleted file mode 100644 index 1b5c736cf..000000000 --- a/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c +++ /dev/null @@ -1,83 +0,0 @@ -/* $Id: mpnotification-r0drv-solaris.c $ */ -/** @file - * IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Solaris. - */ - -/* - * Copyright (C) 2008 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * - * The contents of this file may alternatively be used under the terms - * of the Common Development and Distribution License Version 1.0 - * (CDDL) only, as it comes in the "COPYING.CDDL" file of the - * VirtualBox OSE distribution, in which case the provisions of the - * CDDL are applicable instead of those of the GPL. - * - * You may elect to license modified versions of this file under the - * terms and conditions of either the GPL or the CDDL or both. - */ - - -/******************************************************************************* -* Header Files * -*******************************************************************************/ -#include "the-solaris-kernel.h" -#include "internal/iprt.h" -#include <iprt/mp.h> - -#include <iprt/err.h> -#include "r0drv/mp-r0drv.h" - - -static int rtMpNotificationSolarisCallback(cpu_setup_t enmSolarisEvent, int iCpu, void *pvUser) -{ - NOREF(pvUser); - - /* ASSUMES iCpu == RTCPUID */ - switch (enmSolarisEvent) - { - case CPU_INIT: - case CPU_CONFIG: - case CPU_UNCONFIG: - break; - - case CPU_ON: - rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, iCpu); - break; - - case CPU_OFF: - rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, iCpu); - break; - - case CPU_CPUPART_IN: - case CPU_CPUPART_OUT: - /** @todo are these relevant? */ - break; - } - return 0; -} - - -int rtR0MpNotificationNativeInit(void) -{ - mutex_enter(&cpu_lock); - register_cpu_setup_func(rtMpNotificationSolarisCallback, NULL); - mutex_exit(&cpu_lock); - return VINF_SUCCESS; -} - - -void rtR0MpNotificationNativeTerm(void) -{ - mutex_enter(&cpu_lock); - unregister_cpu_setup_func(rtMpNotificationSolarisCallback, NULL); - mutex_exit(&cpu_lock); -} - diff --git a/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c index b8921218f..9431c915a 100644 --- a/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/semevent-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: semevent-r0drv-solaris.c $ */ +/* $Id: semevent-r0drv-solaris.c 36392 2011-03-24 11:20:37Z vboxsync $ */ /** @file * IPRT - Single Release Event Semaphores, Ring-0 Driver, Solaris. */ @@ -131,6 +131,7 @@ DECLINLINE(void) rtR0SemEventSolRetain(PRTSEMEVENTINTERNAL pThis) { uint32_t cRefs = ASMAtomicIncU32(&pThis->cRefs); Assert(cRefs && cRefs < 100000); + NOREF(cRefs); } diff --git a/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c index 6f7fc5ca7..011369fae 100644 --- a/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: semeventmulti-r0drv-solaris.c $ */ +/* $Id: semeventmulti-r0drv-solaris.c 36392 2011-03-24 11:20:37Z vboxsync $ */ /** @file * IPRT - Multiple Release Event Semaphores, Ring-0 Driver, Solaris. */ @@ -129,6 +129,7 @@ DECLINLINE(void) rtR0SemEventMultiSolRetain(PRTSEMEVENTMULTIINTERNAL pThis) { uint32_t cRefs = ASMAtomicIncU32(&pThis->cRefs); Assert(cRefs && cRefs < 100000); + NOREF(cRefs); } diff --git a/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h b/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h index 45fd29aac..d06b26bf0 100644 --- a/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h +++ b/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h @@ -1,4 +1,4 @@ -/* $Id: semeventwait-r0drv-solaris.h $ */ +/* $Id: semeventwait-r0drv-solaris.h 36392 2011-03-24 11:20:37Z vboxsync $ */ /** @file * IPRT - Solaris Ring-0 Driver Helpers for Event Semaphore Waits. */ diff --git a/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c index baeaec2f5..ef0f5b602 100644 --- a/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/semfastmutex-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: semfastmutex-r0drv-solaris.c $ */ +/* $Id: semfastmutex-r0drv-solaris.c 29284 2010-05-10 00:22:16Z vboxsync $ */ /** @file * IPRT - Fast Mutex Semaphores, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/semmutex-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/semmutex-r0drv-solaris.c index 8394c4d3c..65802fe1a 100644 --- a/src/VBox/Runtime/r0drv/solaris/semmutex-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/semmutex-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: semmutex-r0drv-solaris.c $ */ +/* $Id: semmutex-r0drv-solaris.c 36190 2011-03-07 16:28:50Z vboxsync $ */ /** @file * IPRT - Mutex Semaphores, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c index a66e63b3c..1b37be6b3 100644 --- a/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: spinlock-r0drv-solaris.c $ */ +/* $Id: spinlock-r0drv-solaris.c 29281 2010-05-09 23:40:43Z vboxsync $ */ /** @file * IPRT - Spinlocks, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h b/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h index 7dd607f03..aab14e8fe 100644 --- a/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h +++ b/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h @@ -1,4 +1,4 @@ -/* $Id: the-solaris-kernel.h $ */ +/* $Id: the-solaris-kernel.h 33149 2010-10-15 11:26:24Z vboxsync $ */ /** @file * IPRT - Include all necessary headers for the Solaris kernel. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c index 524236571..2dad122b2 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/RTMpPokeCpu-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: RTMpPokeCpu-r0drv-solaris.c $ */ +/* $Id: RTMpPokeCpu-r0drv-solaris.c 29300 2010-05-10 12:30:43Z vboxsync $ */ /** @file * IPRT - RTMpPokeCpu, Solaris Implementation. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c index e6ee0f1a6..2ab6aba0b 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/alloc-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: alloc-r0drv-solaris.c $ */ +/* $Id: alloc-r0drv-solaris.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Memory Allocation, Ring-0 Driver, Solaris. */ @@ -44,7 +44,7 @@ /** * OS specific allocation function. */ -int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) +DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) { size_t cbAllocated = cb; PRTMEMHDR pHdr; @@ -84,7 +84,7 @@ int rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr) /** * OS specific free function. */ -void rtR0MemFree(PRTMEMHDR pHdr) +DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr) { pHdr->u32Magic += 1; #ifdef RT_ARCH_AMD64 diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c index 4f0304222..69278261d 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010-2011 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -56,6 +56,9 @@ #include <sys/modctl.h> #include <sys/machparam.h> #include <sys/utsname.h> +#include <sys/ctf_api.h> + +#include <iprt/assert.h> #include "vbi.h" @@ -75,7 +78,7 @@ static void (*p_contig_free)(void *, size_t) = contig_free; */ /* Introduced in v9 */ static int use_kflt = 0; -page_t *vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr); +static page_t *vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr, size_t pgsize); /* @@ -141,40 +144,6 @@ static int vbi_verbose = 0; /* Introduced in v8 */ static int vbi_is_initialized = 0; -/* Introduced in v6 */ -static int vbi_is_nevada = 0; - -#ifdef _LP64 -/* 64-bit Solaris 10 offsets */ -/* CPU */ -static int off_s10_cpu_runrun = 232; -static int off_s10_cpu_kprunrun = 233; -/* kthread_t */ -static int off_s10_t_preempt = 42; - -/* 64-bit Solaris 11 (Nevada/OpenSolaris) offsets */ -/* CPU */ -static int off_s11_cpu_runrun = 216; -static int off_s11_cpu_kprunrun = 217; -/* kthread_t */ -static int off_s11_t_preempt = 42; -#else -/* 32-bit Solaris 10 offsets */ -/* CPU */ -static int off_s10_cpu_runrun = 124; -static int off_s10_cpu_kprunrun = 125; -/* kthread_t */ -static int off_s10_t_preempt = 26; - -/* 32-bit Solaris 11 (Nevada/OpenSolaris) offsets */ -/* CPU */ -static int off_s11_cpu_runrun = 112; -static int off_s11_cpu_kprunrun = 113; -/* kthread_t */ -static int off_s11_t_preempt = 26; -#endif - - /* Which offsets will be used */ static int off_cpu_runrun = -1; static int off_cpu_kprunrun = -1; @@ -213,6 +182,35 @@ _init(void) } #endif +static int +vbi_get_ctf_member_offset(ctf_file_t *ctfp, const char *structname, const char *membername, int *offset) +{ + AssertReturn(ctfp, CTF_ERR); + AssertReturn(structname, CTF_ERR); + AssertReturn(membername, CTF_ERR); + AssertReturn(offset, CTF_ERR); + + ctf_id_t typeident = ctf_lookup_by_name(ctfp, structname); + if (typeident != CTF_ERR) + { + ctf_membinfo_t memberinfo; + bzero(&memberinfo, sizeof(memberinfo)); + if (ctf_member_info(ctfp, typeident, membername, &memberinfo) != CTF_ERR) + { + *offset = (memberinfo.ctm_offset >> 3); + cmn_err(CE_NOTE, "%s::%s at %d\n", structname, membername, *offset); + return (0); + } + else + cmn_err(CE_NOTE, "ctf_member_info failed for struct %s member %s\n", structname, membername); + } + else + cmn_err(CE_NOTE, "ctf_lookup_by_name failed for struct %s\n", structname); + + return (CTF_ERR); +} + + int vbi_init(void) { @@ -247,7 +245,7 @@ vbi_init(void) p_contig_free = (void (*)(void *, size_t)) kobj_getsymvalue("contig_free", 1); if (p_contig_free == NULL) { - cmn_err(CE_NOTE, " contig_free() not found in kernel\n"); + cmn_err(CE_NOTE, "contig_free() not found in kernel\n"); return (EINVAL); } } @@ -266,44 +264,33 @@ vbi_init(void) } } - /* - * Check if this is S10 or Nevada + * CTF probing for fluid, private members. */ - if (!strncmp(utsname.release, "5.11", sizeof("5.11") - 1)) { - /* Nevada detected... */ - vbi_is_nevada = 1; - - off_cpu_runrun = off_s11_cpu_runrun; - off_cpu_kprunrun = off_s11_cpu_kprunrun; - off_t_preempt = off_s11_t_preempt; - } else { - /* Solaris 10 detected... */ - vbi_is_nevada = 0; + int err = 0; + modctl_t *genunix_modctl = mod_hold_by_name("genunix"); + if (genunix_modctl) + { + ctf_file_t *ctfp = ctf_modopen(genunix_modctl->mod_mp, &err); + if (ctfp) + { + do { + err = vbi_get_ctf_member_offset(ctfp, "kthread_t", "t_preempt", &off_t_preempt); AssertBreak(!err); + err = vbi_get_ctf_member_offset(ctfp, "cpu_t", "cpu_runrun", &off_cpu_runrun); AssertBreak(!err); + err = vbi_get_ctf_member_offset(ctfp, "cpu_t", "cpu_kprunrun", &off_cpu_kprunrun); AssertBreak(!err); + } while (0); + } - off_cpu_runrun = off_s10_cpu_runrun; - off_cpu_kprunrun = off_s10_cpu_kprunrun; - off_t_preempt = off_s10_t_preempt; + mod_release_mod(genunix_modctl); } - - /* - * Sanity checking... - */ - /* CPU */ - char crr = VBI_CPU_RUNRUN; - char krr = VBI_CPU_KPRUNRUN; - if ( (crr < 0 || crr > 1) - || (krr < 0 || krr > 1)) { - cmn_err(CE_NOTE, ":CPU structure sanity check failed! OS version mismatch.\n"); - return EINVAL; + else + { + cmn_err(CE_NOTE, "failed to open module genunix.\n"); + err = EINVAL; } - /* Thread */ - char t_preempt = VBI_T_PREEMPT; - if (t_preempt < 0 || t_preempt > 32) { - cmn_err(CE_NOTE, ":Thread structure sanity check failed! OS version mismatch.\n"); - return EINVAL; - } + if (err) + return (EINVAL); vbi_is_initialized = 1; @@ -366,7 +353,7 @@ vbi_internal_alloc(uint64_t *phys, size_t size, uint64_t alignment, int contig) ptr = contig_alloc(size, &attr, PAGESIZE, 1); if (ptr == NULL) { - cmn_err(CE_NOTE, "vbi_internal_alloc() failure for %lu bytes", size); + cmn_err(CE_NOTE, "vbi_internal_alloc() failure for %lu bytes contig=%d", size, contig); return (NULL); } @@ -561,7 +548,7 @@ vbi_set_priority(void *thread, int priority) } void * -vbi_thread_create(void *func, void *arg, size_t len, int priority) +vbi_thread_create(void (*func)(void *), void *arg, size_t len, int priority) { kthread_t *t; @@ -1012,9 +999,7 @@ vbi_user_map(caddr_t *va, uint_t prot, uint64_t *palist, size_t len) as_rangelock(as); map_addr(va, len, 0, 0, MAP_SHARED); if (*va != NULL) - { error = as_map(as, *va, len, segvbi_create, &args); - } else error = ENOMEM; if (error) @@ -1029,7 +1014,7 @@ vbi_user_map(caddr_t *va, uint_t prot, uint64_t *palist, size_t len) */ struct vbi_cpu_watch { - void (*vbi_cpu_func)(); + void (*vbi_cpu_func)(void *, int, int); void *vbi_cpu_arg; }; @@ -1050,7 +1035,7 @@ vbi_watcher(cpu_setup_t state, int icpu, void *arg) } vbi_cpu_watch_t * -vbi_watch_cpus(void (*func)(), void *arg, int current_too) +vbi_watch_cpus(void (*func)(void *, int, int), void *arg, int current_too) { int c; vbi_cpu_watch_t *w; @@ -1210,7 +1195,7 @@ vbi_gtimer_begin( t->g_func = func; t->g_cyclic = CYCLIC_NONE; - omni.cyo_online = (void (*)())vbi_gtimer_online; + omni.cyo_online = (void (*)(void *, cpu_t *, cyc_handler_t *, cyc_time_t *))vbi_gtimer_online; omni.cyo_offline = NULL; omni.cyo_arg = t; @@ -1332,11 +1317,11 @@ vbi_pages_alloc(uint64_t *phys, size_t size) for (int64_t i = 0; i < npages; i++, virtAddr += PAGESIZE) { /* get a page from the freelists */ - page_t *ppage = vbi_page_get_fromlist(1 /* freelist */, virtAddr); + page_t *ppage = vbi_page_get_fromlist(1 /* freelist */, virtAddr, PAGESIZE); if (!ppage) { /* try from the cachelists */ - ppage = vbi_page_get_fromlist(2 /* cachelist */, virtAddr); + ppage = vbi_page_get_fromlist(2 /* cachelist */, virtAddr, PAGESIZE); if (!ppage) { /* damn */ @@ -1433,25 +1418,21 @@ vbi_page_to_pa(page_t **pp_pages, pgcnt_t i) } -/* - * This is revision 9 of the interface. - */ -page_t *vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr) +static page_t * +vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr, size_t pgsize) { + /* pgsize only applies when using the freelist */ seg_t kernseg; kernseg.s_as = &kas; page_t *ppage = NULL; if (freelist == 1) { ppage = page_get_freelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr, - PAGESIZE, 0 /* flags */, NULL /* local group */); - if (!ppage) + pgsize, 0 /* flags */, NULL /* local group */); + if (!ppage && use_kflt) { - if (use_kflt) - { - ppage = page_get_freelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr, - PAGESIZE, 0x0200 /* PG_KFLT */, NULL /* local group */); - } + ppage = page_get_freelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr, + pgsize, 0x0200 /* PG_KFLT */, NULL /* local group */); } } else @@ -1459,13 +1440,10 @@ page_t *vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr) /* cachelist */ ppage = page_get_cachelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr, 0 /* flags */, NULL /* local group */); - if (!ppage) + if (!ppage && use_kflt) { - if (use_kflt) - { - ppage = page_get_cachelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr, - 0x0200 /* PG_KFLT */, NULL /* local group */); - } + ppage = page_get_cachelist(&vbipagevp, 0 /* offset */, &kernseg, virtAddr, + 0x0200 /* PG_KFLT */, NULL /* local group */); } } return ppage; @@ -1473,9 +1451,140 @@ page_t *vbi_page_get_fromlist(uint_t freelist, caddr_t virtAddr) /* + * Large page code. + */ + +page_t * +vbi_large_page_alloc(uint64_t *pphys, size_t pgsize) +{ + pgcnt_t const npages = pgsize >> PAGESHIFT; + page_t *pproot, *pp, *pplist; + pgcnt_t ipage; + caddr_t vaddr; + seg_t kernseg; + int rc; + + /* + * Reserve available memory for a large page and create it. + */ + rc = page_resv(npages, KM_NOSLEEP); + if (!rc) + return NULL; + + rc = page_create_wait(npages, 0 /* flags */); + if (!rc) { + page_unresv(npages); + return NULL; + } + + /* + * Get a page off the free list. We set vaddr to 0 since we don't know + * where the memory is going to be mapped. + */ + vaddr = NULL; + kernseg.s_as = &kas; + pproot = vbi_page_get_fromlist(1 /* freelist */, vaddr, pgsize); + if (!pproot) + { + page_create_putback(npages); + page_unresv(npages); + return NULL; + } + AssertMsg(!(page_pptonum(pproot) & (npages - 1)), ("%p:%lx npages=%lx\n", pproot, page_pptonum(pproot), npages)); + + /* + * Mark all the sub-pages as non-free and not-hashed-in. + * It is paramount that we destroy the list (before freeing it). + */ + pplist = pproot; + for (ipage = 0; ipage < npages; ipage++) { + pp = pplist; + AssertPtr(pp); + AssertMsg(page_pptonum(pp) == ipage + page_pptonum(pproot), + ("%p:%lx %lx+%lx\n", pp, page_pptonum(pp), ipage, page_pptonum(pproot))); + page_sub(&pplist, pp); + AssertMsg(PP_ISFREE(pp), ("%p\n", pp)); + AssertMsg(pp->p_szc == pproot->p_szc, ("%p - %d expected %d \n", pp, pp->p_szc, pproot->p_szc)); + + PP_CLRFREE(pp); + PP_CLRAGED(pp); + } + + *pphys = (uint64_t)page_pptonum(pproot) << PAGESHIFT; + AssertMsg(!(*pphys & (pgsize - 1)), ("%llx %zx\n", *pphys, pgsize)); + return pproot; +} + +void +vbi_large_page_free(page_t *pproot, size_t pgsize) +{ + pgcnt_t const npages = pgsize >> PAGESHIFT; + pgcnt_t ipage; + + Assert(page_get_pagecnt(pproot->p_szc) == npages); + AssertMsg(!(page_pptonum(pproot) & (npages - 1)), ("%p:%lx npages=%lx\n", pproot, page_pptonum(pproot), npages)); + + /* + * We need to exclusively lock the sub-pages before freeing + * the large one. + */ + for (ipage = 0; ipage < npages; ipage++) { + page_t *pp = page_nextn(pproot, ipage); + AssertMsg(page_pptonum(pp) == ipage + page_pptonum(pproot), + ("%p:%lx %lx+%lx\n", pp, page_pptonum(pp), ipage, page_pptonum(pproot))); + AssertMsg(!PP_ISFREE(pp), ("%p\n", pp)); + + int rc = page_tryupgrade(pp); + if (!rc) { + page_unlock(pp); + while (!page_lock(pp, SE_EXCL, NULL /* mutex */, P_RECLAIM)) { + /*nothing*/; + } + } + } + + /* + * Free the large page and unreserve the memory. + */ + page_free_pages(pproot); + page_unresv(npages); +} + +int +vbi_large_page_premap(page_t *pproot, size_t pgsize) +{ + pgcnt_t const npages = pgsize >> PAGESHIFT; + pgcnt_t ipage; + + Assert(page_get_pagecnt(pproot->p_szc) == npages); + AssertMsg(!(page_pptonum(pproot) & (npages - 1)), ("%p:%lx npages=%lx\n", pproot, page_pptonum(pproot), npages)); + + /* + * We need to downgrade the sub-pages from exclusive to shared locking + * because otherwise we cannot <you go figure>. + */ + for (ipage = 0; ipage < npages; ipage++) { + page_t *pp = page_nextn(pproot, ipage); + AssertMsg(page_pptonum(pp) == ipage + page_pptonum(pproot), + ("%p:%lx %lx+%lx\n", pp, page_pptonum(pp), ipage, page_pptonum(pproot))); + AssertMsg(!PP_ISFREE(pp), ("%p\n", pp)); + + if (page_tryupgrade(pp) == 1) + page_downgrade(pp); + AssertMsg(!PP_ISFREE(pp), ("%p\n", pp)); + } + + return 0; +} + + +/* * As more functions are added, they should start with a comment indicating * the revision and above this point in the file and the revision level should * be increased. Also change vbi_modlmisc at the top of the file. + * + * NOTE! We'll start care about this if anything in here ever makes it into + * the solaris kernel proper. */ uint_t vbi_revision_level = 9; diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h index f2c412a75..5e4b51ce3 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h +++ b/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h @@ -137,7 +137,7 @@ extern void *vbi_proc(void); * thread functions */ extern void vbi_set_priority(void *thread, int priority); -extern void *vbi_thread_create(void *func, void *arg, size_t len, int priority); +extern void *vbi_thread_create(void (*func)(void *), void *arg, size_t len, int priority); extern void vbi_thread_exit(void); /* @@ -248,7 +248,7 @@ extern uint_t vbi_revision_level; * Note there is no guarantee about which CPU the function is invoked on. */ typedef struct vbi_cpu_watch vbi_cpu_watch_t; -extern vbi_cpu_watch_t *vbi_watch_cpus(void (*func)(void), void *arg, +extern vbi_cpu_watch_t *vbi_watch_cpus(void (*func)(void *, int, int), void *arg, int current_too); extern void vbi_ignore_cpus(vbi_cpu_watch_t *); #pragma weak vbi_watch_cpus @@ -344,7 +344,7 @@ extern int vbi_is_preempt_pending(void); /* begin interfaces defined for version 7 */ /* - * Allocate and free physically limited, aligned as specified continuous or non-continuous memory. + * Allocate and free physically limited, aligned as specified continuous or non-continuous memory. * * return value is a) NULL if memory below "phys" not available or * b) virtual address of memory in kernel heap @@ -368,7 +368,7 @@ extern void vbi_phys_free(void *va, size_t size); * * phys on input is set to the physical address of the first page allocated. * - * size is the amount to allocate and must be a multiple of PAGESIZE + * size is the amount to allocate and must be a multiple of PAGESIZE. */ extern page_t **vbi_pages_alloc(uint64_t *phys, size_t size); @@ -399,6 +399,17 @@ extern int vbi_pages_premap(page_t **pp_pages, size_t size, uint64_t *physaddrs) extern uint64_t vbi_page_to_pa(page_t **pp_pages, pgcnt_t i); /* end of interfaces defined for version 8 */ +/* + * Allocate, free and map one large page. + * + * The size of the large page is hardware specific and must be specified + * correctly or we'll panic. :-) + */ +extern page_t *vbi_large_page_alloc(uint64_t *pphys, size_t pgsize); +extern void vbi_large_page_free(page_t *ppage, size_t pgsize); +extern int vbi_large_page_premap(page_t *pproot, size_t pgsize); + + #ifdef __cplusplus } #endif diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c index d16e9ad6c..4ea9e6796 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/memobj-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: memobj-r0drv-solaris.c $ */ +/* $Id: memobj-r0drv-solaris.c 37281 2011-05-31 21:32:44Z vboxsync $ */ /** @file * IPRT - Ring-0 Memory Objects, Solaris. */ @@ -32,6 +32,7 @@ #include "internal/iprt.h" #include <iprt/memobj.h> +#include <iprt/asm.h> #include <iprt/assert.h> #include <iprt/err.h> #include <iprt/log.h> @@ -56,11 +57,14 @@ typedef struct RTR0MEMOBJSOLARIS void *pvHandle; /** Access during locking. */ int fAccess; + /** Set if large pages are involved in an RTR0MEMOBJTYPE_PHYS + * allocation. */ + bool fLargePage; } RTR0MEMOBJSOLARIS, *PRTR0MEMOBJSOLARIS; -int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) +DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) { PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)pMem; @@ -70,20 +74,17 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) vbi_lowmem_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb); break; - case RTR0MEMOBJTYPE_CONT: case RTR0MEMOBJTYPE_PHYS: - vbi_phys_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb); + if (!pMemSolaris->Core.u.Phys.fAllocated) + { /* nothing to do here */; } + else if (pMemSolaris->fLargePage) + vbi_large_page_free(pMemSolaris->pvHandle, pMemSolaris->Core.cb); + else + vbi_phys_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb); break; case RTR0MEMOBJTYPE_PHYS_NC: -#if 0 - vbi_phys_free(pMemSolaris->Core.pv, pMemSolaris->Core.cb); -#else - if (pMemSolaris->Core.u.Phys.fAllocated == true) - ddi_umem_free(pMemSolaris->Cookie); - else - vbi_pages_free(pMemSolaris->pvHandle, pMemSolaris->Core.cb); -#endif + vbi_pages_free(pMemSolaris->pvHandle, pMemSolaris->Core.cb); break; case RTR0MEMOBJTYPE_PAGE: @@ -107,6 +108,7 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) break; } + case RTR0MEMOBJTYPE_CONT: /* we don't use this type here. */ default: AssertMsgFailed(("enmType=%d\n", pMemSolaris->Core.enmType)); return VERR_INTERNAL_ERROR; @@ -116,7 +118,7 @@ int rtR0MemObjNativeFree(RTR0MEMOBJ pMem) } -int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { /* Create the object. */ PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_PAGE, NULL, cb); @@ -130,14 +132,14 @@ int rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecu return VERR_NO_PAGE_MEMORY; } - pMemSolaris->Core.pv = virtAddr; + pMemSolaris->Core.pv = virtAddr; pMemSolaris->pvHandle = NULL; *ppMem = &pMemSolaris->Core; return VINF_SUCCESS; } -int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { NOREF(fExecutable); @@ -161,65 +163,42 @@ int rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecut } -int rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { NOREF(fExecutable); return rtR0MemObjNativeAllocPhys(ppMem, cb, _4G - 1, PAGE_SIZE /* alignment */); } -int rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) { #if HC_ARCH_BITS == 64 PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_PHYS_NC, NULL, cb); if (!pMemSolaris) return VERR_NO_MEMORY; - /* Allocate physically non-contiguous page-aligned memory. */ - uint64_t physAddr = PhysHighest; - -# if 0 - /* - * The contig_alloc() way of allocating NC pages is broken or does not match our semantics. Refer #4716 for details. - */ -# if 0 - /* caddr_t virtAddr = vbi_phys_alloc(&physAddr, cb, PAGE_SIZE, 0 /* non-contiguous */); -# endif - caddr_t virtAddr = ddi_umem_alloc(cb, DDI_UMEM_SLEEP, &pMemSolaris->Cookie); - if (RT_UNLIKELY(virtAddr == NULL)) - { - rtR0MemObjDelete(&pMemSolaris->Core); - return VERR_NO_MEMORY; - } - pMemSolaris->Core.pv = virtAddr; - pMemSolaris->Core.u.Phys.PhysBase = physAddr; - pMemSolaris->Core.u.Phys.fAllocated = true; - pMemSolaris->pvHandle = NULL; -# else - void *pvPages = vbi_pages_alloc(&physAddr, cb); + uint64_t PhysAddr = PhysHighest; + void *pvPages = vbi_pages_alloc(&PhysAddr, cb); if (!pvPages) { LogRel(("rtR0MemObjNativeAllocPhysNC: vbi_pages_alloc failed.\n")); rtR0MemObjDelete(&pMemSolaris->Core); return VERR_NO_MEMORY; } - pMemSolaris->Core.pv = NULL; - pMemSolaris->Core.u.Phys.PhysBase = physAddr; - pMemSolaris->Core.u.Phys.fAllocated = false; - pMemSolaris->pvHandle = pvPages; -# endif + pMemSolaris->Core.pv = NULL; + pMemSolaris->pvHandle = pvPages; - Assert(!(physAddr & PAGE_OFFSET_MASK)); + Assert(!(PhysAddr & PAGE_OFFSET_MASK)); *ppMem = &pMemSolaris->Core; return VINF_SUCCESS; -#else - /** @todo rtR0MemObjNativeAllocPhysNC / solaris */ + +#else /* 32 bit: */ return VERR_NOT_SUPPORTED; /* see the RTR0MemObjAllocPhysNC specs */ #endif } -int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) +DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) { AssertMsgReturn(PhysHighest >= 16 *_1M, ("PhysHigest=%RHp\n", PhysHighest), VERR_NOT_SUPPORTED); @@ -227,48 +206,71 @@ int rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS Ph if (!pMemSolaris) return VERR_NO_MEMORY; - AssertCompile(NIL_RTHCPHYS == UINT64_MAX); - - /* Allocate physically contiguous memory aligned as specified. */ - uint64_t physAddr = PhysHighest; - caddr_t virtAddr = vbi_phys_alloc(&physAddr, cb, uAlignment, 1 /* contiguous */); - if (RT_UNLIKELY(virtAddr == NULL)) + /* + * Allocating one large page gets special treatment. + */ + static uint32_t s_cbLargePage = UINT32_MAX; + if (s_cbLargePage == UINT32_MAX) { - rtR0MemObjDelete(&pMemSolaris->Core); - return VERR_NO_CONT_MEMORY; +#if 0 /* currently not entirely stable, so disabled. */ + if (page_num_pagesizes() > 1) + ASMAtomicWriteU32(&s_cbLargePage, page_get_pagesize(1)); + else +#endif + ASMAtomicWriteU32(&s_cbLargePage, 0); } - Assert(!(physAddr & PAGE_OFFSET_MASK)); - Assert(physAddr < PhysHighest); - Assert(physAddr + cb <= PhysHighest); -#if 0 - if (uAlignment != PAGE_SIZE) + uint64_t PhysAddr; + if ( cb == s_cbLargePage + && cb == uAlignment + && PhysHighest == NIL_RTHCPHYS) { - /* uAlignment is always a multiple of PAGE_SIZE */ - pgcnt_t cPages = (cb + uAlignment - 1) >> PAGE_SHIFT; - void *pvPage = virtAddr; - while (cPages-- > 0) + /* + * Allocate one large page. + */ + void *pvPages = vbi_large_page_alloc(&PhysAddr, cb); + if (pvPages) { - uint64_t u64Page = vbi_va_to_pa(pvPage); - if (u64Page & (uAlignment - 1)) - { - LogRel(("rtR0MemObjNativeAllocPhys: alignment mismatch! cb=%u uAlignment=%u physAddr=%#x\n", cb, uAlignment, u64Page)); - vbi_phys_free(virtAddr, cb); - rtR0MemObjDelete(&pMemSolaris->Core); - return VERR_NO_MEMORY; - } - pvPage = (void *)((uintptr_t)pvPage + PAGE_SIZE); + AssertMsg(!(PhysAddr & (cb - 1)), ("%RHp\n", PhysAddr)); + pMemSolaris->Core.pv = NULL; + pMemSolaris->Core.u.Phys.PhysBase = PhysAddr; + pMemSolaris->Core.u.Phys.fAllocated = true; + pMemSolaris->pvHandle = pvPages; + pMemSolaris->fLargePage = true; + + *ppMem = &pMemSolaris->Core; + return VINF_SUCCESS; } } -#endif - pMemSolaris->Core.pv = virtAddr; - pMemSolaris->Core.u.Cont.Phys = physAddr; - pMemSolaris->pvHandle = NULL; - *ppMem = &pMemSolaris->Core; - return VINF_SUCCESS; + else + { + /* + * Allocate physically contiguous memory aligned as specified. + */ + AssertCompile(NIL_RTHCPHYS == UINT64_MAX); + PhysAddr = PhysHighest; + caddr_t pvMem = vbi_phys_alloc(&PhysAddr, cb, uAlignment, 1 /* contiguous */); + if (RT_LIKELY(pvMem)) + { + Assert(!(PhysAddr & PAGE_OFFSET_MASK)); + Assert(PhysAddr < PhysHighest); + Assert(PhysAddr + cb <= PhysHighest); + + pMemSolaris->Core.pv = pvMem; + pMemSolaris->Core.u.Phys.PhysBase = PhysAddr; + pMemSolaris->Core.u.Phys.fAllocated = true; + pMemSolaris->pvHandle = NULL; + pMemSolaris->fLargePage = false; + + *ppMem = &pMemSolaris->Core; + return VINF_SUCCESS; + } + } + rtR0MemObjDelete(&pMemSolaris->Core); + return VERR_NO_CONT_MEMORY; } -int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) +DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) { AssertReturn(uCachePolicy == RTMEM_CACHE_POLICY_DONT_CARE, VERR_NOT_SUPPORTED); @@ -278,15 +280,16 @@ int rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t return VERR_NO_MEMORY; /* There is no allocation here, it needs to be mapped somewhere first. */ - pMemSolaris->Core.u.Phys.fAllocated = false; - pMemSolaris->Core.u.Phys.PhysBase = Phys; + pMemSolaris->Core.u.Phys.fAllocated = false; + pMemSolaris->Core.u.Phys.PhysBase = Phys; pMemSolaris->Core.u.Phys.uCachePolicy = uCachePolicy; *ppMem = &pMemSolaris->Core; return VINF_SUCCESS; } -int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, + RTR0PROCESS R0Process) { AssertReturn(R0Process == RTR0ProcHandleSelf(), VERR_INVALID_PARAMETER); NOREF(fAccess); @@ -296,14 +299,13 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c if (!pMemSolaris) return VERR_NO_MEMORY; + /* Lock down user pages. */ int fPageAccess = S_READ; if (fAccess & RTMEM_PROT_WRITE) fPageAccess = S_WRITE; if (fAccess & RTMEM_PROT_EXEC) fPageAccess = S_EXEC; void *pvPageList = NULL; - - /* Lock down user pages */ int rc = vbi_lock_va((caddr_t)R3Ptr, cb, fPageAccess, &pvPageList); if (rc != 0) { @@ -312,15 +314,16 @@ int rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t c return VERR_LOCK_FAILED; } - pMemSolaris->Core.u.Lock.R0Process = (RTR0PROCESS)vbi_proc(); - pMemSolaris->pvHandle = pvPageList; - pMemSolaris->fAccess = fPageAccess; + /* Fill in the object attributes and return successfully. */ + pMemSolaris->Core.u.Lock.R0Process = R0Process; + pMemSolaris->pvHandle = pvPageList; + pMemSolaris->fAccess = fPageAccess; *ppMem = &pMemSolaris->Core; return VINF_SUCCESS; } -int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) +DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) { NOREF(fAccess); @@ -328,6 +331,7 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, if (!pMemSolaris) return VERR_NO_MEMORY; + /* Lock down kernel pages. */ int fPageAccess = S_READ; if (fAccess & RTMEM_PROT_WRITE) fPageAccess = S_WRITE; @@ -342,6 +346,7 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, return VERR_LOCK_FAILED; } + /* Fill in the object attributes and return successfully. */ pMemSolaris->Core.u.Lock.R0Process = NIL_RTR0PROCESS; pMemSolaris->pvHandle = pvPageList; pMemSolaris->fAccess = fPageAccess; @@ -350,7 +355,7 @@ int rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, } -int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) +DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) { PRTR0MEMOBJSOLARIS pMemSolaris; @@ -358,7 +363,7 @@ int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, siz * Use xalloc. */ void *pv = vmem_xalloc(heap_arena, cb, uAlignment, 0 /*phase*/, 0 /*nocross*/, - NULL /*minaddr*/, NULL /*maxaddr*/, VM_SLEEP); + NULL /*minaddr*/, NULL /*maxaddr*/, VM_SLEEP); if (RT_UNLIKELY(!pv)) return VERR_NO_MEMORY; @@ -377,94 +382,111 @@ int rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, siz } -int rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) { return VERR_NOT_SUPPORTED; } -int rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, - unsigned fProt, size_t offSub, size_t cbSub) + +DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, + unsigned fProt, size_t offSub, size_t cbSub) { /** @todo rtR0MemObjNativeMapKernel / Solaris - Should be fairly simple alloc kernel memory and memload it. */ return VERR_NOT_SUPPORTED; } -int rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, PRTR0MEMOBJINTERNAL pMemToMap, RTR3PTR R3PtrFixed, + size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) { + /* + * Fend off things we cannot do. + */ AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED); AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); if (uAlignment != PAGE_SIZE) return VERR_NOT_SUPPORTED; - PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap; - size_t cb = pMemToMapSolaris->Core.cb; - void *pv = pMemToMapSolaris->Core.pv; - pgcnt_t cPages = (cb + PAGE_SIZE - 1) >> PAGE_SHIFT; + /* + * Get parameters from the source object. + */ + PRTR0MEMOBJSOLARIS pMemToMapSolaris = (PRTR0MEMOBJSOLARIS)pMemToMap; + void *pv = pMemToMapSolaris->Core.pv; + size_t cb = pMemToMapSolaris->Core.cb; + pgcnt_t cPages = cb >> PAGE_SHIFT; - /* Create the mapping object */ - PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_MAPPING, pv, cb); + /* + * Create the mapping object + */ + PRTR0MEMOBJSOLARIS pMemSolaris; + pMemSolaris = (PRTR0MEMOBJSOLARIS)rtR0MemObjNew(sizeof(*pMemSolaris), RTR0MEMOBJTYPE_MAPPING, pv, cb); if (RT_UNLIKELY(!pMemSolaris)) return VERR_NO_MEMORY; + int rc = VINF_SUCCESS; uint64_t *paPhysAddrs = kmem_zalloc(sizeof(uint64_t) * cPages, KM_SLEEP); - if (RT_UNLIKELY(!paPhysAddrs)) - return VERR_NO_MEMORY; - - if ( pMemToMapSolaris->Core.enmType == RTR0MEMOBJTYPE_PHYS_NC - && pMemSolaris->Core.u.Phys.fAllocated == false) + if (RT_LIKELY(paPhysAddrs)) { /* - * The PhysNC object has no kernel mapping backing it. The call to vbi_pages_premap() - * prepares the physical pages to be mapped into user or kernel space. + * Prepare the pages according to type. */ - int rc = vbi_pages_premap(pMemToMapSolaris->pvHandle, cb, paPhysAddrs); - if (rc) + if (pMemToMapSolaris->Core.enmType == RTR0MEMOBJTYPE_PHYS_NC) + rc = vbi_pages_premap(pMemToMapSolaris->pvHandle, cb, paPhysAddrs); + else if ( pMemToMapSolaris->Core.enmType == RTR0MEMOBJTYPE_PHYS + && pMemToMapSolaris->fLargePage) { - LogRel(("rtR0MemObjNativeMapUser: vbi_pages_premap failed. rc=%d\n", rc)); - kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages); - rtR0MemObjDelete(&pMemSolaris->Core); - return VERR_MAP_FAILED; + RTHCPHYS Phys = pMemToMapSolaris->Core.u.Phys.PhysBase; + for (pgcnt_t iPage = 0; iPage < cPages; iPage++, Phys += PAGE_SIZE) + paPhysAddrs[iPage] = Phys; + rc = vbi_large_page_premap(pMemToMapSolaris->pvHandle, cb); } - } - else - { - /* - * All other memory object types have allocated memory with kernel mappings. - */ - for (pgcnt_t iPage = 0; iPage < cPages; iPage++) + else { - paPhysAddrs[iPage] = vbi_va_to_pa(pv); - if (RT_UNLIKELY(paPhysAddrs[iPage] == -(uint64_t)1)) + /* Have kernel mapping, just translate virtual to physical. */ + AssertPtr(pv); + rc = 0; + for (pgcnt_t iPage = 0; iPage < cPages; iPage++) { - LogRel(("rtR0MemObjNativeMapUser: no page to map.\n")); - kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages); - rtR0MemObjDelete(&pMemSolaris->Core); - return VERR_MAP_FAILED; + paPhysAddrs[iPage] = vbi_va_to_pa(pv); + if (RT_UNLIKELY(paPhysAddrs[iPage] == -(uint64_t)1)) + { + LogRel(("rtR0MemObjNativeMapUser: no page to map.\n")); + rc = -1; + break; + } + pv = (void *)((uintptr_t)pv + PAGE_SIZE); } - pv = (void *)((uintptr_t)pv + PAGE_SIZE); } - } + if (!rc) + { + /* + * Perform the actual mapping. + */ + caddr_t UserAddr = NULL; + rc = vbi_user_map(&UserAddr, fProt, paPhysAddrs, cb); + if (!rc) + { + pMemSolaris->Core.u.Mapping.R0Process = R0Process; + pMemSolaris->Core.pv = UserAddr; - caddr_t virtAddr = NULL; - int rc = vbi_user_map(&virtAddr, fProt, paPhysAddrs, cb); - if (rc != 0) - { - LogRel(("rtR0MemObjNativeMapUser: vbi mapping failure.\n")); + *ppMem = &pMemSolaris->Core; + kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages); + return VINF_SUCCESS; + } + + LogRel(("rtR0MemObjNativeMapUser: vbi_user_map failed.\n")); + } + rc = VERR_MAP_FAILED; kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages); - rtR0MemObjDelete(&pMemSolaris->Core); - return VERR_MAP_FAILED; } - - pMemSolaris->Core.u.Mapping.R0Process = (RTR0PROCESS)vbi_proc(); - pMemSolaris->Core.pv = virtAddr; - *ppMem = &pMemSolaris->Core; - kmem_free(paPhysAddrs, sizeof(uint64_t) * cPages); - return VINF_SUCCESS; + else + rc = VERR_NO_MEMORY; + rtR0MemObjDelete(&pMemSolaris->Core); + return rc; } -int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) +DECLHIDDEN(int) rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSub, uint32_t fProt) { NOREF(pMem); NOREF(offSub); @@ -474,12 +496,20 @@ int rtR0MemObjNativeProtect(PRTR0MEMOBJINTERNAL pMem, size_t offSub, size_t cbSu } -RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) +DECLHIDDEN(RTHCPHYS) rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) { PRTR0MEMOBJSOLARIS pMemSolaris = (PRTR0MEMOBJSOLARIS)pMem; switch (pMemSolaris->Core.enmType) { + case RTR0MEMOBJTYPE_PHYS_NC: + if (pMemSolaris->Core.u.Phys.fAllocated) + { + uint8_t *pb = (uint8_t *)pMemSolaris->Core.pv + ((size_t)iPage << PAGE_SHIFT); + return vbi_va_to_pa(pb); + } + return vbi_page_to_pa(pMemSolaris->pvHandle, iPage); + case RTR0MEMOBJTYPE_PAGE: case RTR0MEMOBJTYPE_LOW: case RTR0MEMOBJTYPE_LOCK: @@ -497,16 +527,7 @@ RTHCPHYS rtR0MemObjNativeGetPagePhysAddr(PRTR0MEMOBJINTERNAL pMem, size_t iPage) case RTR0MEMOBJTYPE_CONT: case RTR0MEMOBJTYPE_PHYS: - return pMemSolaris->Core.u.Cont.Phys + (iPage << PAGE_SHIFT); - - case RTR0MEMOBJTYPE_PHYS_NC: - if (pMemSolaris->Core.u.Phys.fAllocated == true) - { - uint8_t *pb = (uint8_t *)pMemSolaris->Core.pv + ((size_t)iPage << PAGE_SHIFT); - return vbi_va_to_pa(pb); - } - return vbi_page_to_pa(pMemSolaris->pvHandle, iPage); - + AssertFailed(); /* handled by the caller */ case RTR0MEMOBJTYPE_RES_VIRT: default: return NIL_RTHCPHYS; diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c index 11106cd54..a281c0011 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/mp-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: mp-r0drv-solaris.c $ */ +/* $Id: mp-r0drv-solaris.c 37062 2011-05-13 10:18:29Z vboxsync $ */ /** @file * IPRT - Multiprocessor, Ring-0 Driver, Solaris. */ @@ -173,6 +173,13 @@ static int rtmpOnAllSolarisWrapper(void *uArg, void *uIgnored1, void *uIgnored2) { PRTMPARGS pArgs = (PRTMPARGS)(uArg); + /* + * Solaris CPU cross calls execute on offline CPUs too. Check our CPU cache + * set and ignore if it's offline. + */ + if (!RTMpIsCpuOnline(RTMpCpuId())) + return 0; + pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2); NOREF(uIgnored1); @@ -278,6 +285,9 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1 if (idCpu >= vbi_cpu_count()) return VERR_CPU_NOT_FOUND; + if (RT_UNLIKELY(!RTMpIsCpuOnline(idCpu))) + return RTMpIsCpuPresent(idCpu) ? VERR_CPU_OFFLINE : VERR_CPU_NOT_FOUND; + Args.pfnWorker = pfnWorker; Args.pvUser1 = pvUser1; Args.pvUser2 = pvUser2; diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c index dc2eb4817..65d31989c 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/mpnotification-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: mpnotification-r0drv-solaris.c $ */ +/* $Id: mpnotification-r0drv-solaris.c 37274 2011-05-31 11:47:51Z vboxsync $ */ /** @file * IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Solaris. */ @@ -33,6 +33,8 @@ #include <iprt/err.h> #include <iprt/mp.h> #include <iprt/cpuset.h> +#include <iprt/string.h> +#include <iprt/thread.h> #include "r0drv/mp-r0drv.h" @@ -48,28 +50,56 @@ static vbi_cpu_watch_t *g_hVbiCpuWatch = NULL; RTCPUSET g_rtMpSolarisCpuSet; -static void rtMpNotificationSolarisCallback(void *pvUser, int iCpu, int online) +static void rtMpNotificationSolarisOnCurrentCpu(void *pvArgs, void *uIgnored1, void *uIgnored2) { - NOREF(pvUser); + NOREF(uIgnored1); + NOREF(uIgnored2); + + PRTMPARGS pArgs = (PRTMPARGS)(pvArgs); + AssertRelease(pArgs && pArgs->idCpu == RTMpCpuId()); + Assert(pArgs->pvUser2); + Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); - /* ASSUMES iCpu == RTCPUID */ + int online = *(int *)pArgs->pvUser2; if (online) { - RTCpuSetAdd(&g_rtMpSolarisCpuSet, iCpu); - rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, iCpu); + RTCpuSetAdd(&g_rtMpSolarisCpuSet, pArgs->idCpu); + rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, pArgs->idCpu); } else { - RTCpuSetDel(&g_rtMpSolarisCpuSet, iCpu); - rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, iCpu); + RTCpuSetDel(&g_rtMpSolarisCpuSet, pArgs->idCpu); + rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, pArgs->idCpu); } } -int rtR0MpNotificationNativeInit(void) +static void rtMpNotificationSolarisCallback(void *pvUser, int iCpu, int online) +{ + vbi_preempt_disable(); + + RTMPARGS Args; + RT_ZERO(Args); + Args.pvUser1 = pvUser; + Args.pvUser2 = &online; + Args.idCpu = iCpu; + + /* + * If we're not on the target CPU, schedule (synchronous) the event notification callback + * to run on the target CPU i.e. the one pertaining to the MP event. + */ + bool fRunningOnTargetCpu = iCpu == RTMpCpuId(); /* ASSUMES iCpu == RTCPUID */ + if (fRunningOnTargetCpu) + rtMpNotificationSolarisOnCurrentCpu(&Args, NULL /* pvIgnored1 */, NULL /* pvIgnored2 */); + else + vbi_execute_on_one(rtMpNotificationSolarisOnCurrentCpu, &Args, iCpu); + + vbi_preempt_enable(); +} + + +DECLHIDDEN(int) rtR0MpNotificationNativeInit(void) { - if (vbi_revision_level < 2) - return VERR_NOT_SUPPORTED; if (g_hVbiCpuWatch != NULL) return VERR_WRONG_ORDER; @@ -84,9 +114,9 @@ int rtR0MpNotificationNativeInit(void) } -void rtR0MpNotificationNativeTerm(void) +DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void) { - if (vbi_revision_level >= 2 && g_hVbiCpuWatch != NULL) + if (g_hVbiCpuWatch != NULL) vbi_ignore_cpus(g_hVbiCpuWatch); g_hVbiCpuWatch = NULL; } diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c index dbfb639c8..3e3b61179 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/process-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: process-r0drv-solaris.c $ */ +/* $Id: process-r0drv-solaris.c 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Process Management, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c index 9fbf4eff5..ab31c4b70 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: thread-r0drv-solaris.c $ */ +/* $Id: thread-r0drv-solaris.c 29281 2010-05-09 23:40:43Z vboxsync $ */ /** @file * IPRT - Threads, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c index 383e33ac8..90958120d 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/thread2-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: thread2-r0drv-solaris.c $ */ +/* $Id: thread2-r0drv-solaris.c 36555 2011-04-05 12:34:09Z vboxsync $ */ /** @file * IPRT - Threads (Part 2), Ring-0 Driver, Solaris. */ @@ -38,7 +38,7 @@ -int rtThreadNativeInit(void) +DECLHIDDEN(int) rtThreadNativeInit(void) { return VINF_SUCCESS; } @@ -50,7 +50,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void) } -int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) +DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) { int iPriority; switch (enmType) @@ -71,7 +71,7 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) } -int rtThreadNativeAdopt(PRTTHREADINT pThread) +DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread) { NOREF(pThread); /* There is nothing special that needs doing here, but the @@ -80,7 +80,7 @@ int rtThreadNativeAdopt(PRTTHREADINT pThread) } -void rtThreadNativeDestroy(PRTTHREADINT pThread) +DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread) { NOREF(pThread); } @@ -100,7 +100,7 @@ static void rtThreadNativeMain(void *pvThreadInt) } -int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) +DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) { void *pvKernThread; RT_ASSERT_PREEMPTIBLE(); diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c index d8db73fd1..e0b6f903c 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/time-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: time-r0drv-solaris.c $ */ +/* $Id: time-r0drv-solaris.c 28800 2010-04-27 08:22:32Z vboxsync $ */ /** @file * IPRT - Time, Ring-0 Driver, Solaris. */ diff --git a/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c index feef551da..da5a41622 100644 --- a/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c +++ b/src/VBox/Runtime/r0drv/solaris/vbi/timer-r0drv-solaris.c @@ -1,4 +1,4 @@ -/* $Id: timer-r0drv-solaris.c $ */ +/* $Id: timer-r0drv-solaris.c 37275 2011-05-31 11:48:14Z vboxsync $ */ /** @file * IPRT - Timer, Ring-0 Driver, Solaris. */ @@ -112,8 +112,6 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_ */ if (!RTTIMER_FLAGS_ARE_VALID(fFlags)) return VERR_INVALID_PARAMETER; - if (vbi_revision_level < 2) - return VERR_NOT_SUPPORTED; if ( (fFlags & RTTIMER_FLAGS_CPU_SPECIFIC) && (fFlags & RTTIMER_FLAGS_CPU_ALL) != RTTIMER_FLAGS_CPU_ALL |