[comp.emacs] MIPSCo m-xxx.h and s-xxx.h needed for GNU Emacs

oscar@basser.oz (John Bignucolo) (09/29/89)

Could someone please mail me the m-xxx.h and s-xxx.h config files for a
MIPSCo M/120 running RISC/os (UMIPS) 4.0. I have GNU Emacs 18.53.

Thanks in advance

John Bignucolo
Basser Department of Computer Science
University of Sydney, N.S.W., 2006
Australia

UUCP: ...!uunet!munnari!basser.cs.su.oz!oscar
ARPA: oscar%basser.cs.su.oz@uunet.uu.net
ACSNET, CSNET: oscar@basser.cs.su.oz

ted@nmsu.edu (Ted Dunning) (09/30/89)

In article <2578@basser.oz> oscar@basser.oz (John Bignucolo) writes:


   Could someone please mail me the m-xxx.h and s-xxx.h config files for a
   MIPSCo M/120 running RISC/os (UMIPS) 4.0. I have GNU Emacs 18.53.

   Thanks in advance

   John Bignucolo

   UUCP: ...!uunet!munnari!basser.cs.su.oz!oscar
   ARPA: oscar%basser.cs.su.oz.au

i was able to derive m- and s- files for the m/120, and was able to
make the other necessary mods (due largely to the fact that RISC/os is
sys5 but _very_ close to berkeley).  in addition, for some reason, the
mips has crt1.o instead of crt0.o which requires also requires a change.

this got things to the point where the load succeeds, but temacs
crashes.  i suspect that this is because crt1.o really is different
and that we need a hack to crt0.c in the src directory.

interestingly the machine was shipped with a working emacs (18.51 i
think) so SOMEBODY has the required hacks somewhere.




--
ted@nmsu.edu
			remember, when extensions and subsets are outlawed,
			only outlaws will have extensions or subsets

jkh@meepmeep.pcs.com (Jordan K. Hubbard) (10/02/89)

In article <TED.89Sep29122453@kythera.nmsu.edu> ted@nmsu.edu (Ted Dunning) writes:

      Could someone please mail me the m-xxx.h and s-xxx.h config files for a
      MIPSCo M/120 running RISC/os (UMIPS) 4.0. I have GNU Emacs 18.53.


   i was able to derive m- and s- files for the m/120, and was able to
   make the other necessary mods (due largely to the fact that RISC/os is
   sys5 but _very_ close to berkeley).  in addition, for some reason, the
   mips has crt1.o instead of crt0.o which requires also requires a change.

   this got things to the point where the load succeeds, but temacs
   crashes.  i suspect that this is because crt1.o really is different

Load crt1.o after pre-crt0.o AND /lib/crtn.o after libc.a
I.E:

ld -o temacs pre-crt0.o /lib/crt1.o <objs> <libs> -lc /lib/crtn.o

This should give you a working emacs.

				Jordan Hubbard
--
			PCS Computer Systeme GmbH, Munich, West Germany
	UUCP:		pyramid!pcsbst!jkh jkh@meepmeep.pcs.com
	EUNET:		unido!pcsbst!jkh
	ARPA:		jkh@violet.berkeley.edu or hubbard@decwrl.dec.com

wje@igate (William J. Earl) (10/07/89)

In article <JKH.89Oct2141152@meepmeep.pcs.com>, jkh@meepmeep (Jordan K. Hubbard) writes:
> In article <TED.89Sep29122453@kythera.nmsu.edu> ted@nmsu.edu (Ted Dunning) writes:
> 
>       Could someone please mail me the m-xxx.h and s-xxx.h config files for a
>       MIPSCo M/120 running RISC/os (UMIPS) 4.0. I have GNU Emacs 18.53.
> 
> 
>    i was able to derive m- and s- files for the m/120, and was able to
>    make the other necessary mods (due largely to the fact that RISC/os is
>    sys5 but _very_ close to berkeley).  in addition, for some reason, the
>    mips has crt1.o instead of crt0.o which requires also requires a change.
> 
>    this got things to the point where the load succeeds, but temacs
>    crashes.  i suspect that this is because crt1.o really is different
> 
> Load crt1.o after pre-crt0.o AND /lib/crtn.o after libc.a
> I.E:
> 
> ld -o temacs pre-crt0.o /lib/crt1.o <objs> <libs> -lc /lib/crtn.o
> 
> This should give you a working emacs.

      A working GNU emacs 18.52 is included in RISC/os 4.0.
