* sparc64-tdep.h (sparc64_regnum): Fix comment.
[deliverable/binutils-gdb.git] / gdb / ia64-tdep.c
index 6b4a8137bf8298b1d125d44b572cea5511445056..b6992d90f53393f3e4f820d24ec265b4025823e2 100644 (file)
@@ -28,7 +28,7 @@
 #include "regcache.h"
 #include "doublest.h"
 #include "value.h"
-
+#include "gdb_assert.h"
 #include "objfiles.h"
 #include "elf/common.h"                /* for DT_PLTGOT value */
 #include "elf-bfd.h"
@@ -86,18 +86,13 @@ extern CORE_ADDR ia64_aix_sigcontext_register_address (CORE_ADDR, int);
 static gdbarch_init_ftype ia64_gdbarch_init;
 
 static gdbarch_register_name_ftype ia64_register_name;
-static gdbarch_register_raw_size_ftype ia64_register_raw_size;
-static gdbarch_register_virtual_size_ftype ia64_register_virtual_size;
-static gdbarch_register_virtual_type_ftype ia64_register_virtual_type;
-static gdbarch_register_byte_ftype ia64_register_byte;
 static gdbarch_breakpoint_from_pc_ftype ia64_breakpoint_from_pc;
 static gdbarch_skip_prologue_ftype ia64_skip_prologue;
 static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value;
 static gdbarch_deprecated_extract_struct_value_address_ftype ia64_extract_struct_value_address;
 static gdbarch_use_struct_convention_ftype ia64_use_struct_convention;
 static gdbarch_frameless_function_invocation_ftype ia64_frameless_function_invocation;
-static gdbarch_push_return_address_ftype ia64_push_return_address;
-static gdbarch_saved_pc_after_call_ftype ia64_saved_pc_after_call;
+static gdbarch_deprecated_saved_pc_after_call_ftype ia64_saved_pc_after_call;
 static void ia64_pop_frame_regular (struct frame_info *frame);
 static struct type *is_float_or_hfa_type (struct type *t);
 
@@ -240,13 +235,13 @@ ia64_register_name (int reg)
   return ia64_register_names[reg];
 }
 
-int
+static int
 ia64_register_raw_size (int reg)
 {
   return (IA64_FR0_REGNUM <= reg && reg <= IA64_FR127_REGNUM) ? 16 : 8;
 }
 
-int
+static int
 ia64_register_virtual_size (int reg)
 {
   return (IA64_FR0_REGNUM <= reg && reg <= IA64_FR127_REGNUM) ? 16 : 8;
@@ -254,7 +249,7 @@ ia64_register_virtual_size (int reg)
 
 /* Return true iff register N's virtual format is different from
    its raw format. */
-int
+static int
 ia64_register_convertible (int nr)
 {
   return (IA64_FR0_REGNUM <= nr && nr <= IA64_FR127_REGNUM);
@@ -266,7 +261,7 @@ const struct floatformat floatformat_ia64_ext =
   floatformat_intbit_yes
 };
 
-void
+static void
 ia64_register_convert_to_virtual (int regnum, struct type *type,
                                   char *from, char *to)
 {
@@ -274,19 +269,19 @@ ia64_register_convert_to_virtual (int regnum, struct type *type,
     {
       DOUBLEST val;
       floatformat_to_doublest (&floatformat_ia64_ext, from, &val);
-      store_floating(to, TYPE_LENGTH(type), val);
+      deprecated_store_floating (to, TYPE_LENGTH(type), val);
     }
   else
     error("ia64_register_convert_to_virtual called with non floating point register number");
 }
 
-void
+static void
 ia64_register_convert_to_raw (struct type *type, int regnum,
-                              char *from, char *to)
+                              const char *from, char *to)
 {
   if (regnum >= IA64_FR0_REGNUM && regnum <= IA64_FR127_REGNUM)
     {
-      DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
+      DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type));
       floatformat_from_doublest (&floatformat_ia64_ext, &val, to);
     }
   else
@@ -302,7 +297,7 @@ ia64_register_virtual_type (int reg)
     return builtin_type_long;
 }
 
-int
+static int
 ia64_register_byte (int reg)
 {
   return (8 * reg) +
@@ -544,9 +539,9 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr)
    using the pattern seen below. */
 
 #if 0
