From d8cceb4fcf42c9dd7805b75a8640e15d00dd7ac9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 17 Nov 1998 18:36:05 +0000 Subject: Update. 1998-11-17 Ulrich Drepper * stdio-common/printf_fphex.c (__printf_fphex): Correct printing of denormalized numbers. 1998-10-06 Geoff Keating * sysdeps/powerpc/dl-machine.h (elf_machine_load_address): Suppress another parentheses warning, make nano-optimisation. * sysdeps/powerpc/dl-machine.h (_dl_runtime_resolve): Preserve saved LR on stack so _mcount works. (_dl_prof_resolve): Likewise. * sysdeps/powerpc/register-dump.h: Print FPRs. Adjust for correct signal handler calling convention. * sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h: Adjust for correct signal handler calling convention---more like x86 linux and mklinux, less like linux-ppc versions between 2.1 and 2.1.126. 1998-11-17 Ulrich Drepper * configure.in: Correct allowed makeinfo version. 1998-11-17 Philip Blundell * sysdeps/generic/bits/mathdef.h: Fix typo. * intl/locale.alias: Change `japanese' alias to match X11R6's. --- ChangeLog | 29 ++++++++++++- bits/mathdef.h | 2 +- configure | 4 +- configure.in | 4 +- stdio-common/printf_fphex.c | 50 +++++++++++++++------- sysdeps/generic/bits/mathdef.h | 2 +- sysdeps/powerpc/dl-machine.h | 19 ++++----- sysdeps/powerpc/register-dump.h | 53 ++++++++++++++---------- sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h | 10 ++--- 9 files changed, 115 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7dc183bd82..18914ea140 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +1998-11-17 Ulrich Drepper + + * stdio-common/printf_fphex.c (__printf_fphex): Correct printing + of denormalized numbers. + +1998-10-06 Geoff Keating + + * sysdeps/powerpc/dl-machine.h (elf_machine_load_address): Suppress + another parentheses warning, make nano-optimisation. + + * sysdeps/powerpc/dl-machine.h (_dl_runtime_resolve): Preserve + saved LR on stack so _mcount works. + (_dl_prof_resolve): Likewise. + * sysdeps/powerpc/register-dump.h: Print FPRs. Adjust for correct + signal handler calling convention. + * sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h: Adjust for + correct signal handler calling convention---more like x86 linux and + mklinux, less like linux-ppc versions between 2.1 and 2.1.126. + +1998-11-17 Ulrich Drepper + + * configure.in: Correct allowed makeinfo version. + +1998-11-17 Philip Blundell + + * sysdeps/generic/bits/mathdef.h: Fix typo. + 1998-11-17 Geoff Keating * sysdeps/unix/sysv/linux/powerpc/pwrite.c: Prototype the syscall @@ -11,7 +38,7 @@ 1998-11-16 Ulrich Drepper - * intl/locale.alias: Change `japanese' alais to match X11R6's. + * intl/locale.alias: Change `japanese' alias to match X11R6's. Add `japanese.euc' alias. * manual/Makefile (%.info): Set LANGUAGE and LC_ALL explicitly to C diff --git a/bits/mathdef.h b/bits/mathdef.h index 0d1c4d7374..3708781597 100644 --- a/bits/mathdef.h +++ b/bits/mathdef.h @@ -16,7 +16,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -if !defined _MATH_H && !defined _COMPLEX_H +#if !defined _MATH_H && !defined _COMPLEX_H # error "Never use directly; include instead" #endif diff --git a/configure b/configure index 802cdfe20d..75c7856120 100755 --- a/configure +++ b/configure @@ -1432,7 +1432,7 @@ echo "configure:1432: checking version of $MAKEINFO" >&5 ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 3.1[1-9] | 3.[2-9][0-9]) + 1.6[89] | 1.7[0-9]) ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; @@ -2086,7 +2086,7 @@ else echo '* Prog: (prog). Program.' echo 'END-INFO-DIR-ENTRY') >conftest.d/prog.info if $INSTALL_INFO --info-dir=conftest.d conftest.d/prog.info >&5 2>&1 - then + then if grep -s 'i-d-s works' conftest.d/dir >/dev/null then libc_cv_old_debian_install_info=no else libc_cv_old_debian_install_info=yes diff --git a/configure.in b/configure.in index c3a8e3a2b1..befa6d6da0 100644 --- a/configure.in +++ b/configure.in @@ -451,7 +451,7 @@ AC_CHECK_PROG_VER(MSGFMT, msgfmt gmsgfmt, --version, [0.[1-9][0-9].* | [1-9].*], MSGFMT=: aux_missing=t) AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version, [GNU texinfo.* \([0-9][0-9.]*\)], - [3.1[1-9] | 3.[2-9][0-9]], MAKEINFO=: aux_missing=t) + [1.6[89] | 1.7[0-9]], MAKEINFO=: aux_missing=t) if test -n "$critic_missing"; then AC_MSG_ERROR([ @@ -576,7 +576,7 @@ AC_CACHE_CHECK(for old Debian install-info, libc_cv_old_debian_install_info, echo '* Prog: (prog). Program.' echo 'END-INFO-DIR-ENTRY') >conftest.d/prog.info if $INSTALL_INFO --info-dir=conftest.d conftest.d/prog.info >&AC_FD_CC 2>&1 - then + then if grep -s 'i-d-s works' conftest.d/dir >/dev/null then libc_cv_old_debian_install_info=no else libc_cv_old_debian_install_info=yes diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c index 76084a8de5..4099bf2dd1 100644 --- a/stdio-common/printf_fphex.c +++ b/stdio-common/printf_fphex.c @@ -1,6 +1,6 @@ /* Print floating point number in hexadecimal notation according to ISO C 9X. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -244,16 +244,26 @@ __printf_fphex (FILE *fp, exponent = fpnum.dbl.ieee.exponent; - if (exponent == 0 ? !zero_mantissa : exponent < IEEE754_DOUBLE_BIAS) + if (exponent == 0) { - expnegative = 1; - exponent = -(exponent - IEEE754_DOUBLE_BIAS); + if (zero_mantissa) + expnegative = 0; + else + { + /* This is a denormalized number. */ + expnegative = 1; + exponent = -(1 - IEEE754_DOUBLE_BIAS); + } } - else + else if (exponent >= IEEE754_DOUBLE_BIAS) { expnegative = 0; - if (exponent != 0) - exponent -= IEEE754_DOUBLE_BIAS; + exponent -= IEEE754_DOUBLE_BIAS; + } + else + { + expnegative = 1; + exponent = -(exponent - IEEE754_DOUBLE_BIAS); } } else @@ -282,20 +292,30 @@ __printf_fphex (FILE *fp, /* We use a full nibble for the leading digit. */ leading = *numstr++; - /* We have 3 bits from the mantissa in the leading nibble. */ + /* We have 3 bits from the mantissa in the leading nibble. + Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ exponent = fpnum.ldbl.ieee.exponent; - if (exponent == 0 ? !zero_mantissa - : exponent < IEEE854_LONG_DOUBLE_BIAS + 3) + if (exponent == 0) { - expnegative = 1; - exponent = -(exponent - (IEEE854_LONG_DOUBLE_BIAS + 3)); + if (zero_mantissa) + expnegative = 0; + else + { + /* This is a denormalized number. */ + expnegative = 1; + exponent = -(1 - (IEEE854_LONG_DOUBLE_BIAS + 3)); + } } - else + else if (exponent >= IEEE854_LONG_DOUBLE_BIAS + 3) { expnegative = 0; - if (exponent != 0) - exponent -= IEEE854_LONG_DOUBLE_BIAS + 3; + exponent -= IEEE854_LONG_DOUBLE_BIAS + 2; + } + else + { + expnegative = 1; + exponent = -(exponent - (IEEE854_LONG_DOUBLE_BIAS + 3)); } } diff --git a/sysdeps/generic/bits/mathdef.h b/sysdeps/generic/bits/mathdef.h index 0d1c4d7374..3708781597 100644 --- a/sysdeps/generic/bits/mathdef.h +++ b/sysdeps/generic/bits/mathdef.h @@ -16,7 +16,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -if !defined _MATH_H && !defined _COMPLEX_H +#if !defined _MATH_H && !defined _COMPLEX_H # error "Never use directly; include instead" #endif diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h index ce6fcd02ab..6542b1d3b2 100644 --- a/sysdeps/powerpc/dl-machine.h +++ b/sysdeps/powerpc/dl-machine.h @@ -91,8 +91,7 @@ elf_machine_load_address (void) /* So now work out the difference between where the branch actually points, and the offset of that location in memory from the start of the file. */ return ((Elf32_Addr)branchaddr - *got - + (*branchaddr & 0x3fffffc - | (int)(*branchaddr << 6 & 0x80000000) >> 6)); + + ((int)(*branchaddr << 6 & 0xffffff00) >> 6)); } #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) /* nothing */ @@ -111,7 +110,7 @@ elf_machine_load_address (void) _dl_runtime_resolve: # We need to save the registers used to pass parameters, and register 0, # which is used by _mcount; the registers are saved in a stack frame. - stwu 1,-48(1) + stwu 1,-64(1) stw 0,12(1) stw 3,16(1) stw 4,20(1) @@ -123,7 +122,7 @@ _dl_runtime_resolve: mflr 0 # We also need to save some of the condition register fields. stw 7,32(1) - stw 0,52(1) + stw 0,48(1) stw 8,36(1) mfcr 0 stw 9,40(1) @@ -133,7 +132,7 @@ _dl_runtime_resolve: # 'fixup' returns the address we want to branch to. mtctr 3 # Put the registers back... - lwz 0,52(1) + lwz 0,48(1) lwz 10,44(1) lwz 9,40(1) mtlr 0 @@ -147,7 +146,7 @@ _dl_runtime_resolve: lwz 3,16(1) lwz 0,12(1) # ...unwind the stack frame, and jump to the PLT entry we updated. - addi 1,1,48 + addi 1,1,64 bctr .size _dl_runtime_resolve,.-_dl_runtime_resolve @@ -157,7 +156,7 @@ _dl_runtime_resolve: _dl_prof_resolve: # We need to save the registers used to pass parameters, and register 0, # which is used by _mcount; the registers are saved in a stack frame. - stwu 1,-48(1) + stwu 1,-64(1) stw 0,12(1) stw 3,16(1) stw 4,20(1) @@ -169,7 +168,7 @@ _dl_prof_resolve: mflr 5 # We also need to save some of the condition register fields. stw 7,32(1) - stw 5,52(1) + stw 5,48(1) stw 8,36(1) mfcr 0 stw 9,40(1) @@ -179,7 +178,7 @@ _dl_prof_resolve: # 'fixup' returns the address we want to branch to. mtctr 3 # Put the registers back... - lwz 0,52(1) + lwz 0,48(1) lwz 10,44(1) lwz 9,40(1) mtlr 0 @@ -193,7 +192,7 @@ _dl_prof_resolve: lwz 3,16(1) lwz 0,12(1) # ...unwind the stack frame, and jump to the PLT entry we updated. - addi 1,1,48 + addi 1,1,64 bctr .size _dl_prof_resolve,.-_dl_prof_resolve # Undo '.section text'. diff --git a/sysdeps/powerpc/register-dump.h b/sysdeps/powerpc/register-dump.h index 2e15c0bd71..f1d3985e32 100644 --- a/sysdeps/powerpc/register-dump.h +++ b/sysdeps/powerpc/register-dump.h @@ -21,16 +21,26 @@ #include /* This prints out the information in the following form: */ -static const char dumpform[] = -"Register dump:\n\ -r0 =0000000% sp =0000000% r2 =0000000% r3 =0000000% r4 =0000000% r5 =0000000% -r6 =0000000% r7 =0000000% r8 =0000000% r9 =0000000% r10=0000000% r11=0000000% -r12=0000000% r13=0000000% r14=0000000% r15=0000000% r16=0000000% r17=0000000% -r18=0000000% r19=0000000% r20=0000000% r21=0000000% r22=0000000% r23=0000000% -r24=0000000% r25=0000000% r26=0000000% r27=0000000% r28=0000000% r29=0000000% -r30=0000000% r31=0000000% sr0=0000000% msr=0000000% r3*=0000000% ctr=0000000% -lr =0000000% xer=0000000% ccr=0000000% sr1=0000000% trap=0000000% -address of fault=0000000% dsisr=0000000%\n"; +static const char dumpform[] = "\ +Register dump: +fp0-3: 0000030%0000031% 0000032%0000033% 0000034%0000035% 0000036%0000037% +fp4-7: 0000038%0000039% 000003a%000003b% 000003c%000003d% 000003e%000003f% +fp8-11: 0000040%0000041% 0000042%0000043% 0000044%0000045% 0000046%0000047% +fp12-15: 0000048%0000049% 000004a%000004b% 000004c%000004d% 000004e%000004f% +fp16-19: 0000050%0000051% 0000052%0000053% 0000054%0000055% 0000056%0000057% +fp20-23: 0000058%0000059% 000005a%000005b% 000005c%000005d% 000005e%000005f% +fp24-27: 0000060%0000061% 0000062%0000063% 0000064%0000065% 0000066%0000067% +fp28-31: 0000068%0000069% 000006a%000006b% 000006c%000006d% 000006e%000006f% +r0 =0000000% sp =0000001% r2 =0000002% r3 =0000003% trap=0000028% +r4 =0000004% r5 =0000005% r6 =0000006% r7 =0000007% sr0=0000020% sr1=0000021% +r8 =0000008% r9 =0000009% r10=000000a% r11=000000b% dar=0000029% dsi=000002a% +r12=000000c% r13=000000d% r14=000000e% r15=000000f% r3*=0000022% +r16=0000010% r17=0000011% r18=0000012% r19=0000013% +r20=0000014% r21=0000015% r22=0000016% r23=0000017% lr=0000024% xer=0000025% +r24=0000018% r25=0000019% r26=000001a% r27=000001b% mq=0000027% ctr=0000023% +r28=000001c% r29=000001d% r30=000001e% r31=000001f% fscr=0000071% ccr=0000026% +"; + /* Most of the fields are self-explanatory. 'sr0' is the next instruction to execute, from SRR0, which may have some relationship with the instruction that caused the exception. 'r3*' is the value @@ -66,8 +76,8 @@ address of fault=0000000% dsisr=0000000%\n"; 00C00 - System call exception (for instance, kill(3)). 00E00 - FP assist exception (optional FP instructions, etc.) - 'address of fault' is the memory location that wasn't mapped - (from the DAR). 'dsisr' has the following bits under trap 00300: + 'dar' is the memory location, for traps 00300, 00400, 00600, 00A00. + 'dsisr' has the following bits under trap 00300: 0 - direct-store error exception 1 - no page table entry for page 4 - memory access not permitted @@ -82,23 +92,24 @@ address of fault=0000000% dsisr=0000000%\n"; the instruction without actually having to read it from memory. */ +#define xtoi(x) (x >= 'a' ? x + 10 - 'a' : x - '0') + static void -register_dump (int fd, void **ctx) +register_dump (int fd, struct sigcontext *ctx) { char buffer[sizeof(dumpform)]; - char *bufferpos = buffer; - int i = 0; + char *bufferpos; + unsigned regno; + unsigned *regs = (unsigned *)(ctx->regs); memcpy(buffer, dumpform, sizeof(dumpform)); - ctx += 8; /* FIXME!!!! Why is this necessary? Is it necessary? */ - /* Generate the output. */ - while ((bufferpos = memchr (bufferpos, '%', sizeof(dumpform)))) + while ((bufferpos = memchr (buffer, '%', sizeof(dumpform)))) { - *bufferpos++ = '0'; - _itoa_word ((unsigned long int)(ctx[i]), bufferpos, 16, 0); - i++; + regno = xtoi (bufferpos[-1]) | xtoi (bufferpos[-2]) << 4; + memset (bufferpos-2, '0', 3); + _itoa_word (regs[regno], bufferpos+1, 16, 0); } /* Write the output. */ diff --git a/sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h b/sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h index 2a7a2fe5c8..33a3c817d7 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h @@ -16,9 +16,9 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include -#define SIGCONTEXT void ** -#define GET_PC(ctx) ((ctx)[PT_NIP]) -#define GET_FRAME(ctx) (*(void **)(ctx)[PT_R1]) -#define GET_STACK(ctx) ((ctx)[PT_R1]) +#define SIGCONTEXT struct sigcontext * +#define GET_PC(ctx) ((void *)((ctx)->regs->nip)) +#define GET_FRAME(ctx) (*(void **)((ctx)->regs->gpr[1])) +#define GET_STACK(ctx) ((void *)((ctx)->regs->gpr[1])) -- cgit v1.2.3