Changeset 504 for GPL/branches


Ignore:
Timestamp:
Jul 11, 2010, 7:42:10 AM (15 years ago)
Author:
David Azarewicz
Message:

Bring branch up-to-date with trunk

Location:
GPL/branches/uniaud32-2.1.x
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-2.1.x/alsa-kernel/core/memalloc.c

    r464 r504  
    22 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
    33 *                   Takashi Iwai <tiwai@suse.de>
    4  * 
     4 *
    55 *  Generic memory allocators
    66 *
     
    209209 * Calls the memory-allocator function for the corresponding
    210210 * buffer type.
    211  * 
     211 *
    212212 * Returns zero if the buffer with the given size is allocated successfuly,
    213213 * other a negative value at error.
     
    216216                        struct snd_dma_buffer *dmab)
    217217{
    218 #ifdef DEBUG
    219218    dprintf(("snd_dma_alloc_pages with size = %d",size));
    220 #endif
    221219        if (WARN_ON(!size))
    222220                return -ENXIO;
     
    265263 * tries to allocate again.  The size actually allocated is stored in
    266264 * res_size argument.
    267  * 
     265 *
    268266 * Returns zero if the buffer with the given size is allocated successfuly,
    269267 * other a negative value at error.
     
    362360 *
    363361 * Reserves the given buffer as a reserved buffer.
    364  * 
     362 *
    365363 * Returns zero if successful, or a negative code at error.
    366364 */
  • GPL/branches/uniaud32-2.1.x/drv32/init.c

    r492 r504  
    3636#include <ossidc32.h>
    3737#include <dbgos2.h>
    38 #include <printfos2.h>
    3938#include <irqos2.h>
    4039//#include <bsedos16.h>
     
    4342#endif
    4443#include "parse.h"
     44#include "malloc.h"
    4545
    4646const char ERR_ERROR[]   = "ERROR: ";
     
    6868extern "C" int sprintf (char *buffer, const char *format, ...);
    6969
    70 extern "C" int wrOffset;
    71 extern "C" char *szprintBuf;
    7270extern "C" APIRET APIENTRY DOS16OPEN(PSZ pszFileName, PHFILE phf, PULONG pulAction, ULONG cbFile, ULONG ulAttribute, ULONG fsOpenFlags, ULONG fsOpenMode, PEAOP2 peaop2 );
    7371extern "C" APIRET APIENTRY DOS16CLOSE(HFILE hFile);
    7472extern "C" APIRET APIENTRY DOS16WRITE(HFILE hFile, PVOID pBuffer, ULONG cbWrite, PULONG pcbActual);
    7573extern "C" void SaveBuffer(void);
     74
     75#define VMDHA_FIXED             0x0002
     76
     77extern "C" APIRET VMAlloc(ULONG size, ULONG flags, char NEAR* *pAddr);
    7678
    7779//Print messages with DosWrite when init is done or has failed (see startup.asm)
     
    9193}
    9294
    93 void _cdecl printfos2(char *string)
    94 {
    95    DevSaveMessage(string, strlen(string));
    96 }
    97 
    9895//SvL: Lock our 32 bits data & code segments
    99 int LockSegments(void) 
     96int LockSegments(void)
    10097{
    10198#ifdef KEE
     
    194191#endif
    195192// Initialize device driver
    196 WORD32 DiscardableInit(RPInit __far* rp) 
     193WORD32 DiscardableInit(RPInit __far* rp)
    197194{
    198195    char        debugmsg[64];
     
    209206    }
    210207
     208        DebugLevel = 1;
    211209    rp->Out.FinalCS = 0;
    212210    rp->Out.FinalDS = 0;
     211
     212        if ( szprintBuf == 0 ) {
     213                VMAlloc( DBG_MAX_BUF_SIZE, VMDHA_FIXED, &szprintBuf );
     214                if (szprintBuf) {
     215                        memset( szprintBuf, 0, DBG_MAX_BUF_SIZE );
     216                        wrOffset= 0;
     217                }
     218        }
     219        if (!HeapInit(HEAP_SIZE)) {
     220                dprintf(("HeapInit failed!"));
     221        }
    213222
    214223    args = MAKE_FARPTR32(rp->In.Args);
     
    268277#if 0
    269278        for(int i=1;i<OSS32_MAX_AUDIOCARDS;i++) {
    270             if(OSS32_QueryNames(i, szDeviceName, sizeof(szDeviceName), szMixerName, sizeof(szMixerName)) == OSSERR_SUCCESS) 
     279            if(OSS32_QueryNames(i, szDeviceName, sizeof(szDeviceName), szMixerName, sizeof(szMixerName)) == OSSERR_SUCCESS)
    271280            {
    272281                WriteString(szDeviceName, strlen(szDeviceName));
     
    281290        WriteString(szEOL, sizeof(szEOL)-1);
    282291    }
    283 #ifdef DEBUG
    284     dprintf(("DiscardableInit. cp1"));
    285 #endif
    286292    // Complete the installation
    287293    rp->Out.FinalCS = _OffsetFinalCS16;
    288294    rp->Out.FinalDS = _OffsetFinalDS16;
    289 #ifdef DEBUG
    290     dprintf(("DiscardableInit. cp2"));
    291 #endif
    292 
    293 //    SaveBuffer();
     295
     296        //SaveBuffer();
    294297
    295298    // Confirm a successful installation
  • GPL/branches/uniaud32-2.1.x/drv32/parse.c

    r484 r504  
    3939#include <string.h>
    4040
    41 #ifdef DEBUG
    4241#define COMM_DEBUG
    43 #endif
    4442
    4543// True if the /V parameter was specified
  • GPL/branches/uniaud32-2.1.x/drv32/read.cpp

    r268 r504  
    1111int   wrOffset= 0;
    1212char  *szprintBuf= 0;
    13 #ifdef DEBUG
    14 int   max_buf_size= 0x100000;
    15 #else
    16 int   max_buf_size= 0x10000;
    17 #endif
    1813
    1914void * __ioremap(unsigned long physaddr, unsigned long size, unsigned long flags);
     
    2520{
    2621  RPRWV __far* rp = (RPRWV __far*)_rp;
    27  
     22
    2823  char *lin;
    2924  int   transferCount= rp->Count;
    30  
     25
    3126  if( szprintBuf )
    3227  {
     
    3530    {
    3631      int diffCount;
    37      
     32
    3833      if( rdOffset > wrOffset )
    3934      {
    40         diffCount= max_buf_size - rdOffset + wrOffset;
     35        diffCount= DBG_MAX_BUF_SIZE - rdOffset + wrOffset;
    4136      } else
    4237      {
     
    4540      if( transferCount > diffCount )
    4641        transferCount= diffCount;
    47      
     42
    4843      rp->Count= transferCount;
    49       if( (rdOffset + transferCount) > max_buf_size )
     44      if( (rdOffset + transferCount) > DBG_MAX_BUF_SIZE )
    5045      {
    51         diffCount= max_buf_size - rdOffset;
     46        diffCount= DBG_MAX_BUF_SIZE - rdOffset;
    5247        memcpy( lin, szprintBuf + rdOffset, diffCount );
    5348        transferCount= transferCount - diffCount;
     
    5550      } else
    5651        diffCount= 0;
    57        
    58       if( transferCount ) 
     52
     53      if( transferCount )
    5954      {
    6055        memcpy( lin + diffCount, szprintBuf + rdOffset, transferCount );
  • GPL/branches/uniaud32-2.1.x/drv32/strategy.c

    r458 r504  
    3838ULONG StratClose(RP __far *_rp);
    3939
    40 ULONG DiscardableInit(RPInit __far*); 
     40ULONG DiscardableInit(RPInit __far*);
    4141
    4242ULONG deviceOwner = DEV_NO_OWNER;
     
    7070    RPInit __far* rp = (RPInit __far*)_rp;
    7171    rc = DiscardableInit(rp);
    72 #ifdef DEBUG
    73     dprintf(("StratInit. cp1.rc %d", rc));
    74 #endif
     72    dprintf(("StratInit End rc=%d", rc));
    7573    return rc;
    7674}
     
    8987    BYTE   LowIRQ;
    9088    BYTE   HighIRQ;
    91     BYTE   Pin;   
     89    BYTE   Pin;
    9290};
    9391extern struct SaveIRQForSlot sISRHigh[];
     
    138136#endif
    139137  if(rp->Function == 1) {//end of shutdown
    140         OSS32_Shutdown(); 
     138        OSS32_Shutdown();
    141139  }
    142140  return(RPDONE);
  • GPL/branches/uniaud32-2.1.x/include/dbgos2.h

    r479 r504  
    2626#define __COMMDBG_H__
    2727
    28 //#ifdef DEBUG
    29 #if 1
    3028#ifdef __cplusplus
    3129extern "C" {
    3230#endif
    3331extern int DebugLevel;
    34 
     32extern int wrOffset;
     33extern char *szprintBuf;
     34//void _cdecl DPD(int level, char *x, ...) ; /* not debugging: nothing */
    3535void _cdecl DPE(char *x, ...) ; /* not debugging: nothing */
    36 void _cdecl DPD(int level, char *x, ...) ; /* not debugging: nothing */
    3736#ifdef __cplusplus
    3837}
    3938#endif
    40 #define dprintf(a)      if(DebugLevel > 0) DPE a
     39
     40/* rprintf always prints to the log buffer, and to SIO if enabled */
     41#define rprintf(a) DPE a
     42
     43/* the dprintf functions only print if DEBUG is defined */
     44#ifdef DEBUG
     45#define DBG_MAX_BUF_SIZE 0x100000
     46#define dprintf(a)      DPE a
     47#define dprintf1(a)     if(DebugLevel > 0) DPE a
    4148#define dprintf2(a)     if(DebugLevel > 1) DPE a
    4249#define dprintf3(a)     if(DebugLevel > 2) DPE a
    43 #define DebugInt3()     ; //_asm int 3;
    44 #define DebInt3()       _asm int 3;
    45 #else // #ifdef DEBUG
     50#define DebugInt3()     ; //_asm int 3
     51//#define DebInt3()     _asm int 3;
     52#else
     53// not DEBUG
     54#define DBG_MAX_BUF_SIZE 0x10000
    4655#define dprintf(a)
     56#define dprintf1(a)
    4757#define dprintf2(a)
    4858#define dprintf3(a)
    49 #define DebugInt3()     ;
    50 #endif // #ifdef DEBUG
     59#define DebugInt3()
     60#endif
    5161
    5262#endif //__COMMDBG_H__
     63
  • GPL/branches/uniaud32-2.1.x/include/malloc.h

    r32 r504  
    2525#define MALLOC_INCLUDED
    2626
     27#define  DEFAULT_HEAP   256*1024
     28#define  HEAP_SIZE      256*1024
     29
    2730// Standard malloc.h functions
    2831
     
    3033//      put in seperate private segments)
    3134#ifdef DEBUGHEAP
    32 void NEAR *malloc(unsigned size, const char *filename, int lineno);
     35void NEAR *malloc(ULONG size, const char *filename, int lineno);
    3336void       free(void *NEAR ptr, const char *filename, int lineno);
    3437void NEAR *realloc(void *NEAR ptr, unsigned newsize, const char *filename, int lineno);
    3538#else
    36 void NEAR *malloc(unsigned);
     39void NEAR *malloc(ULONG size);
    3740void       free(void NEAR *);
    3841void NEAR *realloc(void NEAR *, unsigned);
     
    4952
    5053// Specialized routines
    51 unsigned HeapInit(unsigned);        // initializes the heap manager
     54ULONG HeapInit(ULONG size);        // initializes the heap manager
    5255void dumpheap(void);
    5356
  • GPL/branches/uniaud32-2.1.x/lib32/debug.c

    r484 r504  
    2727
    2828#include <string.h>
     29#include <dbgos2.h>
     30
     31#define COMM_DEBUG
    2932
    3033#define CR 0x0d
     
    3437#define SIGNIFICANT_FIELD       0x0007
    3538
    36 BOOL  fLineTerminate=TRUE;
    37 int   DebugLevel = 1;
    38 
    39 extern int wrOffset;
    40 extern char *szprintBuf;
    41 extern int max_buf_size;
     39int DebugLevel;
    4240
    4341char hextab[]="0123456789ABCDEF";
     
    144142}
    145143
    146 #ifdef DEBUG
    147 #define COMM_DEBUG
    148 //------------------------- StringOut --------------------------//
    149 
    150 #define VMDHA_FIXED             0x0002
    151 
    152 extern APIRET VMAlloc(ULONG size, ULONG flags, char NEAR* *pAddr);
    153 
    154144/**
    155145 * Finds the length of a string up to cchMax.
     
    218208#endif
    219209
     210//------------------------- StringOut --------------------------//
    220211void StringOut(char *DbgStr)
    221212{
    222    int len;
     213        int len;
     214
     215        len= _strnlen( DbgStr, 1024 );
     216
    223217#ifdef COMM_DEBUG
    224    int i;
    225 #endif /* DEBUG */
    226 
    227    len= _strnlen( DbgStr, 1024 );
    228 /*
    229    while (*DbgStr)
    230       CharOut(*DbgStr++);
    231       */
    232 #ifdef COMM_DEBUG
    233    if (MAGIC_COMM_PORT)   //PS+++ If have comport - out to it
    234    {
    235        for( i= 0; i < len; i++ )
    236            CharOut( DbgStr[i] );
    237 
    238        if (fLineTerminate)
    239        {
    240            CharOut(CR);                              // append carriage return,
    241            CharOut(LF);                              // linefeed
    242        }
    243    }
     218        if (MAGIC_COMM_PORT) {
     219                int i;
     220
     221                for( i= 0; i < len; i++ ) CharOut( DbgStr[i] );
     222
     223                CharOut(CR);                              // append carriage return,
     224                CharOut(LF);                              // linefeed
     225        }
    244226#endif
    245    if( szprintBuf == 0 )
    246    {
    247       VMAlloc( max_buf_size, VMDHA_FIXED, &szprintBuf );
    248       if( szprintBuf )
    249          memset( szprintBuf, 0, max_buf_size );
    250       wrOffset= 0;
    251    }
    252    if( szprintBuf )
    253    {
    254        if( (len + wrOffset) > max_buf_size )
    255        {
    256           int cntr;
    257           cntr= max_buf_size - wrOffset;
    258           memcpy( szprintBuf +  wrOffset, DbgStr, cntr );
    259           DbgStr+= cntr;
    260           len= len - cntr;
    261           wrOffset= 0;
    262        }
    263        if( len )
    264        {
    265           memcpy( szprintBuf + wrOffset, DbgStr, len );
    266           wrOffset= wrOffset + len;
    267           if( wrOffset >= max_buf_size )
    268               wrOffset= 0;
    269        }
    270        if (fLineTerminate)
    271        {
    272 //           if( (wrOffset+1) >= max_buf_size )
    273 //               wrOffset= 0;
    274            szprintBuf[wrOffset]= CR;
    275            if( ++wrOffset >= max_buf_size )
    276                wrOffset= 0;
    277            szprintBuf[wrOffset]= LF;
    278            if( ++wrOffset >= max_buf_size )
    279                wrOffset= 0;
    280        }
    281    }
    282 }
    283 #endif
    284 
    285 #ifdef  DEBUG
     227
     228        if (szprintBuf == 0) return;
     229
     230        if( (len + wrOffset) > DBG_MAX_BUF_SIZE ) {
     231                int cntr;
     232                cntr = DBG_MAX_BUF_SIZE - wrOffset;
     233                memcpy( szprintBuf +  wrOffset, DbgStr, cntr );
     234                DbgStr += cntr;
     235                len = len - cntr;
     236                wrOffset= 0;
     237        }
     238
     239        if ( len ) {
     240                memcpy( szprintBuf + wrOffset, DbgStr, len );
     241                wrOffset= wrOffset + len;
     242                if( wrOffset >= DBG_MAX_BUF_SIZE ) wrOffset= 0;
     243        }
     244
     245        if ( (wrOffset+1) >= DBG_MAX_BUF_SIZE ) wrOffset= 0;
     246        szprintBuf[wrOffset]= CR;
     247        if ( ++wrOffset >= DBG_MAX_BUF_SIZE ) wrOffset= 0;
     248        szprintBuf[wrOffset]= LF;
     249        if ( ++wrOffset >= DBG_MAX_BUF_SIZE ) wrOffset= 0;
     250}
     251
    286252char BuildString[1024];
    287 #endif          // DEBUG
    288 
     253
     254#if 0
    289255//------------------------- PrintfOut -
    290256void _cdecl DPD(int level, char *DbgStr, ...)
    291257{
    292 #ifdef DEBUG
    293258   char *BuildPtr=BuildString;
    294259   char *pStr=(char *) DbgStr;
     
    398363   *BuildPtr=0;                                 // cauterize the string
    399364   StringOut((char *) BuildString);
    400 #endif                            //DEBUG
    401 }
    402 
     365}
     366#endif
    403367
    404368void _cdecl DPE(char *DbgStr, ...)
    405369{
    406 #ifdef DEBUG
    407370   char *BuildPtr=BuildString;
    408371   char *pStr = (char *) DbgStr;
     
    517480   *BuildPtr=0;                                 // cauterize the string
    518481   StringOut((char *) BuildString);
    519 #endif                            //DEBUG
    520482}
    521483
  • GPL/branches/uniaud32-2.1.x/lib32/irq.c

    r479 r504  
    174174    IRQ_SLOT    *pSlot;
    175175
    176 #ifdef DEBUG
    177 //    dprintf(("enter int proc %d %d",ulSlotNo, *pulIrq));
    178 #endif
     176        //dprintf(("enter int proc %d %d",ulSlotNo, *pulIrq));
    179177
    180178    if(fSuspended)
     
    183181        //Don't pass it to the linux handler as the device doesn't respond as expected
    184182        //when suspended
    185 #ifdef DEBUG
    186183        dprintf(("Slot %d IRQ %d suspended",ulSlotNo, *pulIrq));
    187 #endif
    188184        return FALSE;
    189185    }
     
    229225                    //ok, this interrupt was intended for us; notify the 16 bits MMPM/2 driver
    230226                    OSS32_ProcessIRQ();
    231 #ifdef DEBUG
    232 //                    dprintf(("exit(1) int proc %d %d",ulSlotNo, *pulIrq));
    233 #endif
     227                                        //dprintf(("exit(1) int proc %d %d",ulSlotNo, *pulIrq));
    234228                    eoiIrq[pSlot->irqNo] = 0;
    235229                    return TRUE;
     
    238232        }
    239233    }
    240 #ifdef DEBUG
    241 //                    dprintf(("exit(0) int proc %d %d",ulSlotNo, *pulIrq));
    242 #endif
     234        //dprintf(("exit(0) int proc %d %d",ulSlotNo, *pulIrq));
    243235
    244236    return FALSE;
  • GPL/branches/uniaud32-2.1.x/lib32/malloc.cpp

    r73 r504  
    3838#endif
    3939
    40 #define  DEFAULT_HEAP   256*1024
    41 #define  HEAP_SIZE      256*1024
    42 
    4340#define  SIGNATURE      0xBEEFDEAD      // "DeadBeef" when view in hex in word order.
    4441
     
    4643typedef struct _MEMBLOCK {
    4744    ULONG                  ulSignature;
    48     ULONG                  uSize;
     45    ULONG                  ulSize;
    4946    struct _MEMBLOCK NEAR *pmbNext;
    5047#ifdef DEBUGHEAP
     
    6966LINEAR     acHeap   = NULL;
    7067
     68ULONG ulnAlloc = 0;           // Current number of allocated blocks.
     69ULONG ulcAlloc = 0;           // Total memory in allocated blocks incl. headers.
     70ULONG ulnAllocCalls = 0;      // Cumulative total, number of malloc() calls.
     71ULONG ulnFree  = 0;           // Current number of free blocks.
     72ULONG ulcFree  = 0;           // Total memory in free blocks incl. headers.
     73ULONG ulnFreeCalls  = 0;      // Cumulative total, number of free() calls.
     74ULONG ulnCompact = 0;         // Num of times we've joined two adjacent free
     75                             // blocks into a single larger block.
     76ULONG ulcTotalHeap = HEAP_SIZE;
     77
     78
    7179#pragma off (unreferenced)
    7280
     
    7785void dumpheap(void)
    7886{
    79     int i;
     87    SHORT sI;
    8088    PMEMBLOCK pmb;
    81     unsigned u=0;
    82 
     89    ULONG ulSize;
     90
     91        ulSize = 0;
    8392    pmb=pmbUsed;
    84     dprintf(("HEAP: Heap Dump - Used blocks\n"));
    85     for (i=0; i<10; i++) {
    86         dprintf(("  pmb=%p, length=%ui\n",(void __far *) pmb, pmb->uSize));
    87         u+=pmb->uSize;
     93        dprintf(("HEAP:Heap Dump acHeap=%lx Used=%p Free=%p\n", (void __far *)acHeap, pmbUsed, pmbFree));
     94    dprintf(("  Used blocks\n"));
     95    for (sI=0; sI<10; sI++) {
     96        dprintf(("  pmb=%p, length=%lx\n",(void __far *) pmb, pmb->ulSize));
     97        ulSize+=pmb->ulSize;
    8898        pmb=pmb->pmbNext;
    8999        if (!pmb) break;
    90100    }
    91     dprintf(("  Total used = %ui\n",u));
    92 
    93     u=0;
     101    dprintf(("  Total used = %lx\n", ulSize));
     102
     103    ulSize=0;
    94104    pmb=pmbFree;
    95     dprintf(("HEAP: Heap Dump - Free blocks\n"));
    96     for (i=0; i<50; i++) {
    97         dprintf(("  pmb=%p, length=%ui\n",(void __far *) pmb, pmb->uSize));
    98         u+=pmb->uSize;
     105    dprintf(("  Free blocks\n"));
     106    for (sI=0; sI<50; sI++) {
     107        dprintf(("  pmb=%p, length=%lx\n",(void __far *) pmb, pmb->ulSize));
     108        ulSize+=pmb->ulSize;
    99109        pmb=pmb->pmbNext;
    100110        if (!pmb) break;
    101111    }
    102     dprintf(("  Total free = %ui\n",u));
    103 }
    104 //*****************************************************************************
    105 //*****************************************************************************
    106 
    107 ULONG fMemoryDoc = 0;
    108 ULONG nAlloc = 0;           // Current number of allocated blocks.
    109 ULONG cAlloc = 0;           // Total memory in allocated blocks incl. headers.
    110 ULONG nAllocCalls = 0;      // Cumulative total, number of malloc() calls.
    111 ULONG nFree  = 0;           // Current number of free blocks.
    112 ULONG cFree  = 0;           // Total memory in free blocks incl. headers.
    113 ULONG nFreeCalls  = 0;      // Cumulative total, number of free() calls.
    114 ULONG nCompact = 0;         // Num of times we've joined two adjacent free
    115                              // blocks into a single larger block.
    116 ULONG cTotalHeap = HEAP_SIZE;
    117 
    118 //*****************************************************************************
    119 //*****************************************************************************
    120 BOOL SignatureCheck ( PMEMBLOCK p, PSZ idText )
    121 {
    122     int bGoodPointer;
     112    dprintf(("  Total free = %lx\n", ulSize));
     113}
     114//*****************************************************************************
     115//*****************************************************************************
     116
     117//*****************************************************************************
     118//*****************************************************************************
     119SHORT SignatureCheck ( PMEMBLOCK p, PSZ idText )
     120{
     121    short sGoodPointer;
    123122
    124123    // Set bGoodPointer to indicate whether or not 'p' points within heap.
    125     bGoodPointer = ((LINEAR)p >= (acHeap))
    126                     && ((LINEAR)p <= (( acHeap) + HEAP_SIZE)) ;
    127                               //### heap might have less than HEAP_SIZE bytes
     124    sGoodPointer = ((LINEAR)p >= (acHeap))
     125                                        && ((LINEAR)p <= (( acHeap) + HEAP_SIZE)) ;
     126                                        //### heap might have less than HEAP_SIZE bytes
    128127
    129128    // Check for correct signature.
    130     if (bGoodPointer)
    131         bGoodPointer = (p->ulSignature == SIGNATURE) && p->uSize < HEAP_SIZE;
    132 
    133     if (! bGoodPointer)
    134     {
    135 //      ddprintf( "Heap pointer out of range, or signature exception: %p %s\n", p, idText );
     129    if (sGoodPointer) sGoodPointer = (p->ulSignature == SIGNATURE) && p->ulSize < HEAP_SIZE;
     130
     131    if (!sGoodPointer) {
     132                dprintf(("SignatureCheck: Bad pointer %p %s\n", p, idText));
    136133        DebugInt3();
    137134    }
    138     return bGoodPointer;
    139 }
    140 //*****************************************************************************
    141 //*****************************************************************************
    142 #ifdef DEBUG
     135    return sGoodPointer;
     136}
     137//*****************************************************************************
     138//*****************************************************************************
    143139void HeapCheck ( PSZ idText )
    144140{
    145141    PMEMBLOCK p;
    146     for ( nAlloc = 0, cAlloc = 0, p = pmbUsed; p; p = p->pmbNext ) {
    147         ++nAlloc;
     142    for ( ulnAlloc = 0, ulcAlloc = 0, p = pmbUsed; p; p = p->pmbNext ) {
     143        ++ulnAlloc;
     144        ulcAlloc += p->ulSize + HDR_SIZE;
    148145        SignatureCheck( p,(PSZ) "HeapCheck() Used list" );
    149         cAlloc += p->uSize + HDR_SIZE;
    150     }
    151     for ( nFree = 0, cFree = 0, p = pmbFree; p; p = p->pmbNext ) {
    152         ++nFree;
     146                if (p == p->pmbNext) {
     147                        dprintf(("HeapCheck: used %p points to itself\n", p));
     148                        DebugInt3();
     149                }
     150    }
     151    for ( ulnFree = 0, ulcFree = 0, p = pmbFree; p; p = p->pmbNext ) {
     152        ++ulnFree;
     153        ulcFree += p->ulSize + HDR_SIZE;
    153154        SignatureCheck( p,(PSZ) "HeapCheck() Free list" );
    154         cFree += p->uSize + HDR_SIZE;
    155     }
    156     if (fMemoryDoc & 1) {
    157         if (cAlloc + cFree != cTotalHeap) {
    158 //         ddprintf( "Heap Alloc + Free != Total\n" );
    159 //       dumpheap();
    160             DebugInt3();
    161         }
    162     }
    163 }
    164 #else
    165 #define HeapCheck(a)
    166 #endif
    167 
    168 //*****************************************************************************
    169 //*****************************************************************************
    170 
    171 
     155                if (p == p->pmbNext) {
     156                        dprintf(("HeapCheck: free %p points to itself\n", p));
     157                        DebugInt3();
     158                }
     159    }
     160        if (ulcAlloc + ulcFree != ulcTotalHeap) {
     161                dprintf(("HeapCheck: Alloc+Free != Total\n"));
     162                //dumpheap();
     163                DebugInt3();
     164        }
     165}
     166
     167//*****************************************************************************
     168//*****************************************************************************
    172169
    173170// Threshold for creating a new free block.
    174171#define  MIN_Leftover  (HDR_SIZE + MIN_FragSize)
    175172
    176 /* make_new_free()
     173/*
    177174   Formats the back part of an existing free MEMBLOCK as a new, smaller
    178175   "Free" MEMBLOCK.  Doesn't update Global vbls (caller responsibility).
     
    227224  We split the block into an allocated part to satisfy the allocation request,
    228225  and a free block which can be allocated in a subsequent request.
    229 */
    230 
    231 PMEMBLOCK make_new_free(PMEMBLOCK pmbOldFree, unsigned uRequest)
    232 {
    233     PMEMBLOCK pmbNewFree;     // If we create a new free block, it goes here.
    234 
    235     // Which of the two cases (as described in function header) have we got?
    236     // We know we're big enough to satisfy request, is there enough leftover
    237     // for a new free block?
    238 
    239     if ((uRequest + MIN_Leftover) > pmbOldFree->uSize) {
    240         // Not enough leftover, allocate the entire free block.  Don't
    241         // change pmbOldFree->uSize.
    242         pmbNewFree = 0;
    243     }
    244     else {
    245         // We've got enough leftover to make a new free block.
    246         pmbNewFree = (PMEMBLOCK) ((char *) pmbOldFree + HDR_SIZE + uRequest );
    247         pmbNewFree->ulSignature = SIGNATURE;
    248         pmbNewFree->uSize = pmbOldFree->uSize - (uRequest + HDR_SIZE);
    249         pmbNewFree->pmbNext = pmbOldFree->pmbNext;
    250 
    251         // Update the size of the free block that was passed in.
    252         pmbOldFree->uSize -= (pmbNewFree->uSize + HDR_SIZE);
    253     }
    254 
    255     return pmbNewFree;
    256 }
    257 
    258 
    259 /**@internal _msize
    260  */
    261 unsigned _msize(void NEAR *pvBlock)
    262 {
    263     PMEMBLOCK pmb;
    264 
    265     if (!pvBlock)
    266         return 0;
    267 
    268     pmb = (PMEMBLOCK) ((char NEAR *) pvBlock - HDR_SIZE);
    269    
    270     return pmb->uSize;
    271 }
    272 
    273 
    274 /**@internal pmbAllocateBlock
     226
     227 @internal pmbAllocateBlock
    275228 *  Update all data structures for allocation of one memory block.  It's
    276229 *  assumed, on entry, that the block is large enough for the requested
     
    286239 *  suitable for return to malloc() caller.
    287240 */
    288 void NEAR *npvAllocateBlock( PMEMBLOCK pmb, ULONG uRequest, PMEMBLOCK pmbPrev )
    289 {
     241void NEAR *npvAllocateBlock( PMEMBLOCK pmb, ULONG ulRequest, PMEMBLOCK pmbPrev )
     242{
     243
    290244    //pmb points to the selected block.
    291245    //pmbPrev points to the block prior to the selected block, NULL if pmbFree.
     
    294248
    295249    // Split this block into an allocated + free part if it's big enough.
    296     pmbNewFree = make_new_free( pmb, uRequest );
     250        pmbNewFree = 0;
     251        if (pmb->ulSize >= (ulRequest + MIN_Leftover)) {
     252                // We've got enough leftover to make a new free block.
     253
     254                /* create the new free block */
     255                pmbNewFree = (PMEMBLOCK) ((char __near *) pmb + HDR_SIZE + ulRequest );
     256                pmbNewFree->ulSignature = SIGNATURE;
     257                pmbNewFree->ulSize = pmb->ulSize - (ulRequest + HDR_SIZE);
     258                pmbNewFree->pmbNext = pmb->pmbNext;
     259
     260                // Update the size of the original free block that was passed in.
     261                pmb->ulSize -= (pmbNewFree->ulSize + HDR_SIZE);
     262        }
    297263
    298264    // Update global memory counter.
    299     uMemFree -= (pmb->uSize + HDR_SIZE);
     265    uMemFree -= (pmb->ulSize + HDR_SIZE);
    300266
    301267    // Add this block into the front of the Allocated list.
     
    305271
    306272    // Remove the new allocation from the Free list.
    307     if (pmbNewFree) {                // If we split off a new free block
    308         pmbNewFree->pmbNext = pmbOldNext;
    309         if (pmbPrev)                  // If we're not at head of Free list
    310             pmbPrev->pmbNext = pmbNewFree;
    311         else
    312             pmbFree = pmbNewFree;
    313     }
    314     else {                           // We allocated the entire free block.
    315         if (pmbPrev)                  // If we're not at head of Free list
    316             pmbPrev->pmbNext = pmbOldNext;
    317         else
    318             if (pmbOldNext)
    319                 pmbFree = pmbOldNext;
     273    if (pmbNewFree) { // If we split off a new free block
     274        pmbNewFree->pmbNext = pmbOldNext; // If we're not at head of Free list
     275        if (pmbPrev) pmbPrev->pmbNext = pmbNewFree;
     276        else pmbFree = pmbNewFree;
     277    } else { // We allocated the entire free block.
     278        if (pmbPrev) pmbPrev->pmbNext = pmbOldNext; // If we're not at head of Free list
     279        else pmbFree = pmbOldNext;
    320280    }
    321281
     
    336296
    337297#ifdef DEBUGHEAP
    338 void NEAR *malloc(unsigned uSize, const char *filename, int lineno)
    339 #else
    340 void NEAR *malloc( unsigned uSize )
    341 #endif
    342 {
    343     ULONG uRequest;                    // Request size after alignment.
     298void NEAR *malloc(ULONG ulSize, const char *filename, int lineno)
     299#else
     300void NEAR *malloc( ULONG ulSize )
     301#endif
     302{
     303    ULONG ulRequest;                    // Request size after alignment.
    344304    PMEMBLOCK pmb, pmbPrev;             // Use to walk free lists.
    345     void NEAR *npvReturn = 0;         // Return value.
    346     ULONG cpuflags;
    347 
    348 #ifdef DEBUG
    349 //    dprintf(("malloc(). size: %d",uSize));
    350 #endif
    351     if(acHeap == NULL) {
    352         if (!HeapInit(HEAP_SIZE))
    353         {
    354 #ifdef DEBUG
    355             dprintf(("malloc(): error heap initing"));
    356 #endif
    357             return 0;
    358         }
    359     }
    360 #ifdef DEBUG
    361 //    dprintf(("malloc(): heap inited"));
    362 #endif
    363     if (!uSize || uSize > HEAP_SIZE) {
     305    void NEAR *npvReturn;         // Return value.
     306    ULONG ulCpuFlags;
     307
     308    //dprintf(("malloc(). size: %d", ulSize));
     309    if(acHeap == NULL) return 0;
     310    if (!ulSize || ulSize > HEAP_SIZE) {
    364311        DebugInt3();
    365312        return 0;
    366313    }
    367314
    368     cpuflags = DevPushfCli();
    369     ++nAllocCalls;                      // Diagnostics.
     315    ulCpuFlags = DevPushfCli();
     316        npvReturn = 0;
     317    ++ulnAllocCalls;                      // Diagnostics.
    370318    HeapCheck((PSZ) "malloc() entry" );
    371 #ifdef DEBUG
    372 //    dprintf(("malloc(): heap checked. pmbFree %x",pmbFree));
    373 #endif
    374 
    375     uRequest = (uSize + 3) & -4;        // Force DWORD alignment.
    376 
    377     if (pmbFree->uSize >= uRequest)
    378         npvReturn = npvAllocateBlock( pmbFree, uRequest, NULL );
    379     else {
    380         pmbPrev = pmbFree;
    381         for ( pmb=pmbFree->pmbNext; pmb; pmbPrev=pmb, pmb=pmb->pmbNext)
    382         {
    383 #ifdef DEBUG
    384 //    dprintf(("malloc(): for. pmb %x",pmb));
    385 #endif
    386             if (pmb->uSize >= uRequest) {
    387                 npvReturn = npvAllocateBlock( pmb, uRequest, pmbPrev );
    388                 break;
    389             }
    390         }
    391     }
     319
     320    ulRequest = (ulSize + 3) & -4;        // Force DWORD alignment.
     321
     322        for (pmbPrev=NULL, pmb=pmbFree; pmb; pmbPrev=pmb, pmb=pmb->pmbNext) {
     323                if (pmb->ulSize >= ulRequest) {
     324                        npvReturn = npvAllocateBlock(pmb, ulRequest, pmbPrev);
     325                        break;
     326                }
     327        }
    392328
    393329    if (npvReturn) {
     
    399335#endif
    400336        SignatureCheck( (PMEMBLOCK) (((PUCHAR) npvReturn) - HDR_SIZE), (PSZ) "malloc() exit, allocated block" );
    401     }
    402     else {
    403 #ifdef DEBUG
    404     dprintf(("malloc(): out of memory"));
    405 #endif
    406         // Out of Memory !!!
     337    } else {
     338                dprintf(("malloc(): out of memory"));
    407339        DebugInt3();
    408340    }
    409341
    410342    HeapCheck((PSZ) "malloc() exit" );
    411 #ifdef DEBUG
    412 //    dprintf(("malloc(): malloc exit"));
    413 #endif
    414 
    415     DevPopf(cpuflags);
     343    DevPopf(ulCpuFlags);
    416344    return npvReturn;
    417345}
     
    448376Also, the newly freed block can only be adjacent to at most two other
    449377blocks.  Therefore, the operation of combining two adjacent free blocks can
    450 only happen at most twice.  The variable nFreed counts the number of times
    451 two blocks are combined.  The function exits if nFreed reaches two.  nFreed
     378only happen at most twice.  The variable ulnFreed counts the number of times
     379two blocks are combined.  The function exits if ulnFreed reaches two.  ulnFreed
    452380is initially 0.
    453381
     
    459387*/
    460388
    461 #define after(pmb) ((PMEMBLOCK) ((char *) pmb + pmb->uSize + HDR_SIZE))
     389#define after(pmb) ((PMEMBLOCK) ((char *) pmb + pmb->ulSize + HDR_SIZE))
    462390
    463391void remove(PMEMBLOCK pmb)
     
    470398    }
    471399
    472     for (pmbPrev=pmbFree; pmbPrev; pmbPrev=pmbPrev->pmbNext)
     400    for (pmbPrev=pmbFree; pmbPrev; pmbPrev=pmbPrev->pmbNext) {
    473401        if (pmbPrev->pmbNext == pmb) {
    474402            pmbPrev->pmbNext = pmb->pmbNext;
    475403            return;
    476404        }
     405        }
    477406}
    478407//*****************************************************************************
     
    481410{
    482411    PMEMBLOCK pmb;
    483     int iFreed = 0;
    484 
     412    SHORT sFreed;
     413
     414        sFreed = 0;
    485415    for (pmb=pmbFree->pmbNext; pmb; pmb=pmb->pmbNext) {
    486         if (pmb == pmb->pmbNext) {
    487 //         ddprintf("HEAP: heap loop, %p points to itself\n", (void __far *) pmb);
    488             DebugInt3();
     416        if (after(pmb)  == pmbFree) {
     417                        // ddprintf("HEAP: compact found pointer %p (size=%ui) before pmbFree %p\n", (void __far *) pmb, pmb->uSize, (void __far *) pmbFree);
     418            pmb->ulSize += HDR_SIZE + pmbFree->ulSize;
     419            remove(pmbFree);
     420            if (++sFreed == 2) break;
     421        } else if (after(pmbFree) == pmb) {
     422                        // ddprintf("HEAP: compact found pointer %p (size=%ui) after pmbFree %p\n", (void __far *) pmb, pmb->uSize, (void __far *) pmbFree);
     423            pmbFree->ulSize += HDR_SIZE + pmb->ulSize;
     424            remove(pmb);
     425            if (++sFreed == 2) break;
    489426        }
    490 
    491         if (after(pmb)  == pmbFree) {
    492 // ddprintf("HEAP: compact found pointer %p (size=%ui) before pmbFree %p\n", (void __far *) pmb, pmb->uSize, (void __far *) pmbFree);
    493             pmb->uSize += HDR_SIZE + pmbFree->uSize;
    494             remove(pmbFree);
    495             if (++iFreed == 2) goto exit;
    496         }
    497         else
    498         if (after(pmbFree) == pmb) {
    499 // ddprintf("HEAP: compact found pointer %p (size=%ui) after pmbFree %p\n", (void __far *) pmb, pmb->uSize, (void __far *) pmbFree);
    500             pmbFree->uSize += HDR_SIZE + pmb->uSize;
    501             remove(pmb);
    502             if (++iFreed == 2) goto exit;
    503         }
    504     }
    505 
    506 exit:
    507     nCompact += iFreed;
     427    }
     428
     429    ulnCompact += sFreed;
    508430}
    509431//*****************************************************************************
     
    516438{
    517439    PMEMBLOCK pmb,pmbPrev,pmbBlock;
    518     int fSentinel;
    519     ULONG cpuflags;
     440    ULONG ulCpuFlags;
    520441
    521442    if(acHeap == NULL) {
     
    524445    }
    525446
    526     ++nFreeCalls;
     447    ++ulnFreeCalls;
    527448    if (!pvBlock) return;     // support freeing of NULL
    528449
    529     cpuflags = DevPushfCli();
     450    ulCpuFlags = DevPushfCli();
    530451    pmbBlock=(PMEMBLOCK) ((char NEAR *) pvBlock - HDR_SIZE);
    531452
     
    533454    HeapCheck((PSZ) "free() entry" );
    534455
    535     uMemFree += pmbBlock->uSize + HDR_SIZE;
    536 
    537     if (pmbBlock == pmbUsed) {       // are we freeing the first block?
    538         pmbUsed = pmbUsed->pmbNext;   // the 2nd block is now the 1st
    539         pmbBlock->pmbNext = pmbFree;  // this block is now free, so it points to 1st free block
    540         pmbFree = pmbBlock;           // this is now the 1st free block
    541         compact();
    542         goto exit;
    543     }
    544 
    545     pmbPrev=pmbUsed;
    546     fSentinel = FALSE;
    547     for (pmb=pmbUsed->pmbNext; pmb; pmbPrev=pmb, pmb=pmb->pmbNext) {
    548         if (pmb == pmbBlock) {
    549             if (fSentinel) {
    550                 dprintf(("HEAP: free sentinel triggered, pmb=%p\n", (void __far *) pmb));
    551                 DebugInt3();
    552             }
    553             pmbPrev->pmbNext = pmb->pmbNext;   // delete this block from the chain
    554             pmbBlock->pmbNext = pmbFree;
    555             pmbFree = pmbBlock;
    556             compact();
    557             fSentinel = TRUE;
    558         }
    559     }
    560 
    561 exit: //--- Check things are still intact.
     456    uMemFree += pmbBlock->ulSize + HDR_SIZE;
     457
     458        /* find the block on the used chain */
     459        for (pmbPrev=NULL, pmb=pmbUsed; pmb; pmbPrev=pmb, pmb=pmb->pmbNext) {
     460                if (pmb == pmbBlock) { /* found the block */
     461                        if (pmbPrev) { /* it is in the middle of the chain */
     462                                pmbPrev->pmbNext = pmb->pmbNext; /* delete this block from the chain */
     463                        } else { /* it is the first block on the used list */
     464                                pmbUsed = pmbUsed->pmbNext;     // the 2nd block is now the head
     465                        }
     466                        pmbBlock->pmbNext = pmbFree; /* This block is now free, so it points to the first free block */
     467                        pmbFree = pmbBlock; /* This is now the first free block */
     468                        break;
     469                }
     470        }
     471        if (pmb == 0) {
     472                dprintf(("free: block not found %x\n", pmb));
     473                DebugInt3();
     474        }
     475        compact();
     476
    562477    HeapCheck((PSZ) "free() exit" );
    563     DevPopf(cpuflags);
     478    DevPopf(ulCpuFlags);
    564479}
    565480//*****************************************************************************
     
    571486//*****************************************************************************
    572487//*****************************************************************************
    573 #ifdef DEBUGHEAP
    574 void NEAR *realloc(void NEAR *pvBlock, unsigned usLength, const char *filename, int lineno)
    575 #else
    576 void NEAR *realloc(void NEAR *pvBlock, unsigned usLength)
     488/**@internal _msize
     489 */
     490unsigned _msize(void NEAR *pvBlock)
     491{
     492    PMEMBLOCK pmb;
     493
     494    if (!pvBlock)
     495        return 0;
     496
     497    pmb = (PMEMBLOCK) ((char NEAR *) pvBlock - HDR_SIZE);
     498
     499    return pmb->ulSize;
     500}
     501
     502
     503#ifdef DEBUGHEAP
     504void NEAR *realloc(void NEAR *pvBlock, ULONG ulLength, const char *filename, int lineno)
     505#else
     506void NEAR *realloc(void NEAR *pvBlock, ULONG ulLength)
    577507#endif
    578508{
     
    581511    if (!pvBlock)                 // if ptr is null, alloc block
    582512#ifdef DEBUGHEAP
    583         return malloc(usLength, filename, lineno);
    584 #else
    585         return malloc(usLength);
    586 #endif
    587 
    588     if (!usLength) {              // if length is 0, free block
     513        return malloc(ulLength, filename, lineno);
     514#else
     515        return malloc(ulLength);
     516#endif
     517
     518    if (!ulLength) {              // if length is 0, free block
    589519#ifdef DEBUGHEAP
    590520        free(pvBlock, filename, lineno);
     
    596526
    597527#ifdef DEBUGHEAP
    598     pv = malloc(usLength, filename, lineno);          // attempt to allocate the new block
    599 #else
    600     pv = malloc(usLength);          // attempt to allocate the new block
     528    pv = malloc(ulLength, filename, lineno);          // attempt to allocate the new block
     529#else
     530    pv = malloc(ulLength);          // attempt to allocate the new block
    601531#endif
    602532    if (!pv)                      // can't do it?
    603533        return 0;                  // just fail.  Version 2 will try harder
    604    
    605     memcpy(pv, pvBlock, min( _msize(pvBlock), usLength));
     534
     535    memcpy(pv, pvBlock, min( _msize(pvBlock), ulLength));
    606536
    607537#ifdef DEBUGHEAP
     
    614544//*****************************************************************************
    615545//*****************************************************************************
    616 BOOL IsHeapAddr(ULONG addr) 
     546BOOL IsHeapAddr(ULONG addr)
    617547{
    618548    int bGoodPointer;
     
    626556extern "C" APIRET VMAlloc(ULONG size, ULONG flags, LINEAR *pAddr) ;
    627557//*****************************************************************************
    628 unsigned HeapInit(unsigned uSize)
     558ULONG HeapInit(ULONG ulSize)
    629559{
    630560    LINEAR addr;
    631561    SHORT sel;
    632562
    633     if (!uSize)
    634         uSize = DEFAULT_HEAP;
    635 
    636     if (uSize > HEAP_SIZE)
    637         uSize = HEAP_SIZE;
    638 
    639     if(VMAlloc(uSize, VMDHA_FIXED, &addr)) {
     563    if (!ulSize) ulSize = DEFAULT_HEAP;
     564
     565    if (ulSize > HEAP_SIZE) ulSize = HEAP_SIZE;
     566
     567    if(VMAlloc(ulSize, VMDHA_FIXED, &addr)) {
    640568            DebugInt3();
    641569            return 0;
    642570    }
    643571    acHeap = addr;
    644 #ifdef DEBUG
    645 //    dprintf(("HeapInit(): addr: %x", acHeap));
    646 #endif
     572        //dprintf(("HeapInit(): addr: %x", acHeap));
    647573
    648574    pmbFree = (PMEMBLOCK) acHeap;
    649     pmbFree->uSize = uSize - HDR_SIZE;
     575    pmbFree->ulSize = ulSize - HDR_SIZE;
    650576    pmbFree->ulSignature = SIGNATURE;
    651577    pmbFree->pmbNext = 0;
    652     uMemFree = pmbFree->uSize;
    653     return pmbFree->uSize;
    654 }
    655 //*****************************************************************************
    656 //*****************************************************************************
     578    uMemFree = pmbFree->ulSize;
     579    return pmbFree->ulSize;
     580}
     581//*****************************************************************************
     582//*****************************************************************************
  • GPL/branches/uniaud32-2.1.x/lib32/memory.cpp

    r485 r504  
    197197        *pAddr = (LINEAR)addr;
    198198        if (flags & VMDHA_USEHIGHMEM)
    199             dprintf((("allocated %X in HIGH memory\n"), size));
    200         else dprintf((("allocated %X in LOW memory\n"), size));
    201     }
    202     if ((rc == 87) &&
    203         (flags & VMDHA_USEHIGHMEM))
     199            dprintf1((("allocated %X in HIGH memory\n"), size));
     200        else dprintf1((("allocated %X in LOW memory\n"), size));
     201    }
     202    if ((rc == 87) && (flags & VMDHA_USEHIGHMEM))
    204203    {
    205204        // EARLYMEMINIT workaround
     
    280279        //only done to save size of memory block
    281280        AddBaseAddress(addr, addr, size);
    282 #ifdef DEBUG
    283281        dprintf(("get_free_dma_pages %d -> %x (phys %x)", size, (ULONG)addr, virt_to_phys((void *)addr)));
    284 #endif
    285282        ulget_free_pagesMemUsed += size;
    286 #ifdef DEBUG
    287283        dprintf(("get_free_dma_pages: total alloc size %d", ulget_free_pagesMemUsed));
    288 #endif
    289284    }
    290285
     
    331326                return 0;
    332327        }
    333 ////    dprintf(("__get_free_pages %d returned %x", order*PAGE_SIZE, addr));
     328        //dprintf(("__get_free_pages %d returned %x", order*PAGE_SIZE, addr));
    334329    if(gfp_mask & (GFP_DMA|GFP_DMAHIGHMEM))
    335330    {//must be aligned at 64kb boundary
     
    359354    }
    360355    if(addr) {
    361 #ifdef DEBUG
    362356        dprintf(("get_free_pages %d (%d) -> %x (phys %x)", allocsize, size, (ULONG)addr, virt_to_phys((void *)addr)));
    363 #endif
    364357        ulget_free_pagesMemUsed += allocsize;
    365 #ifdef DEBUG
    366358        dprintf(("get_free_pages: total alloc size %d", ulget_free_pagesMemUsed));
    367 #endif
    368359    }
    369360    return (void *)addr;
     
    382373    }
    383374    else {
    384 #ifdef DEBUG
    385375        dprintf(("free_pages %x size %d", (ULONG)addr, size));
    386 #endif
    387376        ulget_free_pagesMemUsed -= size;
    388 #ifdef DEBUG
    389377        dprintf(("free_pages: total alloc size %d", ulget_free_pagesMemUsed));
    390 #endif
    391     }
    392 ////    dprintf(("free_pages %x", addr));
     378    }
     379        //dprintf(("free_pages %x", addr));
    393380        return 0;
    394381}
     
    409396        }
    410397    if(addr) {
    411 #ifdef DEBUG
    412398        //dprintf(("vmalloc %d -> %x (phys %x)", size, addr, virt_to_phys((void *)addr)));
    413 #endif
    414399        //only done to save size of memory block
    415400        AddBaseAddress(addr, addr, size);
    416401        ulget_free_pagesMemUsed += size;
    417 #ifdef DEBUG
    418402        //dprintf(("vmalloc: total alloc size %d", ulget_free_pagesMemUsed));
    419 #endif
    420403    }
    421404    return (void *)addr;
     
    434417    }
    435418    else {
    436 #ifdef DEBUG
    437419        //dprintf(("vfree %x size %d", (ULONG)ptr, size));
    438 #endif
    439420        ulget_free_pagesMemUsed -= size;
    440 #ifdef DEBUG
    441421        //dprintf(("vfree: total alloc size %d", ulget_free_pagesMemUsed));
    442 #endif
    443422    }
    444423}
     
    474453
    475454    //round to next page boundary
    476 //    size = size + PAGE_SIZE - 1;
    477 //    size &= 0xFFFFF000;
     455        //size = size + PAGE_SIZE - 1;
     456        //size &= 0xFFFFF000;
    478457
    479458#ifdef KEE
    480459    SHORT sel;
    481460
    482 //    rc = KernVMAlloc(size, VMDHA_PHYS, (PVOID*)&addr, (PVOID*)&physaddr, &sel);
     461        //rc = KernVMAlloc(size, VMDHA_PHYS, (PVOID*)&addr, (PVOID*)&physaddr, &sel);
    483462    rc = KernVMAlloc(Length, VMDHA_PHYS, (PVOID*)&addr, (PVOID*)&PhysicalAddress, &sel);
    484463#else
     
    616595        return 0;
    617596    }
    618 ////    dprintf(("kmalloc %d returned %x", size, addr));
     597        //dprintf(("kmalloc %d returned %x", size, addr));
    619598    return addr;
    620599}
     
    634613        return;
    635614    }
    636 ////  dprintf(("kfree %x", addr));
     615        //dprintf(("kfree %x", addr));
    637616    if(IsHeapAddr(addr)) {
    638617#ifdef DEBUGHEAP
  • GPL/branches/uniaud32-2.1.x/lib32/ossidc.cpp

    r503 r504  
    110110        return OSSERR_INIT_FAILED;
    111111    }
    112     dprintf(("\nUniaud version %s\n",UNIAUD_VERSION));
     112    rprintf(("\nUniaud version %s\n",UNIAUD_VERSION));
    113113    dprintf(("OSS32_Initialize. Start address: %X", OffsetBeginCS32));
    114 //    DebugInt3();
     114        //DebugInt3();
    115115
    116116    if(call_module_init(alsa_sound_init) != 0)       return OSSERR_INIT_FAILED;
     
    286286            FillCaps(i);
    287287        }
    288         dprintf(("OSS32_Initialize: SUCCESS. nr. of cards: %d",nrCardsDetected));
     288        dprintf(("OSS32_Initialize: SUCCESS. Cards=%d", nrCardsDetected));
    289289        return OSSERR_SUCCESS;
    290290    }
     
    340340int OSS32_DebugString(char *buffer, ULONG size)
    341341{
    342     dprintf(("U16: %s",buffer));
     342    rprintf(("U16: %s", buffer));
    343343    return size;
    344344}
  • GPL/branches/uniaud32-2.1.x/lib32/sound.c

    r493 r504  
    696696    //set operation to non-blocking
    697697    pHandle->file.f_flags = O_NONBLOCK;
    698 
    699698    ret = pHandle->file.f_op->ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_START, 0);
    700699    if (ret)
  • GPL/branches/uniaud32-2.1.x/uniaud.inc

    r499 r504  
    1313# ex RC3  GA  FIXPACK2 beta_47
    1414# Comment out to avoid a fixpack line in bldlevel
    15 FIXPACK = BETA SVN r499
     15FIXPACK = BETA SVN r504
    1616
    1717# ALSA BUILD VERSION
Note: See TracChangeset for help on using the changeset viewer.