-#define BREAKPOINT 0x00002000040LL
+#define IA64_BREAKPOINT 0x00002000040LL
 #endif
-#define BREAKPOINT 0x00003333300LL
+#define IA64_BREAKPOINT 0x00003333300LL
 
 static int
 ia64_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
@@ -574,7 +569,7 @@ ia64_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 
   instr = slotN_contents (bundle, slotnum);
   memcpy(contents_cache, &instr, sizeof(instr));
-  replace_slotN_contents (bundle, BREAKPOINT, slotnum);
+  replace_slotN_contents (bundle, IA64_BREAKPOINT, slotnum);
   if (val == 0)
     target_write_memory (addr, bundle, BUNDLE_LEN);
 
@@ -624,7 +619,19 @@ ia64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
   return breakpoint;
 }
 
-CORE_ADDR
+static CORE_ADDR
+ia64_read_fp (void)
+{
+  /* We won't necessarily have a frame pointer and even if we do, it
+     winds up being extraordinarly messy when attempting to find the
+     frame chain.  So for the purposes of creating frames (which is
+     all deprecated_read_fp() is used for), simply use the stack
+     pointer value instead.  */
+  gdb_assert (SP_REGNUM >= 0);
+  return read_register (SP_REGNUM);
+}
+
+static CORE_ADDR
 ia64_read_pc (ptid_t ptid)
 {
   CORE_ADDR psr_value = read_register_pid (IA64_PSR_REGNUM, ptid);
@@ -634,7 +641,7 @@ ia64_read_pc (ptid_t ptid)
   return pc_value | (slot_num * SLOT_MULTIPLIER);
 }
 
-void
+static void
 ia64_write_pc (CORE_ADDR new_pc, ptid_t ptid)
 {
   int slot_num = (int) (new_pc & 0xf) / SLOT_MULTIPLIER;
@@ -679,8 +686,8 @@ rse_address_add(CORE_ADDR addr, int nslots)
    computationally expensive.  So, instead of making life difficult
    (and slow), we pick a more convenient representation of the frame
    chain, knowing that we'll have to make some small adjustments in
-   other places.  (E.g, note that read_fp() is actually read_sp() in
-   ia64_gdbarch_init() below.)
+   other places.  (E.g, note that deprecated_read_fp() is actually
+   read_sp() in ia64_gdbarch_init() below.)
 
    Okay, so what is the frame chain exactly?  It'll be the SP value
    at the time that the function in question was entered.
@@ -692,7 +699,7 @@ rse_address_add(CORE_ADDR addr, int nslots)
    represent the frame chain as the end of the previous frame instead
    of the beginning.  */
 
-CORE_ADDR
+static CORE_ADDR
 ia64_frame_chain (struct frame_info *frame)
 {
   if ((get_frame_type (frame) == SIGTRAMP_FRAME))
@@ -712,7 +719,7 @@ ia64_frame_chain (struct frame_info *frame)
     }
 }
 
