]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify start_of_data, start_of_text and related code.
authorDan Nicolaescu <dann@ics.uci.edu>
Thu, 8 Jul 2010 03:03:52 +0000 (20:03 -0700)
committerDan Nicolaescu <dann@ics.uci.edu>
Thu, 8 Jul 2010 03:03:52 +0000 (20:03 -0700)
* 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.

19 files changed:
admin/CPP-DEFINES
src/ChangeLog
src/m/alpha.h
src/m/ia64.h
src/m/ibmrs6000.h
src/m/intel386.h
src/m/iris4d.h
src/m/m68k.h
src/m/macppc.h
src/m/mips.h
src/mem-limits.h
src/s/darwin.h
src/s/hpux10-20.h
src/s/msdos.h
src/sysdep.c
src/unexaix.c
src/unexalpha.c
src/unexec.c
src/vm-limit.c

index f0438b7d59ad3ff3ad64a70161fbd7645b1685ad..af818babb16e9562410ff282b67778d49f4b09be 100644 (file)
@@ -186,7 +186,6 @@ HAVE_SYS_TIMEB_H
 HAVE_SYS_TIME_H
 HAVE_TCATTR
 HAVE_TERMIOS_H
-HAVE_TEXT_START
 HAVE_TIMEVAL
 HAVE_TM_ZONE
 HAVE_TZSET
@@ -262,7 +261,6 @@ SYSV_SYSTEM_DIR
 TAB3
 TABDLY
 TERM
-TEXT_START
 THIS_IS_CONFIGURE
 TIME_WITH_SYS_TIME
 TIOCSIGSEND
index 4896708b979a7b163f351000bc059818aaf145bc..b601fecf809051ca83368e96dfba2e8684cee09a 100644 (file)
@@ -1,3 +1,34 @@
+2010-07-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       Simplify cstart_of_data, start_of_code and related code.
+       * mem-limits.h: Remove !emacs and _LIBC conditional code.
+       (start_of_data): Merge into start_of_data function.
+       * sysdep.c (start_of_text): Remove.  Move simplified versions of
+       it in the only users: 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.
+       * vm-limit.c (start_of_data): Merged and simplified version of the
+       code formerly in mem-limits.h and sysdep.c.
+       * 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.
+       * m/alpha.h (HAVE_TEXT_START): Remove.
+       (TEXT_START): Move ...
+       * unexalpha.c (TEXT_START): ... here.
+       * s/hpux10-20.h (TEXT_START): Remove.
+       * s/darwin.h (TEXT_START):
+       * m/mips.h (TEXT_START):
+       * m/macppc.h (HAVE_TEXT_START):
+       * m/m68k.h (TEXT_START):
+       * m/iris4d.h (TEXT_START):
+       * m/intel386.h (TEXT_START):
+       * m/ibmrs6000.h (TEXT_START):
+       * m/ia64.h (HAVE_TEXT_START):
+       * s/msdos.h (TEXT_START): Likewise.
+
 2010-07-07  Andreas Schwab  <schwab@linux-m68k.org>
 
        * alloc.c (overrun_check_malloc, overrun_check_realloc)
index a7e4fa6b07b0bfedf8a8524a156a6b0afcdc5188..ae8fd62d6f85122ff3470322b50957dc86a5cf59 100644 (file)
@@ -53,14 +53,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define DATA_START    0x140000000
 #endif
 
-#if (defined (__NetBSD__) || defined (__OpenBSD__))
-#define HAVE_TEXT_START
-#endif
-
 #else  /* not __ELF__ */
 
 /* Describe layout of the address space in an executing process.  */
-#define TEXT_START    0x120000000
 #define DATA_START    0x140000000
 
 #endif /* __ELF__ */
index 76e2bb87d80211d0c9d6ec24694d5dfdd7460dc5..5266c682c78f798e33414eda2ff2abede5c93e94 100644 (file)
@@ -58,7 +58,5 @@ extern void r_alloc_free ();
 #endif /* not _MALLOC_INTERNAL */
 #endif /* REL_ALLOC */
 
-#define HAVE_TEXT_START
-
 /* arch-tag: 9b8e9fb2-2e49-4c22-b68f-11a488e77c66
    (do not change this comment) */
index 3831e500641141043e5612a156c8e6c4710abf51..a44b2c4ec3bf5acdd30e37fbbadf32479505eecf 100644 (file)
@@ -22,7 +22,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* The data segment in this machine always starts at address 0x20000000.
    An address of data cannot be stored correctly in a Lisp object;
    we always lose the high bits.  We must tell XPNTR to add them back.  */
