Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

static void* kPrfAllocMem ( KU32  cb  )  [static]

Allocates memory.

Returns:
Pointer to the allocated memory.

NULL on failure.

Parameters:
cb The amount of memory (in bytes) to allocate.

Definition at line 1304 of file kProfileR3.cpp.

Referenced by kPrfInitialize().

{
#if K_OS == K_OS_WINDOWS
    void *pv = VirtualAlloc(NULL, cb, MEM_COMMIT, PAGE_EXECUTE_READWRITE);

#elif defined(KPRF_USE_MMAN)
    void *pv = mmap(NULL, cb, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);

#elif K_OS == K_OS_OS2
    void *pv;
# ifdef INCL_DOSEXAPIS
    if (DosAllocMemEx(&pv, cb, PAG_READ | PAG_WRITE | PAG_EXECUTE | PAG_COMMIT | OBJ_FORK))s
# else
    if (DosAllocMem(&pv, cb, PAG_READ | PAG_WRITE | PAG_EXECUTE | PAG_COMMIT))
# endif
        pvBuf = NULL;

#else
# error not implemented
#endif
    return pv;
}


Generated by  Doxygen 1.6.0   Back to index