comparison src/ntheap.c @ 169:15872534500d r20-3b11

Import from CVS: tag r20-3b11
author cvs
date Mon, 13 Aug 2007 09:46:53 +0200
parents 4be1180a9e89
children 41ff10fd062f
comparison
equal deleted inserted replaced
168:9851d5c6556e 169:15872534500d
78 78
79 return (unsigned char *) (tmp * align); 79 return (unsigned char *) (tmp * align);
80 } 80 }
81 81
82 /* Info for keeping track of our heap. */ 82 /* Info for keeping track of our heap. */
83 unsigned char *data_region_base = NULL; 83 unsigned char *data_region_base = UNINIT_PTR;
84 unsigned char *data_region_end = NULL; 84 unsigned char *data_region_end = UNINIT_PTR;
85 unsigned char *real_data_region_end = NULL; 85 unsigned char *real_data_region_end = UNINIT_PTR;
86 unsigned long data_region_size = 0; 86 unsigned long data_region_size = UNINIT_LONG;
87 unsigned long reserved_heap_size = 0; 87 unsigned long reserved_heap_size = UNINIT_LONG;
88 88
89 /* The start of the data segment. */ 89 /* The start of the data segment. */
90 unsigned char * 90 unsigned char *
91 get_data_start (void) 91 get_data_start (void)
92 { 92 {
141 141
142 unsigned long base = 0x01B00000; /* 27MB */ 142 unsigned long base = 0x01B00000; /* 27MB */
143 unsigned long end = 1 << VALBITS; /* 256MB */ 143 unsigned long end = 1 << VALBITS; /* 256MB */
144 void *ptr = NULL; 144 void *ptr = NULL;
145 145
146 #define NTHEAP_PROBE_BASE 1
146 #if NTHEAP_PROBE_BASE /* This is never normally defined */ 147 #if NTHEAP_PROBE_BASE /* This is never normally defined */
147 /* Try various addresses looking for one the kernel will let us have. */ 148 /* Try various addresses looking for one the kernel will let us have. */
148 while (!ptr && (base < end)) 149 while (!ptr && (base < end))
149 { 150 {
150 reserved_heap_size = end - base; 151 reserved_heap_size = end - base;
172 { 173 {
173 void *result; 174 void *result;
174 long size = (long) increment; 175 long size = (long) increment;
175 176
176 /* Allocate our heap if we haven't done so already. */ 177 /* Allocate our heap if we haven't done so already. */
177 if (!data_region_base) 178 if (data_region_base == UNINIT_PTR)
178 { 179 {
179 data_region_base = allocate_heap (); 180 data_region_base = allocate_heap ();
180 if (!data_region_base) 181 if (!data_region_base)
181 return NULL; 182 return NULL;
182 183