-#define TEXT_START 0x10000000
 #define DATA_START 0x20000000
 #define WORDS_BIG_ENDIAN
 #define DATA_SEG_BITS 0x20000000
index 984a99597362a8c454b04c923fa3b9b17fd86563..76e5929e4e632b0a0e08432314886308f477315e 100644 (file)
@@ -23,10 +23,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    is the most significant byte.  */
 #undef WORDS_BIG_ENDIAN
 
-#ifdef USG
-#define TEXT_START 0
-#endif /* USG */
-
 #ifdef WINDOWSNT
 #define VIRT_ADDR_VARIES
 #define DATA_START     get_data_start ()
index e7f332057e592a38316030814752f7dc38e50233..2ba6b5ba7ce38b53dfc813e981159983c72e4d40 100644 (file)
@@ -30,8 +30,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
 #define EXPLICIT_SIGN_EXTEND
 
-#define TEXT_START 0x400000
-
 /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which
    were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for
    the value field of a LISP_OBJECT).  */
index 668db282593a75b330a6ecf9da3a48a71d604d6f..5a083205e502356496e4bf74725e16a36abbd339 100644 (file)
@@ -41,7 +41,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 
 #define NO_REMAP
-#define TEXT_START 0
 #endif
 
 /* arch-tag: 4eadd161-b4e8-4b82-82a1-e4ce7f42969d
index f348286030c45950ea80970630910324d162167c..2764ae56115f27a2f37ec5d25e94938274215376 100644 (file)
@@ -28,10 +28,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Convert that into an integer that is 100 for a load average of 1.0  */
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
-#if (defined (__NetBSD__) || defined (__OpenBSD__)) && defined (__ELF__)
-#define HAVE_TEXT_START
-#endif
-
 #ifdef _ARCH_PPC64
 #ifndef _LP64
 #define _LP64
index 8e81c0774265afed05e59b3cb6f0094e8363f8c8..39a948c0cde0df618d9237fbc6f58d505ceb3a28 100644 (file)
@@ -31,8 +31,5 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    This flag only matters if you use USE_LISP_UNION_TYPE.  */
 #define EXPLICIT_SIGN_EXTEND
 
-/* Describe layout of the address space in an executing process.  */
-#define TEXT_START      0x00400000
-
 /* arch-tag: 8fd020ee-78a7-4d87-96ce-6129f52f7bee
    (do not change this comment) */
index 490a61227aed204932a8db1c999a1e2c1190f6bc..a550e1464b82fc90bca48f768e52c579b95115c4 100644 (file)
@@ -25,17 +25,6 @@ extern int etext;
 /* Some systems need this before <sys/resource.h>.  */
 #include <sys/types.h>
 
-#ifdef _LIBC
-
-#include <sys/resource.h>
-#define BSD4_2                 /* Tell code below to use getrlimit.  */
-
-/* Old Linux startup code won't define __data_start.  */
-extern int etext, __data_start; weak_extern (__data_start)
-#define start_of_data()        (&__data_start ?: &etext)
-
-#else /* not _LIBC */
-
 #ifdef HAVE_SYS_RESOURCE_H
 # include <sys/time.h>
 # include <sys/resource.h>
@@ -54,7 +43,6 @@ extern int etext, __data_start; weak_extern (__data_start)
 #include <sys/resource.h>
 #endif /* BSD4_2 */
 
-#ifdef emacs
 /* The important properties of this type are that 1) it's a pointer, and
    2) arithmetic on it should work as if the size of the object pointed
    to has a size of 1.  */
@@ -77,26 +65,5 @@ extern POINTER start_of_data (void);
 #define EXCEEDS_LISP_PTR(ptr) ((EMACS_UINT) (ptr) >> VALBITS)
 #endif
 
-#ifdef DATA_START
-#define start_of_data() ((char *)DATA_START)
-#endif
-
-#ifdef BSD_SYSTEM
-#ifndef DATA_SEG_BITS
-#ifndef DATA_START
-extern char etext;
-#define start_of_data() &etext
-#endif
-#endif
-#endif
-
-#else  /* not emacs */
-extern char etext;
-#define start_of_data() &etext
-#endif /* not emacs */
-
-#endif /* not _LIBC */
-
-
 /* arch-tag: fe39244e-e54f-4208-b7aa-02556f7841c5
    (do not change this comment) */
