🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Dirk Grunwald Thu, 12 Oct 1989 03:47
stdarg.h for DECstation-3100
#496
Author: Dirk Grunwald
Date: Thu, 12 Oct 1989 03:47
165 lines
6163 bytes
The following shar contains three patches: one to stdarg.h, one to gnulib.c
and one to gnulib2.c.

These implement a better stdarg.h for the MIPS architecture. I'm not certain
it's completely correct, but it compiles simple test cases.

the changes to gnulib/gnulib2 simple move the definition of
builtin_saveregs from gnulib.c (compiled with `cc') to gnulib2.c
(compiled with `gcc`). This is needed because the MIPS compiler
doesn't support the asm() operations used. The routine __builtin_saveregs
for the MIPS arch. simply stored a0..a3 into the appropriate memory
locations in preperation for a _varargs.

the changes to stdarg.h define a special strick, used by the mips backend
to detect varargs, and then called builtin_saveregs. One would think the
special string would also signel the need to save a0..a3, but I didn't
want to change tm-mips.h any more than needed.

One last change: In the Makefile, you'll need to move the _varargs
from the line for gnulib to gnulib2 -- I forgot to ci my Makefile
before changing things around, so no context diffs.

These changes let `<<' style I/O work on the PMAX; basically, anything
that uses stdarg.h should be recompiled (like, recompiled libg++)

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  gnulib.c.diff gnulib2.c.diff stdarg.h.diff
# Wrapped by grunwald@foobar on Wed Oct 11 21:40:08 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'gnulib.c.diff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'gnulib.c.diff'\"
else
echo shar: Extracting \"'gnulib.c.diff'\" \(379 characters\)
sed "s/^X//" >'gnulib.c.diff' <<'END_OF_FILE'
X299,317d298
X< #ifdef L_varargs
X< #ifdef sparc
X< 	asm (".global ___builtin_saveregs");
X< 	asm ("___builtin_saveregs:");
X< 	asm ("st %i0,[%fp+68]");
X< 	asm ("st %i1,[%fp+72]");
X< 	asm ("st %i2,[%fp+76]");
X< 	asm ("st %i3,[%fp+80]");
X< 	asm ("st %i4,[%fp+84]");
X< 	asm ("retl");
X< 	asm ("st %i5,[%fp+88]");
X< #else
X< __builtin_saveregs ()
X< {
X<   abort ();
X< }
X< #endif
X< #endif
X< 
END_OF_FILE
if test 379 -ne `wc -c <'gnulib.c.diff'`; then
    echo shar: \"'gnulib.c.diff'\" unpacked with wrong size!
fi
# end of 'gnulib.c.diff'
fi
if test -f 'gnulib2.c.diff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'gnulib2.c.diff'\"
else
echo shar: Extracting \"'gnulib2.c.diff'\" \(916 characters\)
sed "s/^X//" >'gnulib2.c.diff' <<'END_OF_FILE'
X*** /tmp/,RCSt1a19906	Wed Oct 11 21:33:56 1989
X--- gnulib2.c	Wed Oct 11 21:24:24 1989
X***************
X*** 845,847 ****
X--- 845,879 ----
X    return (negate ? -d : d);
X  }
X  #endif
X+ 
X+ #ifdef L_varargs
X+ #ifdef sparc
X+ 	asm (".global ___builtin_saveregs");
X+ 	asm ("___builtin_saveregs:");
X+ 	asm ("st %i0,[%fp+68]");
X+ 	asm ("st %i1,[%fp+72]");
X+ 	asm ("st %i2,[%fp+76]");
X+ 	asm ("st %i3,[%fp+80]");
X+ 	asm ("st %i4,[%fp+84]");
X+ 	asm ("retl");
X+ 	asm ("st %i5,[%fp+88]");
X+ #else
X+ #if defined(MIPSEL) | defined(R3000) | defined(R2000) | defined(mips)
X+ 
X+   asm ("	.ent __builtin_saveregs");
X+   asm ("	.globl __builtin_saveregs");
X+   asm ("__builtin_saveregs:");
X+   asm ("	sw	$4,0($30)");
X+   asm ("	sw	$5,4($30)");
X+   asm ("	sw	$6,8($30)");
X+   asm ("	sw	$7,12($30)");
X+   asm ("	j	$31");
X+   asm ("	.end __builtin_saveregs");
X+ #else
X+ __builtin_saveregs ()
X+ {
X+   abort ();
X+ }
X+ #endif
X+ #endif
X+ #endif
END_OF_FILE
if test 916 -ne `wc -c <'gnulib2.c.diff'`; then
    echo shar: \"'gnulib2.c.diff'\" unpacked with wrong size!
fi
# end of 'gnulib2.c.diff'
fi
if test -f 'stdarg.h.diff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stdarg.h.diff'\"
else
echo shar: Extracting \"'stdarg.h.diff'\" \(1219 characters\)
sed "s/^X//" >'stdarg.h.diff' <<'END_OF_FILE'
X*** /tmp/,RCSt1a19942	Wed Oct 11 21:39:35 1989
X--- stdarg.h	Wed Oct 11 21:37:54 1989
X***************
X*** 33,44 ****
X  #define __va_rounded_size(TYPE)  \
X    (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
X  
X! #ifndef sparc
X! #define va_start(AP, LASTARG) 						\
X!  (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
X! #else
X! #define va_start(AP, LASTARG) 						\
X   (__builtin_saveregs (), AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
X  #endif
X  
X  void va_end (va_list);		/* Defined in gnulib */
X--- 33,49 ----
X  #define __va_rounded_size(TYPE)  \
X    (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
X  
X! #if	defined(sparc)
X! #  define va_start(AP, LASTARG)						\
X   (__builtin_saveregs (), AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
X+ #elif defined(mips)
X+ #  define va_start(AP,LASTARG) {\
X+        static char __vd_alist[16] = "__%%VARARGS";  /* Identify to codegen */\
X+ 	__builtin_saveregs();\
X+ 	(AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)));}
X+ #else
X+ #  define va_start(AP, LASTARG)						\
X+  (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
X  #endif
X  
X  void va_end (va_list);		/* Defined in gnulib */
END_OF_FILE
if test 1219 -ne `wc -c <'stdarg.h.diff'`; then
    echo shar: \"'stdarg.h.diff'\" unpacked with wrong size!
fi
# end of 'stdarg.h.diff'
fi
echo shar: End of shell archive.
exit 0
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads