[2511] | 1 | /* $Id: malloc.h,v 1.6 2000-01-24 18:18:59 bird Exp $
|
---|
[847] | 2 | *
|
---|
| 3 | * Heap.
|
---|
| 4 | *
|
---|
| 5 | * Note: This heap does very little checking on input.
|
---|
| 6 | * Use with care! We're running at Ring-0!
|
---|
| 7 | *
|
---|
| 8 | * Copyright (c) 1999 knut st. osmundsen
|
---|
| 9 | *
|
---|
[1678] | 10 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 11 | *
|
---|
[847] | 12 | */
|
---|
| 13 |
|
---|
| 14 | /* XLATOFF */
|
---|
| 15 | #ifndef _MALLOC_H_
|
---|
| 16 | #define _MALLOC_H_
|
---|
[1269] | 17 | #ifdef __MALLOC_H
|
---|
| 18 | #error("A different version of malloc.h has allready been loaded!")
|
---|
| 19 | #endif
|
---|
| 20 | #define __malloc_h
|
---|
[847] | 21 |
|
---|
| 22 | #ifdef __cplusplus
|
---|
| 23 | extern "C" {
|
---|
| 24 | #endif
|
---|
| 25 | /* XLATON */
|
---|
| 26 |
|
---|
| 27 | /*******************************************************************************
|
---|
| 28 | * Exported Functions and Variables *
|
---|
| 29 | *******************************************************************************/
|
---|
[2511] | 30 | int heapInit(unsigned, unsigned, unsigned, unsigned);
|
---|
| 31 | void * malloc(unsigned);
|
---|
| 32 | void * realloc(void *, unsigned);
|
---|
| 33 | void free(void *);
|
---|
| 34 | unsigned _memfree(void);
|
---|
| 35 | unsigned _msize(void *);
|
---|
| 36 | int _validptr(void *);
|
---|
| 37 | int _validptr2(void *, unsigned);
|
---|
| 38 | int _heap_check(void);
|
---|
[847] | 39 |
|
---|
| 40 |
|
---|
| 41 | /*******************************************************************************
|
---|
| 42 | * Defined Constants And Macros *
|
---|
| 43 | *******************************************************************************/
|
---|
[1269] | 44 | /* HeapPointer assert - old ones... */
|
---|
[847] | 45 | #define ltasserthp(a) if (!_validptr((void*)(a))){ _ltasserthp((void*)(a), #a,__FILE__,__LINE__); return FALSE;}
|
---|
| 46 | #define ltasserthp2(a,b) if (!_validptr((void*)(a))){ _ltasserthp((void*)(a), #a,__FILE__,__LINE__); b; return FALSE;}
|
---|
| 47 | #define _ltasserthp(a,b,c,d) _kprintf("ltasserthp: pv=%#.8x - '%s' in %s line %d - returns FALSE\n",a,b,c,d)
|
---|
| 48 | #define ltasserthps(a,b) if (!_validptr2((void*)(a),(unsigned)(b))){ _ltasserthsp((void*)(a), (unsigned)(b), #a, #b,__FILE__,__LINE__); return FALSE;}
|
---|
| 49 | #define ltasserthps2(a,b,c) if (!_validptr2((void*)(a),(unsigned)(b))){ _ltasserthsp((void*)(a), (unsigned)(b), #a, #b,__FILE__,__LINE__); c; return FALSE;}
|
---|
| 50 | #define _ltasserthps(a,b,c,d,e,f) _kprintf("ltasserthsp: pv=%#.8x cb=%#x - '%s' '%s' in %s line %d - returns FALSE\n",a,b,c,d,e,f)
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 | /* XLATOFF */
|
---|
| 54 | #ifdef __cplusplus
|
---|
| 55 | }
|
---|
| 56 | #endif
|
---|
| 57 | #endif /* _MALLOC_H_ */
|
---|
| 58 | /* XLATON */
|
---|
| 59 |
|
---|