1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

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.
This commit is contained in:
Dan Nicolaescu 2010-07-07 20:03:52 -07:00
parent d734dbbd24
commit 313d9eb218
19 changed files with 102 additions and 144 deletions

View 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

View 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)

View 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__ */

View 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) */

View 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

View 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 ()

View 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). */

View 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

View 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

View 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) */

View 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) */

View 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

View 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

View 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

View 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 */
#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) */
/* 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)
{

View 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) */

View 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 *);

View 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
*

View File

@ -244,6 +244,46 @@ check_memory_limits (void)
(*warn_function) ("Warning: memory in use exceeds lisp pointer size");
}
#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) */
/* Enable memory usage warnings.
START says where the end of pure storage is.
WARNFUN specifies the function to call to issue a warning. */