summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2003-05-22 02:04:05 +0000
committerJoel Brobecker <brobecker@gnat.com>2003-05-22 02:04:05 +0000
commit66a2b816fe22c7e2a0aa0e38dba3c1aa99cab760 (patch)
treef61539f3bacf3482d7e69837f586878ac557b6a2
parent2b8e6bbd4201d8bf159bf9b253425449885dee29 (diff)
downloadgdb-66a2b816fe22c7e2a0aa0e38dba3c1aa99cab760.tar.gz
* config/pa/tm-hppa.h: Delete some unused macros. Move some
macro definitions from here... * hppa-tdep.c: ...to there.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/config/pa/tm-hppah.h2
-rw-r--r--gdb/hppa-tdep.c57
3 files changed, 52 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9cf50e6ec02..f05acf16b83 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-21 J. Brobecker <brobecker@gnat.com>
+
+ * config/pa/tm-hppa.h: Delete some unused macros. Move some
+ macro definitions from here...
+ * hppa-tdep.c: ...to there.
+
2003-05-20 Kevin Buettner <kevinb@redhat.com>
* mips-nat.c (REGISTER_PTRACE_ADDR): Convert macro to function
diff --git a/gdb/config/pa/tm-hppah.h b/gdb/config/pa/tm-hppah.h
index 070c83ce514..290f752d0a3 100644
--- a/gdb/config/pa/tm-hppah.h
+++ b/gdb/config/pa/tm-hppah.h
@@ -35,8 +35,10 @@ struct frame_info;
#include "somsolib.h"
#endif
+#if !GDB_MULTI_ARCH
extern int hppa_hpux_pc_in_sigtramp (CORE_ADDR pc, char *name);
#define PC_IN_SIGTRAMP(pc, name) hppa_hpux_pc_in_sigtramp (pc, name)
+#endif
extern void hppa_hpux_frame_saved_pc_in_sigtramp (struct frame_info *fi,
CORE_ADDR *tmp);
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index e8d62db6579..1f78d06d164 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -68,11 +68,33 @@
/* Some local constants. */
static const int hppa_num_regs = 128;
+/* Get at various relevent fields of an instruction word. */
+#define MASK_5 0x1f
+#define MASK_11 0x7ff
+#define MASK_14 0x3fff
+#define MASK_21 0x1fffff
+
+/* Define offsets into the call dummy for the target function address.
+ See comments related to CALL_DUMMY for more info. */
+#define FUNC_LDIL_OFFSET (INSTRUCTION_SIZE * 9)
+#define FUNC_LDO_OFFSET (INSTRUCTION_SIZE * 10)
+
+/* Define offsets into the call dummy for the _sr4export address.
+ See comments related to CALL_DUMMY for more info. */
+#define SR4EXPORT_LDIL_OFFSET (INSTRUCTION_SIZE * 12)
+#define SR4EXPORT_LDO_OFFSET (INSTRUCTION_SIZE * 13)
+
/* To support detection of the pseudo-initial frame
that threads have. */
#define THREAD_INITIAL_FRAME_SYMBOL "__pthread_exit"
#define THREAD_INITIAL_FRAME_SYM_LEN sizeof(THREAD_INITIAL_FRAME_SYMBOL)
+/* Sizes (in bytes) of the native unwind entries. */
+#define UNWIND_ENTRY_SIZE 16
+#define STUB_UNWIND_ENTRY_SIZE 8
+
+static int get_field (unsigned word, int from, int to);
+
static int extract_5_load (unsigned int);
static unsigned extract_5R_store (unsigned int);
@@ -224,6 +246,15 @@ low_sign_extend (unsigned val, unsigned bits)
return (int) ((val & 0x1 ? (-1 << (bits - 1)) : 0) | val >> 1);
}
+/* Extract the bits at positions between FROM and TO, using HP's numbering
+ (MSB = 0). */
+
+static int
+get_field (unsigned word, int from, int to)
+{
+ return ((word) >> (31 - (to)) & ((1 << ((to) - (from) + 1)) - 1));
+}
+
/* extract the immediate field from a ld{bhw}s instruction */
static int
@@ -275,15 +306,15 @@ extract_21 (unsigned word)
word &= MASK_21;
word <<= 11;
- val = GET_FIELD (word, 20, 20);
+ val = get_field (word, 20, 20);
val <<= 11;
- val |= GET_FIELD (word, 9, 19);
+ val |= get_field (word, 9, 19);
val <<= 2;
- val |= GET_FIELD (word, 5, 6);
+ val |= get_field (word, 5, 6);
val <<= 5;
- val |= GET_FIELD (word, 0, 4);
+ val |= get_field (word, 0, 4);
val <<= 2;
- val |= GET_FIELD (word, 7, 8);
+ val |= get_field (word, 7, 8);
return sign_extend (val, 21) << 11;
}
@@ -296,15 +327,15 @@ deposit_21 (unsigned opnd, unsigned word)
{
unsigned val = 0;
- val |= GET_FIELD (opnd, 11 + 14, 11 + 18);
+ val |= get_field (opnd, 11 + 14, 11 + 18);
val <<= 2;
- val |= GET_FIELD (opnd, 11 + 12, 11 + 13);
+ val |= get_field (opnd, 11 + 12, 11 + 13);
val <<= 2;
- val |= GET_FIELD (opnd, 11 + 19, 11 + 20);
+ val |= get_field (opnd, 11 + 19, 11 + 20);
val <<= 11;
- val |= GET_FIELD (opnd, 11 + 1, 11 + 11);
+ val |= get_field (opnd, 11 + 1, 11 + 11);
val <<= 1;
- val |= GET_FIELD (opnd, 11 + 0, 11 + 0);
+ val |= get_field (opnd, 11 + 0, 11 + 0);
return word | val;
}
@@ -314,9 +345,9 @@ deposit_21 (unsigned opnd, unsigned word)
static 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 |
+ return sign_extend (get_field (word, 19, 28) |
+ get_field (word, 29, 29) << 10 |
+ get_field (word, 11, 15) << 11 |
(word & 0x1) << 16, 17) << 2;
}