comparison src/ntheap.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents a307f9a2021d
children a634e3b7acc8
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
19 02111-1307, USA. 19 02111-1307, USA.
20 20
21 Geoff Voelker (voelker@cs.washington.edu) 7-29-94 */ 21 Geoff Voelker (voelker@cs.washington.edu) 7-29-94 */
22 22
23 /* Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> */ 23 /* Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> */
24 /* Synced with FSF Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> */ 24 /* Synced with FSF Emacs 19.34.6 by Marc Paquette <marcpa@cam.org>
25 (Note: Sync messages from Marc Paquette may indicate
26 incomplete synching, so beware.)
27 */
25 28
26 #include <config.h> 29 #include <config.h>
27 #include "lisp.h" /* for VALMASK */ 30 #include "lisp.h"
28 31
29 #include <stdlib.h> 32 #include "syswindows.h"
30
31 #include "ntheap.h"
32 33
33 /* This gives us the page size and the size of the allocation unit on NT. */ 34 /* This gives us the page size and the size of the allocation unit on NT. */
34 SYSTEM_INFO sysinfo_cache; 35 SYSTEM_INFO sysinfo_cache;
35 unsigned long syspage_mask = 0; 36 unsigned long syspage_mask = 0;
36 37
240 VirtualQuery (base, &info, sizeof (info)); 241 VirtualQuery (base, &info, sizeof (info));
241 if (info.State != MEM_FREE) 242 if (info.State != MEM_FREE)
242 { 243 {
243 /* Oops, something has already reserved or commited it, nothing we can do but exit */ 244 /* Oops, something has already reserved or commited it, nothing we can do but exit */
244 char buf[256]; 245 char buf[256];
245 wsprintf(buf, 246 sprintf (buf,
246 "XEmacs cannot start because the memory region required by the heap is not available.\n" 247 "XEmacs cannot start because the memory region required by the heap is not available.\n"
247 "(BaseAddress = 0x%lx, AllocationBase = 0x%lx, Size = 0x%lx, State = %s, Type = %s)", 248 "(BaseAddress = 0x%lx, AllocationBase = 0x%lx, Size = 0x%lx, State = %s, Type = %s)",
248 info.BaseAddress, info.AllocationBase, info.RegionSize, 249 info.BaseAddress, info.AllocationBase, info.RegionSize,
249 info.State == MEM_COMMIT ? "COMMITED" : "RESERVED", 250 info.State == MEM_COMMIT ? "COMMITED" : "RESERVED",
250 info.Type == MEM_IMAGE ? "IMAGE" : info.Type == MEM_MAPPED ? "MAPPED" : "PRIVATE"); 251 info.Type == MEM_IMAGE ? "IMAGE" : info.Type == MEM_MAPPED ? "MAPPED" : "PRIVATE");
251 MessageBox(NULL, buf, "XEmacs", MB_OK | MB_ICONSTOP); 252 MessageBoxA (NULL, buf, "XEmacs", MB_OK | MB_ICONSTOP);
252 exit(1); 253 exit(1);
253 } 254 }
254 255
255 /* Now try and reserve as much as possible */ 256 /* Now try and reserve as much as possible */
256 size = min (info.RegionSize, (DWORD) (end - base)); 257 size = min (info.RegionSize, (DWORD) (end - base));
257 tmp = VirtualAlloc (base, size, MEM_RESERVE, PAGE_NOACCESS); 258 tmp = VirtualAlloc (base, size, MEM_RESERVE, PAGE_NOACCESS);
258 if (!tmp) 259 if (!tmp)
259 { 260 {
260 /* Can't reserve it, nothing we can do but exit */ 261 /* Can't reserve it, nothing we can do but exit */
261 char buf[256]; 262 char buf[256];
262 wsprintf(buf, 263 sprintf (buf,
263 "XEmacs cannot start because it couldn't reserve space required for the heap.\n" 264 "XEmacs cannot start because it couldn't reserve space required for the heap.\n"
264 "(VirtualAlloc at 0x%lx of 0x%lx failed (%d))", base, size, GetLastError()); 265 "(VirtualAlloc at 0x%lx of 0x%lx failed (%d))", base, size, GetLastError());
265 MessageBox(NULL, buf, "XEmacs", MB_OK | MB_ICONSTOP); 266 MessageBoxA (NULL, buf, "XEmacs", MB_OK | MB_ICONSTOP);
266 exit (1); 267 exit (1);
267 } 268 }
268 269
269 /* We read in the data for the .bss section from the executable 270 /* We read in the data for the .bss section from the executable
270 first and map in the heap from the executable second to prevent 271 first and map in the heap from the executable second to prevent