Here are context diffs of the changes to unexmips.c and m-mips.h,
relative to 18.52:

*** ../../dist/src/unexmips.c	Fri Mar 24 20:43:19 1989
--- unexmips.c	Fri Mar 24 20:41:12 1989
***************
*** 108,114 ****
  In other words, you are welcome to use, share and improve this program.
  You are forbidden to forbid anyone else to use, share and improve
  what you give them.   Help stamp out software-hoarding!  */
! 
  #include "config.h"
  #include <sys/types.h>
  #include <sys/file.h>
--- 108,115 ----
  In other words, you are welcome to use, share and improve this program.
  You are forbidden to forbid anyone else to use, share and improve
  what you give them.   Help stamp out software-hoarding!  */
! 
! 
  #include "config.h"
  #include <sys/types.h>
  #include <sys/file.h>
***************
*** 122,131 ****
  
  #ifdef IRIS_4D
  #include "getpagesize.h"
- #include <fcntl.h>
  #endif
  
! static void fatal_unexec ();
  
  #define READ(_fd, _buffer, _size, _error_message, _error_arg) \
  	errno = EEOF; \
--- 123,154 ----
  
  #ifdef IRIS_4D
  #include "getpagesize.h"
  #endif
+ 
+ extern int errno;
+ extern int sys_nerr;
+ extern char *sys_errlist[];
+ #define EEOF -1
  
! static void
! fatal_unexec(s, va_alist)
!     va_dcl
! {
!     va_list ap;
!     if (errno == EEOF) {
! 	fputs("unexec: unexpected end of file, ", stderr);
!     }
!     else if (errno < sys_nerr) {
! 	fprintf(stderr, "unexec: %s, ", sys_errlist[errno]);
!     }
!     else {
! 	fprintf(stderr, "unexec: error code %d, ", errno);
!     }
!     va_start(ap);
!     _doprnt(s, ap, stderr);
!     fputs(".\n", stderr);
!     exit(1);
! }
  
  #define READ(_fd, _buffer, _size, _error_message, _error_arg) \
  	errno = EEOF; \
***************
*** 140,170 ****
  	errno = EEOF; \
  	if (lseek(_fd, _position, L_SET) != _position) \
  	  fatal_unexec(_error_message, _error_arg);
  
! #define private static
  
! extern int errno;
! extern int sys_nerr;
! extern char *sys_errlist[];
! #define EEOF -1
  
  struct headers {
      struct filehdr fhdr;
      struct aouthdr aout;
!     struct scnhdr text_section;
!     struct scnhdr rdata_section;
!     struct scnhdr data_section;
!     struct scnhdr sdata_section;
!     struct scnhdr sbss_section;
!     struct scnhdr bss_section;
  };
  
- /* Define name of label for entry point for the dumped executable.  */
- 
- #ifndef DEFAULT_ENTRY_ADDRESS
- #define DEFAULT_ENTRY_ADDRESS __start
- #endif
- 
  unexec (new_name, a_name, data_start, bss_start, entry_address)
       char *new_name, *a_name;
       unsigned data_start, bss_start, entry_address;
--- 163,194 ----
  	errno = EEOF; \
  	if (lseek(_fd, _position, L_SET) != _position) \
  	  fatal_unexec(_error_message, _error_arg);
+ 
+ /* Define name of label for entry point for the dumped executable.  */
  
! #ifndef DEFAULT_ENTRY_ADDRESS
! #define DEFAULT_ENTRY_ADDRESS __start
! #endif
  