index cd1f93848334e1490bed3aed633c4a08cfeb4529..146bfd693a2c2936513f779c49f0c884be259d9d 100644 (file)
@@ -117,9 +117,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
 #define HAVE_SOCKETS
 
-/* start_of_text isn't actually used, so make it compile without error.  */
-#define TEXT_START (0)
-
 /* Definitions for how to compile & link.  */
 #ifdef HAVE_NS
 #define SYSTEM_PURESIZE_EXTRA 200000
index 8d9c73e23687836370ef5e24ecdc9fb2bfab90f1..dd0e1bea9ad3c061a3c5b3ecad137e25419500ac 100644 (file)
@@ -131,7 +131,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define DATA_SEG_BITS 0x40000000
 
 #define DATA_START    0x40000000
-#define TEXT_START    0x00000000
 
 /* Data type of load average, as read out of kmem.  */
 #define LOAD_AVE_TYPE double
index cffa13cef416c4b77c23ef8b89cc3cdb9033face..78a38c86059aca95dce0f30b5790c8661a6661ab 100644 (file)
@@ -75,7 +75,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
 #define _longjmp longjmp
 
 #define DATA_START  (&etext + 1)
-#define TEXT_START  &start
 
 #define _NAIVE_DOS_REGS
 
index cfa0efa7e873eca40915ccb0ea797dda9527bd0b..ecdb7fcc21bfbe4ff7cad9c7893c4fdcc5d05ddf 100644 (file)
@@ -79,9 +79,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dosfns.h"
 #include "msdos.h"
 #include <sys/param.h>
-
-extern int etext;
-extern unsigned start __asm__ ("start");
 #endif
 
 #include <sys/file.h>
@@ -1511,83 +1508,6 @@ setup_pty (int fd)
 }
 #endif /* HAVE_PTYS */
 \f
-#if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC)
-/* Some systems that cannot dump also cannot implement these.  */
-
-/*
- *     Return the address of the start of the text segment prior to
- *     doing an unexec.  After unexec the return value is undefined.
- *     See crt0.c for further explanation and _start.
- *
- */
-
-#if !(defined (__NetBSD__) && defined (__ELF__))
-#ifndef HAVE_TEXT_START
-char *
-start_of_text (void)
-{
-#ifdef TEXT_START
-  return ((char *) TEXT_START);
-#else
-  extern int _start ();
-  return ((char *) _start);
-#endif /* TEXT_START */
-}
-#endif /* not HAVE_TEXT_START */
-#endif
-
-/*
- *     Return the address of the start of the data segment prior to
- *     doing an unexec.  After unexec the return value is undefined.
- *     See crt0.c for further information and definition of data_start.
- *
- *     Apparently, on BSD systems this is etext at startup.  On
- *     USG systems (swapping) this is highly mmu dependent and
- *     is also dependent on whether or not the program is running
- *     with shared text.  Generally there is a (possibly large)
- *     gap between end of text and start of data with shared text.
- *
- *     On Uniplus+ systems with shared text, data starts at a
- *     fixed address.  Each port (from a given oem) is generally
- *     different, and the specific value of the start of data can
- *     be obtained via the UniPlus+ specific "uvar" system call,
- *     however the method outlined in crt0.c seems to be more portable.
- *
- *     Probably what will have to happen when a USG unexec is available,
- *     at least on UniPlus, is temacs will have to be made unshared so
- *     that text and data are contiguous.  Then once loadup is complete,
- *     unexec will produce a shared executable where the data can be
- *     at the normal shared text boundary and the startofdata variable
- *     will be patched by unexec to the correct value.
- *
- */
-
-#ifndef start_of_data
-char *
-start_of_data (void)
-{
-#ifdef DATA_START
-  return ((char *) DATA_START);
-#else
-#ifdef ORDINARY_LINK
-  /*
-   * This is a hack.  Since we're not linking crt0.c or pre_crt0.c,
-   * data_start isn't defined.  We take the address of environ, which
-   * is known to live at or near the start of the system crt0.c, and
-   * we don't sweat the handful of bytes that might lose.
-   */
-  extern char **environ;
-
-  return ((char *) &environ);
-#else
-  extern int data_start;
-  return ((char *) &data_start);
-#endif /* ORDINARY_LINK */
-#endif /* DATA_START */
-}
-#endif /* start_of_data */
-#endif /* NEED_STARTS (not CANNOT_DUMP or not SYSTEM_MALLOC) */
-\f
 /* init_system_name sets up the string for the Lisp function
    system-name to return. */
 