-CORE_ADDR
+static CORE_ADDR
 ia64_frame_saved_pc (struct frame_info *frame)
 {
   if ((get_frame_type (frame) == SIGTRAMP_FRAME))
@@ -738,7 +745,7 @@ ia64_frame_saved_pc (struct frame_info *frame)
 
 /* Limit the number of skipped non-prologue instructions since examining
    of the prologue is expensive.  */
-static int max_skip_non_prologue_insns = 10;
+static int max_skip_non_prologue_insns = 40;
 
 /* Given PC representing the starting address of a function, and
    LIM_PC which is the (sloppy) limit to which to scan when looking
@@ -826,10 +833,13 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
   CORE_ADDR spill_addr = 0;
   char instores[8];
   char infpstores[8];
+  char reg_contents[256];
   int trust_limit;
+  int frameless = 0;
 
   memset (instores, 0, sizeof instores);
   memset (infpstores, 0, sizeof infpstores);
+  memset (reg_contents, 0, sizeof reg_contents);
 
   if (frame && !get_frame_saved_regs (frame))
     {
@@ -844,13 +854,14 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
     return get_frame_extra_info (frame)->after_prologue;
 
   lim_pc = refine_prologue_limit (pc, lim_pc, &trust_limit);
-
-  /* Must start with an alloc instruction */
   next_pc = fetch_instruction (pc, &it, &instr);
+
+  /* We want to check if we have a recognizable function start before we
+     look ahead for a prologue.  */
   if (pc < lim_pc && next_pc 
       && it == M && ((instr & 0x1ee0000003fLL) == 0x02c00000000LL))
     {
-      /* alloc */
+      /* alloc - start of a regular function.  */
       int sor = (int) ((instr & 0x00078000000LL) >> 27);
       int sol = (int) ((instr & 0x00007f00000LL) >> 20);
       int sof = (int) ((instr & 0x000000fe000LL) >> 13);
@@ -865,9 +876,35 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
     }
   else
     {
-      pc = lim_pc;     /* Frameless: We're done early.  */
-      if (trust_limit)
-       last_prologue_pc = lim_pc;
+      /* Look for a leaf routine.  */
+      if (pc < lim_pc && next_pc
+         && (it == I || it == M) 
+          && ((instr & 0x1ee00000000LL) == 0x10800000000LL))
+       {
+         /* adds rN = imm14, rM   (or mov rN, rM  when imm14 is 0) */
+         int imm = (int) ((((instr & 0x01000000000LL) ? -1 : 0) << 13) 
+                          | ((instr & 0x001f8000000LL) >> 20)
+                          | ((instr & 0x000000fe000LL) >> 13));
+         int rM = (int) ((instr & 0x00007f00000LL) >> 20);
+         int rN = (int) ((instr & 0x00000001fc0LL) >> 6);
+         int qp = (int) (instr & 0x0000000003fLL);
+         if (qp == 0 && rN == 2 && imm == 0 && rM == 12 && fp_reg == 0)
+           {
+             /* mov r2, r12 - beginning of leaf routine */
+             fp_reg = rN;
+             frameless = 1;
+             last_prologue_pc = next_pc;
+           }
+       } 
+
+      /* If we don't recognize a regular function or leaf routine, we are
+        done.  */
+      if (!fp_reg)
+       {
+         pc = lim_pc;  
+         if (trust_limit)
+           last_prologue_pc = lim_pc;
+       }
     }
 
   /* Loop, looking for prologue instructions, keeping track of
@@ -883,6 +920,8 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
        {
          /* Exit loop upon hitting a non-nop branch instruction 
             or a predicated instruction. */
+         if (trust_limit)
+           lim_pc = pc;
          break;
        }
       else if (it == I && ((instr & 0x1eff8000000LL) == 0x00188000000LL))
@@ -942,6 +981,20 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
              spill_reg   = rN;
              last_prologue_pc = next_pc;
            }
+         else if (qp == 0 && rM >= 32 && rM < 40 && !instores[rM] && 
+                  rN < 256 && imm == 0)
+           {
+             /* mov rN, rM where rM is an input register */
+             reg_contents[rN] = rM;
+             last_prologue_pc = next_pc;
+           }
+         else if (frameless && qp == 0 && rN == fp_reg && imm == 0 && 
+                  rM == 2)
+           {
+             /* mov r12, r2 */
+             last_prologue_pc = next_pc;
+             break;
+           }
        }
       else if (it == M 
             && (   ((instr & 0x1efc0000000LL) == 0x0eec0000000LL)
@@ -1007,6 +1060,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
          int rN = (int) ((instr & 0x00007f00000LL) >> 20);
          int rM = (int) ((instr & 0x000000fe000LL) >> 13);
          int qp = (int) (instr & 0x0000000003fLL);
+         int indirect = rM < 256 ? reg_contents[rM] : 0;
          if (qp == 0 && rN == spill_reg && spill_addr != 0
              && (rM == unat_save_reg || rM == pr_save_reg))
            {
@@ -1041,6 +1095,13 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
              instores[rM-32] = 1;
              last_prologue_pc = next_pc;
            }
+         else if (qp == 0 && 32 <= indirect && indirect < 40 && 
+                  !instores[indirect-32])
+           {
+             /* Allow an indirect store of an input register.  */
+             instores[indirect-32] = 1;
+             last_prologue_pc = next_pc;
+           }
        }
       else if (it == M && ((instr & 0x1ff08000000LL) == 0x08c00000000LL))
        {
@@ -1055,11 +1116,19 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
             register is permitted. */
          int rM = (int) ((instr & 0x000000fe000LL) >> 13);
          int qp = (int) (instr & 0x0000000003fLL);
+         int indirect = rM < 256 ? reg_contents[rM] : 0;
          if (qp == 0 && 32 <= rM && rM < 40 && !instores[rM-32])
            {
              instores[rM-32] = 1;
              last_prologue_pc = next_pc;
            }
+         else if (qp == 0 && 32 <= indirect && indirect < 40 && 
+                  !instores[indirect-32])
+           {
+             /* Allow an indirect store of an input register.  */
+             instores[indirect-32] = 1;
+             last_prologue_pc = next_pc;
+           }
        }
       else if (it == M && ((instr & 0x1ff88000000LL) == 0x0cc80000000LL))
         {
@@ -1148,6 +1217,10 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
       get_frame_extra_info (frame)->fp_reg = fp_reg;
     }
 
+  /* Try and trust the lim_pc value whenever possible.  */
+  if (trust_limit && lim_pc >= last_prologue_pc)
+    return lim_pc;
+
   return last_prologue_pc;
 }
 