! static struct scnhdr *text_section;
! static struct scnhdr *init_section;
! static struct scnhdr *finit_section;
! static struct scnhdr *rdata_section;
! static struct scnhdr *data_section;
! #ifdef _LIT8
! static struct scnhdr *lit8_section;
! static struct scnhdr *lit4_section;
! #endif
! static struct scnhdr *sdata_section;
! static struct scnhdr *sbss_section;
! static struct scnhdr *bss_section;
  
  struct headers {
      struct filehdr fhdr;
      struct aouthdr aout;
!     struct scnhdr section[10];
  };
  
  unexec (new_name, a_name, data_start, bss_start, entry_address)
       char *new_name, *a_name;
       unsigned data_start, bss_start, entry_address;
***************
*** 174,184 ****
    int newsyms, symrel;
    int nread;
    struct headers hdr;
  #define BUFSIZE 8192
    char buffer[BUFSIZE];
  
    old = open (a_name, O_RDONLY, 0);
!   if (old < 0) fatal_unexec("openning %s", a_name);
  
    new = creat (new_name, 0666);
    if (new < 0) fatal_unexec("creating %s", new_name);
--- 198,210 ----
    int newsyms, symrel;
    int nread;
    struct headers hdr;
+   int i;
+   int vaddr, scnptr;
  #define BUFSIZE 8192
    char buffer[BUFSIZE];
  
    old = open (a_name, O_RDONLY, 0);
!   if (old < 0) fatal_unexec("opening %s", a_name);
  
    new = creat (new_name, 0666);
    if (new < 0) fatal_unexec("creating %s", new_name);
***************
*** 210,234 ****
        exit(1);
    }
  #endif
!   if (hdr.fhdr.f_nscns != 6) {
!       fprintf(stderr, "unexec: %d sections instead of 6.\n", hdr.fhdr.f_nscns);
!   }
! #define CHECK_SCNHDR(field, name, flags) \
!   if (strcmp(hdr.field.s_name, name) != 0) { \
!       fprintf(stderr, "unexec: %s section where %s expected.\n", \
! 	      hdr.field.s_name, name); \
!       exit(1); \
!   } \
!   else if (hdr.field.s_flags != flags) { \
        fprintf(stderr, "unexec: %x flags where %x expected in %s section.\n", \
! 	      hdr.field.s_flags, flags, name); \
    }
    CHECK_SCNHDR(text_section,  _TEXT,  STYP_TEXT);
    CHECK_SCNHDR(rdata_section, _RDATA, STYP_RDATA);
    CHECK_SCNHDR(data_section,  _DATA,  STYP_DATA);
    CHECK_SCNHDR(sdata_section, _SDATA, STYP_SDATA);
    CHECK_SCNHDR(sbss_section,  _SBSS,  STYP_SBSS);
    CHECK_SCNHDR(bss_section,   _BSS,   STYP_BSS);
  
    pagesize = getpagesize();
    brk = (sbrk(0) + pagesize - 1) & (-pagesize);
--- 236,271 ----
        exit(1);
    }
  #endif
! 
! #define CHECK_SCNHDR(ptr, name, flags) \
!   if (strcmp(hdr.section[i].s_name, name) == 0) { \
!     if (hdr.section[i].s_flags != flags) { \
        fprintf(stderr, "unexec: %x flags where %x expected in %s section.\n", \
! 	      hdr.section[i].s_flags, flags, name); \
!     } \
!     ptr = hdr.section + i; \
!     i += 1; \
!   } \
!   else { \
!     ptr = NULL; \
    }
+ 
+   i = 0;
    CHECK_SCNHDR(text_section,  _TEXT,  STYP_TEXT);
+   CHECK_SCNHDR(init_section,  _INIT,  STYP_INIT);
    CHECK_SCNHDR(rdata_section, _RDATA, STYP_RDATA);
    CHECK_SCNHDR(data_section,  _DATA,  STYP_DATA);
+ #ifdef _LIT8
+   CHECK_SCNHDR(lit8_section,  _LIT8,  STYP_LIT8);
+   CHECK_SCNHDR(lit4_section,  _LIT4,  STYP_LIT4);
+ #endif
    CHECK_SCNHDR(sdata_section, _SDATA, STYP_SDATA);
    CHECK_SCNHDR(sbss_section,  _SBSS,  STYP_SBSS);
    CHECK_SCNHDR(bss_section,   _BSS,   STYP_BSS);
