From 1da5b5ccee340dbecf19d724b80ed61a80fca6d6 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 10 Oct 2005 15:28:15 +0000 Subject: [PATCH] gcc subdir for combined gcc/ack library build --- lib/gnu/Makefile | 7 + lib/gnu/Makefile.gnu | 5 + lib/gnu/end/Makefile | 7 + lib/gnu/end/Makefile.gnu | 16 +++ lib/gnu/end/gnu_end.gs | 5 + lib/gnu/ieee_float/Makefile | 14 ++ lib/gnu/ieee_float/Makefile.gnu.conv | 58 ++++++++ lib/gnu/ieee_float/fphook.c | 195 +++++++++++++++++++++++++++ lib/gnu/ieee_float/frexp.c | 60 +++++++++ lib/gnu/ieee_float/ieee_float.h | 51 +++++++ lib/gnu/ieee_float/isinf.c | 31 +++++ lib/gnu/ieee_float/isnan.c | 31 +++++ lib/gnu/ieee_float/ldexp.c | 99 ++++++++++++++ lib/gnu/ieee_float/modf.c | 61 +++++++++ lib/gnu/rts/Makefile | 10 ++ lib/gnu/rts/Makefile.gnu | 27 ++++ lib/gnu/rts/_longjmp.gs | 38 ++++++ lib/gnu/rts/_setjmp.gs | 32 +++++ lib/gnu/rts/longjmp.gs | 6 + lib/gnu/rts/setjmp.gs | 6 + 20 files changed, 759 insertions(+) create mode 100644 lib/gnu/Makefile create mode 100644 lib/gnu/Makefile.gnu create mode 100644 lib/gnu/end/Makefile create mode 100644 lib/gnu/end/Makefile.gnu create mode 100644 lib/gnu/end/gnu_end.gs create mode 100644 lib/gnu/ieee_float/Makefile create mode 100644 lib/gnu/ieee_float/Makefile.gnu.conv create mode 100755 lib/gnu/ieee_float/fphook.c create mode 100644 lib/gnu/ieee_float/frexp.c create mode 100644 lib/gnu/ieee_float/ieee_float.h create mode 100644 lib/gnu/ieee_float/isinf.c create mode 100644 lib/gnu/ieee_float/isnan.c create mode 100644 lib/gnu/ieee_float/ldexp.c create mode 100644 lib/gnu/ieee_float/modf.c create mode 100644 lib/gnu/rts/Makefile create mode 100644 lib/gnu/rts/Makefile.gnu create mode 100644 lib/gnu/rts/_longjmp.gs create mode 100644 lib/gnu/rts/_setjmp.gs create mode 100644 lib/gnu/rts/longjmp.gs create mode 100644 lib/gnu/rts/setjmp.gs diff --git a/lib/gnu/Makefile b/lib/gnu/Makefile new file mode 100644 index 000000000..889c60bf8 --- /dev/null +++ b/lib/gnu/Makefile @@ -0,0 +1,7 @@ + +SUBDIRS = \ + end \ + ieee_float \ + rts \ + +include ../Makefile.inc diff --git a/lib/gnu/Makefile.gnu b/lib/gnu/Makefile.gnu new file mode 100644 index 000000000..052cf6e3e --- /dev/null +++ b/lib/gnu/Makefile.gnu @@ -0,0 +1,5 @@ + +all: + cd end && gmake + cd ieee_float && gmake + cd rts && gmake diff --git a/lib/gnu/end/Makefile b/lib/gnu/end/Makefile new file mode 100644 index 000000000..c52618d4a --- /dev/null +++ b/lib/gnu/end/Makefile @@ -0,0 +1,7 @@ + +LIBRARIES = end + +end_OBJECTS = gnu_end.o + +include ../../Makefile.gnu.inc + diff --git a/lib/gnu/end/Makefile.gnu b/lib/gnu/end/Makefile.gnu new file mode 100644 index 000000000..8603fd6f8 --- /dev/null +++ b/lib/gnu/end/Makefile.gnu @@ -0,0 +1,16 @@ +CC=gcc +AR=gar +AS=gas + +VPATH=$(SRCDIR)/gnu/end + +LIBRARY=../../end.a +OBJECTS=gnu_end.o + +all: $(LIBRARY) + +$(LIBRARY): $(OBJECTS) + $(AR) cr $@ *.o + +gnu_end.o: gnu_end.s + diff --git a/lib/gnu/end/gnu_end.gs b/lib/gnu/end/gnu_end.gs new file mode 100644 index 000000000..3d774ffd7 --- /dev/null +++ b/lib/gnu/end/gnu_end.gs @@ -0,0 +1,5 @@ + +.stabs "endbss",11,0,0,0 +.stabs "__end",1,0,0,0 + + diff --git a/lib/gnu/ieee_float/Makefile b/lib/gnu/ieee_float/Makefile new file mode 100644 index 000000000..e025178d9 --- /dev/null +++ b/lib/gnu/ieee_float/Makefile @@ -0,0 +1,14 @@ + +CFLAGS = -O -I.. + +LIBRARIES = libc + +libc_OBJECTS = \ + frexp.o \ + isinf.o \ + isnan.o \ + ldexp.o \ + modf.o \ + fphook.o \ + +include ../../Makefile.gnu.inc diff --git a/lib/gnu/ieee_float/Makefile.gnu.conv b/lib/gnu/ieee_float/Makefile.gnu.conv new file mode 100644 index 000000000..479c5fd26 --- /dev/null +++ b/lib/gnu/ieee_float/Makefile.gnu.conv @@ -0,0 +1,58 @@ +# Makefile for lib/ieee_float. + +#CC = gcc +#ARCH = eniac +CFLAGS = -O -I$(SRCDIR)/stdio +CC1 = $(CC) $(CFLAGS) -c + +LIBRARY = ../../libc.a +LIBSOFT = ../../libsoft.a + +OBJECTS = \ + $(LIBRARY)(frexp.o) \ + $(LIBRARY)(isinf.o) \ + $(LIBRARY)(isnan.o) \ + $(LIBRARY)(ldexp.o) \ + $(LIBRARY)(modf.o) \ + $(LIBRARY)(fphook.o) \ + +all: $(LIBRARY) + +$(LIBRARY): $(OBJECTS) + $(AR) cr $@ *.o + +$(LIBRARY)(frexp.o): frexp.c +$(LIBRARY)(isinf.o): isinf.c +$(LIBRARY)(isnan.o): isnan.c +$(LIBRARY)(ldexp.o): ldexp.c +$(LIBRARY)(modf.o): modf.c +$(LIBRARY)(fphook.o): fphook.c +SOFTOBJ = \ + $(LIBSOFT)(frexp.o) \ + $(LIBSOFT)(isinf.o) \ + $(LIBSOFT)(isnan.o) \ + $(LIBSOFT)(ldexp.o) \ + $(LIBSOFT)(modf.o) \ + +soft: $(LIBSOFT) + +$(LIBSOFT): $(SOFTOBJ) + $(CC) -c.a -o $@ *.o + rm *.o + +$(LIBSOFT)(frexp.o): frexp.c + $(CC1) -fsoft frexp.c + +$(LIBSOFT)(isinf.o): isinf.c + $(CC1) -fsoft isinf.c + +$(LIBSOFT)(isnan.o): isnan.c + $(CC1) -fsoft isnan.c + +$(LIBSOFT)(ldexp.o): ldexp.c + $(CC1) -fsoft ldexp.c + +$(LIBSOFT)(modf.o): modf.c + $(CC1) -fsoft modf.c + +# $PchId: Makefile,v 1.3 1996/02/22 21:01:39 philip Exp $ diff --git a/lib/gnu/ieee_float/fphook.c b/lib/gnu/ieee_float/fphook.c new file mode 100755 index 000000000..61730d609 --- /dev/null +++ b/lib/gnu/ieee_float/fphook.c @@ -0,0 +1,195 @@ +/* + * fltpr.c - print floating point numbers + */ +/* $Header$ */ + +#ifndef NOFLOAT +#include +#include +#include "../stdio/loc_incl.h" +int _fp_hook = 1; + +static char * +_pfloat(long double r, register char *s, int n, int flags) +{ + register char *s1; + int sign, dp; + register int i; + + s1 = _fcvt(r, n, &dp, &sign); + if (sign) + *s++ = '-'; + else if (flags & FL_SIGN) + *s++ = '+'; + else if (flags & FL_SPACE) + *s++ = ' '; + + if (dp<=0) + *s++ = '0'; + for (i=dp; i>0; i--) + if (*s1) *s++ = *s1++; + else *s++ = '0'; + if (((i=n) > 0) || (flags & FL_ALT)) + *s++ = '.'; + while (++dp <= 0) { + if (--i<0) + break; + *s++ = '0'; + } + while (--i >= 0) + if (*s1) *s++ = *s1++; + else *s++ = '0'; + return s; +} + +static char * +_pscien(long double r, register char *s, int n, int flags) +{ + int sign, dp; + register char *s1; + + s1 = _ecvt(r, n + 1, &dp, &sign); + if (sign) + *s++ = '-'; + else if (flags & FL_SIGN) + *s++ = '+'; + else if (flags & FL_SPACE) + *s++ = ' '; + + *s++ = *s1++; + if ((n > 0) || (flags & FL_ALT)) + *s++ = '.'; + while (--n >= 0) + if (*s1) *s++ = *s1++; + else *s++ = '0'; + *s++ = 'e'; + if ( r != 0 ) --dp ; + if ( dp<0 ) { + *s++ = '-' ; dp= -dp ; + } else { + *s++ = '+' ; + } + if (dp >= 100) { + *s++ = '0' + (dp / 100); + dp %= 100; + } + *s++ = '0' + (dp/10); + *s++ = '0' + (dp%10); + return s; +} + +#define NDIGINEXP(exp) (((exp) >= 100 || (exp) <= -100) ? 3 : 2) +#define LOW_EXP -4 +#define USE_EXP(exp, ndigits) (((exp) < LOW_EXP + 1) || (exp >= ndigits + 1)) + +static char * +_gcvt(long double value, int ndigit, char *s, int flags) +{ + int sign, dp; + register char *s1, *s2; + register int i; + register int nndigit = ndigit; + + s1 = _ecvt(value, ndigit, &dp, &sign); + s2 = s; + if (sign) *s2++ = '-'; + else if (flags & FL_SIGN) + *s2++ = '+'; + else if (flags & FL_SPACE) + *s2++ = ' '; + + if (!(flags & FL_ALT)) + for (i = nndigit - 1; i > 0 && s1[i] == '0'; i--) + nndigit--; + + if (USE_EXP(dp,ndigit)) { + /* Use E format */ + dp--; + *s2++ = *s1++; + if ((nndigit > 1) || (flags & FL_ALT)) *s2++ = '.'; + while (--nndigit > 0) *s2++ = *s1++; + *s2++ = 'e'; + if (dp < 0) { + *s2++ = '-'; + dp = -dp; + } + else *s2++ = '+'; + s2 += NDIGINEXP(dp); + *s2 = 0; + for (i = NDIGINEXP(dp); i > 0; i--) { + *--s2 = dp % 10 + '0'; + dp /= 10; + } + return s; + } + /* Use f format */ + if (dp <= 0) { + if (*s1 != '0') { + /* otherwise the whole number is 0 */ + *s2++ = '0'; + *s2++ = '.'; + } + while (dp < 0) { + dp++; + *s2++ = '0'; + } + } + for (i = 1; i <= nndigit; i++) { + *s2++ = *s1++; + if (i == dp) *s2++ = '.'; + } + if (i <= dp) { + while (i++ <= dp) *s2++ = '0'; + *s2++ = '.'; + } + if ((s2[-1]=='.') && !(flags & FL_ALT)) s2--; + *s2 = '\0'; + return s; +} + +char * +_f_print(va_list *ap, int flags, char *s, char c, int precision) +{ + register char *old_s = s; + long double ld_val; + + if (flags & FL_LONGDOUBLE) ld_val = va_arg(*ap, long double); + else ld_val = (long double) va_arg(*ap, double); + + switch(c) { + case 'f': + s = _pfloat(ld_val, s, precision, flags); + break; + case 'e': + case 'E': + s = _pscien(ld_val, s, precision , flags); + break; + case 'g': + case 'G': + s = _gcvt(ld_val, precision, s, flags); + s += strlen(s); + break; + } + if ( c == 'E' || c == 'G') { + while (*old_s && *old_s != 'e') old_s++; + if (*old_s == 'e') *old_s = 'E'; + } + return s; +} +#endif /* NOFLOAT */ +/* $Header$ */ + +#include +#include "../ansi/ext_fmt.h" + +void _str_ext_cvt(const char *s, char **ss, struct EXTEND *e); +double _ext_dbl_cvt(struct EXTEND *e); + +double +strtod(const char *p, char **pp) +{ + struct EXTEND e; + + _str_ext_cvt(p, pp, &e); + return _ext_dbl_cvt(&e); +} diff --git a/lib/gnu/ieee_float/frexp.c b/lib/gnu/ieee_float/frexp.c new file mode 100644 index 000000000..7421797c8 --- /dev/null +++ b/lib/gnu/ieee_float/frexp.c @@ -0,0 +1,60 @@ +/* +libc/ieee_float/frexp.c + +Created: Oct 14, 1993 by Philip Homburg + +Implementation of frexp that directly manipulates the exponent bits in an +ieee float +*/ + +#include +#include + +#include "ieee_float.h" + +double frexp(value, eptr) +double value; +int *eptr; +{ + struct f64 *f64p; + int exp, exp_bias; + double factor; + + f64p= (struct f64 *)&value; + exp_bias= 0; + + exp= F64_GET_EXP(f64p); + if (exp == F64_EXP_MAX) + { /* Either infinity or Nan */ + *eptr= 0; + return value; + } + if (exp == 0) + { + /* Either 0 or denormal */ + if (F64_GET_MANT_LOW(f64p) == 0 && + F64_GET_MANT_HIGH(f64p) == 0) + { + *eptr= 0; + return value; + } + + /* Multiply by 2^64 */ + factor= 65536.0; /* 2^16 */ + factor *= factor; /* 2^32 */ + factor *= factor; /* 2^64 */ + value *= factor; + exp_bias= 64; + exp= F64_GET_EXP(f64p); + } + + exp= exp - F64_EXP_BIAS - exp_bias + 1; + *eptr= exp; + F64_SET_EXP(f64p, F64_EXP_BIAS-1); + + return value; +} + +/* + * $PchId: frexp.c,v 1.3 1996/02/22 21:01:39 philip Exp $ + */ diff --git a/lib/gnu/ieee_float/ieee_float.h b/lib/gnu/ieee_float/ieee_float.h new file mode 100644 index 000000000..940a2b1aa --- /dev/null +++ b/lib/gnu/ieee_float/ieee_float.h @@ -0,0 +1,51 @@ +/* +libc/ieee_float/ieee_float.h + +Created: Oct 14, 1993 by Philip Homburg + +Define structures and macros for manipulating IEEE floats +*/ + +#ifndef IEEE_FLOAT_H +#define IEEE_FLOAT_H + +#define isnan __IsNan + +struct f64 +{ + u32_t low_word; + u32_t high_word; +}; + +#define F64_SIGN_SHIFT 31 +#define F64_SIGN_MASK 1 + +#define F64_EXP_SHIFT 20 +#define F64_EXP_MASK 0x7ff +#define F64_EXP_BIAS 1023 +#define F64_EXP_MAX 2047 + +#define F64_MANT_SHIFT 0 +#define F64_MANT_MASK 0xfffff + +#define F64_GET_SIGN(fp) (((fp)->high_word >> F64_SIGN_SHIFT) & \ + F64_SIGN_MASK) +#define F64_GET_EXP(fp) (((fp)->high_word >> F64_EXP_SHIFT) & \ + F64_EXP_MASK) +#define F64_SET_EXP(fp, val) ((fp)->high_word= ((fp)->high_word & \ + ~(F64_EXP_MASK << F64_EXP_SHIFT)) | \ + (((val) & F64_EXP_MASK) << F64_EXP_SHIFT)) + +#define F64_GET_MANT_LOW(fp) ((fp)->low_word) +#define F64_SET_MANT_LOW(fp, val) ((fp)->low_word= (val)) +#define F64_GET_MANT_HIGH(fp) (((fp)->high_word >> F64_MANT_SHIFT) & \ + F64_MANT_MASK) +#define F64_SET_MANT_HIGH(fp, val) ((fp)->high_word= ((fp)->high_word & \ + ~(F64_MANT_MASK << F64_MANT_SHIFT)) | \ + (((val) & F64_MANT_MASK) << F64_MANT_SHIFT)) + +#endif /* IEEE_FLOAT_H */ + +/* + * $PchId: ieee_float.h,v 1.3 1996/02/22 21:01:39 philip Exp $ + */ diff --git a/lib/gnu/ieee_float/isinf.c b/lib/gnu/ieee_float/isinf.c new file mode 100644 index 000000000..49316c612 --- /dev/null +++ b/lib/gnu/ieee_float/isinf.c @@ -0,0 +1,31 @@ +/* +libc/ieee_float/isinf.c + +Created: Oct 14, 1993 by Philip Homburg + +Implementation of isinf that directly tests the bits in an ieee float +*/ + +#define _MINIX_SOURCE + +#include +#include + +#include "ieee_float.h" + +int isinf(value) +double value; +{ + struct f64 *f64p; + int exp; + + f64p= (struct f64 *)&value; + exp= F64_GET_EXP(f64p); + if (exp != F64_EXP_MAX) + return 0; + return F64_GET_MANT_LOW(f64p) == 0 && F64_GET_MANT_HIGH(f64p) == 0; +} + +/* + * $PchId: isinf.c,v 1.3 1996/02/22 21:01:39 philip Exp $ + */ diff --git a/lib/gnu/ieee_float/isnan.c b/lib/gnu/ieee_float/isnan.c new file mode 100644 index 000000000..b941bb9e8 --- /dev/null +++ b/lib/gnu/ieee_float/isnan.c @@ -0,0 +1,31 @@ +/* +libc/ieee_float/isnan.c + +Created: Oct 14, 1993 by Philip Homburg + +Implementation of isnan that directly tests the bits in an ieee float +*/ + +#define _MINIX_SOURCE + +#include +#include + +#include "ieee_float.h" + +int isnan(value) +double value; +{ + struct f64 *f64p; + int exp; + + f64p= (struct f64 *)&value; + exp= F64_GET_EXP(f64p); + if (exp != F64_EXP_MAX) + return 0; + return F64_GET_MANT_LOW(f64p) != 0 || F64_GET_MANT_HIGH(f64p) != 0; +} + +/* + * $PchId: isnan.c,v 1.3 1996/02/22 21:01:39 philip Exp $ + */ diff --git a/lib/gnu/ieee_float/ldexp.c b/lib/gnu/ieee_float/ldexp.c new file mode 100644 index 000000000..32a9a3f85 --- /dev/null +++ b/lib/gnu/ieee_float/ldexp.c @@ -0,0 +1,99 @@ +/* +libc/ieee_float/ldexp.c + +Created: Oct 14, 1993 by Philip Homburg + +Implementation of ldexp that directly manipulates the exponent bits in an +ieee float +*/ + +#include +#include +#include + +#include "ieee_float.h" + +double ldexp(value, exp) +double value; +int exp; +{ + struct f64 *f64p; + int oldexp, exp_bias; + double factor; + + f64p= (struct f64 *)&value; + exp_bias= 0; + + oldexp= F64_GET_EXP(f64p); + if (oldexp == F64_EXP_MAX) + { /* Either infinity or Nan */ + return value; + } + if (oldexp == 0) + { + /* Either 0 or denormal */ + if (F64_GET_MANT_LOW(f64p) == 0 && + F64_GET_MANT_HIGH(f64p) == 0) + { + return value; + } + } + + /* If exp is too large (> 2*F64_EXP_MAX) or too small + * (< -2*F64_EXP_MAX) return HUGE_VAL or 0. This prevents overflows + * in exp if exp is really weird + */ + if (exp >= 2*F64_EXP_MAX) + { + errno= ERANGE; + return HUGE_VAL; + } + if (exp <= -2*F64_EXP_MAX) + { + errno= ERANGE; + return 0; + } + + /* Normalize a denormal */ + if (oldexp == 0) + { + /* Multiply by 2^64 */ + factor= 65536.0; /* 2^16 */ + factor *= factor; /* 2^32 */ + factor *= factor; /* 2^64 */ + value *= factor; + exp= -64; + oldexp= F64_GET_EXP(f64p); + } + + exp= oldexp + exp; + if (exp >= F64_EXP_MAX) + { /* Overflow */ + errno= ERANGE; + return HUGE_VAL; + } + if (exp > 0) + { + /* Normal */ + F64_SET_EXP(f64p, exp); + return value; + } + /* Denormal, or underflow. */ + exp += 64; + F64_SET_EXP(f64p, exp); + /* Divide by 2^64 */ + factor= 65536.0; /* 2^16 */ + factor *= factor; /* 2^32 */ + factor *= factor; /* 2^64 */ + value /= factor; + if (value == 0.0) + { + /* Underflow */ + errno= ERANGE; + } + return value; +} + +/* + * $PchId: ldexp.c,v 1.3 1996/02/22 21:01:39 philip Exp $ + */ diff --git a/lib/gnu/ieee_float/modf.c b/lib/gnu/ieee_float/modf.c new file mode 100644 index 000000000..1b50a4256 --- /dev/null +++ b/lib/gnu/ieee_float/modf.c @@ -0,0 +1,61 @@ +/* +libc/ieee_float/modf.c + +Created: Oct 14, 1993 by Philip Homburg + +Implementation of modf that directly manipulates the exponent bits in an +ieee float +*/ + +#include +#include + +#include "ieee_float.h" + +double modf(value, iptr) +double value; +double *iptr; +{ + struct f64 *f64p; + double tmp; + int exp; + int mask_bits; + u32_t mant; + + f64p= (struct f64 *)&value; + + exp= F64_GET_EXP(f64p); + exp -= F64_EXP_BIAS; + if (exp < 0) + { + *iptr= 0; + return value; + } + mask_bits= 52-exp; + if (mask_bits <= 0) + { + *iptr= value; + return 0; + } + tmp= value; + if (mask_bits >= 32) + { + F64_SET_MANT_LOW(f64p, 0); + mask_bits -= 32; + mant= F64_GET_MANT_HIGH(f64p); + mant &= ~((1 << mask_bits)-1); + F64_SET_MANT_HIGH(f64p, mant); + } + else + { + mant= F64_GET_MANT_LOW(f64p); + mant &= ~((1 << mask_bits)-1); + F64_SET_MANT_LOW(f64p, mant); + } + *iptr= value; + return tmp-value; +} + +/* + * $PchId: modf.c,v 1.3 1996/02/22 21:01:39 philip Exp $ + */ diff --git a/lib/gnu/rts/Makefile b/lib/gnu/rts/Makefile new file mode 100644 index 000000000..492516961 --- /dev/null +++ b/lib/gnu/rts/Makefile @@ -0,0 +1,10 @@ + +LIBRARIES = libc + +libc_OBJECTS = \ + _longjmp.o \ + _setjmp.o \ + longjmp.o \ + setjmp.o \ + +include ../../Makefile.gnu.inc diff --git a/lib/gnu/rts/Makefile.gnu b/lib/gnu/rts/Makefile.gnu new file mode 100644 index 000000000..1dadbfe19 --- /dev/null +++ b/lib/gnu/rts/Makefile.gnu @@ -0,0 +1,27 @@ +CC=gcc +AR=gar +AS=gas + +VPATH=$(SRCDIR)/gnu/rts + +#Makefile for lib/gcc/mach/minix.i386/libsys. + +LIBRARY = ../../libc.a + +OBJECTS = \ + _longjmp.o \ + _setjmp.o \ + longjmp.o \ + setjmp.o \ + +all: $(LIBRARY) + +$(LIBRARY): $(OBJECTS) + $(AR) cr $@ *.o + +_longjmp.o: _longjmp.s +_setjmp.o: _setjmp.s +longjmp.o: longjmp.s +setjmp.o: setjmp.s + +# $PchId: Makefile,v 1.4 1996/02/22 21:54:11 philip Exp $ diff --git a/lib/gnu/rts/_longjmp.gs b/lib/gnu/rts/_longjmp.gs new file mode 100644 index 000000000..74cc58846 --- /dev/null +++ b/lib/gnu/rts/_longjmp.gs @@ -0,0 +1,38 @@ +/ _longjmp.gnu.s +/ +/ Created: Oct 15, 1993 by Philip Homburg + +.text +.globl __longjmp +__longjmp: + movl 4(%esp), %eax # jmp_buf + cmpl $0, 0(%eax) # save mask? + je 1f + leal 4(%eax), %ebx # pointer to sigset_t + pushl %ebx + call ___oldsigset # restore mask + addl $4, %esp + movl 4(%esp), %eax # jmp_buf +1: + movl 8(%esp), %ecx # result value + movl 12(%eax), %esp # restore stack pointer + + movl 8(%eax), %ebx # restore program counter + movl %ebx, 0(%esp) + + pushl %ecx # save result code + + movl 16(%eax), %ebp # restore frame pointer + movl 20(%eax), %ebx + movl 24(%eax), %ecx + movl 28(%eax), %edx + movl 32(%eax), %esi + movl 36(%eax), %edi + pop %eax + testl %eax, %eax + jz 1f + ret +1: movl $1, %eax + ret + +/ $PchId: _longjmp.gnu.s,v 1.4 1996/03/12 19:30:02 philip Exp $ diff --git a/lib/gnu/rts/_setjmp.gs b/lib/gnu/rts/_setjmp.gs new file mode 100644 index 000000000..60b86cab4 --- /dev/null +++ b/lib/gnu/rts/_setjmp.gs @@ -0,0 +1,32 @@ +/ _setjmp.gnu.s +/ +/ Created: Oct 14, 1993 by Philip Homburg + +.text +.globl ___setjmp +___setjmp: + movl 4(%esp), %eax # jmp_buf + movl %ebx, 20(%eax) # save ebx + movl 0(%esp), %ebx + movl %ebx, 8(%eax) # save program counter + movl %esp, 12(%eax) # save stack pointer + movl %ebp, 16(%eax) # save frame pointer + movl 20(%eax), %ebx # restore ebx + movl %ecx, 24(%eax) + movl %edx, 28(%eax) + movl %esi, 32(%eax) + movl %edi, 36(%eax) + + movl 8(%esp), %ebx # save mask? + movl %ebx, 0(%eax) # save whether to restore mask + testl %ebx, %ebx + jz 1f + leal 4(%eax), %ebx # pointer to sigset_t + pushl %ebx + call ___newsigset # save mask + addl $4, %esp +1: + movl $0, %eax + ret + +/ $PchId: _setjmp.gnu.s,v 1.4 1996/03/12 19:30:54 philip Exp $ diff --git a/lib/gnu/rts/longjmp.gs b/lib/gnu/rts/longjmp.gs new file mode 100644 index 000000000..ca19beb3e --- /dev/null +++ b/lib/gnu/rts/longjmp.gs @@ -0,0 +1,6 @@ + .text +.globl _longjmp +_longjmp: + jmp __longjmp + +/ $PchId: longjmp.gnu.s,v 1.4 1996/03/12 19:31:18 philip Exp $ diff --git a/lib/gnu/rts/setjmp.gs b/lib/gnu/rts/setjmp.gs new file mode 100644 index 000000000..93e4caa1b --- /dev/null +++ b/lib/gnu/rts/setjmp.gs @@ -0,0 +1,6 @@ + .text +.globl _setjmp +_setjmp: + jmp ___setjmp + +/ $PchId: setjmp.gnu.s,v 1.4 1996/03/12 19:31:18 philip Exp $ -- 2.44.0