aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/hppa
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-15 06:50:42 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-15 06:50:42 +0000
commitb15cb495054a40644197395fb6a94daa4b0e81cb (patch)
tree085712cd0a7f5e68dc291c49c6adfb9c3675dcee /sysdeps/hppa
parent42be70d43174c6a6e80fbd25276d4eb04c6e5adf (diff)
downloadglibc-b15cb495054a40644197395fb6a94daa4b0e81cb.tar
glibc-b15cb495054a40644197395fb6a94daa4b0e81cb.tar.gz
glibc-b15cb495054a40644197395fb6a94daa4b0e81cb.tar.bz2
glibc-b15cb495054a40644197395fb6a94daa4b0e81cb.zip
Update.
2000-10-14 Ulrich Drepper <drepper@redhat.com> * math/libm-test.inc (frexp_test): Add L suffix also to parameters. (hypot_test): Likewise. * sysdeps/generic/printf_fphex.c: Compute width of decimal point string correctly. Handle padding correctly. * sysdeps/ia64/fpu/printf_fphex.c: Use sizeof in _itowa parameters correctly. * sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise. * sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise. 2000-10-12 Alan Modra <alan@linuxcare.com.au> * FAQ.in: Add --start-group and --end-group. 2000-10-12 Alan Modra <alan@linuxcare.com.au> * malloc/memusage.c: Conditionalize stack usage calculation on stack direction. 2000-10-12 Alan Modra <alan@linuxcare.com.au> * config.h.in: Add ASM_LINE_SEP. * configure.in: Add test for comment and line separators. * include/libc-symbols.h: Define and use ASM_LINE_SEP, and add tabs to placate some hppa assemblers. * sysdeps/hppa/sysdep.h: Likewise. * sysdeps/gnu/siglist.c: Insert \n and \t into inline asm. * sysdeps/unix/sysv/linux/errlist.c: Likewise. 2000-10-12 David Huggins-Daines <dhd@linuxcare.com> * sysdeps/unix/sysv/linux/Makefile: Include <bits/initspin> in $(sysdep_headers). * sysdeps/unix/sysv/linux/bits/initspin.h: Dummy version for non-threaded platforms. 2000-10-12 David Huggins-Daines <dhd@linuxcare.com> * configure.in: Add definitions for hppa. * elf/elf.h: Add PLABEL32 relocation for hppa ELF32, comments for IPLT and EPLT relocations. * shlib-versions: Version symbol definitions for hppa-linux. * sysdeps/unix/sysv/linux/configure.in: Define $arch_minimum_kernel for hppa. 2000-10-12 David Huggins-Daines <dhd@linuxcare.com> * sysdeps/hppa/Makefile: New file. * sysdeps/hppa/Versions: New file. * sysdeps/hppa/setjmp.S: New file. * sysdeps/hppa/__longjmp.S: New file. * sysdeps/hppa/bits/setjmp.h: New file. * sysdeps/hppa/frame.h: New file. * sysdeps/hppa/add_n.s: Don't use %r19 (linkage table pointer). * sysdeps/hppa/sub_n.s: Likewise. * sysdeps/hppa/lshift.s: Likewise. * sysdeps/hppa/rshift.s: Likewise. * sysdeps/hppa/udiv_qrnnd.s: Likewise. * sysdeps/hppa/hppa1.1/addmul_1.s: Likewise. * sysdeps/hppa/hppa1.1/submul_1.s: Likewise. * sysdeps/hppa/hppa1.1/mul_1.s: Likewise. * sysdeps/hppa/hppa1.1/udiv_qrnnd.s: Likewise. * sysdeps/hppa/dl-machine.h: New file. * sysdeps/hppa/dl-fptr.c: New file (note that this is almost identical to the IA-64 one). * sysdeps/hppa/dl-lookupcfg.h: Likewise. * sysdeps/hppa/dl-symaddr.c: Likewise. * sysdeps/hppa/elf/initfini.c: New file. * sysdeps/hppa/elf/start.S: New file. * sysdeps/hppa/fpu/bits/fenv.h: New file. * sysdeps/hppa/fpu/fclrexcpt.c: New file. * sysdeps/hppa/fpu/fedisblxcpt.c: New file. * sysdeps/hppa/fpu/feenablxcpt.c: New file. * sysdeps/hppa/fpu/fegetenv.c: New file. * sysdeps/hppa/fpu/fegetexcept.c: New file. * sysdeps/hppa/fpu/fegetround.c: New file. * sysdeps/hppa/fpu/feholdexcpt.c: New file. * sysdeps/hppa/fpu/fesetenv.c: New file. * sysdeps/hppa/fpu/fesetround.c: New file. * sysdeps/hppa/fpu/feupdateenv.c: New file. * sysdeps/hppa/fpu/fegetexcptflg.c: New file. * sysdeps/hppa/fpu/fraiseexcpt.c: New file. * sysdeps/hppa/fpu/fsetexcptflg.c: New file. * sysdeps/hppa/fpu/ftestexcept.c: New file. * sysdeps/unix/sysv/linux/hppa/Makefile: New file. * sysdeps/unix/sysv/linux/hppa/Versions: New file. * sysdeps/unix/sysv/linux/hppa/syscalls.list: New file. * sysdeps/unix/sysv/linux/hppa/sysdep.c: New file. * sysdeps/unix/sysv/linux/hppa/sysdep.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/fcntl.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/ioctls.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/mman.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/sigaction.h: New file. * sysdeps/unix/sysv/linux/hppa/bits/signum.h: New file. * sysdeps/unix/sysv/linux/hppa/brk.c: New file. * sysdeps/unix/sysv/linux/hppa/clone.S: New file. * sysdeps/unix/sysv/linux/hppa/socket.S: New file. * sysdeps/unix/sysv/linux/hppa/syscall.S: New file. * sysdeps/unix/sysv/linux/hppa/setrlimit.c: New file. * sysdeps/unix/sysv/linux/hppa/getrlimit.c: New file. * sysdeps/unix/sysv/linux/hppa/getrlimit64.c: New file. * sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h: New file. * sysdeps/unix/sysv/linux/hppa/kernel_stat.h: New file. * sysdeps/unix/sysv/linux/hppa/mmap.c: New file. * sysdeps/unix/sysv/linux/hppa/profil-counter.h: New file. * sysdeps/unix/sysv/linux/hppa/procfs.h: New file. * sysdeps/unix/sysv/linux/hppa/ucontext.h: New file. * sysdeps/unix/sysv/linux/hppa/umount.c: New file. 2000-10-12 Alan Modra <alan@linuxcare.com.au> * sysdeps/hppa/hppa1.1/Implies: New file. * sysdeps/hppa/memusage.h: New file.
Diffstat (limited to 'sysdeps/hppa')
-rw-r--r--sysdeps/hppa/Makefile26
-rw-r--r--sysdeps/hppa/Versions6
-rw-r--r--sysdeps/hppa/__longjmp.S72
-rw-r--r--sysdeps/hppa/add_n.s68
-rw-r--r--sysdeps/hppa/bits/setjmp.h41
-rw-r--r--sysdeps/hppa/dl-fptr.c212
-rw-r--r--sysdeps/hppa/dl-lookupcfg.h36
-rw-r--r--sysdeps/hppa/dl-machine.h605
-rw-r--r--sysdeps/hppa/dl-symaddr.c39
-rw-r--r--sysdeps/hppa/elf/initfini.c117
-rw-r--r--sysdeps/hppa/elf/start.S58
-rw-r--r--sysdeps/hppa/fpu/bits/fenv.h78
-rw-r--r--sysdeps/hppa/fpu/fclrexcpt.c37
-rw-r--r--sysdeps/hppa/fpu/fedisblxcpt.c37
-rw-r--r--sysdeps/hppa/fpu/feenablxcpt.c37
-rw-r--r--sysdeps/hppa/fpu/fegetenv.c33
-rw-r--r--sysdeps/hppa/fpu/fegetexcept.c32
-rw-r--r--sysdeps/hppa/fpu/fegetround.c32
-rw-r--r--sysdeps/hppa/fpu/feholdexcpt.c60
-rw-r--r--sysdeps/hppa/fpu/fesetenv.c70
-rw-r--r--sysdeps/hppa/fpu/fesetround.c39
-rw-r--r--sysdeps/hppa/fpu/feupdateenv.c40
-rw-r--r--sysdeps/hppa/fpu/fgetexcptflg.c36
-rw-r--r--sysdeps/hppa/fpu/fraiseexcpt.c89
-rw-r--r--sysdeps/hppa/fpu/fsetexcptflg.c41
-rw-r--r--sysdeps/hppa/fpu/ftestexcept.c32
-rw-r--r--sysdeps/hppa/frame.h28
-rw-r--r--sysdeps/hppa/hppa1.1/Implies4
-rw-r--r--sysdeps/hppa/hppa1.1/addmul_1.s100
-rw-r--r--sysdeps/hppa/hppa1.1/mul_1.s100
-rw-r--r--sysdeps/hppa/hppa1.1/submul_1.s102
-rw-r--r--sysdeps/hppa/hppa1.1/udiv_qrnnd.s69
-rw-r--r--sysdeps/hppa/lshift.s54
-rw-r--r--sysdeps/hppa/memusage.h22
-rw-r--r--sysdeps/hppa/rshift.s54
-rw-r--r--sysdeps/hppa/setjmp.S69
-rw-r--r--sysdeps/hppa/sub_n.s68
-rw-r--r--sysdeps/hppa/sysdep.h18
-rw-r--r--sysdeps/hppa/udiv_qrnnd.s82
39 files changed, 2392 insertions, 351 deletions
diff --git a/sysdeps/hppa/Makefile b/sysdeps/hppa/Makefile
new file mode 100644
index 0000000000..f6ad84358a
--- /dev/null
+++ b/sysdeps/hppa/Makefile
@@ -0,0 +1,26 @@
+# Copyright (C) 2000 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+# Contributed by David Huggins-Daines (dhd@debian.org)
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public License
+# as published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# We need this for all shared objects since the build process uses ld -r
+CFLAGS-.os += -ffunction-sections
+
+ifeq ($(subdir),elf)
+dl-routines += dl-symaddr dl-fptr
+rtld-routines += dl-symaddr dl-fptr
+endif
diff --git a/sysdeps/hppa/Versions b/sysdeps/hppa/Versions
new file mode 100644
index 0000000000..0c447d9f28
--- /dev/null
+++ b/sysdeps/hppa/Versions
@@ -0,0 +1,6 @@
+ld {
+ GLIBC_2.2 {
+ # hppa specific functions in the dynamic linker, but used by libc.so.
+ _dl_symbol_address; _dl_unmap; _dl_lookup_address;
+ }
+}
diff --git a/sysdeps/hppa/__longjmp.S b/sysdeps/hppa/__longjmp.S
new file mode 100644
index 0000000000..418a0b48ce
--- /dev/null
+++ b/sysdeps/hppa/__longjmp.S
@@ -0,0 +1,72 @@
+/* longjmp for PA-RISC.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sysdep.h>
+#define _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+
+/* __longjmp(jmpbuf, val) */
+
+ .text
+ .align 4
+ .globl __longjmp
+ .export __longjmp, code
+ .proc
+ .callinfo
+__longjmp:
+ /* set return value */
+ copy %r25, %r28
+
+ ldw 0(%r26), %r3
+ ldw 8(%r26), %r4
+ ldw 12(%r26), %r5
+ ldw 16(%r26), %r6
+ ldw 20(%r26), %r7
+ ldw 24(%r26), %r8
+ ldw 28(%r26), %r9
+ ldw 32(%r26), %r10
+ ldw 36(%r26), %r11
+ ldw 40(%r26), %r12
+ ldw 44(%r26), %r13
+ ldw 48(%r26), %r14
+ ldw 52(%r26), %r15
+ ldw 56(%r26), %r16
+ ldw 60(%r26), %r17
+ ldw 64(%r26), %r18
+ ldw 68(%r26), %r19
+ ldw 72(%r26), %r27
+ ldw 76(%r26), %r30
+
+ ldw 80(%r26), %rp
+
+ ldo 88(%r26),%r20
+ fldds,ma 8(%r20), %fr12
+ fldds,ma 8(%r20), %fr13
+ fldds,ma 8(%r20), %fr14
+ fldds,ma 8(%r20), %fr15
+ fldds,ma 8(%r20), %fr16
+ fldds,ma 8(%r20), %fr17
+ fldds,ma 8(%r20), %fr18
+ fldds,ma 8(%r20), %fr19
+ fldds,ma 8(%r20), %fr20
+ fldds 0(%r20), %fr21
+
+ bv,n %r0(%r2)
+ .procend
diff --git a/sysdeps/hppa/add_n.s b/sysdeps/hppa/add_n.s
index b4a1428362..87b7cd7131 100644
--- a/sysdeps/hppa/add_n.s
+++ b/sysdeps/hppa/add_n.s
@@ -1,56 +1,56 @@
-; HP-PA __mpn_add_n -- Add two limb vectors of the same length > 0 and store
-; sum in a third limb vector.
+;! HP-PA __mpn_add_n -- Add two limb vectors of the same length > 0 and store
+;! sum in a third limb vector.
-; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
+;! Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-; This file is part of the GNU MP Library.
+;! This file is part of the GNU MP Library.
-; The GNU MP Library is free software; you can redistribute it and/or modify
-; it under the terms of the GNU Library General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or (at your
-; option) any later version.
+;! The GNU MP Library is free software; you can redistribute it and/or modify
+;! it under the terms of the GNU Library General Public License as published by
+;! the Free Software Foundation; either version 2 of the License, or (at your
+;! option) any later version.
-; The GNU MP Library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-; License for more details.
+;! The GNU MP Library is distributed in the hope that it will be useful, but
+;! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+;! License for more details.
-; You should have received a copy of the GNU Library General Public License
-; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
-; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-; MA 02111-1307, USA.
+;! You should have received a copy of the GNU Library General Public License
+;! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;! MA 02111-1307, USA.
-; INPUT PARAMETERS
-; res_ptr gr26
-; s1_ptr gr25
-; s2_ptr gr24
-; size gr23
+;! INPUT PARAMETERS
+;! res_ptr gr26
+;! s1_ptr gr25
+;! s2_ptr gr24
+;! size gr23
-; One might want to unroll this as for other processors, but it turns
-; out that the data cache contention after a store makes such
-; unrolling useless. We can't come under 5 cycles/limb anyway.
+;! One might want to unroll this as for other processors, but it turns
+;! out that the data cache contention after a store makes such
+;! unrolling useless. We can't come under 5 cycles/limb anyway.
- .code
+ .text
.export __mpn_add_n
-__mpn_add_n
+__mpn_add_n:
.proc
.callinfo frame=0,no_calls
.entry
- ldws,ma 4(0,%r25),%r20
- ldws,ma 4(0,%r24),%r19
+ ldws,ma 4(0,%r25),%r21
+ ldws,ma 4(0,%r24),%r20
- addib,= -1,%r23,L$end ; check for (SIZE == 1)
- add %r20,%r19,%r28 ; add first limbs ignoring cy
+ addib,= -1,%r23,L$end ;! check for (SIZE == 1)
+ add %r21,%r20,%r28 ;! add first limbs ignoring cy
-L$loop ldws,ma 4(0,%r25),%r20
- ldws,ma 4(0,%r24),%r19
+L$loop: ldws,ma 4(0,%r25),%r21
+ ldws,ma 4(0,%r24),%r20
stws,ma %r28,4(0,%r26)
addib,<> -1,%r23,L$loop
- addc %r20,%r19,%r28
+ addc %r21,%r20,%r28
-L$end stws %r28,0(0,%r26)
+L$end: stws %r28,0(0,%r26)
bv 0(%r2)
addc %r0,%r0,%r28
diff --git a/sysdeps/hppa/bits/setjmp.h b/sysdeps/hppa/bits/setjmp.h
new file mode 100644
index 0000000000..f72cdb5d86
--- /dev/null
+++ b/sysdeps/hppa/bits/setjmp.h
@@ -0,0 +1,41 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* Define the machine-dependent type `jmp_buf'. HPPA version. */
+
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+/* The previous bits/setjmp.h had __jmp_buf defined as a structure.
+ We use an array of 'double' instead, to make writing the assembler
+ easier, and to ensure proper alignment. Naturally, user code should
+ not depend on either representation. */
+
+#if defined __USE_MISC || defined _ASM
+#define JB_SP (76/4)
+#endif
+
+#ifndef _ASM
+typedef double __jmp_buf[21];
+#endif
+
+/* Test if longjmp to JMPBUF would unwind the frame containing a local
+ variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(_jmpbuf, _address) \
+ ((void *)(_address) > (void *)(((unsigned long *) _jmpbuf)[JB_SP]))
diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c
new file mode 100644
index 0000000000..8a2c1c214d
--- /dev/null
+++ b/sysdeps/hppa/dl-fptr.c
@@ -0,0 +1,212 @@
+/* Make dynamic PLABELs for function pointers. HPPA version.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <unistd.h>
+#include <string.h>
+#include <sys/param.h>
+#include <sys/mman.h>
+#include <link.h>
+#include <errno.h>
+#include <ldsodefs.h>
+#include <elf/dynamic-link.h>
+#include <dl-machine.h>
+#ifdef _LIBC_REENTRANT
+# include <pt-machine.h>
+
+/* Remember, we use 0 to mean that a lock is taken on PA-RISC. */
+static int __hppa_fptr_lock = 1;
+#endif
+
+/* Because ld.so is now versioned, these functions can be in their own
+ file; no relocations need to be done to call them. Of course, if
+ ld.so is not versioned... */
+#if 0
+#ifndef DO_VERSIONING
+# error "This will not work with versioning turned off, sorry."
+#endif
+#endif
+
+#ifdef MAP_ANON
+/* The fd is not examined when using MAP_ANON. */
+#define ANONFD -1
+#else
+extern int _dl_zerofd;
+#define ANONFD _dl_zerofd
+#endif
+
+struct hppa_fptr __boot_ldso_fptr[HPPA_BOOT_FPTR_SIZE];
+struct hppa_fptr *__fptr_root = NULL;
+struct hppa_fptr *__fptr_next = __boot_ldso_fptr;
+static struct hppa_fptr *__fptr_free = NULL;
+int __fptr_count = HPPA_BOOT_FPTR_SIZE;
+
+Elf32_Addr
+__hppa_make_fptr (const struct link_map *sym_map, Elf32_Addr value,
+ struct hppa_fptr **root, struct hppa_fptr *mem)
+{
+ struct hppa_fptr **loc;
+ struct hppa_fptr *f;
+
+#ifdef _LIBC_REENTRANT
+ /* Make sure we are alone. We don't need a lock during bootstrap. */
+ if (mem == NULL)
+ while (testandset (&__hppa_fptr_lock));
+#endif
+
+ /* Search the sorted linked list for an existing entry for this
+ symbol. */
+ loc = root;
+ f = *loc;
+ while (f != NULL && f->func <= value)
+ {
+ if (f->func == value)
+ goto found;
+ loc = &f->next;
+ f = *loc;
+ }
+
+ /* Not found. Create a new one. */
+ if (mem != NULL)
+ f = mem;
+ else if (__fptr_free != NULL)
+ {
+ f = __fptr_free;
+ __fptr_free = f->next;
+ }
+ else
+ {
+ if (__fptr_count == 0)
+ {
+#ifndef MAP_ANON
+# define MAP_ANON 0
+ if (_dl_zerofd == -1)
+ {
+ _dl_zerofd = _dl_sysdep_open_zero_fill ();
+ if (_dl_zerofd == -1)
+ {
+ __close (fd);
+ _dl_signal_error (errno, NULL,
+ "cannot open zero fill device");
+ }
+ }
+#endif
+
+ __fptr_next = __mmap (0, _dl_pagesize, PROT_READ | PROT_WRITE,
+ MAP_ANON | MAP_PRIVATE, ANONFD, 0);
+ if (__fptr_next == MAP_FAILED)
+ _dl_signal_error(errno, NULL, "cannot map page for fptr");
+ __fptr_count = _dl_pagesize / sizeof (struct hppa_fptr);
+ }
+ f = __fptr_next++;
+ __fptr_count--;
+ }
+
+ f->func = value;
+ /* GOT has already been relocated in elf_get_dynamic_info - don't
+ try to relocate it again. */
+ f->gp = sym_map->l_info[DT_PLTGOT]->d_un.d_ptr;
+ f->next = *loc;
+ *loc = f;
+
+found:
+#ifdef _LIBC_REENTRANT
+ /* Release the lock. Again, remember, zero means the lock is taken! */
+ if (mem == NULL)
+ __hppa_fptr_lock = 1;
+#endif
+
+ /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */
+ return (Elf32_Addr) f | 2;
+}
+
+void
+_dl_unmap (struct link_map *map)
+{
+ struct hppa_fptr **floc;
+ struct hppa_fptr *f;
+ struct hppa_fptr **lloc;
+ struct hppa_fptr *l;
+
+ __munmap ((void *) map->l_map_start, map->l_map_end - map->l_map_start);
+
+#ifdef _LIBC_REENTRANT
+ /* Make sure we are alone. */
+ while (testandset (&__hppa_fptr_lock));
+#endif
+
+ /* Search the sorted linked list for the first entry for this object. */
+ floc = &__fptr_root;
+ f = *floc;
+ while (f != NULL && f->func < map->l_map_start)
+ {
+ floc = &f->next;
+ f = *floc;
+ }
+
+ /* We found one. */
+ if (f != NULL && f->func < map->l_map_end)
+ {
+ /* Get the last entry. */
+ lloc = floc;
+ l = f;
+ while (l && l->func < map->l_map_end)
+ {
+ lloc = &l->next;
+ l = *lloc;
+ }
+
+ /* Updated FPTR. */
+ *floc = l;
+
+ /* Prepend them to the free list. */
+ *lloc = __fptr_free;
+ __fptr_free = f;
+ }
+
+#ifdef _LIBC_REENTRANT
+ /* Release the lock. */
+ __hppa_fptr_lock = 1;
+#endif
+}
+
+Elf32_Addr
+_dl_lookup_address (const void *address)
+{
+ Elf32_Addr addr = (Elf32_Addr) address;
+ struct hppa_fptr *f;
+
+#ifdef _LIBC_REENTRANT
+ /* Make sure we are alone. */
+ while (testandset (&__hppa_fptr_lock));
+#endif
+
+ for (f = __fptr_root; f != NULL; f = f->next)
+ if (f == address)
+ {
+ addr = f->func;
+ break;
+ }
+
+#ifdef _LIBC_REENTRANT
+ /* Release the lock. */
+ __hppa_fptr_lock = 1;
+#endif
+
+ return addr;
+}
diff --git a/sysdeps/hppa/dl-lookupcfg.h b/sysdeps/hppa/dl-lookupcfg.h
new file mode 100644
index 0000000000..4f5f8998a7
--- /dev/null
+++ b/sysdeps/hppa/dl-lookupcfg.h
@@ -0,0 +1,36 @@
+/* Configuration of lookup functions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* Like IA-64, PA-RISC needs more information from the symbol lookup
+ function than just the address. */
+#define DL_LOOKUP_RETURNS_MAP
+#define ELF_FUNCTION_PTR_IS_SPECIAL
+#define DL_UNMAP_IS_SPECIAL
+
+void *_dl_symbol_address (const struct link_map *map, const ElfW(Sym) *ref);
+
+#define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref)
+
+Elf32_Addr _dl_lookup_address (const void *address);
+
+#define DL_LOOKUP_ADDRESS(addr) _dl_lookup_address (addr)
+
+void _dl_unmap (struct link_map *map);
+
+#define DL_UNMAP(map) _dl_unmap (map)
diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h
new file mode 100644
index 0000000000..e6782b3481
--- /dev/null
+++ b/sysdeps/hppa/dl-machine.h
@@ -0,0 +1,605 @@
+/* Machine-dependent ELF dynamic relocation inline functions. PA-RISC version.
+ Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ Contributed by David Huggins-Daines <dhd@debian.org>
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef dl_machine_h
+#define dl_machine_h 1
+
+#define ELF_MACHINE_NAME "hppa"
+
+#include <sys/param.h>
+#include <string.h>
+#include <link.h>
+#include <assert.h>
+
+/* These must match the definition of the stub in bfd/elf32-hppa.c. */
+#define SIZEOF_PLT_STUB (4*4)
+#define GOT_FROM_PLT_STUB (4*4)
+
+/* A PLABEL is a function descriptor. Properly they consist of just
+ FUNC and GP. But we want to traverse a binary tree too. See
+ dl-fptr.c for the code (it may be made common between HPPA and
+ IA-64 in the future).
+
+ We call these 'fptr' to make it easier to steal code from IA-64. */
+
+/* ld.so currently has 12 PLABEL32 relocs. We'll keep this constant
+ large for now in case we require more, as the rest of these will be
+ used by the dynamic program itself (libc.so has quite a few
+ PLABEL32 relocs in it). */
+#define HPPA_BOOT_FPTR_SIZE 256
+
+struct hppa_fptr
+{
+ Elf32_Addr func;
+ Elf32_Addr gp;
+ struct hppa_fptr *next;
+};
+
+extern struct hppa_fptr __boot_ldso_fptr[];
+extern struct hppa_fptr *__fptr_root;
+extern int __fptr_count;
+
+extern Elf32_Addr __hppa_make_fptr (const struct link_map *, Elf32_Addr,
+ struct hppa_fptr **, struct hppa_fptr *);
+
+/* Return nonzero iff E_MACHINE is compatible with the running host. */
+static inline int
+elf_machine_matches_host (Elf32_Half e_machine)
+{
+ return e_machine == EM_PARISC;
+}
+
+
+/* Return the link-time address of _DYNAMIC. */
+static inline Elf32_Addr
+elf_machine_dynamic (void)
+{
+ Elf32_Addr dynamic;
+
+#if 0
+ /* Use this method if GOT address not yet set up. */
+ asm ("\
+ b,l 1f,%0
+ depi 0,31,2,%0
+1: addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 8),%0
+ ldw R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 12)(%%r1),%0"
+ : "=r" (dynamic) : : "r1");
+#else
+ /* This works because we already have our GOT address available. */
+ dynamic = (Elf32_Addr) &_DYNAMIC;
+#endif
+
+ return dynamic;
+}
+
+/* Return the run-time load address of the shared object. */
+static inline Elf32_Addr
+elf_machine_load_address (void)
+{
+ Elf32_Addr dynamic, dynamic_linkaddress;
+
+ asm ("\
+ b,l 1f,%0
+ depi 0,31,2,%0
+1: addil L'_DYNAMIC - ($PIC_pcrel$0 - 8),%0
+ ldo R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%%r1),%1
+ addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 16),%0
+ ldw R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 20)(%%r1),%0"
+ : "=r" (dynamic_linkaddress), "=r" (dynamic) : : "r1");
+
+ return dynamic - dynamic_linkaddress;
+}
+
+/* Fixup a PLT entry to bounce directly to the function at VALUE. */
+static inline Elf32_Addr
+elf_machine_fixup_plt (struct link_map *map, lookup_t t,
+ const Elf32_Rela *reloc,
+ Elf32_Addr *reloc_addr, Elf32_Addr value)
+{
+ /* l is the link_map for the caller, t is the link_map for the object
+ * being called */
+ reloc_addr[1] = D_PTR (t, l_info[DT_PLTGOT]);
+ reloc_addr[0] = value;
+ /* Return the PLT slot rather than the function value so that the
+ trampoline can load the new LTP. */
+ return (Elf32_Addr) reloc_addr;
+}
+
+/* Return the final value of a plt relocation. */
+static inline Elf32_Addr
+elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
+ Elf32_Addr value)
+{
+ /* We are rela only */
+ return value + reloc->r_addend;
+}
+
+/* Set up the loaded object described by L so its unrelocated PLT
+ entries will jump to the on-demand fixup code in dl-runtime.c. */
+
+static inline int
+elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
+{
+ extern void _dl_runtime_resolve (void);
+ extern void _dl_runtime_profile (void);
+ Elf32_Addr jmprel = D_PTR(l, l_info[DT_JMPREL]);
+
+ if (lazy && jmprel)
+ {
+ Elf32_Addr *got = NULL;
+ Elf32_Addr l_addr;
+ Elf32_Addr end_jmprel;
+ Elf32_Addr iplt;
+
+ /* Relocate all the PLT slots. */
+ l_addr = l->l_addr;
+ end_jmprel = jmprel + l->l_info[DT_PLTRELSZ]->d_un.d_val;
+ for (iplt = jmprel; iplt < end_jmprel; iplt += sizeof (Elf32_Rela))
+ {
+ const Elf32_Rela *reloc;
+ Elf32_Word r_type;
+ Elf32_Word r_sym;
+ struct hppa_fptr *fptr;
+
+ reloc = (const Elf32_Rela *) iplt;
+ r_type = ELF32_R_TYPE (reloc->r_info);
+ r_sym = ELF32_R_SYM (reloc->r_info);
+
+ if (__builtin_expect (r_type == R_PARISC_IPLT, 1))
+ {
+ fptr = (struct hppa_fptr *) (reloc->r_offset + l_addr);
+ if (r_sym != 0)
+ {
+ /* Relocate the pointer to the stub. */
+ fptr->func += l_addr;
+ /* Instead of the LTP value, we put the reloc offset
+ here. The trampoline code will load the proper
+ LTP and pass the reloc offset to the fixup
+ function. */
+ fptr->gp = iplt - jmprel;
+ if (!got)
+ {
+ static union {
+ unsigned char c[8];
+ Elf32_Addr i[2];
+ } sig = {{0x00,0xc0,0xff,0xee, 0xde,0xad,0xbe,0xef}};
+
+ /* Find our .got section. It's right after the
+ stub. */
+ got = (Elf32_Addr *) (fptr->func + GOT_FROM_PLT_STUB);
+
+ /* Sanity check to see if the address we are
+ going to check below is within a reasonable
+ approximation of the bounds of the PLT (or,
+ at least, is at an address that won't fault
+ on read). Then check for the magic signature
+ above. */
+ if (fptr->func < (Elf32_Addr) fptr + sizeof(*fptr))
+ return 0;
+ if (fptr->func >
+ ((Elf32_Addr) fptr
+ + SIZEOF_PLT_STUB
+ + ((l->l_info[DT_PLTRELSZ]->d_un.d_val / sizeof (Elf32_Rela))
+ * 8)))
+ return 0;
+ if (got[-2] != sig.i[0] || got[-1] != sig.i[1])
+ return 0; /* No lazy linking for you! */
+ }
+ }
+ else
+ {
+ /* Relocate this *ABS* entry. */
+ fptr->func = reloc->r_addend + l_addr;
+ fptr->gp = D_PTR (l, l_info[DT_PLTGOT]);
+ }
+ }
+ else if (__builtin_expect (r_type != R_PARISC_NONE, 0))
+ _dl_reloc_bad_type (l, r_type, 1);
+ }
+
+ if (got)
+ {
+ register Elf32_Addr ltp __asm__ ("%r19");
+ /* Identify this shared object. */
+ got[1] = (Elf32_Addr) l;
+
+ /* This function will be called to perform the relocation. */
+ if (__builtin_expect (!profile, 1))
+ got[-2] =
+ (Elf32_Addr) ((struct hppa_fptr *)
+ ((unsigned long) &_dl_runtime_resolve & ~3))->func;
+ else
+ {
+ if (_dl_name_match_p (_dl_profile, l))
+ {
+ /* This is the object we are looking for. Say that
+ we really want profiling and the timers are
+ started. */
+ _dl_profile_map = l;
+ }
+ got[-2] =
+ (Elf32_Addr) ((struct hppa_fptr *)
+ ((unsigned long) &_dl_runtime_profile & ~3))->func;
+ }
+ got[-1] = ltp;
+ }
+ }
+ return lazy;
+}
+
+/* Initial entry point code for the dynamic linker.
+ The C function `_dl_start' is the real entry point;
+ its return value is the user program's entry point. */
+
+#define RTLD_START asm ("\
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ /* The kernel does not give us an initial stack frame. */
+ ldo 64(%sp),%sp
+ /* Save the relevant arguments (yes, those are the correct
+ registers, the kernel is weird) in their stack slots. */
+ stw %r25,-40(%sp) /* argc */
+ stw %r24,-44(%sp) /* argv */
+
+ /* We need the LTP, and we need it now. */
+ /* $PIC_pcrel$0 points 8 bytes past the current instruction,
+ just like a branch reloc. This sequence gets us the runtime
+ address of _DYNAMIC. */
+ bl 0f,%r19
+ depi 0,31,2,%r19 /* clear priviledge bits */
+0: addil L'_DYNAMIC - ($PIC_pcrel$0 - 8),%r19
+ ldo R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%r1),%r26
+
+ /* Also get the link time address from the first entry of the GOT. */
+ addil L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 16),%r19
+ ldw R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 20)(%r1),%r20
+
+ sub %r26,%r20,%r20 /* Calculate load offset */
+
+ /* Rummage through the dynamic entries, looking for DT_PLTGOT. */
+ ldw,ma 8(%r26),%r19
+1: cmpib,=,n 3,%r19,2f /* tag == DT_PLTGOT? */
+ cmpib,<>,n 0,%r19,1b
+ ldw,ma 8(%r26),%r19
+
+ /* Uh oh! We didn't find one. Abort. */
+ iitlbp %r0,(%r0)
+
+2: ldw -4(%r26),%r19 /* Found it, load value. */
+ add %r19,%r20,%r19 /* And add the load offset. */
+
+ /* Our initial stack layout is rather different from everyone
+ else's due to the unique PA-RISC ABI. As far as I know it
+ looks like this:
+
+ ----------------------------------- (this frame created above)
+ | 32 bytes of magic |
+ |---------------------------------|
+ | 32 bytes argument/sp save area |
+ |---------------------------------| ((current->mm->env_end) + 63 & ~63)
+ | N bytes of slack |
+ |---------------------------------|
+ | envvar and arg strings |
+ |---------------------------------|
+ | ELF auxiliary info |
+ | (up to 28 words) |
+ |---------------------------------|
+ | Environment variable pointers |
+ | upwards to NULL |
+ |---------------------------------|
+ | Argument pointers |
+ | upwards to NULL |
+ |---------------------------------|
+ | argc (1 word) |
+ -----------------------------------
+
+ So, obviously, we can't just pass %sp to _dl_start. That's
+ okay, argv-4 will do just fine.
+
+ The pleasant part of this is that if we need to skip
+ arguments we can just decrement argc and move argv, because
+ the stack pointer is utterly unrelated to the location of
+ the environment and argument vectors. */
+
+ /* This is always within range so we'll be okay. */
+ bl _dl_start,%rp
+ ldo -4(%r24),%r26
+
+ /* FALLTHRU */
+ .globl _dl_start_user
+ .type _dl_start_user,@function
+_dl_start_user:
+ /* Save the entry point in %r3. */
+ copy %ret0,%r3
+
+ /* Remember the lowest stack address. */
+ addil LT'__libc_stack_end,%r19
+ ldw RT'__libc_stack_end(%r1),%r20
+ stw %sp,0(%r20)
+
+ /* See if we were called as a command with the executable file
+ name as an extra leading argument. */
+ addil LT'_dl_skip_args,%r19
+ ldw RT'_dl_skip_args(%r1),%r20
+ ldw 0(%r20),%r20
+
+ ldw -40(%sp),%r25 /* argc */
+ comib,= 0,%r20,.Lnofix /* FIXME: will be mispredicted */
+ ldw -44(%sp),%r24 /* argv (delay slot) */
+
+ sub %r25,%r20,%r25
+ stw %r25,-40(%sp)
+ sh2add %r20,%r24,%r24
+ stw %r24,-44(%sp)
+
+.Lnofix:
+ /* Call _dl_init(_dl_loaded, argc, argv, envp). */
+ addil LT'_dl_loaded,%r19
+ ldw RT'_dl_loaded(%r1),%r26
+ ldw 0(%r26),%r26
+ /* envp = argv + argc + 1 */
+ sh2add %r25,%r24,%r23
+ bl _dl_init,%r2
+ ldo 4(%r23),%r23 /* delay slot */
+
+ /* Reload argc, argv to the registers start.S expects them in (feh) */
+ ldw -40(%sp),%r25
+ ldw -44(%sp),%r24
+
+ /* _dl_fini does have a PLT slot now. I don't know how to get
+ to it though, so this hack will remain. */
+ .section .data
+__dl_fini_plabel:
+ .word _dl_fini
+ .word 0xdeadbeef
+ .previous
+
+ addil LT'__dl_fini_plabel,%r19
+ ldw RT'__dl_fini_plabel(%r1),%r23
+ stw %r19,4(%r23)
+ bv %r0(%r3)
+ depi 2,31,2,%r23 /* delay slot */");
+
+/* This code gets called via the .plt stub, and is used in
+ dl-runtime.c to call the `fixup' function and then redirect to the
+ address it returns.
+ Enter with r19 = reloc offset, r20 = got-8, r21 = fixup ltp. */
+#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
+ extern void tramp_name (void); \
+ asm ( "\
+ /* Trampoline for " #tramp_name " */
+ .globl " #tramp_name "
+ .type " #tramp_name ",@function
+" #tramp_name ":
+ /* Save return pointer */
+ stw %r2,-20(%sp)
+ /* Save argument registers in the call stack frame. */
+ stw %r26,-36(%sp)
+ stw %r25,-40(%sp)
+ stw %r24,-44(%sp)
+ stw %r23,-48(%sp)
+ /* Build a call frame. */
+ stwm %sp,64(%sp)
+
+ /* Set up args to fixup func. */
+ ldw 8+4(%r20),%r26 /* got[1] == struct link_map * */
+ copy %r19,%r25 /* reloc offset */
+
+ /* Call the real address resolver. */
+ bl " #fixup_name ",%r2
+ copy %r21,%r19 /* delay slot, set fixup func ltp */
+
+ ldwm -64(%sp),%sp
+ /* Arguments. */
+ ldw -36(%sp),%r26
+ ldw -40(%sp),%r25
+ ldw -44(%sp),%r24
+ ldw -48(%sp),%r23
+ /* Return pointer. */
+ ldw -20(%sp),%r2
+ /* Call the real function. */
+ ldw 0(%r28),%r22
+ bv %r0(%r22)
+ ldw 4(%r28),%r19
+");
+
+#ifndef PROF
+#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
+ TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup); \
+ TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup);
+#else
+#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
+ TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup); \
+ strong_alias (_dl_runtime_resolve, _dl_runtime_profile);
+#endif
+
+
+/* Nonzero iff TYPE describes a relocation that should
+ skip the executable when looking up the symbol value. */
+#define elf_machine_lookup_noexec_p(type) ((type) == R_PARISC_COPY)
+
+/* Nonzero iff TYPE describes relocation of a PLT entry, so
+ PLT entries should not be allowed to define the value. */
+#define elf_machine_lookup_noplt_p(type) ((type) == R_PARISC_IPLT \
+ || (type) == R_PARISC_EPLT)
+
+/* Used by ld.so for ... something ... */
+#define ELF_MACHINE_JMP_SLOT R_PARISC_IPLT
+
+/* We only use RELA. */
+#define ELF_MACHINE_NO_REL 1
+
+#endif /* !dl_machine_h */
+
+/* These are only actually used where RESOLVE_MAP is defined, anyway. */
+#ifdef RESOLVE_MAP
+
+static inline void
+elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
+ const Elf32_Sym *sym, const struct r_found_version *version,
+ Elf32_Addr *const reloc_addr)
+{
+ const Elf32_Sym *const refsym = sym;
+ unsigned long const r_type = ELF32_R_TYPE (reloc->r_info);
+ struct link_map *sym_map;
+ Elf32_Addr value;
+
+#ifndef RTLD_BOOTSTRAP
+ /* This is defined in rtld.c, but nowhere in the static libc.a; make the
+ reference weak so static programs can still link. This declaration
+ cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP)
+ because rtld.c contains the common defn for _dl_rtld_map, which is
+ incompatible with a weak decl in the same file. */
+ weak_extern (_dl_rtld_map);
+#endif
+
+ /* RESOLVE_MAP will return a null value for undefined syms, and
+ non-null for all other syms. In particular, relocs with no
+ symbol (symbol index of zero), also called *ABS* relocs, will be
+ resolved to MAP. (The first entry in a symbol table is all
+ zeros, and an all zero Elf32_Sym has a binding of STB_LOCAL.)
+ See RESOLVE_MAP definition in elf/dl-reloc.c */
+#ifdef RTLD_BOOTSTRAP
+ /* RESOLVE_MAP in rtld.c doesn't have the local sym test. */
+ sym_map = (ELF32_ST_BIND (sym->st_info) != STB_LOCAL
+ ? RESOLVE_MAP (&sym, version, r_type) : map);
+#else
+ sym_map = RESOLVE_MAP (&sym, version, r_type);
+#endif
+ if (sym_map)
+ {
+ value = sym ? sym_map->l_addr + sym->st_value : 0;
+ value += reloc->r_addend;
+ }
+ else
+ value = 0;
+
+ switch (r_type)
+ {
+ case R_PARISC_DIR32:
+#ifndef RTLD_BOOTSTRAP
+ /* All hell breaks loose if we try to relocate these twice,
+ because any initialized variables in ld.so that refer to
+ other ones will have their values reset. In particular,
+ __fptr_next will be reset, sometimes causing endless loops in
+ __hppa_make_fptr(). So don't do that. */
+ if (map == &_dl_rtld_map)
+ return;
+#endif
+ /* Otherwise, nothing more to do here. */
+ break;
+
+ case R_PARISC_PLABEL32:
+ /* Easy rule: If there is a symbol and it is global, then we
+ need to make a dynamic function descriptor. Otherwise we
+ have the address of a PLT slot for a local symbol which we
+ know to be unique. */
+ if (sym == NULL
+ || sym_map == NULL
+ || ELF32_ST_BIND (sym->st_info) == STB_LOCAL)
+ break;
+
+ /* Okay, we need to make ourselves a PLABEL then. See the IA64
+ code for an explanation of how this works. */
+#ifndef RTLD_BOOTSTRAP
+ value = __hppa_make_fptr (sym_map, value, &__fptr_root, NULL);
+#else
+ {
+ struct hppa_fptr *p_boot_ldso_fptr;
+ struct hppa_fptr **p_fptr_root;
+ int *p_fptr_count;
+ unsigned long dot;
+
+ /* Go from the top of __boot_ldso_fptr. As on IA64, we
+ probably haven't relocated the necessary values by this
+ point so we have to find them ourselves. */
+
+ asm ("bl 0f,%0
+ depi 0,31,2,%0
+0: addil L'__boot_ldso_fptr - ($PIC_pcrel$0 - 8),%0
+ ldo R'__boot_ldso_fptr - ($PIC_pcrel$0 - 12)(%%r1),%1
+ addil L'__fptr_root - ($PIC_pcrel$0 - 16),%0
+ ldo R'__fptr_root - ($PIC_pcrel$0 - 20)(%%r1),%2
+ addil L'__fptr_count - ($PIC_pcrel$0 - 24),%0
+ ldo R'__fptr_count - ($PIC_pcrel$0 - 28)(%%r1),%3"
+ :
+ "=r" (dot),
+ "=r" (p_boot_ldso_fptr),
+ "=r" (p_fptr_root),
+ "=r" (p_fptr_count));
+
+ value = __hppa_make_fptr (sym_map, value, p_fptr_root,
+ &p_boot_ldso_fptr[--*p_fptr_count]);
+ }
+#endif
+ break;
+
+ case R_PARISC_IPLT:
+ if (__builtin_expect (sym_map != NULL, 1))
+ elf_machine_fixup_plt (NULL, sym_map, reloc, reloc_addr, value);
+ else
+ {
+ /* If we get here, it's a (weak) undefined sym. */
+ elf_machine_fixup_plt (NULL, map, reloc, reloc_addr, value);
+ }
+ return;
+
+ case R_PARISC_COPY:
+ if (__builtin_expect (sym == NULL, 0))
+ /* This can happen in trace mode if an object could not be
+ found. */
+ break;
+ if (__builtin_expect (sym->st_size > refsym->st_size, 0)
+ || (__builtin_expect (sym->st_size < refsym->st_size, 0)
+ && __builtin_expect (_dl_verbose, 0)))
+ {
+ const char *strtab;
+
+ strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
+ _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
+ ": Symbol `", strtab + refsym->st_name,
+ "' has different size in shared object, "
+ "consider re-linking\n", NULL);
+ }
+ memcpy (reloc_addr, (void *) value,
+ MIN (sym->st_size, refsym->st_size));
+ return;
+
+ case R_PARISC_NONE: /* Alright, Wilbur. */
+ return;
+
+ default:
+ _dl_reloc_bad_type (map, r_type, 0);
+ }
+
+ *reloc_addr = value;
+}
+
+static inline void
+elf_machine_lazy_rel (struct link_map *map,
+ Elf32_Addr l_addr, const Elf32_Rela *reloc)
+{
+ /* We don't have anything to do here. elf_machine_runtime_setup has
+ done all the relocs already. */
+}
+
+#endif /* RESOLVE_MAP */
diff --git a/sysdeps/hppa/dl-symaddr.c b/sysdeps/hppa/dl-symaddr.c
new file mode 100644
index 0000000000..038404a48b
--- /dev/null
+++ b/sysdeps/hppa/dl-symaddr.c
@@ -0,0 +1,39 @@
+/* Get the symbol address. HPPA version.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <ldsodefs.h>
+#include <dl-machine.h>
+
+void *
+_dl_symbol_address (const struct link_map *map, const ElfW(Sym) *ref)
+{
+ Elf32_Addr value = (map ? map->l_addr : 0) + ref->st_value;
+
+ /* On hppa, we have to return the pointer to function descriptor. */
+ if (ELFW(ST_TYPE) (ref->st_info) == STT_FUNC)
+ return (void *) __hppa_make_fptr (map, value, &__fptr_root, NULL);
+ else
+ return (void *) value;
+}
+
+ElfW(Addr)
+_dl_start_address (const struct link_map *map, ElfW(Addr) start)
+{
+ return __hppa_make_fptr (map, start, &__fptr_root, NULL);
+}
diff --git a/sysdeps/hppa/elf/initfini.c b/sysdeps/hppa/elf/initfini.c
new file mode 100644
index 0000000000..c058ed0425
--- /dev/null
+++ b/sysdeps/hppa/elf/initfini.c
@@ -0,0 +1,117 @@
+/* Special .init and .fini section support for HPPA
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ In addition to the permissions in the GNU Library General Public
+ License, the Free Software Foundation gives you unlimited
+ permission to link the compiled version of this file with other
+ programs, and to distribute those programs without any restriction
+ coming from the use of this file. (The Library General Public
+ License restrictions do apply in other respects; for example, they
+ cover modification of the file, and distribution when not linked
+ into another program.)
+
+ The GNU C Library is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* This file is compiled into assembly code which is then munged by a sed
+ script into two files: crti.s and crtn.s.
+
+ * crti.s puts a function prologue at the beginning of the
+ .init and .fini sections and defines global symbols for
+ those addresses, so they can be called as functions.
+
+ * crtn.s puts the corresponding function epilogues
+ in the .init and .fini sections. */
+
+/* If we use the standard C version, the linkage table pointer won't
+ be properly preserved due to the splitting up of function prologues
+ and epilogues. Therefore we write these in assembly to make sure
+ they do the right thing.
+
+ Note that we cannot have a weak undefined __gmon_start__, because
+ that would require this to be PIC, and the linker is currently not
+ able to generate a proper procedure descriptor for _init. Sad but
+ true. Anyway, HPPA is one of those horrible architectures where
+ making the comparison and indirect call is quite expensive (see the
+ comment in sysdeps/generic/initfini.c). */
+
+__asm__ ("
+
+#include \"defs.h\"
+
+/*@HEADER_ENDS*/
+
+/*@_init_PROLOG_BEGINS*/
+ .section .init
+ .align 4
+ .globl _init
+ .type _init,@function
+ .proc
+ .callinfo
+_init:
+ stw %rp,-20(%sp)
+ stwm %r4,64(%sp)
+ stw %r19,-32(%sp)
+ bl __gmon_start__,%rp
+ copy %r19,%r4 /* delay slot */
+ copy %r4,%r19
+ .align 4
+ .procend
+/*@_init_PROLOG_ENDS*/
+
+/*@_init_EPILOG_BEGINS*/
+ .section .init
+ copy %r4,%r19
+ ldw -84(%sp),%rp
+ bv %r0(%rp)
+ ldwm -64(%sp),%r4
+ .text
+ .align 4
+ .weak __gmon_start__
+ .type __gmon_start__,@function
+ .proc
+ .callinfo
+__gmon_start__:
+ bv,n %r0(%r2)
+ .procend
+/*@_init_EPILOG_ENDS*/
+
+/*@_fini_PROLOG_BEGINS*/
+ .section .fini
+ .align 4
+ .globl _fini
+ .type _fini,@function
+ .proc
+ .callinfo
+_fini:
+ stw %rp,-20(%sp)
+ stwm %r4,64(%sp)
+ stw %r19,-32(%sp)
+ copy %r19,%r4
+ .align 4
+ .procend
+/*@_fini_PROLOG_ENDS*/
+
+/*@_fini_EPILOG_BEGINS*/
+ .section .fini
+ copy %r4,%r19
+ ldw -84(%sp),%rp
+ bv %r0(%rp)
+ ldwm -64(%sp),%r4
+/*@_fini_EPILOG_ENDS*/
+
+/*@TRAILER_BEGINS*/
+");
diff --git a/sysdeps/hppa/elf/start.S b/sysdeps/hppa/elf/start.S
new file mode 100644
index 0000000000..88bb790be2
--- /dev/null
+++ b/sysdeps/hppa/elf/start.S
@@ -0,0 +1,58 @@
+
+ .text
+
+ .align 4
+
+ .import main, code
+ .import $global$, data
+ .import __libc_start_main, code
+ .import _fini, code
+ .import _init, code
+
+
+
+
+ .globl _start
+ .export _start, ENTRY
+
+_start:
+
+ .proc
+ .callinfo
+
+ /* load main */
+ ldil LP%main, %r26
+ ldo RP%main(%r26), %r26
+
+ /* argc and argv should be in 25 and 24 */
+
+ /* Expand the stack to store the 5th through 7th args */
+ ldo 64(%sp), %sp
+
+ /* void (*rtld_fini) (void) (actually the 6th arg) */
+ stw %r23, -56(%sp)
+
+ /* void (*init) (void) */
+ ldil LP%_init, %r23
+ ldo RP%_init(%r23), %r23
+
+ /* void (*fini) (void) */
+ ldil LP%_fini, %r22
+ ldo RP%_fini(%r22), %r22
+ stw %r22, -52(%sp)
+
+ /* void *stack_end */
+ stw %sp, -60(%sp)
+
+ /* load global */
+ ldil L%$global$, %dp
+ ldo R%$global$(%dp), %dp
+
+ bl __libc_start_main,%r2
+ nop
+ /* die horribly if it returned (it shouldn't) */
+ iitlbp %r0,(%r0)
+ nop
+
+ .procend
+
diff --git a/sysdeps/hppa/fpu/bits/fenv.h b/sysdeps/hppa/fpu/bits/fenv.h
new file mode 100644
index 0000000000..7d25b9947c
--- /dev/null
+++ b/sysdeps/hppa/fpu/bits/fenv.h
@@ -0,0 +1,78 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _FENV_H
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
+
+/* Define bits representing the exception. We use the values of the
+ appropriate enable bits in the FPU status word (which,
+ coincidentally, are the same as the flag bits, but shifted right by
+ 27 bits). */
+enum
+{
+ FE_INVALID = 1<<4, /* V */
+#define FE_INVALID FE_INVALID
+ FE_DIVBYZERO = 1<<3, /* Z */
+#define FE_DIVBYZERO FE_DIVBYZERO
+ FE_OVERFLOW = 1<<2, /* O */
+#define FE_OVERFLOW FE_OVERFLOW
+ FE_UNDERFLOW = 1<<1, /* U */
+#define FE_UNDERFLOW FE_UNDERFLOW
+ FE_INEXACT = 1<<0, /* I */
+#define FE_INEXACT FE_INEXACT
+};
+
+#define FE_ALL_EXCEPT \
+ (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+/* The PA-RISC FPU supports all of the four defined rounding modes.
+ We use the values of the RM field in the floating point status
+ register for the appropriate macros. */
+enum
+ {
+ FE_TONEAREST = 0 << 9,
+#define FE_TONEAREST FE_TONEAREST
+ FE_TOWARDZERO = 1 << 9,
+#define FE_TOWARDZERO FE_TOWARDZERO
+ FE_UPWARD = 2 << 9,
+#define FE_UPWARD FE_UPWARD
+ FE_DOWNWARD = 3 << 9,
+#define FE_DOWNWARD FE_DOWNWARD
+ };
+
+/* Type representing exception flags. */
+typedef unsigned int fexcept_t;
+
+/* Type representing floating-point environment. This structure
+ corresponds to the layout of the status and exception words in the
+ register file. */
+typedef struct
+{
+ unsigned int __status_word;
+ unsigned int __exception[7];
+} fenv_t;
+
+/* If the default argument is used we use this value. */
+#define FE_DFL_ENV ((fenv_t *) -1)
+
+#ifdef __USE_GNU
+/* Floating-point environment where none of the exceptions are masked. */
+# define FE_NOMASK_ENV ((fenv_t *) -2)
+#endif
diff --git a/sysdeps/hppa/fpu/fclrexcpt.c b/sysdeps/hppa/fpu/fclrexcpt.c
new file mode 100644
index 0000000000..4c64027310
--- /dev/null
+++ b/sysdeps/hppa/fpu/fclrexcpt.c
@@ -0,0 +1,37 @@
+/* Clear given exceptions in current floating-point environment.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+feclearexcept (int excepts)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ /* Clear all the relevant bits. */
+ sw[0] &= ~(excepts & FE_ALL_EXCEPT);
+ __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
+
+ /* Success. */
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fedisblxcpt.c b/sysdeps/hppa/fpu/fedisblxcpt.c
new file mode 100644
index 0000000000..95c362a263
--- /dev/null
+++ b/sysdeps/hppa/fpu/fedisblxcpt.c
@@ -0,0 +1,37 @@
+/* Disable floating-point exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fedisableexcept (int excepts)
+{
+ unsigned int sw[2], old_exc;
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ old_exc = sw[0] & FE_ALL_EXCEPT;
+
+ sw[0] &= ~(excepts & FE_ALL_EXCEPT);
+ __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
+
+ return old_exc;
+}
diff --git a/sysdeps/hppa/fpu/feenablxcpt.c b/sysdeps/hppa/fpu/feenablxcpt.c
new file mode 100644
index 0000000000..ac46722767
--- /dev/null
+++ b/sysdeps/hppa/fpu/feenablxcpt.c
@@ -0,0 +1,37 @@
+/* Enable floating-point exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+feenableexcept (int excepts)
+{
+ unsigned int sw[2], old_exc;
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ old_exc = sw[0] & FE_ALL_EXCEPT;
+
+ sw[0] |= (excepts & FE_ALL_EXCEPT);
+ __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
+
+ return old_exc;
+}
diff --git a/sysdeps/hppa/fpu/fegetenv.c b/sysdeps/hppa/fpu/fegetenv.c
new file mode 100644
index 0000000000..0fe9773bb7
--- /dev/null
+++ b/sysdeps/hppa/fpu/fegetenv.c
@@ -0,0 +1,33 @@
+/* Store current floating-point environment.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fegetenv (fenv_t *envp)
+{
+ __asm__ (
+ "fstd %%fr0,0(%2)\n"
+ "fstd,ma %%fr1,8(%2)\n"
+ "fstd,ma %%fr2,8(%2)\n"
+ "fstd %%fr3,0(%2)\n"
+ : "=m" (*envp), "=r" (envp) : "1" (envp));
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fegetexcept.c b/sysdeps/hppa/fpu/fegetexcept.c
new file mode 100644
index 0000000000..6bf3f6446e
--- /dev/null
+++ b/sysdeps/hppa/fpu/fegetexcept.c
@@ -0,0 +1,32 @@
+/* Get enabled floating-point exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fegetexcept (void)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ return sw[0] & FE_ALL_EXCEPT;
+}
diff --git a/sysdeps/hppa/fpu/fegetround.c b/sysdeps/hppa/fpu/fegetround.c
new file mode 100644
index 0000000000..6e07f8654f
--- /dev/null
+++ b/sysdeps/hppa/fpu/fegetround.c
@@ -0,0 +1,32 @@
+/* Return current rounding direction.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fegetround (void)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ return sw[0] & FE_DOWNWARD;
+}
diff --git a/sysdeps/hppa/fpu/feholdexcpt.c b/sysdeps/hppa/fpu/feholdexcpt.c
new file mode 100644
index 0000000000..10621786eb
--- /dev/null
+++ b/sysdeps/hppa/fpu/feholdexcpt.c
@@ -0,0 +1,60 @@
+/* Store current floating-point environment and clear exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+#include <string.h>
+
+int
+feholdexcept (fenv_t *envp)
+{
+ fenv_t clear;
+
+ /* Store the environment. */
+ {
+ fenv_t * _regs = envp;
+ __asm__ (
+ "fstd %%fr0,0(%2)\n"
+ "fstd,ma %%fr1,8(%2)\n"
+ "fstd,ma %%fr2,8(%2)\n"
+ "fstd %%fr3,0(%2)\n"
+ : "=m" (*_regs), "=r" (_regs) : "1" (_regs));
+ memcpy (&clear, envp, sizeof (clear));
+ }
+
+ /* Now clear all exceptions. */
+ clear.__status_word &= ~(FE_ALL_EXCEPT << 27);
+ memset (clear.__exception, 0, sizeof (clear.__exception));
+
+ /* And set all exceptions to non-stop. */
+ clear.__status_word &= ~FE_ALL_EXCEPT;
+
+ /* Load the new environment. */
+ {
+ fenv_t * _regs = &clear + 1;
+ __asm__ (
+ "fldd,mb -8(%2),%%fr3\n"
+ "fldd,mb -8(%2),%%fr2\n"
+ "fldd,mb -8(%2),%%fr1\n"
+ "fldd -8(%2),%%fr0\n"
+ : "=m" (*_regs), "=r" (_regs) : "1" (_regs));
+ }
+
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fesetenv.c b/sysdeps/hppa/fpu/fesetenv.c
new file mode 100644
index 0000000000..4bfbefdd9b
--- /dev/null
+++ b/sysdeps/hppa/fpu/fesetenv.c
@@ -0,0 +1,70 @@
+/* Install given floating-point environment.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+ Based on the m68k version by
+ Andreas Schwab <schwab@suse.de>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fesetenv (const fenv_t *envp)
+{
+ fenv_t temp;
+
+ /* Install the environment specified by ENVP. But there are a few
+ values which we do not want to come from the saved environment.
+ Therefore, we get the current environment and replace the values
+ we want to use from the environment specified by the parameter. */
+ {
+ fenv_t * _regs = &temp;
+ __asm__ (
+ "fstd %%fr0,0(%2)\n"
+ "fstd,ma %%fr1,8(%2)\n"
+ "fstd,ma %%fr2,8(%2)\n"
+ "fstd %%fr3,0(%2)\n"
+ : "=m" (*_regs), "=r" (_regs) : "1" (_regs));
+ }
+
+ temp.__status_word &= ~(FE_ALL_EXCEPT
+ | (FE_ALL_EXCEPT << 27)
+ | FE_DOWNWARD);
+ if (envp == FE_DFL_ENV)
+ ;
+ else if (envp == FE_NOMASK_ENV)
+ temp.__status_word |= FE_ALL_EXCEPT;
+ else
+ temp.__status_word |= (envp->__status_word
+ & (FE_ALL_EXCEPT
+ | FE_DOWNWARD
+ | (FE_ALL_EXCEPT << 27)));
+
+ /* Load the new environment. */
+ {
+ fenv_t * _regs = &temp + 1;
+ __asm__ (
+ "fldd,mb -8(%2),%%fr3\n"
+ "fldd,mb -8(%2),%%fr2\n"
+ "fldd,mb -8(%2),%%fr1\n"
+ "fldd -8(%2),%%fr0\n"
+ : "=m" (*_regs), "=r" (_regs) : "1" (_regs));
+ }
+
+ /* Success. */
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fesetround.c b/sysdeps/hppa/fpu/fesetround.c
new file mode 100644
index 0000000000..0d5858f263
--- /dev/null
+++ b/sysdeps/hppa/fpu/fesetround.c
@@ -0,0 +1,39 @@
+/* Set current rounding direction.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fesetround (int round)
+{
+ unsigned int sw[2];
+
+ if (round & ~FE_DOWNWARD)
+ /* ROUND is not a valid rounding mode. */
+ return 1;
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+ sw[0] &= ~FE_UPWARD;
+ sw[0] |= round;
+ __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
+
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/feupdateenv.c b/sysdeps/hppa/fpu/feupdateenv.c
new file mode 100644
index 0000000000..7e2d715e25
--- /dev/null
+++ b/sysdeps/hppa/fpu/feupdateenv.c
@@ -0,0 +1,40 @@
+/* Install given floating-point environment and raise exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+feupdateenv (const fenv_t *envp)
+{
+ unsigned int sw[2];
+
+ /* Get the current exception status. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+ sw[0] &= (FE_ALL_EXCEPT << 27);
+
+ /* Install new environment. */
+ fesetenv (envp);
+
+ /* Raise the saved exception. */
+ feraiseexcept (sw[0] >> 27);
+
+ /* Success. */
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fgetexcptflg.c b/sysdeps/hppa/fpu/fgetexcptflg.c
new file mode 100644
index 0000000000..800b1f4014
--- /dev/null
+++ b/sysdeps/hppa/fpu/fgetexcptflg.c
@@ -0,0 +1,36 @@
+/* Store current representation for exceptions.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ *flagp = (sw[0] >> 27) & excepts & FE_ALL_EXCEPT;
+
+ /* Success. */
+ return 0;
+}
+
diff --git a/sysdeps/hppa/fpu/fraiseexcpt.c b/sysdeps/hppa/fpu/fraiseexcpt.c
new file mode 100644
index 0000000000..7feeb9946f
--- /dev/null
+++ b/sysdeps/hppa/fpu/fraiseexcpt.c
@@ -0,0 +1,89 @@
+/* Raise given exceptions.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+#include <math.h>
+
+int
+feraiseexcept (int excepts)
+{
+ /* Raise exceptions represented by EXCEPTS. But we must raise only one
+ signal at a time. It is important that if the overflow/underflow
+ exception and the divide by zero exception are given at the same
+ time, the overflow/underflow exception follows the divide by zero
+ exception. */
+
+ /* We do these bits in assembly to be certain GCC doesn't optimize
+ away something important, and so we can force delayed traps to
+ occur. */
+
+ /* FIXME: These all need verification! */
+
+ /* First: invalid exception. */
+ if (excepts & FE_INVALID)
+ {
+ /* One example of a invalid operation is 0 * Infinity. */
+ double d = HUGE_VAL;
+ __asm__ __volatile__ ("fmpy,dbl %1,%%fr0,%0\n\t"
+ /* FIXME: is this a proper trap barrier? */
+ "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d));
+ }
+
+ /* Next: division by zero. */
+ if (excepts & FE_DIVBYZERO)
+ {
+ double d = 1.0;
+ __asm__ __volatile__ ("fdiv,dbl %1,%%fr0,%0\n\t"
+ "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d));
+ }
+
+ /* Next: overflow. */
+ /* FIXME: Compare with IA-64 - do we have the same problem? */
+ if (excepts & FE_OVERFLOW)
+ {
+ double d = DBL_MAX;
+
+ __asm__ __volatile__ ("fmpy,dbl %1,%1,%0\n\t"
+ "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d));
+ }
+
+ /* Next: underflow. */
+ if (excepts & FE_UNDERFLOW)
+ {
+ double d = DBL_MIN;
+ double e = 69.69;
+
+ __asm__ __volatile__ ("fdiv,dbl %1,%2,%0\n\t"
+ "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d), "f" (e));
+ }
+
+ /* Last: inexact. */
+ if (excepts & FE_INEXACT)
+ {
+ double d = 1.0;
+ double e = M_PI;
+
+ __asm__ __volatile__ ("fdiv,dbl %1,%2,%0\n\t"
+ "fcpy,dbl %%fr0,%%fr0" : "=f" (d) : "0" (d), "f" (e));
+ }
+
+ /* Success. */
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/fsetexcptflg.c b/sysdeps/hppa/fpu/fsetexcptflg.c
new file mode 100644
index 0000000000..2e369ea721
--- /dev/null
+++ b/sysdeps/hppa/fpu/fsetexcptflg.c
@@ -0,0 +1,41 @@
+/* Set floating-point environment exception handling.
+ Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+#include <math.h>
+
+int
+fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ /* Install the new exception flags bits. */
+ sw[0] &= ~(excepts & (FE_ALL_EXCEPT >> 27));
+ sw[0] |= (*flagp & excepts & FE_ALL_EXCEPT) << 27;
+
+ /* Store the new status word. */
+ __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
+
+ /* Success. */
+ return 0;
+}
diff --git a/sysdeps/hppa/fpu/ftestexcept.c b/sysdeps/hppa/fpu/ftestexcept.c
new file mode 100644
index 0000000000..15d149193f
--- /dev/null
+++ b/sysdeps/hppa/fpu/ftestexcept.c
@@ -0,0 +1,32 @@
+/* Test exception in current environment.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Huggins-Daines <dhd@debian.org>, 2000
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <fenv.h>
+
+int
+fetestexcept (int excepts)
+{
+ unsigned int sw[2];
+
+ /* Get the current status word. */
+ __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
+
+ return (sw[0] >> 27) & excepts & FE_ALL_EXCEPT;
+}
diff --git a/sysdeps/hppa/frame.h b/sysdeps/hppa/frame.h
new file mode 100644
index 0000000000..e6764daa24
--- /dev/null
+++ b/sysdeps/hppa/frame.h
@@ -0,0 +1,28 @@
+/* Definition of stack frame structure. HPPA version.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* PA stacks grow upwards. */
+#define INNER_THAN >
+
+/* FIXME: will verify this later */
+struct layout
+{
+ void *next;
+ void *return_address;
+};
diff --git a/sysdeps/hppa/hppa1.1/Implies b/sysdeps/hppa/hppa1.1/Implies
new file mode 100644
index 0000000000..5f935a299c
--- /dev/null
+++ b/sysdeps/hppa/hppa1.1/Implies
@@ -0,0 +1,4 @@
+wordsize-32
+ieee754/flt-32
+ieee754/dbl-64
+ieee754/ldbl-128
diff --git a/sysdeps/hppa/hppa1.1/addmul_1.s b/sysdeps/hppa/hppa1.1/addmul_1.s
index 0fdcb3cb20..5b3e0482a5 100644
--- a/sysdeps/hppa/hppa1.1/addmul_1.s
+++ b/sysdeps/hppa/hppa1.1/addmul_1.s
@@ -1,71 +1,72 @@
-; HP-PA-1.1 __mpn_addmul_1 -- Multiply a limb vector with a limb and
-; add the result to a second limb vector.
+;! HP-PA-1.1 __mpn_addmul_1 -- Multiply a limb vector with a limb and
+;! add the result to a second limb vector.
-; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+;! Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
-; This file is part of the GNU MP Library.
+;! This file is part of the GNU MP Library.
-; The GNU MP Library is free software; you can redistribute it and/or modify
-; it under the terms of the GNU Library General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or (at your
-; option) any later version.
+;! The GNU MP Library is free software; you can redistribute it and/or modify
+;! it under the terms of the GNU Library General Public License as published by
+;! the Free Software Foundation; either version 2 of the License, or (at your
+;! option) any later version.
-; The GNU MP Library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-; License for more details.
+;! The GNU MP Library is distributed in the hope that it will be useful, but
+;! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+;! License for more details.
-; You should have received a copy of the GNU Library General Public License
-; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
-; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-; MA 02111-1307, USA.
+;! You should have received a copy of the GNU Library General Public License
+;! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;! MA 02111-1307, USA.
-; INPUT PARAMETERS
-; res_ptr r26
-; s1_ptr r25
-; size r24
-; s2_limb r23
+;! INPUT PARAMETERS
+;! res_ptr r26
+;! s1_ptr r25
+;! size r24
+;! s2_limb r23
-; This runs at 11 cycles/limb on a PA7000. With the used instructions, it
-; can not become faster due to data cache contention after a store. On the
-; PA7100 it runs at 10 cycles/limb, and that can not be improved either,
-; since only the xmpyu does not need the integer pipeline, so the only
-; dual-issue we will get are addc+xmpyu. Unrolling could gain a cycle/limb
-; on the PA7100.
+;! This runs at 11 cycles/limb on a PA7000. With the used instructions, it
+;! can not become faster due to data cache contention after a store. On the
+;! PA7100 it runs at 10 cycles/limb, and that can not be improved either,
+;! since only the xmpyu does not need the integer pipeline, so the only
+;! dual-issue we will get are addc+xmpyu. Unrolling could gain a cycle/limb
+;! on the PA7100.
-; There are some ideas described in mul_1.s that applies to this code too.
+;! There are some ideas described in mul_1.s that applies to this code too.
- .code
+ .text
.export __mpn_addmul_1
-__mpn_addmul_1
+__mpn_addmul_1:
.proc
.callinfo frame=64,no_calls
.entry
ldo 64(%r30),%r30
fldws,ma 4(%r25),%fr5
- stw %r23,-16(%r30) ; move s2_limb ...
+ stw %r23,-16(%r30) ;! move s2_limb ...
addib,= -1,%r24,L$just_one_limb
- fldws -16(%r30),%fr4 ; ... into fr4
- add %r0,%r0,%r0 ; clear carry
+ fldws -16(%r30),%fr4 ;! ... into fr4
+ add %r0,%r0,%r0 ;! clear carry
xmpyu %fr4,%fr5,%fr6
fldws,ma 4(%r25),%fr7
fstds %fr6,-16(%r30)
xmpyu %fr4,%fr7,%fr8
- ldw -12(%r30),%r19 ; least significant limb in product
+ ldw -12(%r30),%r20 ;! least significant limb in product
ldw -16(%r30),%r28
fstds %fr8,-16(%r30)
addib,= -1,%r24,L$end
ldw -12(%r30),%r1
-; Main loop
-L$loop ldws 0(%r26),%r29
+;! Main loop
+L$loop:
+ ldws 0(%r26),%r29
fldws,ma 4(%r25),%fr5
- add %r29,%r19,%r19
- stws,ma %r19,4(%r26)
- addc %r28,%r1,%r19
+ add %r29,%r20,%r20
+ stws,ma %r20,4(%r26)
+ addc %r28,%r1,%r20
xmpyu %fr4,%fr5,%fr6
ldw -16(%r30),%r28
fstds %fr6,-16(%r30)
@@ -73,27 +74,28 @@ L$loop ldws 0(%r26),%r29
addib,<> -1,%r24,L$loop
ldw -12(%r30),%r1
-L$end ldw 0(%r26),%r29
- add %r29,%r19,%r19
- stws,ma %r19,4(%r26)
- addc %r28,%r1,%r19
+L$end:
+ ldw 0(%r26),%r29
+ add %r29,%r20,%r20
+ stws,ma %r20,4(%r26)
+ addc %r28,%r1,%r20
ldw -16(%r30),%r28
ldws 0(%r26),%r29
addc %r0,%r28,%r28
- add %r29,%r19,%r19
- stws,ma %r19,4(%r26)
+ add %r29,%r20,%r20
+ stws,ma %r20,4(%r26)
addc %r0,%r28,%r28
bv 0(%r2)
- ldo -64(%r30),%r30
+ ldo -64(%r30),%r30
-L$just_one_limb
+L$just_one_limb:
xmpyu %fr4,%fr5,%fr6
ldw 0(%r26),%r29
fstds %fr6,-16(%r30)
ldw -12(%r30),%r1
ldw -16(%r30),%r28
- add %r29,%r1,%r19
- stw %r19,0(%r26)
+ add %r29,%r1,%r20
+ stw %r20,0(%r26)
addc %r0,%r28,%r28
bv 0(%r2)
ldo -64(%r30),%r30
diff --git a/sysdeps/hppa/hppa1.1/mul_1.s b/sysdeps/hppa/hppa1.1/mul_1.s
index cdd0c1d7fa..7f53916e83 100644
--- a/sysdeps/hppa/hppa1.1/mul_1.s
+++ b/sysdeps/hppa/hppa1.1/mul_1.s
@@ -1,92 +1,94 @@
-; HP-PA-1.1 __mpn_mul_1 -- Multiply a limb vector with a limb and store
-; the result in a second limb vector.
+;! HP-PA-1.1 __mpn_mul_1 -- Multiply a limb vector with a limb and store
+;! the result in a second limb vector.
-; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+;! Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
-; This file is part of the GNU MP Library.
+;! This file is part of the GNU MP Library.
-; The GNU MP Library is free software; you can redistribute it and/or modify
-; it under the terms of the GNU Library General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or (at your
-; option) any later version.
+;! The GNU MP Library is free software; you can redistribute it and/or modify
+;! it under the terms of the GNU Library General Public License as published by
+;! the Free Software Foundation; either version 2 of the License, or (at your
+;! option) any later version.
-; The GNU MP Library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-; License for more details.
+;! The GNU MP Library is distributed in the hope that it will be useful, but
+;! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+;! License for more details.
-; You should have received a copy of the GNU Library General Public License
-; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
-; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-; MA 02111-1307, USA.
+;! You should have received a copy of the GNU Library General Public License
+;! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;! MA 02111-1307, USA.
-; INPUT PARAMETERS
-; res_ptr r26
-; s1_ptr r25
-; size r24
-; s2_limb r23
+;! INPUT PARAMETERS
+;! res_ptr r26
+;! s1_ptr r25
+;! size r24
+;! s2_limb r23
-; This runs at 9 cycles/limb on a PA7000. With the used instructions, it can
-; not become faster due to data cache contention after a store. On the
-; PA7100 it runs at 7 cycles/limb, and that can not be improved either, since
-; only the xmpyu does not need the integer pipeline, so the only dual-issue
-; we will get are addc+xmpyu. Unrolling would not help either CPU.
+;! This runs at 9 cycles/limb on a PA7000. With the used instructions, it can
+;! not become faster due to data cache contention after a store. On the
+;! PA7100 it runs at 7 cycles/limb, and that can not be improved either, since
+;! only the xmpyu does not need the integer pipeline, so the only dual-issue
+;! we will get are addc+xmpyu. Unrolling would not help either CPU.
-; We could use fldds to read two limbs at a time from the S1 array, and that
-; could bring down the times to 8.5 and 6.5 cycles/limb for the PA7000 and
-; PA7100, respectively. We don't do that since it does not seem worth the
-; (alignment) troubles...
+;! We could use fldds to read two limbs at a time from the S1 array, and that
+;! could bring down the times to 8.5 and 6.5 cycles/limb for the PA7000 and
+;! PA7100, respectively. We don't do that since it does not seem worth the
+;! (alignment) troubles...
-; At least the PA7100 is rumored to be able to deal with cache-misses
-; without stalling instruction issue. If this is true, and the cache is
-; actually also lockup-free, we should use a deeper software pipeline, and
-; load from S1 very early! (The loads and stores to -12(sp) will surely be
-; in the cache.)
+;! At least the PA7100 is rumored to be able to deal with cache-misses
+;! without stalling instruction issue. If this is true, and the cache is
+;! actually also lockup-free, we should use a deeper software pipeline, and
+;! load from S1 very early; (The loads and stores to -12(sp) will surely be
+;! in the cache.)
- .code
+ .text
.export __mpn_mul_1
-__mpn_mul_1
+__mpn_mul_1:
.proc
.callinfo frame=64,no_calls
.entry
ldo 64(%r30),%r30
fldws,ma 4(%r25),%fr5
- stw %r23,-16(%r30) ; move s2_limb ...
+ stw %r23,-16(%r30) ;! move s2_limb ...
addib,= -1,%r24,L$just_one_limb
- fldws -16(%r30),%fr4 ; ... into fr4
- add %r0,%r0,%r0 ; clear carry
+ fldws -16(%r30),%fr4 ;! ... into fr4
+ add %r0,%r0,%r0 ;! clear carry
xmpyu %fr4,%fr5,%fr6
fldws,ma 4(%r25),%fr7
fstds %fr6,-16(%r30)
xmpyu %fr4,%fr7,%fr8
- ldw -12(%r30),%r19 ; least significant limb in product
+ ldw -12(%r30),%r20 ;! least significant limb in product
ldw -16(%r30),%r28
fstds %fr8,-16(%r30)
addib,= -1,%r24,L$end
ldw -12(%r30),%r1
-; Main loop
-L$loop fldws,ma 4(%r25),%fr5
- stws,ma %r19,4(%r26)
- addc %r28,%r1,%r19
+;! Main loop
+L$loop:
+ fldws,ma 4(%r25),%fr5
+ stws,ma %r20,4(%r26)
+ addc %r28,%r1,%r20
xmpyu %fr4,%fr5,%fr6
ldw -16(%r30),%r28
fstds %fr6,-16(%r30)
addib,<> -1,%r24,L$loop
ldw -12(%r30),%r1
-L$end stws,ma %r19,4(%r26)
- addc %r28,%r1,%r19
+L$end:
+ stws,ma %r20,4(%r26)
+ addc %r28,%r1,%r20
ldw -16(%r30),%r28
- stws,ma %r19,4(%r26)
+ stws,ma %r20,4(%r26)
addc %r0,%r28,%r28
bv 0(%r2)
ldo -64(%r30),%r30
-L$just_one_limb
+L$just_one_limb:
xmpyu %fr4,%fr5,%fr6
fstds %fr6,-16(%r30)
ldw -16(%r30),%r28
diff --git a/sysdeps/hppa/hppa1.1/submul_1.s b/sysdeps/hppa/hppa1.1/submul_1.s
index a4a385467e..f2c19c7bc8 100644
--- a/sysdeps/hppa/hppa1.1/submul_1.s
+++ b/sysdeps/hppa/hppa1.1/submul_1.s
@@ -1,77 +1,78 @@
-; HP-PA-1.1 __mpn_submul_1 -- Multiply a limb vector with a limb and
-; subtract the result from a second limb vector.
+;! HP-PA-1.1 __mpn_submul_1 -- Multiply a limb vector with a limb and
+;! subtract the result from a second limb vector.
-; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+;! Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
-; This file is part of the GNU MP Library.
+;! This file is part of the GNU MP Library.
-; The GNU MP Library is free software; you can redistribute it and/or modify
-; it under the terms of the GNU Library General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or (at your
-; option) any later version.
+;! The GNU MP Library is free software; you can redistribute it and/or modify
+;! it under the terms of the GNU Library General Public License as published by
+;! the Free Software Foundation; either version 2 of the License, or (at your
+;! option) any later version.
-; The GNU MP Library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-; License for more details.
+;! The GNU MP Library is distributed in the hope that it will be useful, but
+;! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+;! License for more details.
-; You should have received a copy of the GNU Library General Public License
-; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
-; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-; MA 02111-1307, USA.
+;! You should have received a copy of the GNU Library General Public License
+;! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;! MA 02111-1307, USA.
-; INPUT PARAMETERS
-; res_ptr r26
-; s1_ptr r25
-; size r24
-; s2_limb r23
+;! INPUT PARAMETERS
+;! res_ptr r26
+;! s1_ptr r25
+;! size r24
+;! s2_limb r23
-; This runs at 12 cycles/limb on a PA7000. With the used instructions, it
-; can not become faster due to data cache contention after a store. On the
-; PA7100 it runs at 11 cycles/limb, and that can not be improved either,
-; since only the xmpyu does not need the integer pipeline, so the only
-; dual-issue we will get are addc+xmpyu. Unrolling could gain a cycle/limb
-; on the PA7100.
+;! This runs at 12 cycles/limb on a PA7000. With the used instructions, it
+;! can not become faster due to data cache contention after a store. On the
+;! PA7100 it runs at 11 cycles/limb, and that can not be improved either,
+;! since only the xmpyu does not need the integer pipeline, so the only
+;! dual-issue we will get are addc+xmpyu. Unrolling could gain a cycle/limb
+;! on the PA7100.
-; There are some ideas described in mul_1.s that applies to this code too.
+;! There are some ideas described in mul_1.s that applies to this code too.
-; It seems possible to make this run as fast as __mpn_addmul_1, if we use
-; sub,>>= %r29,%r19,%r22
-; addi 1,%r28,%r28
-; but that requires reworking the hairy software pipeline...
+;! It seems possible to make this run as fast as __mpn_addmul_1, if we use
+;! sub,>>= %r29,%r20,%r22
+;! addi 1,%r28,%r28
+;! but that requires reworking the hairy software pipeline...
- .code
+ .text
.export __mpn_submul_1
-__mpn_submul_1
+__mpn_submul_1:
.proc
.callinfo frame=64,no_calls
.entry
ldo 64(%r30),%r30
fldws,ma 4(%r25),%fr5
- stw %r23,-16(%r30) ; move s2_limb ...
+ stw %r23,-16(%r30) ;! move s2_limb ...
addib,= -1,%r24,L$just_one_limb
- fldws -16(%r30),%fr4 ; ... into fr4
- add %r0,%r0,%r0 ; clear carry
+ fldws -16(%r30),%fr4 ;! ... into fr4
+ add %r0,%r0,%r0 ;! clear carry
xmpyu %fr4,%fr5,%fr6
fldws,ma 4(%r25),%fr7
fstds %fr6,-16(%r30)
xmpyu %fr4,%fr7,%fr8
- ldw -12(%r30),%r19 ; least significant limb in product
+ ldw -12(%r30),%r20 ;! least significant limb in product
ldw -16(%r30),%r28
fstds %fr8,-16(%r30)
addib,= -1,%r24,L$end
ldw -12(%r30),%r1
-; Main loop
-L$loop ldws 0(%r26),%r29
+;! Main loop
+L$loop:
+ ldws 0(%r26),%r29
fldws,ma 4(%r25),%fr5
- sub %r29,%r19,%r22
- add %r22,%r19,%r0
+ sub %r29,%r20,%r22
+ add %r22,%r20,%r0
stws,ma %r22,4(%r26)
- addc %r28,%r1,%r19
+ addc %r28,%r1,%r20
xmpyu %fr4,%fr5,%fr6
ldw -16(%r30),%r28
fstds %fr6,-16(%r30)
@@ -79,22 +80,23 @@ L$loop ldws 0(%r26),%r29
addib,<> -1,%r24,L$loop
ldw -12(%r30),%r1
-L$end ldw 0(%r26),%r29
- sub %r29,%r19,%r22
- add %r22,%r19,%r0
+L$end:
+ ldw 0(%r26),%r29
+ sub %r29,%r20,%r22
+ add %r22,%r20,%r0
stws,ma %r22,4(%r26)
- addc %r28,%r1,%r19
+ addc %r28,%r1,%r20
ldw -16(%r30),%r28
ldws 0(%r26),%r29
addc %r0,%r28,%r28
- sub %r29,%r19,%r22
- add %r22,%r19,%r0
+ sub %r29,%r20,%r22
+ add %r22,%r20,%r0
stws,ma %r22,4(%r26)
addc %r0,%r28,%r28
bv 0(%r2)
ldo -64(%r30),%r30
-L$just_one_limb
+L$just_one_limb:
xmpyu %fr4,%fr5,%fr6
ldw 0(%r26),%r29
fstds %fr6,-16(%r30)
diff --git a/sysdeps/hppa/hppa1.1/udiv_qrnnd.s b/sysdeps/hppa/hppa1.1/udiv_qrnnd.s
index bf7dc70cd7..c0a02d89ad 100644
--- a/sysdeps/hppa/hppa1.1/udiv_qrnnd.s
+++ b/sysdeps/hppa/hppa1.1/udiv_qrnnd.s
@@ -1,53 +1,55 @@
-; HP-PA __udiv_qrnnd division support, used from longlong.h.
-; This version runs fast on PA 7000 and later.
+;! HP-PA __udiv_qrnnd division support, used from longlong.h.
+;! This version runs fast on PA 7000 and later.
-; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+;! Copyright (C) 1993, 1994 Free Software Foundation, Inc.
-; This file is part of the GNU MP Library.
+;! This file is part of the GNU MP Library.
-; The GNU MP Library is free software; you can redistribute it and/or modify
-; it under the terms of the GNU Library General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or (at your
-; option) any later version.
+;! The GNU MP Library is free software; you can redistribute it and/or modify
+;! it under the terms of the GNU Library General Public License as published by
+;! the Free Software Foundation; either version 2 of the License, or (at your
+;! option) any later version.
-; The GNU MP Library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-; License for more details.
+;! The GNU MP Library is distributed in the hope that it will be useful, but
+;! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+;! License for more details.
-; You should have received a copy of the GNU Library General Public License
-; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
-; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-; MA 02111-1307, USA.
+;! You should have received a copy of the GNU Library General Public License
+;! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;! MA 02111-1307, USA.
-; INPUT PARAMETERS
-; rem_ptr gr26
-; n1 gr25
-; n0 gr24
-; d gr23
+;! INPUT PARAMETERS
+;! rem_ptr gr26
+;! n1 gr25
+;! n0 gr24
+;! d gr23
- .code
-L$0000 .word 0x43f00000
+ .text
+L$0000:
+ .word 0x43f00000
.word 0x0
.export __udiv_qrnnd
-__udiv_qrnnd
+__udiv_qrnnd:
.proc
.callinfo frame=64,no_calls
.entry
ldo 64(%r30),%r30
- stws %r25,-16(0,%r30) ; n_hi
- stws %r24,-12(0,%r30) ; n_lo
- ldil L'L$0000,%r19
- ldo R'L$0000(%r19),%r19
+ stws %r25,-16(0,%r30) ;! n_hi
+ stws %r24,-12(0,%r30) ;! n_lo
+ b,l L$0,%r1
+ ldo L$0000-L$0(%r1),%r1
+L$0:
fldds -16(0,%r30),%fr5
stws %r23,-12(0,%r30)
comib,<= 0,%r25,L$1
fcnvxf,dbl,dbl %fr5,%fr5
- fldds 0(0,%r19),%fr4
+ fldds 0(0,%r1),%fr4
fadd,dbl %fr4,%fr5,%fr5
-L$1
+L$1:
fcpy,sgl %fr0,%fr6L
fldws -12(0,%r30),%fr6R
fcnvxf,dbl,dbl %fr6,%fr4
@@ -62,13 +64,14 @@ L$1
ldws -12(0,%r30),%r21
ldws -16(0,%r30),%r20
sub %r24,%r21,%r22
- subb %r25,%r20,%r19
- comib,= 0,%r19,L$2
+ subb %r25,%r20,%r1
+ comib,= 0,%r1,L$2
ldo -64(%r30),%r30
add %r22,%r23,%r22
ldo -1(%r28),%r28
-L$2 bv 0(%r2)
+L$2:
+ bv 0(%r2)
stws %r22,0(0,%r26)
.exit
diff --git a/sysdeps/hppa/lshift.s b/sysdeps/hppa/lshift.s
index abac6ec201..de6dd761ca 100644
--- a/sysdeps/hppa/lshift.s
+++ b/sysdeps/hppa/lshift.s
@@ -1,34 +1,34 @@
-; HP-PA __mpn_lshift --
+;! HP-PA __mpn_lshift --
-; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
+;! Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-; This file is part of the GNU MP Library.
+;! This file is part of the GNU MP Library.
-; The GNU MP Library is free software; you can redistribute it and/or modify
-; it under the terms of the GNU Library General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or (at your
-; option) any later version.
+;! The GNU MP Library is free software; you can redistribute it and/or modify
+;! it under the terms of the GNU Library General Public License as published by
+;! the Free Software Foundation; either version 2 of the License, or (at your
+;! option) any later version.
-; The GNU MP Library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-; License for more details.
+;! The GNU MP Library is distributed in the hope that it will be useful, but
+;! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+;! License for more details.
-; You should have received a copy of the GNU Library General Public License
-; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
-; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-; MA 02111-1307, USA.
+;! You should have received a copy of the GNU Library General Public License
+;! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;! MA 02111-1307, USA.
-; INPUT PARAMETERS
-; res_ptr gr26
-; s_ptr gr25
-; size gr24
-; cnt gr23
+;! INPUT PARAMETERS
+;! res_ptr gr26
+;! s_ptr gr25
+;! size gr24
+;! cnt gr23
- .code
+ .text
.export __mpn_lshift
-__mpn_lshift
+__mpn_lshift:
.proc
.callinfo frame=64,no_calls
.entry
@@ -39,12 +39,12 @@ __mpn_lshift
subi 32,%r23,%r1
mtsar %r1
addib,= -1,%r24,L$0004
- vshd %r0,%r22,%r28 ; compute carry out limb
+ vshd %r0,%r22,%r28 ;! compute carry out limb
ldws,mb -4(0,%r25),%r29
addib,= -1,%r24,L$0002
vshd %r22,%r29,%r20
-L$loop ldws,mb -4(0,%r25),%r22
+L$loop: ldws,mb -4(0,%r25),%r22
stws,mb %r20,-4(0,%r26)
addib,= -1,%r24,L$0003
vshd %r29,%r22,%r20
@@ -53,12 +53,12 @@ L$loop ldws,mb -4(0,%r25),%r22
addib,<> -1,%r24,L$loop
vshd %r22,%r29,%r20
-L$0002 stws,mb %r20,-4(0,%r26)
+L$0002: stws,mb %r20,-4(0,%r26)
vshd %r29,%r0,%r20
bv 0(%r2)
stw %r20,-4(0,%r26)
-L$0003 stws,mb %r20,-4(0,%r26)
-L$0004 vshd %r22,%r0,%r20
+L$0003: stws,mb %r20,-4(0,%r26)
+L$0004: vshd %r22,%r0,%r20
bv 0(%r2)
stw %r20,-4(0,%r26)
diff --git a/sysdeps/hppa/memusage.h b/sysdeps/hppa/memusage.h
new file mode 100644
index 0000000000..5a06b7b656
--- /dev/null
+++ b/sysdeps/hppa/memusage.h
@@ -0,0 +1,22 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#define GETSP() ({ register uintptr_t stack_ptr asm ("%r30"); stack_ptr; })
+#define STACK_GROWS_UPWARD 1
+
+#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/hppa/rshift.s b/sysdeps/hppa/rshift.s
index c1480e5abf..bba60cf2c4 100644
--- a/sysdeps/hppa/rshift.s
+++ b/sysdeps/hppa/rshift.s
@@ -1,34 +1,34 @@
-; HP-PA __mpn_rshift --
+;! HP-PA __mpn_rshift --
-; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
+;! Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-; This file is part of the GNU MP Library.
+;! This file is part of the GNU MP Library.
-; The GNU MP Library is free software; you can redistribute it and/or modify
-; it under the terms of the GNU Library General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or (at your
-; option) any later version.
+;! The GNU MP Library is free software; you can redistribute it and/or modify
+;! it under the terms of the GNU Library General Public License as published by
+;! the Free Software Foundation; either version 2 of the License, or (at your
+;! option) any later version.
-; The GNU MP Library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-; License for more details.
+;! The GNU MP Library is distributed in the hope that it will be useful, but
+;! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+;! License for more details.
-; You should have received a copy of the GNU Library General Public License
-; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
-; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-; MA 02111-1307, USA.
+;! You should have received a copy of the GNU Library General Public License
+;! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;! MA 02111-1307, USA.
-; INPUT PARAMETERS
-; res_ptr gr26
-; s_ptr gr25
-; size gr24
-; cnt gr23
+;! INPUT PARAMETERS
+;! res_ptr gr26
+;! s_ptr gr25
+;! size gr24
+;! cnt gr23
- .code
+ .text
.export __mpn_rshift
-__mpn_rshift
+__mpn_rshift:
.proc
.callinfo frame=64,no_calls
.entry
@@ -36,12 +36,12 @@ __mpn_rshift
ldws,ma 4(0,%r25),%r22
mtsar %r23
addib,= -1,%r24,L$0004
- vshd %r22,%r0,%r28 ; compute carry out limb
+ vshd %r22,%r0,%r28 ;! compute carry out limb
ldws,ma 4(0,%r25),%r29
addib,= -1,%r24,L$0002
vshd %r29,%r22,%r20
-L$loop ldws,ma 4(0,%r25),%r22
+L$loop: ldws,ma 4(0,%r25),%r22
stws,ma %r20,4(0,%r26)
addib,= -1,%r24,L$0003
vshd %r22,%r29,%r20
@@ -50,12 +50,12 @@ L$loop ldws,ma 4(0,%r25),%r22
addib,<> -1,%r24,L$loop
vshd %r29,%r22,%r20
-L$0002 stws,ma %r20,4(0,%r26)
+L$0002: stws,ma %r20,4(0,%r26)
vshd %r0,%r29,%r20
bv 0(%r2)
stw %r20,0(0,%r26)
-L$0003 stws,ma %r20,4(0,%r26)
-L$0004 vshd %r0,%r22,%r20
+L$0003: stws,ma %r20,4(0,%r26)
+L$0004: vshd %r0,%r22,%r20
bv 0(%r2)
stw %r20,0(0,%r26)
diff --git a/sysdeps/hppa/setjmp.S b/sysdeps/hppa/setjmp.S
new file mode 100644
index 0000000000..0890975b88
--- /dev/null
+++ b/sysdeps/hppa/setjmp.S
@@ -0,0 +1,69 @@
+/* setjmp for HPPA.
+ Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+
+
+ .text
+ .align 4
+ .import __sigjmp_save, code
+ .globl __sigsetjmp
+ .export __sigsetjmp, code
+ .proc
+ .callinfo
+__sigsetjmp:
+ stw %r3, 0(%r26)
+ stw %r4, 8(%r26)
+ stw %r5, 12(%r26)
+ stw %r6, 16(%r26)
+ stw %r7, 20(%r26)
+ stw %r8, 24(%r26)
+ stw %r9, 28(%r26)
+ stw %r10, 32(%r26)
+ stw %r11, 36(%r26)
+ stw %r12, 40(%r26)
+ stw %r13, 44(%r26)
+ stw %r14, 48(%r26)
+ stw %r15, 52(%r26)
+ stw %r16, 56(%r26)
+ stw %r17, 60(%r26)
+ stw %r18, 64(%r26)
+ stw %r19, 68(%r26)
+ stw %r27, 72(%r26)
+ stw %r30, 76(%r26)
+
+ stw %rp, 80(%r26)
+
+ ldo 88(%r26),%r19
+ fstds,ma %fr12, 8(%r19) /* 88 */
+ fstds,ma %fr13, 8(%r19) /* 96 */
+ fstds,ma %fr14, 8(%r19) /* 104 */
+ fstds,ma %fr15, 8(%r19) /* 112 */
+ fstds,ma %fr16, 8(%r19) /* 120 */
+ fstds,ma %fr17, 8(%r19) /* 128 */
+ fstds,ma %fr18, 8(%r19) /* 136 */
+ fstds,ma %fr19, 8(%r19) /* 144 */
+ fstds,ma %fr20, 8(%r19) /* 152 */
+ fstds %fr21, 0(%r19) /* 160 */
+ b __sigjmp_save
+ nop
+ .procend
diff --git a/sysdeps/hppa/sub_n.s b/sysdeps/hppa/sub_n.s
index 04fa3e1e33..b50bb11e51 100644
--- a/sysdeps/hppa/sub_n.s
+++ b/sysdeps/hppa/sub_n.s
@@ -1,56 +1,56 @@
-; HP-PA __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-; store difference in a third limb vector.
+;! HP-PA __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
+;! store difference in a third limb vector.
-; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
+;! Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-; This file is part of the GNU MP Library.
+;! This file is part of the GNU MP Library.
-; The GNU MP Library is free software; you can redistribute it and/or modify
-; it under the terms of the GNU Library General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or (at your
-; option) any later version.
+;! The GNU MP Library is free software; you can redistribute it and/or modify
+;! it under the terms of the GNU Library General Public License as published by
+;! the Free Software Foundation; either version 2 of the License, or (at your
+;! option) any later version.
-; The GNU MP Library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-; License for more details.
+;! The GNU MP Library is distributed in the hope that it will be useful, but
+;! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+;! License for more details.
-; You should have received a copy of the GNU Library General Public License
-; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
-; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-; MA 02111-1307, USA.
+;! You should have received a copy of the GNU Library General Public License
+;! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;! MA 02111-1307, USA.
-; INPUT PARAMETERS
-; res_ptr gr26
-; s1_ptr gr25
-; s2_ptr gr24
-; size gr23
+;! INPUT PARAMETERS
+;! res_ptr gr26
+;! s1_ptr gr25
+;! s2_ptr gr24
+;! size gr23
-; One might want to unroll this as for other processors, but it turns
-; out that the data cache contention after a store makes such
-; unrolling useless. We can't come under 5 cycles/limb anyway.
+;! One might want to unroll this as for other processors, but it turns
+;! out that the data cache contention after a store makes such
+;! unrolling useless. We can't come under 5 cycles/limb anyway.
- .code
+ .text
.export __mpn_sub_n
-__mpn_sub_n
+__mpn_sub_n:
.proc
.callinfo frame=0,no_calls
.entry
- ldws,ma 4(0,%r25),%r20
- ldws,ma 4(0,%r24),%r19
+ ldws,ma 4(0,%r25),%r21
+ ldws,ma 4(0,%r24),%r20
- addib,= -1,%r23,L$end ; check for (SIZE == 1)
- sub %r20,%r19,%r28 ; subtract first limbs ignoring cy
+ addib,= -1,%r23,L$end ;! check for (SIZE == 1)
+ sub %r21,%r20,%r28 ;! subtract first limbs ignoring cy
-L$loop ldws,ma 4(0,%r25),%r20
- ldws,ma 4(0,%r24),%r19
+L$loop: ldws,ma 4(0,%r25),%r21
+ ldws,ma 4(0,%r24),%r20
stws,ma %r28,4(0,%r26)
addib,<> -1,%r23,L$loop
- subb %r20,%r19,%r28
+ subb %r21,%r20,%r28
-L$end stws %r28,0(0,%r26)
+L$end: stws %r28,0(0,%r26)
addc %r0,%r0,%r28
bv 0(%r2)
subi 1,%r28,%r28
diff --git a/sysdeps/hppa/sysdep.h b/sysdeps/hppa/sysdep.h
index 735882da09..2ac9840355 100644
--- a/sysdeps/hppa/sysdep.h
+++ b/sysdeps/hppa/sysdep.h
@@ -20,6 +20,11 @@
#include <sysdeps/generic/sysdep.h>
#include <sys/syscall.h>
+#include "config.h"
+
+#ifndef ASM_LINE_SEP
+#define ASM_LINE_SEP ;
+#endif
#ifdef __ASSEMBLER__
@@ -34,13 +39,12 @@
incomplete stabs information. Fake some entries here which specify
the current source file. */
#define ENTRY(name) \
- .SPACE $TEXT$; \
- .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY; \
- .align ALIGNARG(4); \
- .NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY; \
- .EXPORT C_SYMBOL_NAME(name),ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR; \
+ .SPACE $TEXT$ ASM_LINE_SEP \
+ .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY ASM_LINE_SEP \
+ .align ALIGNARG(4) ASM_LINE_SEP \
+ .NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY ASM_LINE_SEP \
+ .EXPORT C_SYMBOL_NAME(name),ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR ASM_LINE_SEP\
C_LABEL(name) \
-
CALL_MCOUNT
#undef END
@@ -53,7 +57,7 @@
/* The mcount code relies on a normal frame pointer being on the stack
to locate our caller, so push one just for its benefit. */
#define CALL_MCOUNT \
- XXX
+ XXX ASM_LINE_SEP
#else
#define CALL_MCOUNT /* Do nothing. */
#endif
diff --git a/sysdeps/hppa/udiv_qrnnd.s b/sysdeps/hppa/udiv_qrnnd.s
index 9b45eb40df..053205720b 100644
--- a/sysdeps/hppa/udiv_qrnnd.s
+++ b/sysdeps/hppa/udiv_qrnnd.s
@@ -1,45 +1,45 @@
-; HP-PA __udiv_qrnnd division support, used from longlong.h.
-; This version runs fast on pre-PA7000 CPUs.
+;! HP-PA __udiv_qrnnd division support, used from longlong.h.
+;! This version runs fast on pre-PA7000 CPUs.
-; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+;! Copyright (C) 1993, 1994 Free Software Foundation, Inc.
-; This file is part of the GNU MP Library.
+;! This file is part of the GNU MP Library.
-; The GNU MP Library is free software; you can redistribute it and/or modify
-; it under the terms of the GNU Library General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or (at your
-; option) any later version.
+;! The GNU MP Library is free software; you can redistribute it and/or modify
+;! it under the terms of the GNU Library General Public License as published by
+;! the Free Software Foundation; either version 2 of the License, or (at your
+;! option) any later version.
-; The GNU MP Library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
-; License for more details.
+;! The GNU MP Library is distributed in the hope that it will be useful, but
+;! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+;! License for more details.
-; You should have received a copy of the GNU Library General Public License
-; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
-; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-; MA 02111-1307, USA.
+;! You should have received a copy of the GNU Library General Public License
+;! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
+;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;! MA 02111-1307, USA.
-; INPUT PARAMETERS
-; rem_ptr gr26
-; n1 gr25
-; n0 gr24
-; d gr23
+;! INPUT PARAMETERS
+;! rem_ptr gr26
+;! n1 gr25
+;! n0 gr24
+;! d gr23
-; The code size is a bit excessive. We could merge the last two ds;addc
-; sequences by simply moving the "bb,< Odd" instruction down. The only
-; trouble is the FFFFFFFF code that would need some hacking.
+;! The code size is a bit excessive. We could merge the last two ds;addc
+;! sequences by simply moving the "bb,< Odd" instruction down. The only
+;! trouble is the FFFFFFFF code that would need some hacking.
- .code
+ .text
.export __udiv_qrnnd
-__udiv_qrnnd
+__udiv_qrnnd:
.proc
.callinfo frame=0,no_calls
.entry
comb,< %r23,0,L$largedivisor
- sub %r0,%r23,%r1 ; clear cy as side-effect
+ sub %r0,%r23,%r1 ;! clear cy as side-effect
ds %r0,%r1,%r0
addc %r24,%r24,%r24
ds %r25,%r23,%r25
@@ -111,12 +111,12 @@ __udiv_qrnnd
bv 0(%r2)
addc %r28,%r28,%r28
-L$largedivisor
- extru %r24,31,1,%r19 ; r19 = n0 & 1
+L$largedivisor:
+ extru %r24,31,1,%r20 ;! r20 = n0 & 1
bb,< %r23,31,L$odd
- extru %r23,30,31,%r22 ; r22 = d >> 1
- shd %r25,%r24,1,%r24 ; r24 = new n0
- extru %r25,30,31,%r25 ; r25 = new n1
+ extru %r23,30,31,%r22 ;! r22 = d >> 1
+ shd %r25,%r24,1,%r24 ;! r24 = new n0
+ extru %r25,30,31,%r25 ;! r25 = new n1
sub %r0,%r22,%r21
ds %r0,%r21,%r0
addc %r24,%r24,%r24
@@ -185,14 +185,14 @@ L$largedivisor
ds %r25,%r22,%r25
comclr,>= %r25,%r0,%r0
addl %r25,%r22,%r25
- sh1addl %r25,%r19,%r25
+ sh1addl %r25,%r20,%r25
stws %r25,0(0,%r26)
bv 0(%r2)
addc %r24,%r24,%r28
-L$odd addib,sv,n 1,%r22,L$FF.. ; r22 = (d / 2 + 1)
- shd %r25,%r24,1,%r24 ; r24 = new n0
- extru %r25,30,31,%r25 ; r25 = new n1
+L$odd: addib,sv,n 1,%r22,L$FF.. ;! r22 = (d / 2 + 1)
+ shd %r25,%r24,1,%r24 ;! r24 = new n0
+ extru %r25,30,31,%r25 ;! r25 = new n1
sub %r0,%r22,%r21
ds %r0,%r21,%r0
addc %r24,%r24,%r24
@@ -262,8 +262,8 @@ L$odd addib,sv,n 1,%r22,L$FF.. ; r22 = (d / 2 + 1)
addc %r24,%r24,%r28
comclr,>= %r25,%r0,%r0
addl %r25,%r22,%r25
- sh1addl %r25,%r19,%r25
-; We have computed (n1,,n0) / (d + 1), q' = r28, r' = r25
+ sh1addl %r25,%r20,%r25
+;! We have computed (n1,,n0) / (d + 1), q' = r28, r' = r25
add,nuv %r28,%r25,%r25
addl %r25,%r1,%r25
addc %r0,%r28,%r28
@@ -273,9 +273,9 @@ L$odd addib,sv,n 1,%r22,L$FF.. ; r22 = (d / 2 + 1)
bv 0(%r2)
addc %r0,%r28,%r28
-; This is just a special case of the code above.
-; We come here when d == 0xFFFFFFFF
-L$FF.. add,uv %r25,%r24,%r24
+;! This is just a special case of the code above.
+;! We come here when d == 0xFFFFFFFF
+L$FF..: add,uv %r25,%r24,%r24
sub,<< %r24,%r23,%r0
ldo 1(%r24),%r24
stws %r24,0(0,%r26)