diff options
| author | Dan Nicolaescu | 2010-07-07 20:03:52 -0700 |
|---|---|---|
| committer | Dan Nicolaescu | 2010-07-07 20:03:52 -0700 |
| commit | 313d9eb21863418cb91328c3d5ef0c2d356fc483 (patch) | |
| tree | 87aa5f39b43cc9c308839047bc83345d518f5d0a /src | |
| parent | d734dbbd24fca96383d2583c36d2a805181cf306 (diff) | |
| download | emacs-313d9eb21863418cb91328c3d5ef0c2d356fc483.tar.gz emacs-313d9eb21863418cb91328c3d5ef0c2d356fc483.zip | |
Simplify start_of_data, start_of_text and related code.
* src/mem-limits.h: Remove !emacs and _LIBC conditional code.
(start_of_data): Merge into start_of_data function.
* src/sysdep.c (start_of_text): Remove. Move simplified versions of
it in the only users: src/unexaix.c and unexec.c.
(read_input_waiting): Remove local declaration of quit_char.
(start, etext): Remove declarations.
(start_of_data): Merge with the version in mem-limits.h and move
to vm-limits.c.
* src/vm-limit.c (start_of_data): Merged and simplified version of the
code formerly in mem-limits.h and sysdep.c.
* src/unexec.c (start): New declaration, moved from sysdep.c.
(start_of_text): Simplified version of the code formerly in sysdep.c.
* unexaix.c (start_of_text): Simplified version of the code
formerly in sysdep.c.
* src/m/alpha.h (HAVE_TEXT_START): Remove.
(TEXT_START): Move ...
* src/unexalpha.c (TEXT_START): ... here.
* src/s/hpux10-20.h (TEXT_START): Remove.
* src/s/darwin.h (TEXT_START):
* src/m/mips.h (TEXT_START):
* src/m/macppc.h (HAVE_TEXT_START):
* src/m/m68k.h (TEXT_START):
* src/m/iris4d.h (TEXT_START):
* src/m/intel386.h (TEXT_START):
* src/m/ibmrs6000.h (TEXT_START):
* src/m/ia64.h (HAVE_TEXT_START):
* src/s/msdos.h (TEXT_START): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 31 | ||||
| -rw-r--r-- | src/m/alpha.h | 5 | ||||
| -rw-r--r-- | src/m/ia64.h | 2 | ||||
| -rw-r--r-- | src/m/ibmrs6000.h | 1 | ||||
| -rw-r--r-- | src/m/intel386.h | 4 | ||||
| -rw-r--r-- | src/m/iris4d.h | 2 | ||||
| -rw-r--r-- | src/m/m68k.h | 1 | ||||
| -rw-r--r-- | src/m/macppc.h | 4 | ||||
| -rw-r--r-- | src/m/mips.h | 3 | ||||
| -rw-r--r-- | src/mem-limits.h | 33 | ||||
| -rw-r--r-- | src/s/darwin.h | 3 | ||||
| -rw-r--r-- | src/s/hpux10-20.h | 1 | ||||
| -rw-r--r-- | src/s/msdos.h | 1 | ||||
| -rw-r--r-- | src/sysdep.c | 81 | ||||
| -rw-r--r-- | src/unexaix.c | 15 | ||||
| -rw-r--r-- | src/unexalpha.c | 2 | ||||
| -rw-r--r-- | src/unexec.c | 15 | ||||
| -rw-r--r-- | src/vm-limit.c | 40 |
18 files changed, 102 insertions, 142 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4896708b979..b601fecf809 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,34 @@ | |||
| 1 | 2010-07-08 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | Simplify cstart_of_data, start_of_code and related code. | ||
| 4 | * mem-limits.h: Remove !emacs and _LIBC conditional code. | ||
| 5 | (start_of_data): Merge into start_of_data function. | ||
| 6 | * sysdep.c (start_of_text): Remove. Move simplified versions of | ||
| 7 | it in the only users: unexaix.c and unexec.c. | ||
| 8 | (read_input_waiting): Remove local declaration of quit_char. | ||
| 9 | (start, etext): Remove declarations. | ||
| 10 | (start_of_data): Merge with the version in mem-limits.h and move | ||
| 11 | to vm-limits.c. | ||
| 12 | * vm-limit.c (start_of_data): Merged and simplified version of the | ||
| 13 | code formerly in mem-limits.h and sysdep.c. | ||
| 14 | * unexec.c (start): New declaration, moved from sysdep.c. | ||
| 15 | (start_of_text): Simplified version of the code formerly in sysdep.c. | ||
| 16 | * unexaix.c (start_of_text): Simplified version of the code | ||
| 17 | formerly in sysdep.c. | ||
| 18 | * m/alpha.h (HAVE_TEXT_START): Remove. | ||
| 19 | (TEXT_START): Move ... | ||
| 20 | * unexalpha.c (TEXT_START): ... here. | ||
| 21 | * s/hpux10-20.h (TEXT_START): Remove. | ||
| 22 | * s/darwin.h (TEXT_START): | ||
| 23 | * m/mips.h (TEXT_START): | ||
| 24 | * m/macppc.h (HAVE_TEXT_START): | ||
| 25 | * m/m68k.h (TEXT_START): | ||
| 26 | * m/iris4d.h (TEXT_START): | ||
| 27 | * m/intel386.h (TEXT_START): | ||
| 28 | * m/ibmrs6000.h (TEXT_START): | ||
| 29 | * m/ia64.h (HAVE_TEXT_START): | ||
| 30 | * s/msdos.h (TEXT_START): Likewise. | ||
| 31 | |||
| 1 | 2010-07-07 Andreas Schwab <schwab@linux-m68k.org> | 32 | 2010-07-07 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 33 | ||
| 3 | * alloc.c (overrun_check_malloc, overrun_check_realloc) | 34 | * alloc.c (overrun_check_malloc, overrun_check_realloc) |
diff --git a/src/m/alpha.h b/src/m/alpha.h index a7e4fa6b07b..ae8fd62d6f8 100644 --- a/src/m/alpha.h +++ b/src/m/alpha.h | |||
| @@ -53,14 +53,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 53 | #define DATA_START 0x140000000 | 53 | #define DATA_START 0x140000000 |
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | #if (defined (__NetBSD__) || defined (__OpenBSD__)) | ||
| 57 | #define HAVE_TEXT_START | ||
| 58 | #endif | ||
| 59 | |||
| 60 | #else /* not __ELF__ */ | 56 | #else /* not __ELF__ */ |
| 61 | 57 | ||
| 62 | /* Describe layout of the address space in an executing process. */ | 58 | /* Describe layout of the address space in an executing process. */ |
| 63 | #define TEXT_START 0x120000000 | ||
| 64 | #define DATA_START 0x140000000 | 59 | #define DATA_START 0x140000000 |
| 65 | 60 | ||
| 66 | #endif /* __ELF__ */ | 61 | #endif /* __ELF__ */ |
diff --git a/src/m/ia64.h b/src/m/ia64.h index 76e2bb87d80..5266c682c78 100644 --- a/src/m/ia64.h +++ b/src/m/ia64.h | |||
| @@ -58,7 +58,5 @@ extern void r_alloc_free (); | |||
| 58 | #endif /* not _MALLOC_INTERNAL */ | 58 | #endif /* not _MALLOC_INTERNAL */ |
| 59 | #endif /* REL_ALLOC */ | 59 | #endif /* REL_ALLOC */ |
| 60 | 60 | ||
| 61 | #define HAVE_TEXT_START | ||
| 62 | |||
| 63 | /* arch-tag: 9b8e9fb2-2e49-4c22-b68f-11a488e77c66 | 61 | /* arch-tag: 9b8e9fb2-2e49-4c22-b68f-11a488e77c66 |
| 64 | (do not change this comment) */ | 62 | (do not change this comment) */ |
diff --git a/src/m/ibmrs6000.h b/src/m/ibmrs6000.h index 3831e500641..a44b2c4ec3b 100644 --- a/src/m/ibmrs6000.h +++ b/src/m/ibmrs6000.h | |||
| @@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | /* The data segment in this machine always starts at address 0x20000000. | 22 | /* The data segment in this machine always starts at address 0x20000000. |
| 23 | An address of data cannot be stored correctly in a Lisp object; | 23 | An address of data cannot be stored correctly in a Lisp object; |
| 24 | we always lose the high bits. We must tell XPNTR to add them back. */ | 24 | we always lose the high bits. We must tell XPNTR to add them back. */ |
| 25 | #define TEXT_START 0x10000000 | ||
| 26 | #define DATA_START 0x20000000 | 25 | #define DATA_START 0x20000000 |
| 27 | #define WORDS_BIG_ENDIAN | 26 | #define WORDS_BIG_ENDIAN |
| 28 | #define DATA_SEG_BITS 0x20000000 | 27 | #define DATA_SEG_BITS 0x20000000 |
diff --git a/src/m/intel386.h b/src/m/intel386.h index 984a9959736..76e5929e4e6 100644 --- a/src/m/intel386.h +++ b/src/m/intel386.h | |||
| @@ -23,10 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 23 | is the most significant byte. */ | 23 | is the most significant byte. */ |
| 24 | #undef WORDS_BIG_ENDIAN | 24 | #undef WORDS_BIG_ENDIAN |
| 25 | 25 | ||
| 26 | #ifdef USG | ||
| 27 | #define TEXT_START 0 | ||
| 28 | #endif /* USG */ | ||
| 29 | |||
| 30 | #ifdef WINDOWSNT | 26 | #ifdef WINDOWSNT |
| 31 | #define VIRT_ADDR_VARIES | 27 | #define VIRT_ADDR_VARIES |
| 32 | #define DATA_START get_data_start () | 28 | #define DATA_START get_data_start () |
diff --git a/src/m/iris4d.h b/src/m/iris4d.h index e7f332057e5..2ba6b5ba7ce 100644 --- a/src/m/iris4d.h +++ b/src/m/iris4d.h | |||
| @@ -30,8 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 30 | This flag only matters if you use USE_LISP_UNION_TYPE. */ | 30 | This flag only matters if you use USE_LISP_UNION_TYPE. */ |
| 31 | #define EXPLICIT_SIGN_EXTEND | 31 | #define EXPLICIT_SIGN_EXTEND |
| 32 | 32 | ||
| 33 | #define TEXT_START 0x400000 | ||
| 34 | |||
| 35 | /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which | 33 | /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which |
| 36 | were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for | 34 | were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for |
| 37 | the value field of a LISP_OBJECT). */ | 35 | the value field of a LISP_OBJECT). */ |
diff --git a/src/m/m68k.h b/src/m/m68k.h index 668db282593..5a083205e50 100644 --- a/src/m/m68k.h +++ b/src/m/m68k.h | |||
| @@ -41,7 +41,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 41 | #endif | 41 | #endif |
| 42 | 42 | ||
| 43 | #define NO_REMAP | 43 | #define NO_REMAP |
| 44 | #define TEXT_START 0 | ||
| 45 | #endif | 44 | #endif |
| 46 | 45 | ||
| 47 | /* arch-tag: 4eadd161-b4e8-4b82-82a1-e4ce7f42969d | 46 | /* arch-tag: 4eadd161-b4e8-4b82-82a1-e4ce7f42969d |
diff --git a/src/m/macppc.h b/src/m/macppc.h index f348286030c..2764ae56115 100644 --- a/src/m/macppc.h +++ b/src/m/macppc.h | |||
| @@ -28,10 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | /* Convert that into an integer that is 100 for a load average of 1.0 */ | 28 | /* Convert that into an integer that is 100 for a load average of 1.0 */ |
| 29 | #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) | 29 | #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE) |
| 30 | 30 | ||
| 31 | #if (defined (__NetBSD__) || defined (__OpenBSD__)) && defined (__ELF__) | ||
| 32 | #define HAVE_TEXT_START | ||
| 33 | #endif | ||
| 34 | |||
| 35 | #ifdef _ARCH_PPC64 | 31 | #ifdef _ARCH_PPC64 |
| 36 | #ifndef _LP64 | 32 | #ifndef _LP64 |
| 37 | #define _LP64 | 33 | #define _LP64 |
diff --git a/src/m/mips.h b/src/m/mips.h index 8e81c077426..39a948c0cde 100644 --- a/src/m/mips.h +++ b/src/m/mips.h | |||
| @@ -31,8 +31,5 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | This flag only matters if you use USE_LISP_UNION_TYPE. */ | 31 | This flag only matters if you use USE_LISP_UNION_TYPE. */ |
| 32 | #define EXPLICIT_SIGN_EXTEND | 32 | #define EXPLICIT_SIGN_EXTEND |
| 33 | 33 | ||
| 34 | /* Describe layout of the address space in an executing process. */ | ||
| 35 | #define TEXT_START 0x00400000 | ||
| 36 | |||
| 37 | /* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee | 34 | /* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee |
| 38 | (do not change this comment) */ | 35 | (do not change this comment) */ |
diff --git a/src/mem-limits.h b/src/mem-limits.h index 490a61227ae..a550e1464b8 100644 --- a/src/mem-limits.h +++ b/src/mem-limits.h | |||
| @@ -25,17 +25,6 @@ extern int etext; | |||
| 25 | /* Some systems need this before <sys/resource.h>. */ | 25 | /* Some systems need this before <sys/resource.h>. */ |
| 26 | #include <sys/types.h> | 26 | #include <sys/types.h> |
| 27 | 27 | ||
| 28 | #ifdef _LIBC | ||
| 29 | |||
| 30 | #include <sys/resource.h> | ||
| 31 | #define BSD4_2 /* Tell code below to use getrlimit. */ | ||
| 32 | |||
| 33 | /* Old Linux startup code won't define __data_start. */ | ||
| 34 | extern int etext, __data_start; weak_extern (__data_start) | ||
| 35 | #define start_of_data() (&__data_start ?: &etext) | ||
| 36 | |||
| 37 | #else /* not _LIBC */ | ||
| 38 | |||
| 39 | #ifdef HAVE_SYS_RESOURCE_H | 28 | #ifdef HAVE_SYS_RESOURCE_H |
| 40 | # include <sys/time.h> | 29 | # include <sys/time.h> |
| 41 | # include <sys/resource.h> | 30 | # include <sys/resource.h> |
| @@ -54,7 +43,6 @@ extern int etext, __data_start; weak_extern (__data_start) | |||
| 54 | #include <sys/resource.h> | 43 | #include <sys/resource.h> |
| 55 | #endif /* BSD4_2 */ | 44 | #endif /* BSD4_2 */ |
| 56 | 45 | ||
| 57 | #ifdef emacs | ||
| 58 | /* The important properties of this type are that 1) it's a pointer, and | 46 | /* The important properties of this type are that 1) it's a pointer, and |
| 59 | 2) arithmetic on it should work as if the size of the object pointed | 47 | 2) arithmetic on it should work as if the size of the object pointed |
| 60 | to has a size of 1. */ | 48 | to has a size of 1. */ |
| @@ -77,26 +65,5 @@ extern POINTER start_of_data (void); | |||
| 77 | #define EXCEEDS_LISP_PTR(ptr) ((EMACS_UINT) (ptr) >> VALBITS) | 65 | #define EXCEEDS_LISP_PTR(ptr) ((EMACS_UINT) (ptr) >> VALBITS) |
| 78 | #endif | 66 | #endif |
| 79 | 67 | ||
| 80 | #ifdef DATA_START | ||
| 81 | #define start_of_data() ((char *)DATA_START) | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #ifdef BSD_SYSTEM | ||
| 85 | #ifndef DATA_SEG_BITS | ||
| 86 | #ifndef DATA_START | ||
| 87 | extern char etext; | ||
| 88 | #define start_of_data() &etext | ||
| 89 | #endif | ||
| 90 | #endif | ||
| 91 | #endif | ||
| 92 | |||
| 93 | #else /* not emacs */ | ||
| 94 | extern char etext; | ||
| 95 | #define start_of_data() &etext | ||
| 96 | #endif /* not emacs */ | ||
| 97 | |||
| 98 | #endif /* not _LIBC */ | ||
| 99 | |||
| 100 | |||
| 101 | /* arch-tag: fe39244e-e54f-4208-b7aa-02556f7841c5 | 68 | /* arch-tag: fe39244e-e54f-4208-b7aa-02556f7841c5 |
| 102 | (do not change this comment) */ | 69 | (do not change this comment) */ |
diff --git a/src/s/darwin.h b/src/s/darwin.h index cd1f9384833..146bfd693a2 100644 --- a/src/s/darwin.h +++ b/src/s/darwin.h | |||
| @@ -117,9 +117,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 117 | /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ | 117 | /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets. */ |
| 118 | #define HAVE_SOCKETS | 118 | #define HAVE_SOCKETS |
| 119 | 119 | ||
| 120 | /* start_of_text isn't actually used, so make it compile without error. */ | ||
| 121 | #define TEXT_START (0) | ||
| 122 | |||
| 123 | /* Definitions for how to compile & link. */ | 120 | /* Definitions for how to compile & link. */ |
| 124 | #ifdef HAVE_NS | 121 | #ifdef HAVE_NS |
| 125 | #define SYSTEM_PURESIZE_EXTRA 200000 | 122 | #define SYSTEM_PURESIZE_EXTRA 200000 |
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h index 8d9c73e2368..dd0e1bea9ad 100644 --- a/src/s/hpux10-20.h +++ b/src/s/hpux10-20.h | |||
| @@ -131,7 +131,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 131 | #define DATA_SEG_BITS 0x40000000 | 131 | #define DATA_SEG_BITS 0x40000000 |
| 132 | 132 | ||
| 133 | #define DATA_START 0x40000000 | 133 | #define DATA_START 0x40000000 |
| 134 | #define TEXT_START 0x00000000 | ||
| 135 | 134 | ||
| 136 | /* Data type of load average, as read out of kmem. */ | 135 | /* Data type of load average, as read out of kmem. */ |
| 137 | #define LOAD_AVE_TYPE double | 136 | #define LOAD_AVE_TYPE double |
diff --git a/src/s/msdos.h b/src/s/msdos.h index cffa13cef41..78a38c86059 100644 --- a/src/s/msdos.h +++ b/src/s/msdos.h | |||
| @@ -75,7 +75,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ | |||
| 75 | #define _longjmp longjmp | 75 | #define _longjmp longjmp |
| 76 | 76 | ||
| 77 | #define DATA_START (&etext + 1) | 77 | #define DATA_START (&etext + 1) |
| 78 | #define TEXT_START &start | ||
| 79 | 78 | ||
| 80 | #define _NAIVE_DOS_REGS | 79 | #define _NAIVE_DOS_REGS |
| 81 | 80 | ||
diff --git a/src/sysdep.c b/src/sysdep.c index cfa0efa7e87..ecdb7fcc21b 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -79,9 +79,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 79 | #include "dosfns.h" | 79 | #include "dosfns.h" |
| 80 | #include "msdos.h" | 80 | #include "msdos.h" |
| 81 | #include <sys/param.h> | 81 | #include <sys/param.h> |
| 82 | |||
| 83 | extern int etext; | ||
| 84 | extern unsigned start __asm__ ("start"); | ||
| 85 | #endif | 82 | #endif |
| 86 | 83 | ||
| 87 | #include <sys/file.h> | 84 | #include <sys/file.h> |
| @@ -1511,83 +1508,6 @@ setup_pty (int fd) | |||
| 1511 | } | 1508 | } |
| 1512 | #endif /* HAVE_PTYS */ | 1509 | #endif /* HAVE_PTYS */ |
| 1513 | 1510 | ||
| 1514 | #if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC) | ||
| 1515 | /* Some systems that cannot dump also cannot implement these. */ | ||
| 1516 | |||
| 1517 | /* | ||
| 1518 | * Return the address of the start of the text segment prior to | ||
| 1519 | * doing an unexec. After unexec the return value is undefined. | ||
| 1520 | * See crt0.c for further explanation and _start. | ||
| 1521 | * | ||
| 1522 | */ | ||
| 1523 | |||
| 1524 | #if !(defined (__NetBSD__) && defined (__ELF__)) | ||
| 1525 | #ifndef HAVE_TEXT_START | ||
| 1526 | char * | ||
| 1527 | start_of_text (void) | ||
| 1528 | { | ||
| 1529 | #ifdef TEXT_START | ||
| 1530 | return ((char *) TEXT_START); | ||
| 1531 | #else | ||
| 1532 | extern int _start (); | ||
| 1533 | return ((char *) _start); | ||
| 1534 | #endif /* TEXT_START */ | ||
| 1535 | } | ||
| 1536 | #endif /* not HAVE_TEXT_START */ | ||
| 1537 | #endif | ||
| 1538 | |||
| 1539 | /* | ||
| 1540 | * Return the address of the start of the data segment prior to | ||
| 1541 | * doing an unexec. After unexec the return value is undefined. | ||
| 1542 | * See crt0.c for further information and definition of data_start. | ||
| 1543 | * | ||
| 1544 | * Apparently, on BSD systems this is etext at startup. On | ||
| 1545 | * USG systems (swapping) this is highly mmu dependent and | ||
| 1546 | * is also dependent on whether or not the program is running | ||
| 1547 | * with shared text. Generally there is a (possibly large) | ||
| 1548 | * gap between end of text and start of data with shared text. | ||
| 1549 | * | ||
| 1550 | * On Uniplus+ systems with shared text, data starts at a | ||
| 1551 | * fixed address. Each port (from a given oem) is generally | ||
| 1552 | * different, and the specific value of the start of data can | ||
| 1553 | * be obtained via the UniPlus+ specific "uvar" system call, | ||
| 1554 | * however the method outlined in crt0.c seems to be more portable. | ||
| 1555 | * | ||
| 1556 | * Probably what will have to happen when a USG unexec is available, | ||
| 1557 | * at least on UniPlus, is temacs will have to be made unshared so | ||
| 1558 | * that text and data are contiguous. Then once loadup is complete, | ||
| 1559 | * unexec will produce a shared executable where the data can be | ||
| 1560 | * at the normal shared text boundary and the startofdata variable | ||
| 1561 | * will be patched by unexec to the correct value. | ||
| 1562 | * | ||
| 1563 | */ | ||
| 1564 | |||
| 1565 | #ifndef start_of_data | ||
| 1566 | char * | ||
| 1567 | start_of_data (void) | ||
| 1568 | { | ||
| 1569 | #ifdef DATA_START | ||
| 1570 | return ((char *) DATA_START); | ||
| 1571 | #else | ||
| 1572 | #ifdef ORDINARY_LINK | ||
| 1573 | /* | ||
| 1574 | * This is a hack. Since we're not linking crt0.c or pre_crt0.c, | ||
| 1575 | * data_start isn't defined. We take the address of environ, which | ||
| 1576 | * is known to live at or near the start of the system crt0.c, and | ||
| 1577 | * we don't sweat the handful of bytes that might lose. | ||
| 1578 | */ | ||
| 1579 | extern char **environ; | ||
| 1580 | |||
| 1581 | return ((char *) &environ); | ||
| 1582 | #else | ||
| 1583 | extern int data_start; | ||
| 1584 | return ((char *) &data_start); | ||
| 1585 | #endif /* ORDINARY_LINK */ | ||
| 1586 | #endif /* DATA_START */ | ||
| 1587 | } | ||
| 1588 | #endif /* start_of_data */ | ||
| 1589 | #endif /* NEED_STARTS (not CANNOT_DUMP or not SYSTEM_MALLOC) */ | ||
| 1590 | |||
| 1591 | /* init_system_name sets up the string for the Lisp function | 1511 | /* init_system_name sets up the string for the Lisp function |
| 1592 | system-name to return. */ | 1512 | system-name to return. */ |
| 1593 | 1513 | ||
| @@ -1912,7 +1832,6 @@ read_input_waiting (void) | |||
| 1912 | /* XXX This needs to be updated for multi-tty support. Is there | 1832 | /* XXX This needs to be updated for multi-tty support. Is there |
| 1913 | anybody who needs to emulate select these days? */ | 1833 | anybody who needs to emulate select these days? */ |
| 1914 | int nread, i; | 1834 | int nread, i; |
| 1915 | extern int quit_char; | ||
| 1916 | 1835 | ||
| 1917 | if (read_socket_hook) | 1836 | if (read_socket_hook) |
| 1918 | { | 1837 | { |
diff --git a/src/unexaix.c b/src/unexaix.c index 2657d144296..949616d5e31 100644 --- a/src/unexaix.c +++ b/src/unexaix.c | |||
| @@ -71,7 +71,7 @@ what you give them. Help stamp out software-hoarding! */ | |||
| 71 | #include <unistd.h> | 71 | #include <unistd.h> |
| 72 | #include <fcntl.h> | 72 | #include <fcntl.h> |
| 73 | 73 | ||
| 74 | extern char *start_of_text (void); /* Start of text */ | 74 | char *start_of_text (void); /* Start of text */ |
| 75 | extern char *start_of_data (void); /* Start of initialized data */ | 75 | extern char *start_of_data (void); /* Start of initialized data */ |
| 76 | 76 | ||
| 77 | extern int _data; | 77 | extern int _data; |
| @@ -669,5 +669,18 @@ unrelocate_symbols (int new, int a_out, char *a_name, char *new_name) | |||
| 669 | return 0; | 669 | return 0; |
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | /* | ||
| 673 | * Return the address of the start of the text segment prior to | ||
| 674 | * doing an unexec. After unexec the return value is undefined. | ||
| 675 | * See crt0.c for further explanation and _start. | ||
| 676 | * | ||
| 677 | */ | ||
| 678 | |||
| 679 | char * | ||
| 680 | start_of_text (void) | ||
| 681 | { | ||
| 682 | return ((char *) 0x10000000); | ||
| 683 | } | ||
| 684 | |||
| 672 | /* arch-tag: 0783857a-7c2d-456f-a426-58b722d69fd0 | 685 | /* arch-tag: 0783857a-7c2d-456f-a426-58b722d69fd0 |
| 673 | (do not change this comment) */ | 686 | (do not change this comment) */ |
diff --git a/src/unexalpha.c b/src/unexalpha.c index ab71f6c004c..982097a9318 100644 --- a/src/unexalpha.c +++ b/src/unexalpha.c | |||
| @@ -79,8 +79,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 79 | #define _RDATA ".rdata" | 79 | #define _RDATA ".rdata" |
| 80 | #define _SDATA ".sdata" | 80 | #define _SDATA ".sdata" |
| 81 | #define _SBSS ".sbss" | 81 | #define _SBSS ".sbss" |
| 82 | #define TEXT_START 0x120000000 | ||
| 82 | #endif /* __NetBSD__ || __OpenBSD__ */ | 83 | #endif /* __NetBSD__ || __OpenBSD__ */ |
| 83 | 84 | ||
| 85 | |||
| 84 | static void fatal_unexec (char *, char *); | 86 | static void fatal_unexec (char *, char *); |
| 85 | static void mark_x (char *); | 87 | static void mark_x (char *); |
| 86 | 88 | ||
diff --git a/src/unexec.c b/src/unexec.c index 27a15188837..8edd9e22b96 100644 --- a/src/unexec.c +++ b/src/unexec.c | |||
| @@ -687,6 +687,21 @@ adjust_lnnoptrs (writedesc, readdesc, new_name) | |||
| 687 | return 0; | 687 | return 0; |
| 688 | } | 688 | } |
| 689 | 689 | ||
| 690 | extern unsigned start __asm__ ("start"); | ||
| 691 | |||
| 692 | /* | ||
| 693 | * Return the address of the start of the text segment prior to | ||
| 694 | * doing an unexec. After unexec the return value is undefined. | ||
| 695 | * See crt0.c for further explanation and _start. | ||
| 696 | * | ||
| 697 | */ | ||
| 698 | |||
| 699 | char * | ||
| 700 | start_of_text (void) | ||
| 701 | { | ||
| 702 | return ((char *) &start); | ||
| 703 | } | ||
| 704 | |||
| 690 | /* **************************************************************** | 705 | /* **************************************************************** |
| 691 | * unexec | 706 | * unexec |
| 692 | * | 707 | * |
diff --git a/src/vm-limit.c b/src/vm-limit.c index 00b041d8ef8..cb42f78701b 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c | |||
| @@ -244,6 +244,46 @@ check_memory_limits (void) | |||
| 244 | (*warn_function) ("Warning: memory in use exceeds lisp pointer size"); | 244 | (*warn_function) ("Warning: memory in use exceeds lisp pointer size"); |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | #if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC) | ||
| 248 | /* Some systems that cannot dump also cannot implement these. */ | ||
| 249 | |||
| 250 | /* | ||
| 251 | * Return the address of the start of the data segment prior to | ||
| 252 | * doing an unexec. After unexec the return value is undefined. | ||
| 253 | * See crt0.c for further information and definition of data_start. | ||
| 254 | * | ||
| 255 | * Apparently, on BSD systems this is etext at startup. On | ||
| 256 | * USG systems (swapping) this is highly mmu dependent and | ||
| 257 | * is also dependent on whether or not the program is running | ||
| 258 | * with shared text. Generally there is a (possibly large) | ||
| 259 | * gap between end of text and start of data with shared text. | ||
| 260 | * | ||
| 261 | */ | ||
| 262 | |||
| 263 | POINTER | ||
| 264 | start_of_data (void) | ||
| 265 | { | ||
| 266 | #ifdef BSD_SYSTEM | ||
| 267 | extern char etext; | ||
| 268 | return (POINTER)(&etext); | ||
| 269 | #elif defined DATA_START | ||
| 270 | return ((POINTER) DATA_START); | ||
| 271 | #elif defined ORDINARY_LINK | ||
| 272 | /* | ||
| 273 | * This is a hack. Since we're not linking crt0.c or pre_crt0.c, | ||
| 274 | * data_start isn't defined. We take the address of environ, which | ||
| 275 | * is known to live at or near the start of the system crt0.c, and | ||
| 276 | * we don't sweat the handful of bytes that might lose. | ||
| 277 | */ | ||
| 278 | extern char **environ; | ||
| 279 | return ((POINTER) &environ); | ||
| 280 | #else | ||
| 281 | extern int data_start; | ||
| 282 | return ((POINTER) &data_start); | ||
| 283 | #endif | ||
| 284 | } | ||
| 285 | #endif /* (not CANNOT_DUMP or not SYSTEM_MALLOC) */ | ||
| 286 | |||
| 247 | /* Enable memory usage warnings. | 287 | /* Enable memory usage warnings. |
| 248 | START says where the end of pure storage is. | 288 | START says where the end of pure storage is. |
| 249 | WARNFUN specifies the function to call to issue a warning. */ | 289 | WARNFUN specifies the function to call to issue a warning. */ |