configure.ac: Add the POSIX thread libs to the HP-UX PA configuration.
authorAndreas Tobler <a.tobler@schweiz.ch>
Sat, 20 May 2006 21:33:07 +0000 (23:33 +0200)
committerAndreas Tobler <andreast@gcc.gnu.org>
Sat, 20 May 2006 21:33:07 +0000 (23:33 +0200)
2006-05-20  Andreas Tobler  <a.tobler@schweiz.ch>
    John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

* configure.ac: Add the POSIX thread libs to the HP-UX PA
configuration. Add signal specification for HP-UX PA.
* configure: Rebuilt.
* configure.host: Add defaults for the HP-UX PA architecture.
Add descriptor files for HP-UX PA 32-bit and 64-bit.
* include/hppa-signal.h: New file.
* include/posix.h: Add shared library suffix for HP-UX.
* sysdep/pa/descriptor-pa32-hpux.h: New file.
* sysdep/pa/descriptor-pa64-hpux.h: Likewise.

Co-Authored-By: John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
From-SVN: r113937

libjava/ChangeLog
libjava/configure
libjava/configure.ac
libjava/configure.host
libjava/include/hppa-signal.h [new file with mode: 0644]
libjava/include/posix.h
libjava/sysdep/pa/descriptor-pa32-hpux.h [new file with mode: 0644]
libjava/sysdep/pa/descriptor-pa64-hpux.h [new file with mode: 0644]

index 5313199..f55b902 100644 (file)
@@ -1,3 +1,16 @@
+2006-05-20  Andreas Tobler  <a.tobler@schweiz.ch>
+           John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       * configure.ac: Add the POSIX thread libs to the HP-UX PA
+       configuration. Add signal specification for HP-UX PA.
+       * configure: Rebuilt.
+       * configure.host: Add defaults for the HP-UX PA architecture.
+       Add descriptor files for HP-UX PA 32-bit and 64-bit.
+       * include/hppa-signal.h: New file.
+       * include/posix.h: Add shared library suffix for HP-UX.
+       * sysdep/pa/descriptor-pa32-hpux.h: New file.
+       * sysdep/pa/descriptor-pa64-hpux.h: Likewise.
+
 2006-05-19  Ranjit Mathew  <rmathew@gcc.gnu.org>
 
        * ChangeLog: Correct incorrect GNU Classpath version in the
index 070b010..9f4e8a7 100755 (executable)
@@ -9215,7 +9215,7 @@ case "$THREADS" in
        THREADLDFLAGS=-pthread
        THREADSPEC=-lpthread
        ;;
-     alpha*-dec-osf*)
+     alpha*-dec-osf* | hppa*-hp-hpux*)
        THREADCXXFLAGS=-pthread
        # boehm-gc needs some functions from librt, so link that too.
        THREADLIBS='-lpthread -lrt'
@@ -16470,6 +16470,9 @@ case "${host}" in
  hppa*-*-linux*)
     SIGNAL_HANDLER=include/pa-signal.h
     ;;
+ hppa*-hp-hpux*)
+    SIGNAL_HANDLER=include/hppa-signal.h
+    ;;
  ia64-*-linux*)
     SIGNAL_HANDLER=include/dwarf2-signal.h
     ;;
index 69f4317..6b97979 100644 (file)
@@ -805,7 +805,7 @@ case "$THREADS" in
        THREADLDFLAGS=-pthread
        THREADSPEC=-lpthread
        ;;
-     alpha*-dec-osf*)
+     alpha*-dec-osf* | hppa*-hp-hpux*)
        THREADCXXFLAGS=-pthread
        # boehm-gc needs some functions from librt, so link that too.
        THREADLIBS='-lpthread -lrt'
@@ -1371,6 +1371,9 @@ case "${host}" in
  hppa*-*-linux*)
     SIGNAL_HANDLER=include/pa-signal.h
     ;;
+ hppa*-hp-hpux*)
+    SIGNAL_HANDLER=include/hppa-signal.h
+    ;;
  ia64-*-linux*)
     SIGNAL_HANDLER=include/dwarf2-signal.h
     ;;
index e213072..c27f54c 100644 (file)
@@ -127,7 +127,7 @@ case "${host}" in
        enable_hash_synchronization_default=yes
        IEEESPEC=-mieee
        ;;