+   if (i != hdr.fhdr.f_nscns) {
+       fprintf(stderr, "unexec: %d sections found instead of %d.\n",
+ 	      i, hdr.fhdr.f_nscns);
+   }
  
    pagesize = getpagesize();
    brk = (sbrk(0) + pagesize - 1) & (-pagesize);
***************
*** 242,271 ****
      hdr.aout.entry = entry_address;
    }
    hdr.aout.bss_start = hdr.aout.data_start + hdr.aout.dsize;
!   hdr.rdata_section.s_size = data_start - DATA_START;
!   hdr.data_section.s_vaddr = data_start;
!   hdr.data_section.s_paddr = data_start;
!   hdr.data_section.s_size = brk - DATA_START;
!   hdr.data_section.s_scnptr = hdr.rdata_section.s_scnptr
! 				+ hdr.rdata_section.s_size;
!   hdr.sdata_section.s_vaddr = hdr.data_section.s_vaddr
! 				+ hdr.data_section.s_size;
!   hdr.sdata_section.s_paddr = hdr.sdata_section.s_paddr;
!   hdr.sdata_section.s_size = 0;
!   hdr.sdata_section.s_scnptr = hdr.data_section.s_scnptr
! 				+ hdr.data_section.s_size;
!   hdr.sbss_section.s_vaddr = hdr.sdata_section.s_vaddr
! 				+ hdr.sdata_section.s_size;
!   hdr.sbss_section.s_paddr = hdr.sbss_section.s_vaddr;
!   hdr.sbss_section.s_size = 0;
!   hdr.sbss_section.s_scnptr = hdr.sdata_section.s_scnptr
! 				+ hdr.sdata_section.s_size;
!   hdr.bss_section.s_vaddr = hdr.sbss_section.s_vaddr
! 				+ hdr.sbss_section.s_size;
!   hdr.bss_section.s_paddr = hdr.bss_section.s_vaddr;
!   hdr.bss_section.s_size = 0;
!   hdr.bss_section.s_scnptr = hdr.sbss_section.s_scnptr
! 				+ hdr.sbss_section.s_size;
  
    WRITE(new, TEXT_START, hdr.aout.tsize,
  	"writing text section to %s", new_name);
--- 279,324 ----
      hdr.aout.entry = entry_address;
    }
    hdr.aout.bss_start = hdr.aout.data_start + hdr.aout.dsize;
!   rdata_section->s_size = data_start - DATA_START;
!   data_section->s_vaddr = data_start;
!   data_section->s_paddr = data_start;
!   data_section->s_size = brk - DATA_START;
!   data_section->s_scnptr = rdata_section->s_scnptr
! 				+ rdata_section->s_size;
!   vaddr = data_section->s_vaddr + data_section->s_size;
!   scnptr = data_section->s_scnptr + data_section->s_size;
! #ifdef _LIT8
!   if (lit8_section != NULL) {
p!     lit8_section->s_vaddr = vaddr;
!     lit8_section->s_paddr = vaddr;
!     lit8_section->s_size = 0;
!     lit8_section->s_scnptr = scnptr;
!   }
!   if (lit4_section != NULL) {
!     lit4_section->s_vaddr = vaddr;
!     lit4_section->s_paddr = vaddr;
!     lit4_section->s_size = 0;
!     lit4_section->s_scnptr = scnptr;
!   }
! #endif
!   if (sdata_section != NULL) {
!     sdata_section->s_vaddr = vaddr;
!     sdata_section->s_paddr = vaddr;
!     sdata_section->s_size = 0;
!     sdata_section->s_scnptr = scnptr;
!   }
!   if (sbss_section != NULL) {
!     sbss_section->s_vaddr = vaddr;
!     sbss_section->s_paddr = vaddr;
!     sbss_section->s_size = 0;
!     sbss_section->s_scnptr = scnptr;
!   }
!   if (bss_section != NULL) {
!     bss_section->s_vaddr = vaddr;
!     bss_section->s_paddr = vaddr;
!     bss_section->s_size = 0;
!     bss_section->s_scnptr = scnptr;
!   }
  
    WRITE(new, TEXT_START, hdr.aout.tsize,
  	"writing text section to %s", new_name);
***************
*** 308,314 ****
    close(new);
    mark_x(new_name);
  }
