view vmalloc.h @ 206:a262abf4b8d5

brch file for new WestmereEx 4x10 HW Branch
author Merten Sach <msach@mailbox.tu-berlin.de>
date Fri, 17 Feb 2012 18:43:52 +0100
parents 9b2b9bc2c362
children
line source
1 /*
2 * Copyright 2009 OpenSourceCodeStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 * Created on November 14, 2009, 9:07 PM
8 */
10 #ifndef _VMALLOC_H
11 #define _VMALLOC_H
13 #include <malloc.h>
14 #include <inttypes.h>
15 #include "VMS_primitive_data_types.h"
17 #define SMALL_CHUNK_SIZE 32
18 #define SMALL_CHUNK_COUNT 4
19 #define LOWER_BOUND 128 //Biggest chunk size that is created for the small chunks
20 #define BIG_LOWER_BOUND 160 //Smallest chunk size that is created for the big chunks
22 #define LOG54 0.3219280948873623
23 #define LOG128 7
25 typedef struct _MallocProlog MallocProlog;
27 struct _MallocProlog
28 {
29 MallocProlog *nextChunkInFreeList;
30 MallocProlog *prevChunkInFreeList;
31 MallocProlog *nextHigherInMem;
32 MallocProlog *nextLowerInMem;
33 };
34 //MallocProlog
36 typedef struct MallocArrays MallocArrays;
38 struct MallocArrays
39 {
40 MallocProlog **smallChunks;
41 MallocProlog **bigChunks;
42 uint64 bigChunksSearchVector[2];
43 void *memSpace;
44 uint32 containerCount;
45 };
46 //MallocArrays
48 typedef struct
49 {
50 MallocProlog *firstChunkInFreeList;
51 int32 numInList; //TODO not used
52 }
53 FreeListHead;
55 //comply with interface of HW__generic_x86_64_MC branch
56 #define VMS_WL__malloc VMS_int__malloc
57 #define VMS_WL__malloc_aligned VMS_int__malloc_aligned
58 #define VMS_WL__free VMS_int__free
60 void *
61 VMS_int__malloc( size_t sizeRequested );
63 void *
64 VMS_int__malloc_aligned( size_t sizeRequested );
66 void
67 VMS_int__free( void *ptrToFree );
69 /*Allocates memory from the external system -- higher overhead
70 */
71 void *
72 VMS_int__malloc_in_ext( size_t sizeRequested );
74 /*Frees memory that was allocated in the external system -- higher overhead
75 */
76 void
77 VMS_int__free_in_ext( void *ptrToFree );
80 MallocArrays *
81 VMS_ext__create_free_list();
83 void
84 VMS_ext__free_free_list(MallocArrays *freeLists );
86 #endif