diff options
| author | Geoff Voelker | 1997-09-03 00:51:32 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1997-09-03 00:51:32 +0000 |
| commit | 801f68b995bc026446109ac3fafd9af5f7816827 (patch) | |
| tree | 323f7b133568a7612e36198a57c91c6874dc3485 /src | |
| parent | 1edf84e7517f0cffce3595dcfc819718d8f60135 (diff) | |
| download | emacs-801f68b995bc026446109ac3fafd9af5f7816827.tar.gz emacs-801f68b995bc026446109ac3fafd9af5f7816827.zip | |
(os_subtype): New variable.
(cache_system_info): Set os_subtype.
(recreate_heap): Update system information after loading heap.
Don't use data_seg pragma here.
(_heap_init, _heap_term) [_MSC_VER >= 1000]: New functions that
override CRT routines.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32heap.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/w32heap.c b/src/w32heap.c index 8565999b459..21a2fceb06e 100644 --- a/src/w32heap.c +++ b/src/w32heap.c | |||
| @@ -41,6 +41,9 @@ int etext; | |||
| 41 | int w32_major_version; | 41 | int w32_major_version; |
| 42 | int w32_minor_version; | 42 | int w32_minor_version; |
| 43 | 43 | ||
| 44 | /* Distinguish between Windows NT and Windows 95. */ | ||
| 45 | int os_subtype; | ||
| 46 | |||
| 44 | /* Cache information describing the NT system for later use. */ | 47 | /* Cache information describing the NT system for later use. */ |
| 45 | void | 48 | void |
| 46 | cache_system_info (void) | 49 | cache_system_info (void) |
| @@ -61,6 +64,11 @@ cache_system_info (void) | |||
| 61 | w32_major_version = version.info.major; | 64 | w32_major_version = version.info.major; |
| 62 | w32_minor_version = version.info.minor; | 65 | w32_minor_version = version.info.minor; |
| 63 | 66 | ||
| 67 | if (version.info.platform & 0x8000) | ||
| 68 | os_subtype = OS_WIN95; | ||
| 69 | else | ||
| 70 | os_subtype = OS_NT; | ||
| 71 | |||
| 64 | /* Cache page size, allocation unit, processor type, etc. */ | 72 | /* Cache page size, allocation unit, processor type, etc. */ |
| 65 | GetSystemInfo (&sysinfo_cache); | 73 | GetSystemInfo (&sysinfo_cache); |
| 66 | syspage_mask = sysinfo_cache.dwPageSize - 1; | 74 | syspage_mask = sysinfo_cache.dwPageSize - 1; |
| @@ -85,10 +93,6 @@ round_to_next (unsigned char *address, unsigned long align) | |||
| 85 | return (unsigned char *) (tmp * align); | 93 | return (unsigned char *) (tmp * align); |
| 86 | } | 94 | } |
| 87 | 95 | ||
| 88 | /* Force zero initialized variables to be placed in the .data segment; | ||
| 89 | MSVC 5.0 otherwise places them in .bss, which breaks the dumping code. */ | ||
| 90 | #pragma data_seg(".data") | ||
| 91 | |||
| 92 | /* Info for keeping track of our heap. */ | 96 | /* Info for keeping track of our heap. */ |
| 93 | unsigned char *data_region_base = NULL; | 97 | unsigned char *data_region_base = NULL; |
| 94 | unsigned char *data_region_end = NULL; | 98 | unsigned char *data_region_end = NULL; |
| @@ -278,6 +282,9 @@ recreate_heap (char *executable_path) | |||
| 278 | any funny interactions between file I/O and file mapping. */ | 282 | any funny interactions between file I/O and file mapping. */ |
| 279 | read_in_bss (executable_path); | 283 | read_in_bss (executable_path); |
| 280 | map_in_heap (executable_path); | 284 | map_in_heap (executable_path); |
| 285 | |||
| 286 | /* Update system version information to match current system. */ | ||
| 287 | cache_system_info (); | ||
| 281 | } | 288 | } |
| 282 | 289 | ||
| 283 | /* Round the heap up to the given alignment. */ | 290 | /* Round the heap up to the given alignment. */ |
| @@ -293,3 +300,26 @@ round_heap (unsigned long align) | |||
| 293 | if (need_to_alloc) | 300 | if (need_to_alloc) |
| 294 | sbrk (need_to_alloc); | 301 | sbrk (need_to_alloc); |
| 295 | } | 302 | } |
| 303 | |||
| 304 | #if (_MSC_VER >= 1000) | ||
| 305 | |||
| 306 | /* MSVC 4.2 invokes these functions from mainCRTStartup to initialize | ||
| 307 | a heap via HeapCreate. They are normally defined by the runtime, | ||
| 308 | but we override them here so that the unnecessary HeapCreate call | ||
| 309 | is not performed. */ | ||
| 310 | |||
| 311 | int __cdecl | ||
| 312 | _heap_init (void) | ||
| 313 | { | ||
| 314 | /* Stepping through the assembly indicates that mainCRTStartup is | ||
| 315 | expecting a nonzero success return value. */ | ||
| 316 | return 1; | ||
| 317 | } | ||
| 318 | |||
| 319 | void __cdecl | ||
| 320 | _heap_term (void) | ||
| 321 | { | ||
| 322 | return; | ||
| 323 | } | ||
| 324 | |||
| 325 | #endif | ||