-  hppa-*)
+  hppa*-*)
        sysdeps_dir=pa
        libgcj_interpreter=yes
        enable_hash_synchronization_default=yes
@@ -273,6 +273,11 @@ EOF
        enable_hash_synchronization_default=no
        slow_pthread_self=
        ;;
+  hppa*-hp-hpux11.*)
+       slow_pthread_self=no
+       can_unwind_signal=yes
+       DIVIDESPEC=-fuse-divide-subroutine
+       ;;
 esac
 
 case "${host}" in
@@ -288,6 +293,14 @@ case "${host}" in
        descriptor_h=sysdep/descriptor-y.h
        ;;
 
+  hppa*64*-*-hpux*)
+       descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
+       ;;
+
+  hppa*-*-hpux*)
+       descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
+       ;;
+
   hppa*-*)
        descriptor_h=sysdep/pa/descriptor.h
        ;;
diff --git a/libjava/include/hppa-signal.h b/libjava/include/hppa-signal.h
new file mode 100644 (file)
index 0000000..ac4cac5
--- /dev/null
@@ -0,0 +1,68 @@
+/* hppa-signal.h - Catch runtime signals and turn them into exceptions,
+   on a HP-UX 11 PA system.  */
+
+/* Copyright (C) 2006  Free Software Foundation
+
+   This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
+details.  */
+
+/* This file is really more of a specification.  The rest of the system
+   should be arranged so that this Just Works.  */
+
+#ifndef JAVA_SIGNAL_H
+# define JAVA_SIGNAL_H 1
+
+#include <sys/types.h>
+#include <signal.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+# define HANDLE_SEGV 1
+# undef HANDLE_FPE
+
+#define SIGNAL_HANDLER(_name)                                          \
+  static void _name (int _dummy __attribute__ ((unused)),              \
+                    siginfo_t *_info __attribute__ ((__unused__)),     \
+                    void *arg __attribute__ ((__unused__)))
+
+#define MAKE_THROW_FRAME(_exception)                                   \
+do                                                                     \
+{                                                                      \
+  ucontext_t *_context = (ucontext_t *) arg;                           \
+  (void)_dummy;                                                                \
+  (void)_info;                                                         \
+  mcontext_t *mc = &(_context->uc_mcontext);                           \
+  SetSSReg (mc, ss_pcoq_head, GetSSReg (mc, ss_pcoq_tail));            \
+  SetSSReg (mc, ss_pcsq_head, GetSSReg (mc, ss_pcsq_tail));            \
+  /* This part is not quit right if the head pc was pointing           \
+     at a branch.  The tail needs to be adjusted to the branch         \
+     target if the branch is taken.  The tail space register           \
+     may need adjustment as well if the branch is an interspace                \
+     branch.  */                                                       \
+  SetSSReg (mc, ss_pcoq_tail, (GetSSReg (mc, ss_pcoq_tail) + 4));      \
+                                                                       \
+ }                                                                     \
+while (0)
+
+# define INIT_SEGV                             \
+  do {                                         \
+      struct sigaction sa;                     \
+      sa.sa_sigaction = catch_segv;            \
+      sigemptyset (&sa.sa_mask);               \
+      sa.sa_flags = SA_SIGINFO | SA_NODEFER;   \
+      sigaction (SIGSEGV, &sa, NULL);          \
+    } while (0)
+
+# define INIT_FPE                              \
+  do {                                         \
+      struct sigaction sa;                     \
+      sa.sa_sigaction = catch_fpe;             \
+      sigemptyset (&sa.sa_mask);               \
+      sa.sa_flags = SA_SIGINFO | SA_NODEFER;   \
+      sigaction (SIGFPE, &sa, NULL);           \
+    } while (0)
+
+#endif /* JAVA_SIGNAL_H */
index 4ceb008..63fc135 100644 (file)
@@ -44,6 +44,8 @@ details.  */
 #define _Jv_platform_solib_prefix "lib"
 #if defined(__APPLE__) && defined(__MACH__)
 #define _Jv_platform_solib_suffix ".dylib"
+#elif defined(HPUX) && defined(HP_PA)
+#define _Jv_platform_solib_suffix ".sl"
 #else
 #define _Jv_platform_solib_suffix ".so"
 #endif
