diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/unexmacosx.c | 43 |
2 files changed, 48 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b99d5b4a2ba..e9ddaf38aa8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2003-07-22 Andrew Choi <akochoi@shaw.ca> | ||
| 2 | |||
| 3 | * unexmacosx.c (unexec_regions_sort_compare): | ||
| 4 | (unexec_regions_merge): New functions. Sort and merge unexec | ||
| 5 | regions before dumping them. | ||
| 6 | |||
| 1 | 2003-07-22 Dave Love <fx@gnu.org> | 7 | 2003-07-22 Dave Love <fx@gnu.org> |
| 2 | 8 | ||
| 3 | * xfns.c [HAVE_PNG]: Consider both png.h and libpng/png.h. | 9 | * xfns.c [HAVE_PNG]: Consider both png.h and libpng/png.h. |
diff --git a/src/unexmacosx.c b/src/unexmacosx.c index ac87f9e6c63..c84e5c95d03 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c | |||
| @@ -364,7 +364,7 @@ build_region_list () | |||
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | 366 | ||
| 367 | #define MAX_UNEXEC_REGIONS 30 | 367 | #define MAX_UNEXEC_REGIONS 200 |
| 368 | 368 | ||
| 369 | int num_unexec_regions; | 369 | int num_unexec_regions; |
| 370 | vm_range_t unexec_regions[MAX_UNEXEC_REGIONS]; | 370 | vm_range_t unexec_regions[MAX_UNEXEC_REGIONS]; |
| @@ -403,6 +403,46 @@ find_emacs_zone_regions () | |||
| 403 | unexec_regions_recorder); | 403 | unexec_regions_recorder); |
| 404 | } | 404 | } |
| 405 | 405 | ||
| 406 | static int | ||
| 407 | unexec_regions_sort_compare (const void *a, const void *b) | ||
| 408 | { | ||
| 409 | vm_address_t aa = ((vm_range_t *) a)->address; | ||
| 410 | vm_address_t bb = ((vm_range_t *) b)->address; | ||
| 411 | |||
| 412 | if (aa < bb) | ||
| 413 | return -1; | ||
| 414 | else if (aa > bb) | ||
| 415 | return 1; | ||
| 416 | else | ||
| 417 | return 0; | ||
| 418 | } | ||
| 419 | |||
| 420 | static void | ||
| 421 | unexec_regions_merge () | ||
| 422 | { | ||
| 423 | int i, n; | ||
| 424 | vm_range_t r; | ||
| 425 | |||
| 426 | qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]), | ||
| 427 | &unexec_regions_sort_compare); | ||
| 428 | n = 0; | ||
| 429 | r = unexec_regions[0]; | ||
| 430 | for (i = 1; i < num_unexec_regions; i++) | ||
| 431 | { | ||
| 432 | if (r.address + r.size == unexec_regions[i].address) | ||
| 433 | { | ||
| 434 | r.size += unexec_regions[i].size; | ||
| 435 | } | ||
| 436 | else | ||
| 437 | { | ||
| 438 | unexec_regions[n++] = r; | ||
| 439 | r = unexec_regions[i]; | ||
| 440 | } | ||
| 441 | } | ||
| 442 | unexec_regions[n++] = r; | ||
| 443 | num_unexec_regions = n; | ||
| 444 | } | ||
| 445 | |||
| 406 | 446 | ||
| 407 | /* More informational messages routines. */ | 447 | /* More informational messages routines. */ |
| 408 | 448 | ||
| @@ -863,6 +903,7 @@ unexec (char *outfile, char *infile, void *start_data, void *start_bss, | |||
| 863 | read_load_commands (); | 903 | read_load_commands (); |
| 864 | 904 | ||
| 865 | find_emacs_zone_regions (); | 905 | find_emacs_zone_regions (); |
| 906 | unexec_regions_merge (); | ||
| 866 | 907 | ||
| 867 | in_dumped_exec = 1; | 908 | in_dumped_exec = 1; |
| 868 | 909 | ||