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

void* kldrDyldOSAllocStack ( KSIZE  cb  ) 

Allocates a stack.

Returns:
Pointer to the stack. NULL on allocation failure (assumes out of memory).
Parameters:
cb The size of the stack. This shall be page aligned. If 0, a OS specific default stack size will be employed.

Definition at line 62 of file kLdrDyldOS.c.

References K_FALSE, KPROT_READWRITE, and NULL.

Referenced by kldrDyldModGetMainStack().

{
#if K_OS == K_OS_OS2
    APIRET rc;
    PVOID pv;

    if (!cb)
        cb = 1 * 1024*1024; /* 1MB */

    rc = DosAllocMem(&pv, cb, OBJ_TILE | PAG_COMMIT | PAG_WRITE | PAG_READ);
    if (rc == NO_ERROR)
        return pv;
    return NULL;

#elif K_OS == K_OS_WINDOWS

    if (!cb)
        cb = 1 *1024*1024; /* 1MB */

    return VirtualAlloc(NULL, cb, MEM_COMMIT, PAGE_READWRITE);

#else
    void *pv;

    if (!cb)
        cb = 1 * 1024*1024; /* 1MB */

    if (!kHlpPageAlloc(&pv, cb, KPROT_READWRITE, K_FALSE))
        return pv;
    return NULL;
#endif
}


Generated by  Doxygen 1.6.0   Back to index