comparison src/ntheap.c @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 8626e4521993
children a86b2b5e0111
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
36 36
37 /* These are defined to get Emacs to compile, but are not used. */ 37 /* These are defined to get Emacs to compile, but are not used. */
38 int edata; 38 int edata;
39 int etext; 39 int etext;
40 40
41 /* The major and minor versions of NT. */
42 int nt_major_version;
43 int nt_minor_version;
44
45 /* Distinguish between Windows NT and Windows 95. */
46 int os_subtype;
47
48 /* Cache information describing the NT system for later use. */ 41 /* Cache information describing the NT system for later use. */
49 void 42 void
50 cache_system_info (void) 43 cache_system_info (void)
51 { 44 {
52 union
53 {
54 struct info
55 {
56 char major;
57 char minor;
58 short platform;
59 } info;
60 DWORD data;
61 } version;
62
63 /* Cache the version of the operating system. */
64 version.data = GetVersion ();
65 nt_major_version = version.info.major;
66 nt_minor_version = version.info.minor;
67
68 if (version.info.platform & 0x8000)
69 os_subtype = OS_WIN95;
70 else
71 os_subtype = OS_NT;
72
73 /* Cache page size, allocation unit, processor type, etc. */ 45 /* Cache page size, allocation unit, processor type, etc. */
74 GetSystemInfo (&sysinfo_cache); 46 GetSystemInfo (&sysinfo_cache);
75 syspage_mask = sysinfo_cache.dwPageSize - 1; 47 syspage_mask = sysinfo_cache.dwPageSize - 1;
76 } 48 }
77 49
146 28 bits available for pointers, this lets us use the remainder of 118 28 bits available for pointers, this lets us use the remainder of
147 the region below the 256MB line for our malloc arena - 229MB is 119 the region below the 256MB line for our malloc arena - 229MB is
148 still a pretty decent arena to play in! */ 120 still a pretty decent arena to play in! */
149 121
150 unsigned long base = 0x01B00000; /* 27MB */ 122 unsigned long base = 0x01B00000; /* 27MB */
151 unsigned long end = 1 << VALBITS; /* 256MB */ 123 /* Temporary hack for the non-starting problem - use 28 (256Mb) rather than VALBITS (1Gb) */
124 unsigned long end = 1 << 28; /* 256MB */
152 void *ptr = NULL; 125 void *ptr = NULL;
153 126
154 #define NTHEAP_PROBE_BASE 1 127 #define NTHEAP_PROBE_BASE 1
155 #if NTHEAP_PROBE_BASE /* This is never normally defined */ 128 #if NTHEAP_PROBE_BASE /* This is never normally defined */
156 /* 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. */
187 { 160 {
188 data_region_base = allocate_heap (); 161 data_region_base = allocate_heap ();
189 if (!data_region_base) 162 if (!data_region_base)
190 return NULL; 163 return NULL;
191 164
192 #ifndef USE_MINIMAL_TAGBITS
193 /* Ensure that the addresses don't use the upper tag bits since
194 the Lisp type goes there. */
195 #ifdef USE_UNION_TYPE
196 if (((unsigned long) data_region_base & ~((1U << VALBITS) - 1)) != 0)
197 #else
198 if (((unsigned long) data_region_base & ~VALMASK) != 0)
199 #endif
200 {
201 printf ("Error: The heap was allocated in upper memory.\n");
202 exit (1);
203 }
204 #endif
205
206 data_region_end = data_region_base; 165 data_region_end = data_region_base;
207 real_data_region_end = data_region_end; 166 real_data_region_end = data_region_end;
208 data_region_size = get_reserved_heap_size (); 167 data_region_size = get_reserved_heap_size ();
209 } 168 }
210 169
259 } 218 }
260 219
261 return result; 220 return result;
262 } 221 }
263 222
264 #ifndef CANNOT_DUMP 223 #if !defined (CANNOT_DUMP) && !defined(HEAP_IN_DATA) && !defined(PDUMP)
265 224
266 /* 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.
267 EXECUTABLE_PATH tells us where to find the executable. */ 226 EXECUTABLE_PATH tells us where to find the executable. */
268 void 227 void
269 recreate_heap (char *executable_path) 228 recreate_heap (char *executable_path)