| 1 | /* $Id: rmalloc.h,v 1.3 2000-09-02 21:08:04 bird Exp $ | 
|---|
| 2 | * | 
|---|
| 3 | * Resident 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-2000 knut st. osmundsen | 
|---|
| 9 | * | 
|---|
| 10 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 11 | * | 
|---|
| 12 | */ | 
|---|
| 13 |  | 
|---|
| 14 | /* XLATOFF */ | 
|---|
| 15 | #ifndef _RMALLOC_H_ | 
|---|
| 16 | #define _RMALLOC_H_ | 
|---|
| 17 |  | 
|---|
| 18 | #ifdef __cplusplus | 
|---|
| 19 | extern "C" { | 
|---|
| 20 | #endif | 
|---|
| 21 | /* XLATON */ | 
|---|
| 22 | /******************************************************************************* | 
|---|
| 23 | *   Structures and Typedefs                                                    * | 
|---|
| 24 | *******************************************************************************/ | 
|---|
| 25 | typedef struct HeapState_s  /* note: this is used by both swappable and resident heaps */ | 
|---|
| 26 | { | 
|---|
| 27 | ULONG       cbHeapSize;          /* Amount of memory used by the heap free and used++. */ | 
|---|
| 28 | ULONG       cbHeapFree;          /* Amount of used space. */ | 
|---|
| 29 | ULONG       cbHeapUsed;          /* Amount of free space reserved. */ | 
|---|
| 30 | ULONG       cBlocksUsed;         /* Count of used blocks. */ | 
|---|
| 31 | ULONG       cBlocksFree;         /* Count of free blocks. */ | 
|---|
| 32 | } HEAPSTATE, *PHEAPSTATE; | 
|---|
| 33 |  | 
|---|
| 34 |  | 
|---|
| 35 | /******************************************************************************* | 
|---|
| 36 | *   Exported Functions and Variables                                           * | 
|---|
| 37 | *******************************************************************************/ | 
|---|
| 38 | int         resHeapInit(unsigned, unsigned); | 
|---|
| 39 | void *      rmalloc(unsigned); | 
|---|
| 40 | void *      rrealloc(void *, unsigned); | 
|---|
| 41 | void        rfree(void *); | 
|---|
| 42 |  | 
|---|
| 43 | unsigned    _res_msize(void *); | 
|---|
| 44 | int         _res_validptr(void *); | 
|---|
| 45 | int         _res_validptr2(void *, unsigned); | 
|---|
| 46 | unsigned    _res_memfree(void); | 
|---|
| 47 | unsigned    _res_memused(void); | 
|---|
| 48 | int         _res_state(PHEAPSTATE); | 
|---|
| 49 | int         _res_heap_check(void); | 
|---|
| 50 | void        _res_heapmin(void); | 
|---|
| 51 | void        _res_dump_subheaps(void); | 
|---|
| 52 | void        _res_dump_allocated(unsigned); | 
|---|
| 53 |  | 
|---|
| 54 | extern unsigned cbResHeapMax;           /* Maximum amount of memory used by the heap. */ | 
|---|
| 55 |  | 
|---|
| 56 |  | 
|---|
| 57 | /* XLATOFF */ | 
|---|
| 58 | #ifdef __cplusplus | 
|---|
| 59 | } | 
|---|
| 60 | #endif | 
|---|
| 61 | #endif /* _MALLOC_H_ */ | 
|---|
| 62 | /* XLATON */ | 
|---|
| 63 |  | 
|---|