summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Thorpe <thorpej@netbsd.org>2002-05-26 23:06:08 +0000
committerJason Thorpe <thorpej@netbsd.org>2002-05-26 23:06:08 +0000
commitad0d47ff8a8b34d5b7b97164a6561104322c1210 (patch)
tree6e4a098833280b0233bcedcc33a68eac85c8a9cf
parent9110162d31351285a9daa8ef3a9b73b5a8beef15 (diff)
downloadgdb-ad0d47ff8a8b34d5b7b97164a6561104322c1210.tar.gz
* ns32k-tdep.c (ns32k_saved_pc_after_call,
ns32k_store_struct_return, ns32k_extract_return_value, ns32k_store_return_value, ns32k_extract_struct_value_address): New functions. * config/ns32k/tm-umax.h (SAVED_PC_AFTER_CALL): Define as ns32k_saved_pc_after_call. (STORE_STRUCT_RETURN): Define as ns32k_store_struct_return. (EXTRACT_RETURN_VALUE): Define as ns32k_extract_return_value. (STORE_RETURN_VALUE): Define as ns32k_store_return_value. (EXTRACT_STRUCT_VALUE_ADDRESS): Define as ns32k_extract_struct_value_address.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/config/ns32k/tm-umax.h45
-rw-r--r--gdb/ns32k-tdep.c38
3 files changed, 67 insertions, 30 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6bff1d763c8..dfb344350f3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,19 @@
2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
+ * ns32k-tdep.c (ns32k_saved_pc_after_call,
+ ns32k_store_struct_return, ns32k_extract_return_value,
+ ns32k_store_return_value, ns32k_extract_struct_value_address): New
+ functions.
+ * config/ns32k/tm-umax.h (SAVED_PC_AFTER_CALL): Define as
+ ns32k_saved_pc_after_call.
+ (STORE_STRUCT_RETURN): Define as ns32k_store_struct_return.
+ (EXTRACT_RETURN_VALUE): Define as ns32k_extract_return_value.
+ (STORE_RETURN_VALUE): Define as ns32k_store_return_value.
+ (EXTRACT_STRUCT_VALUE_ADDRESS): Define as
+ ns32k_extract_struct_value_address.
+
+2002-05-26 Jason Thorpe <thorpej@wasabisystems.com>
+
* ns32k-tdep.c (ns32k_call_dummy_words, sizeof_ns32k_call_dummy_words,
ns32k_fix_call_dummy): New.
* config/ns32k/tm-umax.h (CALL_DUMMY_WORDS): Define as
diff --git a/gdb/config/ns32k/tm-umax.h b/gdb/config/ns32k/tm-umax.h
index 636e9d7d70a..0ddd6d13f4e 100644
--- a/gdb/config/ns32k/tm-umax.h
+++ b/gdb/config/ns32k/tm-umax.h
@@ -21,6 +21,9 @@
#include "regcache.h"
+struct value;
+struct type;
+
/* Need to get function ends by adding this to epilogue address from .bf
record, not using x_fsize field. */
#define FUNCTION_EPILOGUE_SIZE 4
@@ -36,13 +39,8 @@
extern CORE_ADDR umax_skip_prologue (CORE_ADDR);
#define SKIP_PROLOGUE(pc) (umax_skip_prologue (pc))
-/* Immediately after a function call, return the saved pc.
- Can't always go through the frames for this because on some machines
- the new frame is not set up until the new function executes
- some instructions. */
-
-#define SAVED_PC_AFTER_CALL(frame) \
- read_memory_integer (read_register (SP_REGNUM), 4)
+CORE_ADDR ns32k_saved_pc_after_call (struct frame_info *);
+#define SAVED_PC_AFTER_CALL(frame) ns32k_saved_pc_after_call ((frame))
/* Address of end of stack space. */
@@ -126,32 +124,21 @@ extern int ns32k_register_virtual_size (int);
struct type *ns32k_register_virtual_type (int);
#define REGISTER_VIRTUAL_TYPE(N) ns32k_register_virtual_type ((N))
-/* Store the address of the place in which to copy the structure the
- subroutine will return. This is called from call_function.
-
- On this machine this is a no-op, because gcc isn't used on it
- yet. So this calling convention is not used. */
-
-#define STORE_STRUCT_RETURN(ADDR, SP)
-
-/* Extract from an array REGBUF containing the (raw) register state
- a function return value of type TYPE, and copy that, in virtual format,
- into VALBUF. */
+extern void ns32k_store_struct_return (CORE_ADDR, CORE_ADDR);
+#define STORE_STRUCT_RETURN(ADDR, SP) \
+ ns32k_store_struct_return ((ADDR), (SP))
+extern void ns32k_extract_return_value (struct type *, char *, char *);
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- memcpy (VALBUF, REGBUF+REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 0), TYPE_LENGTH (TYPE))
-
-/* Write into appropriate registers a function return value
- of type TYPE, given in virtual format. */
+ ns32k_extract_return_value ((TYPE), (REGBUF), (VALBUF))
+extern void ns32k_store_return_value (struct type *, char *);
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
- write_register_bytes (REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 0), VALBUF, TYPE_LENGTH (TYPE))
-
-/* Extract from an array REGBUF containing the (raw) register state
- the address in which a function should return its structure value,
- as a CORE_ADDR (or an expression that can be used as one). */
+ ns32k_store_return_value ((TYPE), (VALBUF))
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
+extern CORE_ADDR ns32k_extract_struct_value_address (char *);
+#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+ ns32k_extract_struct_value_address ((REGBUF))
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
@@ -198,8 +185,6 @@ extern int sizeof_ns32k_call_dummy_words;
#define CALL_DUMMY_START_OFFSET 3
-struct value;
-struct type;
extern void ns32k_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, int,
struct value **, struct type *, int);
#define FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) \
diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c
index 66bce73fec1..752e075a43f 100644
--- a/gdb/ns32k-tdep.c
+++ b/gdb/ns32k-tdep.c
@@ -120,6 +120,17 @@ ns32k_register_virtual_type (int regno)
return (builtin_type_double);
}
+/* Immediately after a function call, return the saved PC. Can't
+ always go through the frames for this because on some systems,
+ the new frame is not set up until the new function executes some
+ instructions. */
+
+CORE_ADDR
+ns32k_saved_pc_after_call (struct frame_info *frame)
+{
+ return (read_memory_integer (read_register (SP_REGNUM), 4));
+}
+
/* Advance PC across any function entry prologue instructions
to reach some "real" code. */
@@ -434,6 +445,33 @@ ns32k_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
}
void
+ns32k_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+{
+ /* On this machine, this is a no-op (Encore Umax didn't use GCC). */
+}
+
+void
+ns32k_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
+{
+ memcpy (valbuf,
+ regbuf + REGISTER_BYTE (TYPE_CODE (valtype) == TYPE_CODE_FLT ?
+ FP0_REGNUM : 0), TYPE_LENGTH (valtype));
+}
+
+void
+ns32k_store_return_value (struct type *valtype, char *valbuf)
+{
+ write_register_bytes (TYPE_CODE (valtype) == TYPE_CODE_FLT ?
+ FP0_REGNUM : 0, valbuf, TYPE_LENGTH (valtype));
+}
+
+CORE_ADDR
+ns32k_extract_struct_value_address (char *regbuf)
+{
+ return (extract_address (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0)));
+}
+
+void
_initialize_ns32k_tdep (void)
{
tm_print_insn = print_insn_ns32k;