Ignore:
Timestamp:
Sep 2, 2000, 11:08:23 PM (25 years ago)
Author:
bird
Message:

Merged in the Grace branch. New Win32k!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/misc/malloc.c

    r2511 r4164  
    1 /* $Id: malloc.c,v 1.6 2000-01-24 18:19:00 bird Exp $
     1/* $Id: malloc.c,v 1.7 2000-09-02 21:08:14 bird Exp $
    22 *
    33 * Common Heap - this forwards to the swappable heap!
     
    2020******************************************************************************/
    2121#include <os2.h>
     22#include "devSegDf.h"                   /* Win32k segment definitions. */
    2223#include "smalloc.h"
    2324#include "rmalloc.h"
     
    2829*  Global data
    2930******************************************************************************/
    30 #ifndef RING0
     31#if !defined(RING0) || defined(R3TST)
    3132    char           fInited;       /* init flag */
    3233#endif
     
    5354    if (rc != 0)
    5455        return rc;
    55     #ifdef RING3
     56    #if !defined(RING0) || defined(R3TST)
    5657        fInited = TRUE;
    5758    #endif
     
    6970void * malloc(unsigned cbSize)
    7071{
     72    #ifdef R3TST
     73    if (!fInited)
     74    {
     75        PVOID pv;
     76        if (!DosAllocMem(&pv, cbSize, PAG_WRITE | PAG_READ | PAG_COMMIT)) /* no SSToDS! */
     77            return pv;
     78        else
     79            return NULL;
     80    }
     81    #endif
    7182    return smalloc(cbSize);
    7283}
     
    8192void *realloc(void *pv, unsigned cbNew)
    8293{
     94    #ifdef R3TST
     95    if (!fInited)
     96        Int3();
     97    #endif
    8398    return srealloc(pv, cbNew);
    8499}
     
    91106void free(void *pv)
    92107{
     108    #ifdef R3TST
     109    if (!fInited) /* controlled leak! */
     110       return;
     111    #endif
    93112    sfree(pv);
    94113}
     
    154173
    155174
     175
    156176#if !defined(RING0) && defined(__IBMC__)
    157177
     
    162182int _rmem_init(void)
    163183{
    164     int rc = heapInit(CB_RES_INIT, CB_RES_MAX, CB_SWP_INIT, CB_SWP_MAX);
     184    int rc;
     185    rc = heapInit(CB_RES_INIT, CB_RES_MAX, CB_SWP_INIT, CB_SWP_MAX);
    165186    return rc;
    166187}
Note: See TracChangeset for help on using the changeset viewer.