! 
  /*
   * mark_x
   *
--- 361,367 ----
    close(new);
    mark_x(new_name);
  }
! 
  /*
   * mark_x
   *
***************
*** 321,346 ****
    struct stat sbuf;
    int um = umask (777);
    umask (um);
!   if (stat (name, &sbuf) < 0)
!     fatal_unexec ("getting protection on %s", name);
    sbuf.st_mode |= 0111 & ~um;
!   if (chmod (name, sbuf.st_mode) < 0)
!     fatal_unexec ("setting protection on %s", name);
! }
! 
! static void
! fatal_unexec (s, va_alist)
!     va_dcl
! {
!   va_list ap;
!   if (errno == EEOF)
!     fputs ("unexec: unexpected end of file, ", stderr);
!   else if (errno < sys_nerr)
!     fprintf (stderr, "unexec: %s, ", sys_errlist[errno]);
!   else
!     fprintf (stderr, "unexec: error code %d, ", errno);
!   va_start (ap);
!   _doprnt (s, ap, stderr);
!   fputs (".\n", stderr);
!   exit (1);
  }
--- 374,382 ----
    struct stat sbuf;
    int um = umask (777);
    umask (um);
!   if (stat(name, &sbuf) < 0)
!     fatal_unexec("getting protection on %s", name);
    sbuf.st_mode |= 0111 & ~um;
!   if (chmod(name, sbuf.st_mode) < 0)
!     fatal_unexec("setting protection on %s", name);
  }

*** ../../dist/src/m-mips.h	Fri Mar 24 20:43:00 1989
--- m-mips.h	Fri Mar 24 20:41:12 1989
***************
*** 90,96 ****
     Otherwise Emacs assumes that text space precedes data space,
     numerically.  */
  
! #define VIRT_ADDR_VARIES
  
  /* Define C_ALLOCA if this machine does not support a true alloca
     and the one written in C should be used instead.
--- 90,96 ----
     Otherwise Emacs assumes that text space precedes data space,
     numerically.  */
  
! /* #define VIRT_ADDR_VARIES */
  
  /* Define C_ALLOCA if this machine does not support a true alloca
     and the one written in C should be used instead.
***************
*** 123,130 ****
  
  #define LIBS_MACHINE -lmld
  #define LD_SWITCH_MACHINE -D 800000
- #define LIBS_DEBUG
  #define COFF
  
  /* The standard definitions of these macros would work ok,
     but these are faster because the constants are short.  */
--- 123,130 ----
  
  #define LIBS_MACHINE -lmld
  #define LD_SWITCH_MACHINE -D 800000
  #define COFF
+ #define LIBS_DEBUG
  
  /* The standard definitions of these macros would work ok,
     but these are faster because the constants are short.  */
***************
*** 138,143 ****
  #define XSETUINT(a, b) XSET(a, XTYPE(a), b)
  #define XSETPNTR(a, b) XSET(a, XTYPE(a), b)
  
- #define XMARKBIT(a) ((a) < 0)
- #define XSETMARKBIT(a,b) ((a) = ((a) & ~MARKBIT) | ((b) ? MARKBIT : 0))
  #define XUNMARK(a) ((a) = (((unsigned)(a) << INTBITS-GCTYPEBITS-VALBITS) >> INTBITS-GCTYPEBITS-VALBITS))
--- 138,141 ----



---------------------------------------------------------------------------
In addition, RISC/os 4.0 uses the following file s-riscos.h:

/* Definitions file for GNU emacs running on MIPS RISC/os 4.0 */

#include "s-bsd4-3.h"

/*
 *	/bin/mail does not use flock() in 4.0 (it will in 5.0) 
 */
#undef MAIL_USE_FLOCK 