@@ -1912,7 +1832,6 @@ read_input_waiting (void)
   /* XXX This needs to be updated for multi-tty support.  Is there
      anybody who needs to emulate select these days?  */
   int nread, i;
-  extern int quit_char;
 
   if (read_socket_hook)
     {
index 2657d14429688fad1ffe9ce068fcff590b64ecf8..949616d5e3157b61ad0ba9c8eb64c5d1747bc1aa 100644 (file)
@@ -71,7 +71,7 @@ what you give them.   Help stamp out software-hoarding!  */
 #include <unistd.h>
 #include <fcntl.h>
 
-extern char *start_of_text (void);             /* Start of text */
+char *start_of_text (void);                    /* Start of text */
 extern char *start_of_data (void);             /* Start of initialized data */
 
 extern int _data;
@@ -669,5 +669,18 @@ unrelocate_symbols (int new, int a_out, char *a_name, char *new_name)
   return 0;
 }
 
+/*
+ *     Return the address of the start of the text segment prior to
+ *     doing an unexec.  After unexec the return value is undefined.
+ *     See crt0.c for further explanation and _start.
+ *
+ */
+
+char *
+start_of_text (void)
+{
+  return ((char *) 0x10000000);
+}
+
 /* arch-tag: 0783857a-7c2d-456f-a426-58b722d69fd0
    (do not change this comment) */
index ab71f6c004cc6b9603d29e3c3031df40b17806b6..982097a9318949a2e8faf66c9753199972a23854 100644 (file)
@@ -79,8 +79,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define        _RDATA          ".rdata"
 #define        _SDATA          ".sdata"
 #define        _SBSS           ".sbss"
+#define TEXT_START     0x120000000
 #endif /* __NetBSD__ || __OpenBSD__ */
 
+
 static void fatal_unexec (char *, char *);
 static void mark_x (char *);
 
index 27a15188837fb02622fd30385241a242978a30f8..8edd9e22b96adf354d3643bcde50be6477f60993 100644 (file)
@@ -687,6 +687,21 @@ adjust_lnnoptrs (writedesc, readdesc, new_name)
   return 0;
 }
 
+extern unsigned start __asm__ ("start");
+
+/*
+ *     Return the address of the start of the text segment prior to
+ *     doing an unexec.  After unexec the return value is undefined.
+ *     See crt0.c for further explanation and _start.
+ *
+ */
+
+char *
+start_of_text (void)
+{
+  return ((char *) &start);
+}
+
 /* ****************************************************************
  * unexec
  *
index 00b041d8ef8bc3a36298703892164c4ab86e755e..cb42f78701b7dbe98b04504de0bfcc166f6346cb 100644 (file)
@@ -244,6 +244,46 @@ check_memory_limits (void)
     (*warn_function) ("Warning: memory in use exceeds lisp pointer size");
 }
 \f
+#if !defined(CANNOT_DUMP) || !defined(SYSTEM_MALLOC)
+/* Some systems that cannot dump also cannot implement these.  */
+
+/*
+ *     Return the address of the start of the data segment prior to
+ *     doing an unexec.  After unexec the return value is undefined.
+ *     See crt0.c for further information and definition of data_start.
+ *
+ *     Apparently, on BSD systems this is etext at startup.  On
+ *     USG systems (swapping) this is highly mmu dependent and
+ *     is also dependent on whether or not the program is running
+ *     with shared text.  Generally there is a (possibly large)
+ *     gap between end of text and start of data with shared text.
+ *
+ */
+
+POINTER
+start_of_data (void)
+{
+#ifdef BSD_SYSTEM
+  extern char etext;
+  return (POINTER)(&etext);
+#elif defined DATA_START
+  return ((POINTER) DATA_START);
+#elif defined ORDINARY_LINK
+  /*
+   * This is a hack.  Since we're not linking crt0.c or pre_crt0.c,
+   * data_start isn't defined.  We take the address of environ, which
+   * is known to live at or near the start of the system crt0.c, and
+   * we don't sweat the handful of bytes that might lose.
+   */
+  extern char **environ;
+  return ((POINTER) &environ);
+#else
+  extern int data_start;
+  return ((POINTER) &data_start);
+#endif
+}
+#endif /* (not CANNOT_DUMP or not SYSTEM_MALLOC) */
+\f
 /* Enable memory usage warnings.
    START says where the end of pure storage is.
    WARNFUN specifies the function to call to issue a warning.  */