comparison src/unexelfsgi.c @ 165:5a88923fcbfe r20-3b9

Import from CVS: tag r20-3b9
author cvs
date Mon, 13 Aug 2007 09:44:42 +0200
parents 0132846995bd
children 85ec50267440
comparison
equal deleted inserted replaced
164:4e0740e5aab2 165:5a88923fcbfe
495 #include <unistd.h> 495 #include <unistd.h>
496 #include <fcntl.h> 496 #include <fcntl.h>
497 #include <elf.h> 497 #include <elf.h>
498 #include <sym.h> /* for HDRR declaration */ 498 #include <sym.h> /* for HDRR declaration */
499 #include <sys/mman.h> 499 #include <sys/mman.h>
500 #include <config.h>
501 #include "sysdep.h"
500 502
501 /* in 64bits mode, use 64bits elf */ 503 /* in 64bits mode, use 64bits elf */
502 #ifdef _ABI64 504 #ifdef _ABI64
503 typedef Elf64_Shdr l_Elf_Shdr; 505 typedef Elf64_Shdr l_Elf_Shdr;
504 typedef Elf64_Phdr l_Elf_Phdr; 506 typedef Elf64_Phdr l_Elf_Phdr;
604 * 606 *
605 */ 607 */
606 void 608 void
607 unexec (new_name, old_name, data_start, bss_start, entry_address) 609 unexec (new_name, old_name, data_start, bss_start, entry_address)
608 char *new_name, *old_name; 610 char *new_name, *old_name;
609 unsigned data_start, bss_start, entry_address; 611 uintptr_t data_start, bss_start, entry_address;
610 { 612 {
611 extern unsigned int bss_end; 613 extern uintptr_t bss_end;
612 int new_file, old_file, new_file_size; 614 int new_file, old_file, new_file_size;
613 615
614 /* Pointers to the base of the image of the two files. */ 616 /* Pointers to the base of the image of the two files. */
615 caddr_t old_base, new_base; 617 caddr_t old_base, new_base;
616 618
678 old_name, old_file_h, old_section_h, 0); 680 old_name, old_file_h, old_section_h, 0);
679 681
680 old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr; 682 old_bss_addr = OLD_SECTION_H (old_bss_index).sh_addr;
681 old_bss_size = OLD_SECTION_H (old_bss_index).sh_size; 683 old_bss_size = OLD_SECTION_H (old_bss_index).sh_size;
682 #if defined(emacs) || !defined(DEBUG) 684 #if defined(emacs) || !defined(DEBUG)
683 bss_end = (unsigned int) sbrk (0); 685 bss_end = (uintptr_t) sbrk (0);
684 new_bss_addr = (l_Elf_Addr) bss_end; 686 new_bss_addr = (l_Elf_Addr) bss_end;
685 #else 687 #else
686 new_bss_addr = old_bss_addr + old_bss_size + 0x1234; 688 new_bss_addr = old_bss_addr + old_bss_size + 0x1234;
687 #endif 689 #endif
688 new_data2_addr = old_bss_addr; 690 new_data2_addr = old_bss_addr;