#define TERMINFO
#undef KERNEL_FILE
#define KERNEL_FILE "/unix"
#undef LDAV_SYMBOL
#define LDAV_SYMBOL "avenrun"
#undef START_FILES
#define START_FILES pre-crt0.o /bsd43/usr/lib/cmplrs/cc/crt1.o
#define LD_SWITCH_SYSTEM -L -L/bsd43/usr/lib -L/bsd43/usr/lib/cmplrs/cc
#define C_SWITCH_SYSTEM -systype bsd43
#define C_DEBUG_SWITCH -O0 -g
#define C_OPTIMIZE_SWITCH C_DEBUG_SWITCH
#undef LIB_STANDARD
#define LIB_STANDARD -lc /bsd43/usr/lib/cmplrs/cc/crtn.o
#undef LIBS_TERMCAP
#define LIBS_TERMCAP
#undef LIBX11_SYSTEM
#define LIBX11_SYSTEM -lcurses



----------------------------------------------------------------------
Lastly, here is the config.h were used for RISC/os 4.0:

/* GNU Emacs site configuration template file.
   Copyright (C) 1988 Free Software Foundation, Inc.

This file is part of GNU Emacs.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.  No author or distributor
accepts responsibility to anyone for the consequences of using it
or for whether it serves any particular purpose or works at all,
unless he says so in writing.  Refer to the GNU Emacs General Public
License for full details.

Everyone is granted permission to copy, modify and redistribute
GNU Emacs, but only under the conditions described in the
GNU Emacs General Public License.   A copy of this license is
supposed to have been given to you along with GNU Emacs so you
can know your rights and responsibilities.  It should be in a
file named COPYING.  Among other things, the copyright notice
and this notice must be preserved on all copies.  */



/* Include here a s- file that describes the system type you are using.
   See the file ../etc/MACHINES for a list of systems and
   the names of the s- files to use for them.
   See s-template.h for documentation on writing s- files.  */
#include "s-riscos.h"

/* Include here a m- file that describes the machine and system you use.
   See the file ../etc/MACHINES for a list of machines and
   the names of the m- files to use for them.
   See m-template.h for info on what m- files should define.
   */
#include "m-mips.h"

/* Load in the conversion definitions if this system
   needs them and the source file being compiled has not
   said to inhibit this.  */

#ifdef SHORTNAMES
#ifndef NO_SHORTNAMES
#include "../shortnames/remap.h"
#endif /* not NO_SHORTNAMES */
#endif /* SHORTNAMES */

/* Define HAVE_X_WINDOWS if you want to use the X window system.  */

#define HAVE_X_WINDOWS

/* Define X11 if you want to use version 11 of X windows.
   Otherwise, Emacs expects to use version 10.  */

#define X11

/* Define HAVE_X_MENU if you want to use the X window menu system.
   This appears to work on some machines that support X
   and not on others.  */

/* #define HAVE_X_MENU */

/* Define `subprocesses' should be defined if you want to
   have code for asynchronous subprocesses
   (as used in M-x compile and M-x shell).
   These do not work for some USG systems yet;
   for the ones where they work, the s-*.h file defines this flag.  */

#ifndef VMS
#ifndef USG
#define subprocesses
#endif
#endif

/* Define USER_FULL_NAME to return a string
   that is the user's full name.
   It can assume that the variable `pw'
   points to the password file entry for this user.

   At some sites, the pw_gecos field contains
   the user's full name.  If neither this nor any other
   field contains the right thing, use pw_name,
   giving the user's login name, since that is better than nothing.  */

#define USER_FULL_NAME pw->pw_gecos

/* Define AMPERSAND_FULL_NAME if you use the convention
  that & in the full name stands for the login id.  */

/* #define AMPERSAND_FULL_NAME */

/* Maximum screen width we handle. */

#define MScreenWidth 300

/* Maximum screen length we handle. */

#define MScreenLength 300

/* # bytes of pure Lisp code to leave space for.
   Note that s-vms.h and m-sun2.h may override this default.  */

#ifndef PURESIZE
#ifdef HAVE_X_WINDOWS
#define PURESIZE 160000
#else
#define PURESIZE 118000
#endif
#endif

/* Define HIGHPRI as a negative number
   if you want Emacs to run at a higher than normal priority.
   For this to take effect, you must install it as setuid root.
   Emacs will change back to the users's own uid after setting
   its priority.  */

/* #define HIGHPRI */

----------------------------------------------------------------------

     Note that the above config.h assumes that you have installed
RISCwindows (MIPS X windows product) on your system.  You have to
turn off HAVE_X_WINDOWS if not.