* ns32k-tdep.c (ns32k_saved_pc_after_call,
authorJason Thorpe <thorpej@netbsd.org>
Sun, 26 May 2002 23:06:08 +0000 (23:06 +0000)
committerJason Thorpe <thorpej@netbsd.org>
Sun, 26 May 2002 23:06:08 +0000 (23:06 +0000)
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.

gdb/ChangeLog
gdb/config/ns32k/tm-umax.h
gdb/ns32k-tdep.c

index 6bff1d763c89422cd30896b2816d3975209893d0..dfb344350f36c67646f26184f74f00316ae06132 100644 (file)
@@ -1,3 +1,17 @@
+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,
index 636e9d7d70ae22167c7a73dba3aa257fe5327baa..0ddd6d13f4efc6b2e1ddb30df155f909787d322a 100644 (file)
@@ -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
 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))
 \f
 /* 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) \
index 66bce73fec1f6ff1de1755586838881f0319046c..752e075a43f0135c8a489519573dcea7119773b3 100644 (file)
@@ -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,
 }
 \f
 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)));
+}
+\f
+void
 _initialize_ns32k_tdep (void)
 {
   tm_print_insn = print_insn_ns32k;
This page took 0.028116 seconds and 4 git commands to generate.