@@ -1157,7 +1230,7 @@ ia64_skip_prologue (CORE_ADDR pc)
   return examine_prologue (pc, pc+1024, 0);
 }
 
-void
+static void
 ia64_frame_init_saved_regs (struct frame_info *frame)
 {
   if (get_frame_saved_regs (frame))
@@ -1206,12 +1279,12 @@ ia64_frame_init_saved_regs (struct frame_info *frame)
     {
       CORE_ADDR func_start;
 
-      func_start = get_pc_function_start (get_frame_pc (frame));
+      func_start = get_frame_func (frame);
       examine_prologue (func_start, get_frame_pc (frame), frame);
     }
 }
 
-void
+static void
 ia64_get_saved_register (char *raw_buffer, 
                          int *optimized, 
                         CORE_ADDR *addrp,
@@ -1240,13 +1313,13 @@ ia64_get_saved_register (char *raw_buffer,
   if (regnum == SP_REGNUM && get_next_frame (frame))
     {
       /* Handle SP values for all frames but the topmost. */
-      store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
-                    get_frame_base (frame));
+      store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum),
+                             get_frame_base (frame));
     }
   else if (regnum == IA64_BSP_REGNUM)
     {
-      store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), 
-                     get_frame_extra_info (frame)->bsp);
+      store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), 
+                             get_frame_extra_info (frame)->bsp);
     }
   else if (regnum == IA64_VFP_REGNUM)
     {
@@ -1256,11 +1329,11 @@ ia64_get_saved_register (char *raw_buffer,
         still provide a value since we know the size of the frame */
       CORE_ADDR vfp = (get_frame_base (frame)
                       + get_frame_extra_info (frame)->mem_stack_frame_size);
-      store_address (raw_buffer, REGISTER_RAW_SIZE (IA64_VFP_REGNUM), vfp);
+      store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (IA64_VFP_REGNUM), vfp);
     }
   else if (IA64_PR0_REGNUM <= regnum && regnum <= IA64_PR63_REGNUM)
     {
-      char *pr_raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+      char pr_raw_buffer[MAX_REGISTER_SIZE];
       int  pr_optim;
       enum lval_type pr_lval;
       CORE_ADDR pr_addr;
@@ -1283,7 +1356,7 @@ ia64_get_saved_register (char *raw_buffer,
     }
   else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
     {
-      char *unat_raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+      char unat_raw_buffer[MAX_REGISTER_SIZE];
       int  unat_optim;
       enum lval_type unat_lval;
       CORE_ADDR unat_addr;
@@ -1339,7 +1412,7 @@ ia64_get_saved_register (char *raw_buffer,
         {
          pc = read_pc ();
        }
-      store_address (raw_buffer, REGISTER_RAW_SIZE (IA64_IP_REGNUM), pc);
+      store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (IA64_IP_REGNUM), pc);
     }
   else if (IA64_GR32_REGNUM <= regnum && regnum <= IA64_GR127_REGNUM)
     {
@@ -1443,11 +1516,11 @@ ia64_extract_struct_value_address (char *regbuf)
   return struct_return_address;
 }
 
-void
+static void
 ia64_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   /* FIXME: See above. */
-  /* Note that most of the work was done in ia64_push_arguments() */
+  /* Note that most of the work was done in ia64_push_dummy_call() */
   struct_return_address = addr;
 }
 