diff --git a/libjava/sysdep/pa/descriptor-pa32-hpux.h b/libjava/sysdep/pa/descriptor-pa32-hpux.h
new file mode 100644 (file)
index 0000000..6000edb
--- /dev/null
@@ -0,0 +1,91 @@
+/* descriptor-pa32-hpux.h - Given a function pointer, extract and return the
+   actual code address of the corresponding function.
+
+   This is done by checking if the plabel bit is set. If it's not set,
+   return the function pointer.  If it's set, mask it off and extract
+   the address from the function descriptor.  This address may point
+   to an export stub.  If so, extract the branch target from the stub
+   and return it.  Otherwise, the address from the function descriptor
+   is returned.
+
+   Copyright (C) 2006  Free Software Foundation
+
+   This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
+details.  */
+
+#define UNWRAP_FUNCTION_DESCRIPTOR pa_unwrap_function_descriptor
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Extract bit field from word using HP's numbering (MSB = 0).  */
+#define GET_FIELD(X, FROM, TO)                                 \
+  ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
+
+static inline int
+sign_extend (int x, int len)
+{
+  int signbit = (1 << (len - 1));
+  int mask = (signbit << 1) - 1;
+  return ((x & mask) ^ signbit) - signbit;
+}
+
+/* Extract a 17-bit signed constant from branch instructions.  */
+static inline int
+extract_17 (unsigned word)
+{
+  return sign_extend (GET_FIELD (word, 19, 28)
+                     | GET_FIELD (word, 29, 29) << 10
+                     | GET_FIELD (word, 11, 15) << 11
+                     | (word & 0x1) << 16, 17);
+}
+
+/* Extract a 22-bit signed constant from branch instructions.  */
+static inline int
+extract_22 (unsigned word)
+{
+  return sign_extend (GET_FIELD (word, 19, 28)
+                     | GET_FIELD (word, 29, 29) << 10
+                     | GET_FIELD (word, 11, 15) << 11
+                     | GET_FIELD (word, 6, 10) << 16
+                     | (word & 0x1) << 21, 22);
+}
+
+static void *
+pa_unwrap_function_descriptor (void *addr)
+{
+  unsigned int *tmp_addr;
+
+  /* Check if plabel bit is set in function pointer.  */
+  if (!((unsigned int) addr & 2))
+    return addr;
+
+  tmp_addr = *(unsigned int **) ((unsigned int) addr & ~3);
+
+  /* If TMP_ADDR points to an export stub, adjust it so that it points
+     to the branch target of the stub.  */
+  if ((*tmp_addr & 0xffe0e002) == 0xe8400000           /* bl x,r2 */
+      && *(tmp_addr + 1) == 0x08000240                 /* nop */
+      && *(tmp_addr + 2) == 0x4bc23fd1                 /* ldw -18(sp),rp */
+      && *(tmp_addr + 3) == 0x004010a1                 /* ldsid (rp),r1 */
+      && *(tmp_addr + 4) == 0x00011820                 /* mtsp r1,sr0 */
+      && *(tmp_addr + 5) == 0xe0400002)                        /* be,n 0(sr0,rp) */
+    /* Extract target address from PA 1.x 17-bit branch.  */
+    tmp_addr += extract_17 (*tmp_addr) + 2;
+  else if ((*tmp_addr & 0xfc00e002) == 0xe800a000      /* b,l x,r2 */
+          && *(tmp_addr + 1) == 0x08000240             /* nop */
+          && *(tmp_addr + 2) == 0x4bc23fd1             /* ldw -18(sp),rp */
+          && *(tmp_addr + 3) == 0xe840d002)            /* bve,n (rp) */
+    /* Extract target address from PA 2.0 22-bit branch.  */
+    tmp_addr += extract_22 (*tmp_addr) + 2;
+
+  return (void *) tmp_addr;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/libjava/sysdep/pa/descriptor-pa64-hpux.h b/libjava/sysdep/pa/descriptor-pa64-hpux.h
new file mode 100644 (file)
index 0000000..bc6af6b
--- /dev/null
@@ -0,0 +1,6 @@
+// Given a function pointer, return the code address.
+// If the plabel bit is set, mask it off and return the code from the
+// first word of the function descriptor.  Otherwise, the function
+// pointer is the code address.
+
+#define UNWRAP_FUNCTION_DESCRIPTOR(X) *(void **)((unsigned long) (X) + 16)