diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/unexcw.c | 17 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7e6e08ac5c2..a118678dba9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-03-22 Ken Brown <kbrown@cornell.edu> | ||
| 2 | |||
| 3 | * unexcw.c: Drop unneeded inclusion of w32common.h. | ||
| 4 | (report_sheap_usage): Declare. | ||
| 5 | (read_exe_header): Add magic numbers for x86_64. | ||
| 6 | (fixup_executable): Fix printf format specifier for unsigned long | ||
| 7 | argument. | ||
| 8 | |||
| 1 | 2013-03-22 Dmitry Antipov <dmantipov@yandex.ru> | 9 | 2013-03-22 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 10 | ||
| 3 | * frame.h (struct frame): Put menu_bar_window under #ifdef | 11 | * frame.h (struct frame): Put menu_bar_window under #ifdef |
diff --git a/src/unexcw.c b/src/unexcw.c index af93e158e14..1290c28d245 100644 --- a/src/unexcw.c +++ b/src/unexcw.c | |||
| @@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include "unexec.h" | 22 | #include "unexec.h" |
| 23 | #include "w32common.h" | ||
| 24 | 23 | ||
| 25 | #include <lisp.h> | 24 | #include <lisp.h> |
| 26 | #include <stdio.h> | 25 | #include <stdio.h> |
| @@ -31,6 +30,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | 30 | ||
| 32 | #define DOTEXE ".exe" | 31 | #define DOTEXE ".exe" |
| 33 | 32 | ||
| 33 | extern void report_sheap_usage (int); | ||
| 34 | |||
| 34 | extern int bss_sbrk_did_unexec; | 35 | extern int bss_sbrk_did_unexec; |
| 35 | 36 | ||
| 36 | extern int __malloc_initialized; | 37 | extern int __malloc_initialized; |
| @@ -73,7 +74,11 @@ read_exe_header (int fd, exe_header_t * exe_header_buffer) | |||
| 73 | 74 | ||
| 74 | assert (exe_header_buffer->file_header.e_magic == 0x5a4d); | 75 | assert (exe_header_buffer->file_header.e_magic == 0x5a4d); |
| 75 | assert (exe_header_buffer->file_header.nt_signature == 0x4550); | 76 | assert (exe_header_buffer->file_header.nt_signature == 0x4550); |
| 77 | #ifdef __x86_64__ | ||
| 78 | assert (exe_header_buffer->file_header.f_magic == 0x8664); | ||
| 79 | #else | ||
| 76 | assert (exe_header_buffer->file_header.f_magic == 0x014c); | 80 | assert (exe_header_buffer->file_header.f_magic == 0x014c); |
| 81 | #endif | ||
| 77 | assert (exe_header_buffer->file_header.f_nscns > 0); | 82 | assert (exe_header_buffer->file_header.f_nscns > 0); |
| 78 | assert (exe_header_buffer->file_header.f_nscns <= | 83 | assert (exe_header_buffer->file_header.f_nscns <= |
| 79 | sizeof (exe_header_buffer->section_header) / | 84 | sizeof (exe_header_buffer->section_header) / |
| @@ -85,7 +90,11 @@ read_exe_header (int fd, exe_header_t * exe_header_buffer) | |||
| 85 | sizeof (exe_header_buffer->file_optional_header)); | 90 | sizeof (exe_header_buffer->file_optional_header)); |
| 86 | assert (ret == sizeof (exe_header_buffer->file_optional_header)); | 91 | assert (ret == sizeof (exe_header_buffer->file_optional_header)); |
| 87 | 92 | ||
| 93 | #ifdef __x86_64__ | ||
| 94 | assert (exe_header_buffer->file_optional_header.magic == 0x020b); | ||
| 95 | #else | ||
| 88 | assert (exe_header_buffer->file_optional_header.magic == 0x010b); | 96 | assert (exe_header_buffer->file_optional_header.magic == 0x010b); |
| 97 | #endif | ||
| 89 | 98 | ||
| 90 | for (i = 0; i < exe_header_buffer->file_header.f_nscns; ++i) | 99 | for (i = 0; i < exe_header_buffer->file_header.f_nscns; ++i) |
| 91 | { | 100 | { |
| @@ -132,7 +141,7 @@ fixup_executable (int fd) | |||
| 132 | exe_header->file_optional_header.ImageBase + | 141 | exe_header->file_optional_header.ImageBase + |
| 133 | exe_header->section_header[i].s_paddr; | 142 | exe_header->section_header[i].s_paddr; |
| 134 | if (debug_unexcw) | 143 | if (debug_unexcw) |
| 135 | printf ("%8s start 0x%08x end 0x%08x\n", | 144 | printf ("%8s start %#lx end %#lx\n", |
| 136 | exe_header->section_header[i].s_name, | 145 | exe_header->section_header[i].s_name, |
| 137 | start_address, end_address); | 146 | start_address, end_address); |
| 138 | if (my_edata >= (char *) start_address | 147 | if (my_edata >= (char *) start_address |
| @@ -149,7 +158,7 @@ fixup_executable (int fd) | |||
| 149 | assert (ret == my_edata - (char *) start_address); | 158 | assert (ret == my_edata - (char *) start_address); |
| 150 | ++found_data; | 159 | ++found_data; |
| 151 | if (debug_unexcw) | 160 | if (debug_unexcw) |
| 152 | printf (" .data, mem start 0x%08x mem length %d\n", | 161 | printf (" .data, mem start %#lx mem length %d\n", |
| 153 | start_address, my_edata - (char *) start_address); | 162 | start_address, my_edata - (char *) start_address); |
| 154 | if (debug_unexcw) | 163 | if (debug_unexcw) |
| 155 | printf (" .data, file start %d file length %d\n", | 164 | printf (" .data, file start %d file length %d\n", |
| @@ -233,7 +242,7 @@ fixup_executable (int fd) | |||
| 233 | __malloc_initialized = 1; | 242 | __malloc_initialized = 1; |
| 234 | assert (ret == (my_endbss - (char *) start_address)); | 243 | assert (ret == (my_endbss - (char *) start_address)); |
| 235 | if (debug_unexcw) | 244 | if (debug_unexcw) |
| 236 | printf (" .bss, mem start 0x%08x mem length %d\n", | 245 | printf (" .bss, mem start %#lx mem length %d\n", |
| 237 | start_address, my_endbss - (char *) start_address); | 246 | start_address, my_endbss - (char *) start_address); |
| 238 | if (debug_unexcw) | 247 | if (debug_unexcw) |
| 239 | printf (" .bss, file start %d file length %d\n", | 248 | printf (" .bss, file start %d file length %d\n", |