@@ -1464,7 +1537,7 @@ ia64_saved_pc_after_call (struct frame_info *frame)
   return read_register (IA64_BR0_REGNUM);
 }
 
-CORE_ADDR
+static CORE_ADDR
 ia64_frame_args_address (struct frame_info *frame)
 {
   /* frame->frame points at the SP for this frame; But we want the start
@@ -1472,7 +1545,7 @@ ia64_frame_args_address (struct frame_info *frame)
   return ia64_frame_chain (frame);
 }
 
-CORE_ADDR
+static CORE_ADDR
 ia64_frame_locals_address (struct frame_info *frame)
 {
   /* frame->frame points at the SP for this frame; But we want the start
@@ -1480,7 +1553,7 @@ ia64_frame_locals_address (struct frame_info *frame)
   return ia64_frame_chain (frame);
 }
 
-void
+static void
 ia64_init_extra_frame_info (int fromleaf, struct frame_info *frame)
 {
   CORE_ADDR bsp, cfm;
@@ -1682,7 +1755,7 @@ generic_elf_find_global_pointer (CORE_ADDR faddr)
                  status = target_read_memory (addr + 8, buf, sizeof (buf));
                  if (status != 0)
                    break;
-                 global_pointer = extract_address (buf, sizeof (buf));
+                 global_pointer = extract_unsigned_integer (buf, sizeof (buf));
 
                  /* The payoff... */
                  return global_pointer;
@@ -1770,8 +1843,8 @@ find_func_descr (CORE_ADDR faddr, CORE_ADDR *fdaptr)
       if (global_pointer == 0)
        global_pointer = read_register (IA64_GR1_REGNUM);
 
-      store_address (buf, 8, faddr);
-      store_address (buf + 8, 8, global_pointer);
+      store_unsigned_integer (buf, 8, faddr);
+      store_unsigned_integer (buf + 8, 8, global_pointer);
 
       write_memory (fdesc, buf, 16);
     }
@@ -1779,9 +1852,11 @@ find_func_descr (CORE_ADDR faddr, CORE_ADDR *fdaptr)
   return fdesc; 
 }
 
-CORE_ADDR
-ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
-                   int struct_return, CORE_ADDR struct_addr)
+static CORE_ADDR
+ia64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+                     struct regcache *regcache, CORE_ADDR bp_addr,
+                     int nargs, struct value **args, CORE_ADDR sp,
+                     int struct_return, CORE_ADDR struct_addr)
 {
   int argno;
   struct value *arg;
@@ -1789,7 +1864,9 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
   int len, argoffset;
   int nslots, rseslots, memslots, slotnum, nfuncargs;
   int floatreg;
-  CORE_ADDR bsp, cfm, pfs, new_bsp, funcdescaddr;
+  ULONGEST bsp, cfm, pfs, new_bsp;
+  CORE_ADDR funcdescaddr;
+  ULONGEST global_pointer = FIND_GLOBAL_POINTER (func_addr);
 
   nslots = 0;
   nfuncargs = 0;
@@ -1814,21 +1891,21 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
   memslots = nslots - rseslots;
 
   /* Allocate a new RSE frame */
-  cfm = read_register (IA64_CFM_REGNUM);
+  regcache_cooked_read_unsigned (regcache, IA64_CFM_REGNUM, &cfm);
 
-  bsp = read_register (IA64_BSP_REGNUM);
+  regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp);
   bsp = rse_address_add (bsp, cfm & 0x7f);
   new_bsp = rse_address_add (bsp, rseslots);
-  write_register (IA64_BSP_REGNUM, new_bsp);
+  regcache_cooked_write_unsigned (regcache, IA64_BSP_REGNUM, new_bsp);
 
