Changeset 1673
- Timestamp:
- 02/17/98 01:45:18 (11 years ago)
- Files:
-
- branches/GNU/src/unexelf1.c (added)
- branches/GNU/src/unexencap.c (added)
- branches/GNU/src/unexenix.c (added)
- branches/GNU/src/unexfx2800.c (added)
- branches/GNU/src/unexhp9k800.c (modified) (1 diff)
- branches/GNU/src/unexmips.c (added)
- branches/GNU/src/unexnext.c (added)
- branches/GNU/src/unexsgi.c (modified) (4 diffs)
- branches/GNU/src/unexsni.c (modified) (7 diffs)
- branches/GNU/src/unexsunos4.c (modified) (3 diffs)
- branches/GNU/src/unexw32.c (modified) (24 diffs)
- branches/GNU/src/vlimit.h (added)
- branches/GNU/src/vm-limit.c (modified) (1 diff)
- branches/GNU/src/vms-pp.c (added)
- branches/GNU/src/vms-pp.trans (added)
- branches/GNU/src/vms-pwd.h (added)
- branches/GNU/src/vmsdir.h (added)
- branches/GNU/src/vmsfns.c (added)
- branches/GNU/src/vmsgmalloc.c (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/GNU/src/unexhp9k800.c
r1669 r1673 38 38 */ 39 39 40 #include <stdio.h> 41 #include <fcntl.h> 42 #include <errno.h> 43 44 #include <a.out.h> 45 40 46 #ifdef emacs 41 47 #include <config.h> 42 48 #endif 43 44 #include <stdio.h>45 #include <fcntl.h>46 #include <errno.h>47 48 #include <a.out.h>49 49 50 50 #ifdef HPUX_USE_SHLIBS branches/GNU/src/unexsgi.c
r1663 r1673 413 413 */ 414 414 415 #include <config.h>416 415 #include <sys/types.h> 417 416 #include <stdio.h> … … 760 759 } 761 760 else 762 { 763 memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (n), 764 old_file_h->e_shentsize); 765 766 /* Any section that was original placed AFTER the bss 767 section must now be adjusted by NEW_OFFSETS_SHIFT. */ 768 769 if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset) 770 NEW_SECTION_H (nn).sh_offset += new_offsets_shift; 771 } 772 761 memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (n), 762 old_file_h->e_shentsize); 763 764 /* Any section that was original placed AFTER the bss 765 section must now be adjusted by NEW_OFFSETS_SHIFT. */ 766 767 if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset) 768 NEW_SECTION_H (nn).sh_offset += new_offsets_shift; 769 773 770 /* If any section hdr refers to the section after the new .data 774 771 section, make it refer to next one because we have inserted … … 790 787 ".data" in the strings table) get copied from the current process 791 788 instead of the old file. */ 792 if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data") 793 || !strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data1") 794 #ifdef IRIX6_5 795 /* Under IRIX 6.5 gcc places objects with adresses relative to 796 shared symbols in the section .rodata, which are adjusted at 797 startup time. Unfortunately they aren't adjusted after unexec, 798 so with this configuration we must get .rodata also from memory. 799 Do any other configurations need this, too? 800 <Wolfgang.Glas@hfm.tu-graz.ac.at> 1999-06-08. */ 801 || !strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".rodata") 802 #endif 803 || !strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".got")) 789 if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data") 790 || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data1") 791 || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".got")) 804 792 src = (caddr_t) OLD_SECTION_H (n).sh_addr; 805 793 else … … 872 860 for (; num--; sym++) 873 861 { 874 /* don't patch special section indices. */875 862 if (sym->st_shndx == SHN_UNDEF 876 || sym->st_shndx >= SHN_LORESERVE) 863 || sym->st_shndx == SHN_ABS 864 || sym->st_shndx == SHN_COMMON) 877 865 continue; 878 866 branches/GNU/src/unexsni.c
r1669 r1673 23 23 You are forbidden to forbid anyone else to use, share and improve 24 24 what you give them. Help stamp out software-hoarding! */ 25 25 26 26 27 /* … … 117 118 * New modifications for Siemens Nixdorf's MIPS-based machines. 118 119 * Marco.Walther@mch.sni.de 119 * marco@inreach.com120 120 * 121 121 * The problem: Before the bss segment we have a so called sbss segment … … 306 306 #include <elf.h> 307 307 #include <sys/mman.h> 308 #include <assert.h>309 310 /* #define DEBUG */311 308 312 309 #ifndef emacs … … 387 384 Elf32_Addr new_data3_addr; 388 385 389 390 Elf32_Addr old_rel_dyn_addr;391 Elf32_Word old_rel_dyn_size;392 int old_rel_dyn_index;393 394 386 Elf32_Word old_sdata_size, new_sdata_size; 395 387 int old_sdata_index = 0; … … 471 463 if (old_sbss_index != (old_bss_index - 1)) 472 464 fatal (".sbss should come immediately before .bss in %s.\n", old_name, 0); 473 474 /* Find the old .rel.dyn section.475 */476 477 for (old_rel_dyn_index = 1; old_rel_dyn_index < old_file_h->e_shnum;478 old_rel_dyn_index++)479 {480 #ifdef DEBUG481 fprintf (stderr, "Looking for .rel.dyn - found %s\n",482 old_section_names + OLD_SECTION_H(old_rel_dyn_index).sh_name);483 #endif484 if (!strcmp (old_section_names + OLD_SECTION_H(old_rel_dyn_index).sh_name,485 ".rel.dyn"))486 break;487 }488 if (old_rel_dyn_index == old_file_h->e_shnum)489 fatal ("Can't find .rel_dyn in %s.\n", old_name, 0);490 491 old_rel_dyn_addr = OLD_SECTION_H(old_rel_dyn_index).sh_addr;492 old_rel_dyn_size = OLD_SECTION_H(old_rel_dyn_index).sh_size;493 465 494 466 /* Figure out parameters of the new data3 and data2 sections. … … 545 517 fprintf (stderr, "old_sbss_addr %x\n", old_sbss_addr); 546 518 fprintf (stderr, "old_sbss_size %x\n", old_sbss_size); 547 fprintf (stderr, "old_rel_dyn_addr %x\n", old_rel_dyn_addr);548 fprintf (stderr, "old_rel_dyn_size %x\n", old_rel_dyn_size);549 519 if (old_sdata_index) 550 520 { … … 847 817 } 848 818 } 849 {850 Elf32_Rel *rel_p;851 unsigned int old_data_addr_start;852 unsigned int old_data_addr_end;853 unsigned int old_data_offset;854 unsigned int new_data_offset;855 int i;856 857 rel_p = (Elf32_Rel *)OLD_SECTION_H(old_rel_dyn_index).sh_addr;858 old_data_addr_start = OLD_SECTION_H(old_data_index).sh_addr;859 old_data_addr_end = old_data_addr_start +860 OLD_SECTION_H(old_data_index).sh_size;861 old_data_offset = (int)OLD_SECTION_H(old_data_index).sh_offset +862 (unsigned int)old_base;863 new_data_offset = (int)NEW_SECTION_H(old_data_index).sh_offset +864 (unsigned int)new_base;865 866 #ifdef DEBUG867 fprintf(stderr, "old_data.sh_addr= 0x%08x ... 0x%08x\n", old_data_addr_start,868 old_data_addr_end);869 #endif /* DEBUG */870 871 for (i = 0; i < old_rel_dyn_size/sizeof(Elf32_Rel); i++)872 {873 #ifdef DEBUG874 fprintf(stderr, ".rel.dyn offset= 0x%08x type= %d sym= %d\n",875 rel_p->r_offset, ELF32_R_TYPE(rel_p->r_info), ELF32_R_SYM(rel_p->r_info));876 #endif /* DEBUG */877 878 if (rel_p->r_offset)879 {880 unsigned int offset;881 882 assert(old_data_addr_start <= rel_p->r_offset &&883 rel_p->r_offset <= old_data_addr_end);884 885 offset = rel_p->r_offset - old_data_addr_start;886 887 #ifdef DEBUG888 fprintf(stderr, "r_offset= 0x%08x *r_offset= 0x%08x\n",889 rel_p->r_offset, *((int *)(rel_p->r_offset)));890 fprintf(stderr, "old = 0x%08x *old =0x%08x\n",891 (old_data_offset + offset - (unsigned int)old_base),892 *((int *)(old_data_offset + offset)));893 fprintf(stderr, "new = 0x%08x *new =0x%08x\n",894 (new_data_offset + offset - (unsigned int)new_base),895 *((int *)(new_data_offset + offset)));896 #endif /* DEBUG */897 898 *((int *)(new_data_offset + offset)) = *((int *)(old_data_offset + offset));899 }900 901 rel_p++;902 }903 }904 819 905 820 /* Close the files and make the new file executable */ branches/GNU/src/unexsunos4.c
r1669 r1673 1 1 /* Unexec for Sunos 4 using shared libraries. 2 Copyright (C) 1990, 1994 , 1999Free Software Foundation, Inc.2 Copyright (C) 1990, 1994 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Emacs. … … 44 44 * 45 45 */ 46 47 #ifdef emacs48 #include <config.h>49 #endif50 51 46 #include <sys/param.h> 52 47 #include <sys/mman.h> … … 56 51 #include <stdio.h> 57 52 #include <a.out.h> 53 54 /* Do this after the above #include's in case a configuration file wants 55 to define things for this file based on what <a.out.h> defines. */ 56 #ifdef emacs 57 #include <config.h> 58 #endif 58 59 59 60 #if defined (SUNOS4) || defined (__FreeBSD__) || defined (__NetBSD__) branches/GNU/src/unexw32.c
r1671 r1673 22 22 */ 23 23 24 #include <config.h>25 26 24 #include <stdlib.h> /* _fmode */ 27 25 #include <stdio.h> 28 26 #include <fcntl.h> 29 #include <time.h>30 27 #include <windows.h> 31 28 32 /* Include relevant definitions from IMAGEHLP.H, which can be found 33 in \\win32sdk\mstools\samples\image\include\imagehlp.h. */ 34 35 PIMAGE_NT_HEADERS 36 (__stdcall * pfnCheckSumMappedFile) (LPVOID BaseAddress, 37 DWORD FileLength, 38 LPDWORD HeaderSum, 39 LPDWORD CheckSum); 40 29 #pragma data_seg(".emdata") 41 30 extern BOOL ctrl_c_handler (unsigned long type); 42 31 43 extern char my_begdata[];44 extern char my_edata[];45 extern char my_begbss[];46 extern char my_endbss[];47 extern char *my_begbss_static;48 extern char *my_endbss_static;49 50 32 #include "w32heap.h" 51 52 #undef min53 #undef max54 #define min(x, y) (((x) < (y)) ? (x) : (y))55 #define max(x, y) (((x) > (y)) ? (x) : (y))56 33 57 34 /* Basically, our "initialized" flag. */ … … 78 55 DWORD bss_size = 0; 79 56 80 #ifdef HAVE_NTGUI81 57 HINSTANCE hinst = NULL; 82 58 HINSTANCE hprevinst = NULL; 83 59 LPSTR lpCmdLine = ""; 84 60 int nCmdShow = 0; 85 #endif /* HAVE_NTGUI */86 61 87 62 /* Startup code for running on NT. When we are running as the dumped … … 92 67 _start (void) 93 68 { 69 #ifndef __BORLANDC__ /* 97/01/13 by Y.Matsushima */ 94 70 extern void mainCRTStartup (void); 71 extern BOOL dump_memmap(void); 72 #endif 95 73 96 74 #if 0 … … 131 109 p[1] = 'e'; 132 110 } 133 111 #ifdef PROFILE 134 112 /* Using HiProf profiler, exe name is different still. */ 135 113 { … … 138 116 } 139 117 #endif 118 #endif 140 119 141 120 recreate_heap (executable_path); … … 158 137 /* Invoke the NT CRT startup routine now that our housecleaning 159 138 is finished. */ 160 #ifdef HAVE_NTGUI161 139 /* determine WinMain args like crt0.c does */ 162 140 hinst = GetModuleHandle(NULL); 163 141 lpCmdLine = GetCommandLine(); 164 142 nCmdShow = SW_SHOWDEFAULT; 165 #endif 143 144 /*********************************************Check! Later!!!!! 145 init_allocate_heap(); 146 **************************************************************/ 147 #ifndef __BORLANDC__ /* 97/01/13 by Y.Matsushima */ 166 148 mainCRTStartup (); 167 } 149 #endif 150 } 151 152 #ifdef __BORLANDC__ /* 97/01/13 by Y.Matsushima */ 153 #pragma startup _start 0 154 BOOL BorlandDebugDump = FALSE; 155 #endif 168 156 169 157 /* Dump out .data and .bss sections into a new executable. */ … … 206 194 get_section_info (&in_file); 207 195 196 #ifndef __BORLANDC__ /* 97/01/17 by Y.Matsushima */ 208 197 /* The size of the dumped executable is the size of the original 209 198 executable plus the size of the heap and the size of the .bss section. */ … … 223 212 copy_executable_and_dump_data_section (&in_file, &out_file); 224 213 dump_bss_and_heap (&in_file, &out_file); 225 226 /* Patch up header fields; profiler is picky about this. */ 227 { 228 PIMAGE_DOS_HEADER dos_header; 229 PIMAGE_NT_HEADERS nt_header; 230 HANDLE hImagehelp = LoadLibrary ("imagehlp.dll"); 231 DWORD headersum; 232 DWORD checksum; 233 234 dos_header = (PIMAGE_DOS_HEADER) out_file.file_base; 235 nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + dos_header->e_lfanew); 236 237 nt_header->OptionalHeader.CheckSum = 0; 238 // nt_header->FileHeader.TimeDateStamp = time (NULL); 239 // dos_header->e_cp = size / 512; 240 // nt_header->OptionalHeader.SizeOfImage = size; 241 242 pfnCheckSumMappedFile = (void *) GetProcAddress (hImagehelp, "CheckSumMappedFile"); 243 if (pfnCheckSumMappedFile) 244 { 245 // nt_header->FileHeader.TimeDateStamp = time (NULL); 246 pfnCheckSumMappedFile (out_file.file_base, 247 out_file.size, 248 &headersum, 249 &checksum); 250 nt_header->OptionalHeader.CheckSum = checksum; 251 } 252 FreeLibrary (hImagehelp); 214 #else 215 if( !BorlandDebugDump ){ 216 heap_index_in_executable = (unsigned long) 217 round_to_next ((unsigned char *) in_file.size, get_allocation_unit ()); 218 size = heap_index_in_executable + get_committed_heap_size () + bss_size; 219 } else { 220 heap_index_in_executable = 0; 221 size = in_file.size; 253 222 } 254 223 open_output_file (&out_file, out_filename, size); 224 need_to_recreate_heap = TRUE; 225 copy_executable_and_dump_data_section (&in_file, &out_file); 226 if( BorlandDebugDump ){ 227 close_file_data (&out_file); 228 size = get_committed_heap_size () + bss_size; 229 strcpy(&out_filename[strlen(out_filename) -4], ".dmp"); 230 open_output_file(&out_file, out_filename, size); 231 } 232 dump_bss_and_heap (&in_file, &out_file); 233 #endif 255 234 close_file_data (&in_file); 256 235 close_file_data (&out_file); … … 334 313 335 314 /* Routines to manipulate NT executable file sections. */ 336 337 #ifdef SEPARATE_BSS_SECTION 315 #if 0 338 316 static void 339 317 get_bss_info_from_map_file (file_data *p_infile, PUCHAR *p_bss_start, … … 376 354 #endif 377 355 378 unsigned long 356 /* Correct section size is not necessary. The wanted size has only not to 357 not collide with other sections. */ 358 #if 0 359 static unsigned long 379 360 get_section_size (PIMAGE_SECTION_HEADER p_section) 380 361 { 381 /* The true section size, before rounding. Some linkers swap the 382 meaning of these two values. */ 383 return min (p_section->SizeOfRawData, 384 p_section->Misc.VirtualSize); 385 } 386 362 /* The section size is in different locations in the different versions. */ 363 switch (get_nt_minor_version ()) 364 { 365 case 10: 366 return p_section->SizeOfRawData; 367 default: 368 return p_section->Misc.VirtualSize; 369 } 370 } 371 #endif 387 372 /* Return pointer to section header for named section. */ 388 373 IMAGE_SECTION_HEADER * … … 422 407 return NULL; 423 408 } 424 425 409 426 410 /* Flip through the executable and cache the info necessary for dumping. */ … … 434 418 int i; 435 419 420 #ifndef __BORLANDC__ /* 97/01/13 by Y.Matsushima */ 421 const char *SectionNameData = ".emdata"; 422 const char *SectionNameBss = ".embss"; 423 #else 424 const char *SectionNameData = "DATA"; 425 const char *SectionNameBss = "BSS--> UnUsed"; 426 const char *SectionNameDebug= ".debug"; 427 extern char my_sdata, my_sbss; 428 extern char my_edata, my_ebss; 429 #endif 430 436 431 dos_header = (PIMAGE_DOS_HEADER) p_infile->file_base; 437 432 if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) … … 460 455 for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) 461 456 { 462 #ifdef SEPARATE_BSS_SECTION 463 if (!strcmp (section->Name, ".bss")) 457 if (!strcmp (section->Name, SectionNameBss)) 464 458 { 465 /* The . bss section. */459 /* The .embss section. */ 466 460 ptr = (char *) nt_header->OptionalHeader.ImageBase + 467 461 section->VirtualAddress; 468 462 bss_start = ptr; 463 #if 0 469 464 bss_size = get_section_size (section); 465 #else 466 bss_size = section->Misc.VirtualSize; 467 #endif 470 468 } 471 #endif 472 #if 0 473 if (!strcmp (section->Name, ".data")) 469 if (!strcmp (section->Name, SectionNameData)) 474 470 { 475 /* From lastfile.c */476 extern char my_edata[];477 478 471 /* The .data section. */ 479 472 data_section = section; 480 473 ptr = (char *) nt_header->OptionalHeader.ImageBase + 481 474 section->VirtualAddress; 475 #ifndef __BORLANDC__ /* 97/01/13 by Y.Matsushima */ 482 476 data_start_va = ptr; 483 477 data_start_file = section->PointerToRawData; 484 478 479 #if 0 485 480 /* We want to only write Emacs data back to the executable, 486 481 not any of the library data (if library data is included, … … 488 483 than the one Emacs was dumped on). */ 489 484 data_size = my_edata - data_start_va; 485 #endif 486 data_size = section -> SizeOfRawData; 487 #else /* for BORLANDC */ 488 /* INIT DATA */ 489 data_start_file = section->PointerToRawData + 490 ((DWORD)&my_sdata - (DWORD)ptr); /* seek to &my_sdata */ 491 data_start_va = &my_sdata; 492 data_size = (DWORD)&my_edata - (DWORD)&my_sdata; 493 /* BSS */ 494 bss_start = &my_sbss; 495 bss_size = (DWORD)&my_ebss - (DWORD)&my_sbss; 496 #endif 490 497 } 491 #else 492 if (!strcmp (section->Name, "EMDATA")) 493 { 494 /* The Emacs initialized data section. */ 495 data_section = section; 496 ptr = (char *) nt_header->OptionalHeader.ImageBase + 497 section->VirtualAddress; 498 data_start_va = ptr; 499 data_start_file = section->PointerToRawData; 500 501 /* Write back the full section. */ 502 data_size = get_section_size (section); 503 } 498 #ifdef __BORLANDC__ /* 97/01/17 by Y.Matsushima */ 499 if( !strcmp (section->Name, SectionNameDebug) ) 500 BorlandDebugDump = TRUE; 504 501 #endif 505 502 section++; 506 503 } 507 504 508 #if def SEPARATE_BSS_SECTION509 if ( bss_start == UNINIT_PTR && bss_size == UNINIT_LONG)505 #if 0 506 if (!bss_start && !bss_size) 510 507 { 511 508 /* Starting with MSVC 4.0, the .bss section has been eliminated … … 521 518 + data_section->VirtualAddress; 522 519 } 523 #else524 /* As noted in lastfile.c, the Alpha (but not the Intel) MSVC linker525 globally segregates all static and public bss data (ie. across all526 linked modules, not just per module), so we must take both static and527 public bss areas into account to determine the true extent of the bss528 area used by Emacs.529 530 To be strictly correct, we should dump the static and public bss531 areas used by Emacs separately if non-overlapping (since otherwise we532 are dumping bss data belonging to system libraries, eg. the static533 bss system data on the Alpha). However, in practice this doesn't534 seem to matter, since presumably the system libraries always535 reinitialize their bss variables. */536 bss_start = min (my_begbss, my_begbss_static);537 bss_size = max (my_endbss, my_endbss_static) - bss_start;538 520 #endif 539 521 } … … 548 530 unsigned char *data_file, *data_va; 549 531 unsigned long size, index; 550 532 551 533 /* Get a pointer to where the raw data should go in the executable file. */ 552 534 data_file = (char *) p_outfile->file_base + data_start_file; … … 563 545 564 546 size = data_size; 565 printf ("Dumping . data section...\n");547 printf ("Dumping .emdata section...\n"); 566 548 printf ("\t0x%08x Address in process.\n", data_va); 567 549 printf ("\t0x%08x Offset in output file.\n", … … 598 580 memcpy ((PUCHAR) p_outfile->file_base + index, heap_data, size); 599 581 600 printf ("Dumping .bss into executable...\n"); 582 /* .embss section is dumped for all uninitialized data. */ 583 printf ("Dumping .embss into executable...\n"); 601 584 602 585 index += size; … … 604 587 bss_data = bss_start; 605 588 606 printf ("\t0x%08x BSS start in process.\n", bss_data);607 printf ("\t0x%08x BSS offset in executable.\n", index);608 printf ("\t0x%08x BSS size in bytes.\n", size);589 printf ("\t0x%08x EMACS BSS start in process.\n", bss_data); 590 printf ("\t0x%08x EMACS BSS offset in executable.\n", index); 591 printf ("\t0x%08x EMACS BSS size in bytes.\n", size); 609 592 memcpy ((char *) p_outfile->file_base + index, bss_data, size); 610 593 } … … 613 596 /* Reload and remap routines. */ 614 597 615 void616 w32_fatal_reload_error (char *step)617 {618 int error = GetLastError ();619 char *buffer = alloca (4096);620 621 sprintf (buffer,622 "Emacs failed to load its dumped heap back into its address space.\n"623 "The error occurred during the following step:\n\n"624 "%s\n\n"625 "GetLastError = %d\n\n"626 "Heap start: 0x%08x\n"627 "Heap commit: 0x%08x\n"628 "Heap end: 0x%08x\n\n"629 "This error typically happens when the system loads a DLL into\n"630 "the middle of Emacs' address space, preventing Emacs from\n"631 "loading its heap there. If this happens only occasionally, then\n"632 "you can probably ignore it. But if it happens so often that\n"633 "you cannot get Emacs to start reliably, and you think that Emacs\n"634 "is installed correctly, then you have a couple of options:\n\n"635 "Emacs correctly, then you have two options:\n\n"636 "1) You can dump Emacs yourself. By doing this, you ensure that\n"637 "Emacs' heap fits around the DLLs in your system. To dump Emacs,\n"638 "download the emacs-(version)-undump-(arch) distribution file\n"639 "from the site where you downloaded the executable distribution.\n\n"640 "2) You can build Emacs from source. This is just another way\n"641 "to dump Emacs on your system.",642 step,643 error,644 get_heap_start (),645 get_heap_start () + get_committed_heap_size (),646 get_heap_end ());647 648 MessageBox (NULL,649 buffer,650 "Emacs Abort Dialog",651 MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL);652 653 exit (-1);654 }655 598 656 599 /* Load the dumped .bss section into the .bss area of our address space. */ … … 662 605 char buffer[512], *bss; 663 606 int i; 664 607 #ifdef __BORLANDC__ /* 97/01/17 by Y.Matsushima */ 608 char alter_filename[MAX_PATH]; 609 610 if( BorlandDebugDump ){ 611 strcpy(alter_filename, filename); 612 strcpy(&alter_filename[strlen(alter_filename) -4], ".dmp"); 613 filename = alter_filename; 614 } 615 #endif 665 616 file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, 666 617 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 667 618 if (file == INVALID_HANDLE_VALUE) 668 w32_fatal_reload_error ("Opening Emacs executable file for .bss."); 619 { 620 i = GetLastError (); 621 exit (1); 622 } 669 623 670 624 /* Seek to where the .bss section is tucked away after the heap... */ 671 625 index = heap_index_in_executable + get_committed_heap_size (); 672 626 if (SetFilePointer (file, index, NULL, FILE_BEGIN) == 0xFFFFFFFF) 673 w32_fatal_reload_error ("Seeking to the saved .bss section."); 627 { 628 i = GetLastError (); 629 exit (1); 630 } 631 674 632 675 633 /* Ok, read in the saved .bss section and initialize all 676 634 uninitialized variables. */ 677 635 if (!ReadFile (file, bss_start, bss_size, &n_read, NULL)) 678 w32_fatal_reload_error ("Reading the saved .bss section."); 636 { 637 i = GetLastError (); 638 exit (1); 639 } 679 640 680 641 CloseHandle (file); … … 690 651 unsigned long size, upper_size, n_read; 691 652 int i; 692 653 #ifdef __BORLANDC__ /* 97/01/17 by Y.Matsushima */ 654 char alter_filename[MAX_PATH]; 655 656 if( BorlandDebugDump ){ 657 strcpy(alter_filename, filename); 658 strcpy(&alter_filename[strlen(alter_filename) -4], ".dmp"); 659 filename = alter_filename; 660 } 661 #endif 693 662 file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, 694 663 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 695 664 if (file == INVALID_HANDLE_VALUE) 696 w32_fatal_reload_error ("Opening Emacs executable file for heap."); 665 { 666 i = GetLastError (); 667 exit (1); 668 } 697 669 698 670 size = GetFileSize (file, &upper_size); … … 700 672 0, size, NULL); 701 673 if (!file_mapping) 702 w32_fatal_reload_error ("Creating file mapping to heap in executable."); 674 { 675 i = GetLastError (); 676 exit (1); 677 } 703 678 704 679 size = get_committed_heap_size (); … … 718 693 if (VirtualAlloc (get_heap_start (), get_committed_heap_size (), 719 694 MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE) == NULL) 720 w32_fatal_reload_error ("Allocating heap address space."); 695 { 696 i = GetLastError (); 697 exit (1); 698 } 721 699 722 700 /* Seek to the location of the heap data in the executable. */ 723 701 i = heap_index_in_executable; 724 702 if (SetFilePointer (file, i, NULL, FILE_BEGIN) == 0xFFFFFFFF) 725 w32_fatal_reload_error ("Seeking to saved heap in executable file."); 703 { 704 i = GetLastError (); 705 exit (1); 706 } 726 707 727 708 /* Read in the data. */ 728 709 if (!ReadFile (file, get_heap_start (), 729 710 get_committed_heap_size (), &n_read, NULL)) 730 w32_fatal_reload_error ("Reading saved heap from executable file."); 711 { 712 i = GetLastError (); 713 exit (1); 714 } 731 715 732 716 CloseHandle (file); branches/GNU/src/vm-limit.c
r1667 r1673 131 131 warn_function = warnfun; 132 132 __after_morecore_hook = check_memory_limits; 133 134 #ifdef WINDOWSNT135 /* Force data limit to be recalculated on each run. */136 lim_data = 0;137 #endif138 133 }
