* serial.h (SERIAL_SET_TTY_STATE): Comment return value.
[deliverable/binutils-gdb.git] / gdb / alpha-tdep.c
index 57e098f08c71f5c17f53376b43141293a908afd1..a1b53e6e378a68690f506f2b2ad4b7a680b93899 100644 (file)
@@ -51,9 +51,6 @@ alpha_in_lenient_prologue PARAMS ((CORE_ADDR, CORE_ADDR));
 static void
 reinit_frame_cache_sfunc PARAMS ((char *, int, struct cmd_list_element *));
 
-void
-_initialize_alpha_tdep PARAMS ((void));
-
 /* Heuristic_proc_start may hunt through the text section for a long
    time across a 2400 baud serial line.  Allows the user to limit this
    search.  */
@@ -71,8 +68,8 @@ static unsigned int heuristic_fence_post = 0;
    |  |localoff        |  Copies of 1st .. 6th         |
    |  |  |  |  |  argument if necessary.       |
    |  |  |  v  |                               |
-   |  |  |  ---        |-------------------------------|<-- FRAME_ARGS_ADDRESS,
-   |  |  |      |                              |    FRAME_LOCALS_ADDRESS
+   |  |  |  ---        |-------------------------------|<-- FRAME_LOCALS_ADDRESS
+   |  |  |      |                              |
    |  |  |      |  Locals and temporaries.     |
    |  |  |      |                              |
    |  |  |      |-------------------------------|
@@ -469,24 +466,6 @@ init_extra_frame_info(fci)
         even if we are in the middle of the prologue.  */
       fci->localoff = PROC_LOCALOFF(proc_desc);
 
-      /* FIXME: This is a kludge for gcc-2.4.5.
-        gcc-2.4.5 builds frames for the alpha in a peculiar way.
-        It uses $fp as a frame register (which seems to be identical to $sp
-        in all procedures that do not use alloca).
-        It has the arguments and the locals above the frame register, if
-        there are few arguments then the locals are above the arguments,
-        otherwise the arguments are above the local.
-        Frame offsets for arguments and locals are relative to $fp and always
-        positive.
-        If we want to stay compatible with the native cc compiler we have
-        to set localoff to frameoffset so that FRAME_ARGS_ADDRESS and
-        FRAME_LOCALS_ADDRESS point to the right place in the frame.
-        Please note that the setting of localoff in the compiler won't work
-        as localoff is only 8 bits wide (which is enough for cc as it needs
-        at most number_of_arg_regs * 8 == 48).  */
-      if (PROC_FRAME_REG(proc_desc) == GCC_FP_REGNUM)
-       fci->localoff = PROC_FRAME_OFFSET(proc_desc);
-
       /* Fixup frame-pointer - only needed for top frame */
       /* Fetch the frame pointer for a dummy frame from the procedure
         descriptor.  */
@@ -603,8 +582,6 @@ setup_arbitrary_frame (argc, argv)
    If the called function is returning a structure, the address of the
    structure to be returned is passed as a hidden first argument.  */
 
-#define NUM_ARG_REGS   6
-
 CORE_ADDR
 alpha_push_arguments (nargs, args, sp, struct_return, struct_addr)
   int nargs;
@@ -615,7 +592,7 @@ alpha_push_arguments (nargs, args, sp, struct_return, struct_addr)
 {
   register i;
   int accumulate_size = struct_return ? 8 : 0;
-  int arg_regs_size = NUM_ARG_REGS * 8;
+  int arg_regs_size = ALPHA_NUM_ARG_REGS * 8;
   struct alpha_arg { char *contents; int len; int offset; };
   struct alpha_arg *alpha_args =
       (struct alpha_arg*)alloca (nargs * sizeof (struct alpha_arg));
@@ -638,8 +615,8 @@ alpha_push_arguments (nargs, args, sp, struct_return, struct_addr)
   /* Determine required argument register loads, loading an argument register
      is expensive as it uses three ptrace calls.  */
   required_arg_regs = accumulate_size / 8;
-  if (required_arg_regs > NUM_ARG_REGS)
-    required_arg_regs = NUM_ARG_REGS;
+  if (required_arg_regs > ALPHA_NUM_ARG_REGS)
+    required_arg_regs = ALPHA_NUM_ARG_REGS;
 
   /* Make room for the arguments on the stack.  */
   if (accumulate_size < arg_regs_size)
@@ -905,6 +882,73 @@ alpha_in_lenient_prologue (startaddr, pc)
   return pc >= startaddr && pc < end_prologue;
 }
 
+/* The alpha needs a conversion between register and memory format if
+   the register is a floating point register and
+      memory format is float, as the register format must be double
+   or
+      memory format is an integer with 4 bytes or less, as the representation
+      of integers in floating point registers is different. */
+void
+alpha_register_convert_to_virtual (regnum, valtype, raw_buffer, virtual_buffer)
+    int regnum;
+    struct type *valtype;
+    char *raw_buffer;
+    char *virtual_buffer;
+{
+  if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum))
+    {
+      memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (regnum));
+      return;
+    }
+
+  if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
+    {
+      double d = extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum));
+      store_floating (virtual_buffer, TYPE_LENGTH (valtype), d);
+    }
+  else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
+    {
+      unsigned LONGEST l;
+      l = extract_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum));
+      l = ((l >> 32) & 0xc0000000) | ((l >> 29) & 0x3fffffff);
+      store_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype), l);
+    }
+  else
+    error ("Cannot retrieve value from floating point register");
+}
+
+void
+alpha_register_convert_to_raw (valtype, regnum, virtual_buffer, raw_buffer)
+    struct type *valtype;
+    int regnum;
+    char *virtual_buffer;
+    char *raw_buffer;
+{
+  if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum))
+    {
+      memcpy (raw_buffer, virtual_buffer, REGISTER_RAW_SIZE (regnum));
+      return;
+    }
+
+  if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
+    {
+      double d = extract_floating (virtual_buffer, TYPE_LENGTH (valtype));
+      store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d);
+    }
+  else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
+    {
+      unsigned LONGEST l;
+      if (TYPE_UNSIGNED (valtype))
+       l = extract_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype));
+      else
+       l = extract_signed_integer (virtual_buffer, TYPE_LENGTH (valtype));
+      l = ((l & 0xc0000000) << 32) | ((l & 0x3fffffff) << 29);
+      store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), l);
+    }
+  else
+    error ("Cannot store value in floating point register");
+}
+
 /* Given a return value in `regbuf' with a type `valtype', 
    extract and copy its value into `valbuf'.  */
 void
@@ -942,7 +986,7 @@ alpha_store_return_value (valtype, valbuf)
 int
 print_insn (memaddr, stream)
      CORE_ADDR memaddr;
-     FILE *stream;
+     GDB_FILE *stream;
 {
   disassemble_info info;
 
This page took 0.024908 seconds and 4 git commands to generate.