-  pfs = read_register (IA64_PFS_REGNUM);
+  regcache_cooked_read_unsigned (regcache, IA64_PFS_REGNUM, &pfs);
   pfs &= 0xc000000000000000LL;
   pfs |= (cfm & 0xffffffffffffLL);
-  write_register (IA64_PFS_REGNUM, pfs);
+  regcache_cooked_write_unsigned (regcache, IA64_PFS_REGNUM, pfs);
 
   cfm &= 0xc000000000000000LL;
   cfm |= rseslots;
-  write_register (IA64_CFM_REGNUM, cfm);
+  regcache_cooked_write_unsigned (regcache, IA64_CFM_REGNUM, cfm);
   
   /* We will attempt to find function descriptors in the .opd segment,
      but if we can't we'll construct them ourselves.  That being the
@@ -1863,9 +1940,9 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
        {
          char val_buf[8];
 
-         store_address (val_buf, 8,
-           find_func_descr (extract_address (VALUE_CONTENTS (arg), 8),
-                            &funcdescaddr));
+         store_unsigned_integer (val_buf, 8,
+                                 find_func_descr (extract_unsigned_integer (VALUE_CONTENTS (arg), 8),
+                                                  &funcdescaddr));
          if (slotnum < rseslots)
            write_memory (rse_address_add (bsp, slotnum), val_buf, 8);
          else
@@ -1906,11 +1983,12 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
          len = TYPE_LENGTH (type);
          while (len > 0 && floatreg < IA64_FR16_REGNUM)
            {
-             ia64_register_convert_to_raw (
-               float_elt_type,
-               floatreg,
-               VALUE_CONTENTS (arg) + argoffset,
-               &deprecated_registers[REGISTER_BYTE (floatreg)]);
+             char buf[MAX_REGISTER_SIZE];
+             ia64_register_convert_to_raw (float_elt_type,
+                                           floatreg,
+                                           VALUE_CONTENTS (arg) + argoffset,
+                                           buf);
+             regcache_raw_write (regcache, floatreg, buf);
              floatreg++;
              argoffset += TYPE_LENGTH (float_elt_type);
              len -= TYPE_LENGTH (float_elt_type);
@@ -1921,22 +1999,26 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
   /* Store the struct return value in r8 if necessary. */
   if (struct_return)
     {
-      store_address (&deprecated_registers[REGISTER_BYTE (IA64_GR8_REGNUM)],
-                     REGISTER_RAW_SIZE (IA64_GR8_REGNUM),
-                    struct_addr);
+      regcache_cooked_write_unsigned (regcache, IA64_GR8_REGNUM, struct_addr);
     }
 
+  if (global_pointer != 0)
+    regcache_cooked_write_unsigned (regcache, IA64_GR1_REGNUM, global_pointer);
+
+  regcache_cooked_write_unsigned (regcache, IA64_BR0_REGNUM, bp_addr);
+
   /* Sync gdb's idea of what the registers are with the target. */
   target_store_registers (-1);
 
-  /* FIXME: This doesn't belong here!  Instead, SAVE_DUMMY_FRAME_TOS needs
-     to be defined to call generic_save_dummy_frame_tos().  But at the
-     time of this writing, SAVE_DUMMY_FRAME_TOS wasn't gdbarch'd, so
-     I chose to put this call here instead of using the old mechanisms. 
-     Once SAVE_DUMMY_FRAME_TOS is gdbarch'd, all we need to do is add the
-     line
+  /* FIXME: This doesn't belong here!  Instead,
+     DEPRECATED_SAVE_DUMMY_FRAME_TOS needs to be defined to call
+     generic_save_dummy_frame_tos().  But at the time of this writing,
+     DEPRECATED_SAVE_DUMMY_FRAME_TOS wasn't gdbarch'd, so I chose to
+     put this call here instead of using the old mechanisms.  Once
+     DEPRECATED_SAVE_DUMMY_FRAME_TOS is gdbarch'd, all we need to do
+     is add the line
 
-       set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
+       set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
 
      to ia64_gdbarch_init() and remove the line below. */
   generic_save_dummy_frame_tos (sp);
@@ -1944,19 +2026,7 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
   return sp;
 }
 
