VirtualBox

Changeset 11020 in vbox for trunk/src/VBox/Runtime/r3/posix


Ignore:
Timestamp:
Jul 30, 2008 10:48:35 PM (17 years ago)
Author:
vboxsync
Message:

iprt: Added a RT_NO_THROW macro for wrapping up the throw() stuff, applying it to mem.h and rand.h to try make RTMemAutoPtr work as efficiently as the pure C version of the stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/alloc-posix.cpp

    r8245 r11020  
    4646#if !defined(RT_USE_MMAP) && (defined(RT_OS_LINUX))
    4747# define RT_USE_MMAP
    48 #endif 
     48#endif
    4949
    5050/*******************************************************************************
     
    5252*******************************************************************************/
    5353#ifdef RT_USE_MMAP
    54 /** 
     54/**
    5555 * RTMemExecAlloc() header used when using mmap for allocating the memory.
    5656 */
     
    6363# if ARCH_BITS == 32
    6464    uint32_t    Alignment[2];
    65 # endif 
     65# endif
    6666} RTMEMEXECHDR, *PRTMEMEXECHDR;
    6767
     
    8282 * @param   cb      Size in bytes of the memory block to allocate.
    8383 */
    84 RTDECL(void *) RTMemExecAlloc(size_t cb)
     84RTDECL(void *) RTMemExecAlloc(size_t cb) RT_NO_THROW
    8585{
    8686    AssertMsg(cb, ("Allocating ZERO bytes is really not a good idea! Good luck with the next assertion!\n"));
     
    9191     */
    9292    size_t cbAlloc = RT_ALIGN_Z(cb + sizeof(RTMEMEXECHDR), PAGE_SIZE);
    93     void *pv = mmap(NULL, cbAlloc, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS 
     93    void *pv = mmap(NULL, cbAlloc, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS
    9494#if defined(RT_ARCH_AMD64) && defined(MAP_32BIT)
    9595                    | MAP_32BIT
     
    140140 * @param   pv      Pointer to memory block.
    141141 */
    142 RTDECL(void)    RTMemExecFree(void *pv)
     142RTDECL(void)    RTMemExecFree(void *pv) RT_NO_THROW
    143143{
    144144    if (pv)
     
    152152#else
    153153        free(pv);
    154 #endif 
     154#endif
    155155    }
    156156}
     
    164164 * @param   cb  Size of the memory block. Will be rounded up to page size.
    165165 */
    166 RTDECL(void *) RTMemPageAlloc(size_t cb)
     166RTDECL(void *) RTMemPageAlloc(size_t cb) RT_NO_THROW
    167167{
    168168#if 0 /** @todo huh? we're using posix_memalign in the next function... */
     
    185185 * @param   cb  Size of the memory block. Will be rounded up to page size.
    186186 */
    187 RTDECL(void *) RTMemPageAllocZ(size_t cb)
     187RTDECL(void *) RTMemPageAllocZ(size_t cb) RT_NO_THROW
    188188{
    189189    void *pv;
     
    204204 *                  NULL will be ignored.
    205205 */
    206 RTDECL(void) RTMemPageFree(void *pv)
     206RTDECL(void) RTMemPageFree(void *pv) RT_NO_THROW
    207207{
    208208    if (pv)
     
    219219 * @param   fProtect    The new protection, a combination of the RTMEM_PROT_* defines.
    220220 */
    221 RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect)
     221RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW
    222222{
    223223    /*
Note: See TracChangeset for help on using the changeset viewer.

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