Mercurial > hg > xemacs-beta
comparison src/ntheap.c @ 400:a86b2b5e0111 r21-2-30
Import from CVS: tag r21-2-30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:14:34 +0200 |
parents | 74fd4e045ea6 |
children | 5a2589c672dc |
comparison
equal
deleted
inserted
replaced
399:376370fb5946 | 400:a86b2b5e0111 |
---|---|
78 get_data_end (void) | 78 get_data_end (void) |
79 { | 79 { |
80 return data_region_end; | 80 return data_region_end; |
81 } | 81 } |
82 | 82 |
83 static char * | 83 static unsigned char * |
84 allocate_heap (void) | 84 allocate_heap (void) |
85 { | 85 { |
86 /* The base address for our GNU malloc heap is chosen in conjunction | 86 /* The base address for our GNU malloc heap is chosen in conjunction |
87 with the link settings for temacs.exe which control the stack size, | 87 with the link settings for temacs.exe which control the stack size, |
88 the initial default process heap size and the executable image base | 88 the initial default process heap size and the executable image base |
120 still a pretty decent arena to play in! */ | 120 still a pretty decent arena to play in! */ |
121 | 121 |
122 unsigned long base = 0x01B00000; /* 27MB */ | 122 unsigned long base = 0x01B00000; /* 27MB */ |
123 /* Temporary hack for the non-starting problem - use 28 (256Mb) rather than VALBITS (1Gb) */ | 123 /* Temporary hack for the non-starting problem - use 28 (256Mb) rather than VALBITS (1Gb) */ |
124 unsigned long end = 1 << 28; /* 256MB */ | 124 unsigned long end = 1 << 28; /* 256MB */ |
125 void *ptr = NULL; | 125 void *ptr; |
126 | 126 |
127 #define NTHEAP_PROBE_BASE 1 | 127 #define NTHEAP_PROBE_BASE 1 |
128 #if NTHEAP_PROBE_BASE /* This is never normally defined */ | 128 #if NTHEAP_PROBE_BASE /* This is never normally defined */ |
129 /* Try various addresses looking for one the kernel will let us have. */ | 129 /* Try various addresses looking for one the kernel will let us have. */ |
130 while (!ptr && (base < end)) | 130 while (!ptr && (base < end)) |
142 get_reserved_heap_size (), | 142 get_reserved_heap_size (), |
143 MEM_RESERVE, | 143 MEM_RESERVE, |
144 PAGE_NOACCESS); | 144 PAGE_NOACCESS); |
145 #endif | 145 #endif |
146 | 146 |
147 return ptr; | 147 return (unsigned char*) ptr; |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 /* Emulate Unix sbrk. */ | 151 /* Emulate Unix sbrk. */ |
152 void * | 152 void * |
225 /* Recreate the heap from the data that was dumped to the executable. | 225 /* Recreate the heap from the data that was dumped to the executable. |
226 EXECUTABLE_PATH tells us where to find the executable. */ | 226 EXECUTABLE_PATH tells us where to find the executable. */ |
227 void | 227 void |
228 recreate_heap (char *executable_path) | 228 recreate_heap (char *executable_path) |
229 { | 229 { |
230 unsigned char *tmp; | 230 void *tmp; |
231 | 231 |
232 /* First reserve the upper part of our heap. (We reserve first | 232 /* First reserve the upper part of our heap. (We reserve first |
233 because there have been problems in the past where doing the | 233 because there have been problems in the past where doing the |
234 mapping first has loaded DLLs into the VA space of our heap.) */ | 234 mapping first has loaded DLLs into the VA space of our heap.) */ |
235 tmp = VirtualAlloc ((void *) get_heap_end (), | 235 tmp = VirtualAlloc ((void *) get_heap_end (), |