-CORE_ADDR
-ia64_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
-  CORE_ADDR global_pointer = FIND_GLOBAL_POINTER (pc);
-
-  if (global_pointer != 0)
-    write_register (IA64_GR1_REGNUM, global_pointer);
-
-  write_register (IA64_BR0_REGNUM, CALL_DUMMY_ADDRESS ());
-  return sp;
-}
-
-void
+static void
 ia64_store_return_value (struct type *type, char *valbuf)
 {
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
@@ -1970,7 +2040,7 @@ ia64_store_return_value (struct type *type, char *valbuf)
                                     valbuf, TYPE_LENGTH (type));
 }
 
-void
+static void
 ia64_pop_frame (void)
 {
   generic_pop_current_frame (ia64_pop_frame_regular);
@@ -2034,7 +2104,9 @@ ia64_pop_frame_regular (struct frame_info *frame)
 }
 
 static void
-ia64_remote_translate_xfer_address (CORE_ADDR memaddr, int nr_bytes,
+ia64_remote_translate_xfer_address (struct gdbarch *gdbarch,
+                                   struct regcache *regcache,
+                                   CORE_ADDR memaddr, int nr_bytes,
                                    CORE_ADDR *targ_addr, int *targ_len)
 {
   *targ_addr = memaddr;
@@ -2088,6 +2160,13 @@ process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
     }
 }
 
+static int
+ia64_print_insn (bfd_vma memaddr, struct disassemble_info *info)
+{
+  info->bytes_per_line = SLOT_MULTIPLIER;
+  return print_insn_ia64 (memaddr, info);
+}
+
 static struct gdbarch *
 ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -2164,31 +2243,30 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_long_long_bit (gdbarch, 64);
   set_gdbarch_float_bit (gdbarch, 32);
   set_gdbarch_double_bit (gdbarch, 64);
-  set_gdbarch_long_double_bit (gdbarch, 64);
+  set_gdbarch_long_double_bit (gdbarch, 128);
   set_gdbarch_ptr_bit (gdbarch, 64);
 
   set_gdbarch_num_regs (gdbarch, ia64_num_regs);
   set_gdbarch_sp_regnum (gdbarch, sp_regnum);
-  set_gdbarch_fp_regnum (gdbarch, fp_regnum);
+  set_gdbarch_deprecated_fp_regnum (gdbarch, fp_regnum);
   set_gdbarch_pc_regnum (gdbarch, pc_regnum);
   set_gdbarch_fp0_regnum (gdbarch, IA64_FR0_REGNUM);
 
   set_gdbarch_register_name (gdbarch, ia64_register_name);
-  set_gdbarch_register_size (gdbarch, 8);
-  set_gdbarch_register_bytes (gdbarch, ia64_num_regs * 8 + 128*8);
-  set_gdbarch_register_byte (gdbarch, ia64_register_byte);
-  set_gdbarch_register_raw_size (gdbarch, ia64_register_raw_size);
+  set_gdbarch_deprecated_register_size (gdbarch, 8);
+  set_gdbarch_deprecated_register_bytes (gdbarch, ia64_num_regs * 8 + 128*8);
+  set_gdbarch_deprecated_register_byte (gdbarch, ia64_register_byte);
+  set_gdbarch_deprecated_register_raw_size (gdbarch, ia64_register_raw_size);
   set_gdbarch_deprecated_max_register_raw_size (gdbarch, 16);
-  set_gdbarch_register_virtual_size (gdbarch, ia64_register_virtual_size);
+  set_gdbarch_deprecated_register_virtual_size (gdbarch, ia64_register_virtual_size);
   set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 16);
-  set_gdbarch_register_virtual_type (gdbarch, ia64_register_virtual_type);
+  set_gdbarch_deprecated_register_virtual_type (gdbarch, ia64_register_virtual_type);
 
   set_gdbarch_skip_prologue (gdbarch, ia64_skip_prologue);
 
-  set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
   set_gdbarch_frameless_function_invocation (gdbarch, ia64_frameless_function_invocation);
 
-  set_gdbarch_saved_pc_after_call (gdbarch, ia64_saved_pc_after_call);
+  set_gdbarch_deprecated_saved_pc_after_call (gdbarch, ia64_saved_pc_after_call);
 
   set_gdbarch_deprecated_frame_chain (gdbarch, ia64_frame_chain);
   set_gdbarch_deprecated_frame_saved_pc (gdbarch, ia64_frame_saved_pc);
@@ -2196,9 +2274,9 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ia64_frame_init_saved_regs);
   set_gdbarch_deprecated_get_saved_register (gdbarch, ia64_get_saved_register);
 
-  set_gdbarch_register_convertible (gdbarch, ia64_register_convertible);
-  set_gdbarch_register_convert_to_virtual (gdbarch, ia64_register_convert_to_virtual);
-  set_gdbarch_register_convert_to_raw (gdbarch, ia64_register_convert_to_raw);
+  set_gdbarch_deprecated_register_convertible (gdbarch, ia64_register_convertible);
+  set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, ia64_register_convert_to_virtual);
+  set_gdbarch_deprecated_register_convert_to_raw (gdbarch, ia64_register_convert_to_raw);
 
   set_gdbarch_use_struct_convention (gdbarch, ia64_use_struct_convention);
   set_gdbarch_deprecated_extract_return_value (gdbarch, ia64_extract_return_value);
@@ -2214,36 +2292,26 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_write_pc (gdbarch, ia64_write_pc);
 
   /* Settings for calling functions in the inferior.  */
-  set_gdbarch_call_dummy_length (gdbarch, 0);
-  set_gdbarch_deprecated_push_arguments (gdbarch, ia64_push_arguments);
-  set_gdbarch_push_return_address (gdbarch, ia64_push_return_address);
+  set_gdbarch_push_dummy_call (gdbarch, ia64_push_dummy_call);
   set_gdbarch_deprecated_pop_frame (gdbarch, ia64_pop_frame);
 
-  set_gdbarch_call_dummy_p (gdbarch, 1);
-  set_gdbarch_call_dummy_words (gdbarch, ia64_call_dummy_words);
-  set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (ia64_call_dummy_words));
-  set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
+  set_gdbarch_deprecated_call_dummy_words (gdbarch, ia64_call_dummy_words);
+  set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (ia64_call_dummy_words));
   set_gdbarch_deprecated_init_extra_frame_info (gdbarch, ia64_init_extra_frame_info);
-  set_gdbarch_frame_args_address (gdbarch, ia64_frame_args_address);
-  set_gdbarch_frame_locals_address (gdbarch, ia64_frame_locals_address);
+  set_gdbarch_deprecated_frame_args_address (gdbarch, ia64_frame_args_address);
+  set_gdbarch_deprecated_frame_locals_address (gdbarch, ia64_frame_locals_address);
 
-  /* We won't necessarily have a frame pointer and even if we do,
-     it winds up being extraordinarly messy when attempting to find
-     the frame chain.  So for the purposes of creating frames (which
-     is all read_fp() is used for), simply use the stack pointer value
-     instead.  */
-  set_gdbarch_read_fp (gdbarch, generic_target_read_sp);
+  /* We won't necessarily have a frame pointer and even if we do, it
+     winds up being extraordinarly messy when attempting to find the
+     frame chain.  So for the purposes of creating frames (which is
+     all deprecated_read_fp() is used for), simply use the stack
+     pointer value instead.  */
+  set_gdbarch_deprecated_target_read_fp (gdbarch, ia64_read_fp);
 
   /* Settings that should be unnecessary.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
 
-  set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
-  set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
-
-  set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
-  set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
-  set_gdbarch_call_dummy_start_offset (gdbarch, 0);
-  set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
+  set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
 
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
   set_gdbarch_function_start_offset (gdbarch, 0);
@@ -2252,14 +2320,15 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_remote_translate_xfer_address (
     gdbarch, ia64_remote_translate_xfer_address);
 
+  set_gdbarch_print_insn (gdbarch, ia64_print_insn);
+
   return gdbarch;
 }
 
+extern initialize_file_ftype _initialize_ia64_tdep; /* -Wmissing-prototypes */
+
 void
 _initialize_ia64_tdep (void)
 {
   register_gdbarch_init (bfd_arch_ia64, ia64_gdbarch_init);
-
-  tm_print_insn = print_insn_ia64;
-  tm_print_insn_info.bytes_per_line = SLOT_MULTIPLIER;
 }
This page took 0.038717 seconds and 4 git commands to generate.