2003-06-11 Andrew Cagney <cagney@redhat.com>
[binutils-gdb.git] / gdb / ia64-tdep.c
index 0a3aad841884e9da9055322a06b7c2c585ddc7ca..9a93586f3864173c87b614e9861920f14c6444fd 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the IA-64 for GDB, the GNU debugger.
-   Copyright 1999, 2000
-   Free Software Foundation, Inc.
+
+   Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "gdbcore.h"
 #include "arch-utils.h"
 #include "floatformat.h"
-
+#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"
 
+/* Hook for determining the global pointer when calling functions in
+   the inferior under AIX.  The initialization code in ia64-aix-nat.c
+   sets this hook to the address of a function which will find the
+   global pointer for a given address.  
+   
+   The generic code which uses the dynamic section in the inferior for
+   finding the global pointer is not of much use on AIX since the
+   values obtained from the inferior have not been relocated.  */
+
+CORE_ADDR (*native_find_global_pointer) (CORE_ADDR) = 0;
+
+/* An enumeration of the different IA-64 instruction types.  */
+
 typedef enum instruction_type
 {
   A,                   /* Integer ALU ;    I-unit or M-unit */
@@ -63,9 +79,9 @@ typedef enum instruction_type
 
 #define BUNDLE_LEN 16
 
-extern void _initialize_ia64_tdep (void);
-
+/* FIXME: These extern declarations should go in ia64-tdep.h.  */
 extern CORE_ADDR ia64_linux_sigcontext_register_address (CORE_ADDR, int);
+extern CORE_ADDR ia64_aix_sigcontext_register_address (CORE_ADDR, int);
 
 static gdbarch_init_ftype ia64_gdbarch_init;
 
@@ -75,22 +91,12 @@ 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_frame_chain_ftype ia64_frame_chain;
-static gdbarch_frame_saved_pc_ftype ia64_frame_saved_pc;
 static gdbarch_skip_prologue_ftype ia64_skip_prologue;
-static gdbarch_frame_init_saved_regs_ftype ia64_frame_init_saved_regs;
-static gdbarch_get_saved_register_ftype ia64_get_saved_register;
-static gdbarch_extract_return_value_ftype ia64_extract_return_value;
-static gdbarch_extract_struct_value_address_ftype ia64_extract_struct_value_address;
+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_init_extra_frame_info_ftype ia64_init_extra_frame_info;
-static gdbarch_store_return_value_ftype ia64_store_return_value;
-static gdbarch_store_struct_return_ftype ia64_store_struct_return;
-static gdbarch_push_arguments_ftype ia64_push_arguments;
-static gdbarch_push_return_address_ftype ia64_push_return_address;
-static gdbarch_pop_frame_ftype ia64_pop_frame;
-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);
 
@@ -213,17 +219,21 @@ struct frame_extra_info
 struct gdbarch_tdep
   {
     int os_ident;      /* From the ELF header, one of the ELFOSABI_
-                           constants: ELFOSABI_LINUX, ELFOSABI_MONTEREY,
+                           constants: ELFOSABI_LINUX, ELFOSABI_AIX,
                           etc. */
     CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int);
                        /* OS specific function which, given a frame address
                           and register number, returns the offset to the
                           given register from the start of the frame. */
+    CORE_ADDR (*find_global_pointer) (CORE_ADDR);
   };
 
-#define SIGCONTEXT_REGISTER_ADDRESS (gdbarch_tdep (current_gdbarch)->sigcontext_register_address)
+#define SIGCONTEXT_REGISTER_ADDRESS \
+  (gdbarch_tdep (current_gdbarch)->sigcontext_register_address)
+#define FIND_GLOBAL_POINTER \
+  (gdbarch_tdep (current_gdbarch)->find_global_pointer)
 
-static char *
+static const char *
 ia64_register_name (int reg)
 {
   return ia64_register_names[reg];
@@ -243,7 +253,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);
@@ -255,7 +265,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)
 {
@@ -263,19 +273,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)
 {
   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
@@ -307,20 +317,21 @@ read_sigcontext_register (struct frame_info *frame, int regnum)
   CORE_ADDR regaddr;
 
   if (frame == NULL)
-    internal_error ("read_sigcontext_register: NULL frame");
-  if (!frame->signal_handler_caller)
-    internal_error (
-      "read_sigcontext_register: frame not a signal_handler_caller");
+    internal_error (__FILE__, __LINE__,
+                   "read_sigcontext_register: NULL frame");
+  if (!(get_frame_type (frame) == SIGTRAMP_FRAME))
+    internal_error (__FILE__, __LINE__,
+                   "read_sigcontext_register: frame not a signal trampoline");
   if (SIGCONTEXT_REGISTER_ADDRESS == 0)
-    internal_error (
-      "read_sigcontext_register: SIGCONTEXT_REGISTER_ADDRESS is 0");
+    internal_error (__FILE__, __LINE__,
+                   "read_sigcontext_register: SIGCONTEXT_REGISTER_ADDRESS is 0");
 
-  regaddr = SIGCONTEXT_REGISTER_ADDRESS (frame->frame, regnum);
+  regaddr = SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), regnum);
   if (regaddr)
     return read_memory_integer (regaddr, REGISTER_RAW_SIZE (regnum));
   else
-    internal_error (
-      "read_sigcontext_register: Register %d not in struct sigcontext", regnum);
+    internal_error (__FILE__, __LINE__,
+                   "read_sigcontext_register: Register %d not in struct sigcontext", regnum);
 }
 
 /* Extract ``len'' bits from an instruction bundle starting at
@@ -413,7 +424,7 @@ replace_bit_field (char *bundle, long long val, int from, int len)
    and instruction bundle */
 
 static long long
-slotN_contents (unsigned char *bundle, int slotnum)
+slotN_contents (char *bundle, int slotnum)
 {
   return extract_bit_field (bundle, 5+41*slotnum, 41);
 }
@@ -421,7 +432,7 @@ slotN_contents (unsigned char *bundle, int slotnum)
 /* Store an instruction in an instruction bundle */
 
 static void
-replace_slotN_contents (unsigned char *bundle, long long instr, int slotnum)
+replace_slotN_contents (char *bundle, long long instr, int slotnum)
 {
   replace_bit_field (bundle, instr, 5+41*slotnum, 41);
 }
@@ -473,8 +484,25 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr)
   long long template;
   int val;
 
+  /* Warn about slot numbers greater than 2.  We used to generate
+     an error here on the assumption that the user entered an invalid
+     address.  But, sometimes GDB itself requests an invalid address.
+     This can (easily) happen when execution stops in a function for
+     which there are no symbols.  The prologue scanner will attempt to
+     find the beginning of the function - if the nearest symbol
+     happens to not be aligned on a bundle boundary (16 bytes), the
+     resulting starting address will cause GDB to think that the slot
+     number is too large.
+
+     So we warn about it and set the slot number to zero.  It is
+     not necessarily a fatal condition, particularly if debugging
+     at the assembly language level.  */
   if (slotnum > 2)
-    error("Can't fetch instructions for slot numbers greater than 2.");
+    {
+      warning ("Can't fetch instructions for slot numbers greater than 2.\n"
+              "Using slot 0 instead");
+      slotnum = 0;
+    }
 
   addr &= ~0x0f;
 
@@ -515,9 +543,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)
@@ -526,6 +554,7 @@ ia64_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
   int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER;
   long long instr;
   int val;
+  int template;
 
   if (slotnum > 2)
     error("Can't insert breakpoint for slot numbers greater than 2.");
@@ -533,9 +562,18 @@ ia64_memory_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
   addr &= ~0x0f;
 
   val = target_read_memory (addr, bundle, BUNDLE_LEN);
+
+  /* Check for L type instruction in 2nd slot, if present then
+     bump up the slot number to the 3rd slot */
+  template = extract_bit_field (bundle, 0, 5);
+  if (slotnum == 1 && template_encoding_table[template][1] == L)
+    {
+      slotnum = 2;
+    }
+
   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);
 
@@ -549,10 +587,20 @@ ia64_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
   int slotnum = (addr & 0x0f) / SLOT_MULTIPLIER;
   long long instr;
   int val;
+  int template;
 
   addr &= ~0x0f;
 
   val = target_read_memory (addr, bundle, BUNDLE_LEN);
+
+  /* Check for L type instruction in 2nd slot, if present then
+     bump up the slot number to the 3rd slot */
+  template = extract_bit_field (bundle, 0, 5);
+  if (slotnum == 1 && template_encoding_table[template][1] == L)
+    {
+      slotnum = 2;
+    }
+
   memcpy (&instr, contents_cache, sizeof instr);
   replace_slotN_contents (bundle, instr, slotnum);
   if (val == 0)
@@ -563,7 +611,7 @@ ia64_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 
 /* We don't really want to use this, but remote.c needs to call it in order
    to figure out if Z-packets are supported or not.  Oh, well. */
-unsigned char *
+const unsigned char *
 ia64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
   static unsigned char breakpoint[] =
@@ -575,28 +623,40 @@ ia64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
   return breakpoint;
 }
 
-CORE_ADDR
-ia64_read_pc (int pid)
+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, pid);
-  CORE_ADDR pc_value   = read_register_pid (IA64_IP_REGNUM, pid);
+  CORE_ADDR psr_value = read_register_pid (IA64_PSR_REGNUM, ptid);
+  CORE_ADDR pc_value   = read_register_pid (IA64_IP_REGNUM, ptid);
   int slot_num = (psr_value >> 41) & 3;
 
   return pc_value | (slot_num * SLOT_MULTIPLIER);
 }
 
-void
-ia64_write_pc (CORE_ADDR new_pc, int pid)
+static void
+ia64_write_pc (CORE_ADDR new_pc, ptid_t ptid)
 {
   int slot_num = (int) (new_pc & 0xf) / SLOT_MULTIPLIER;
-  CORE_ADDR psr_value = read_register_pid (IA64_PSR_REGNUM, pid);
+  CORE_ADDR psr_value = read_register_pid (IA64_PSR_REGNUM, ptid);
   psr_value &= ~(3LL << 41);
   psr_value |= (CORE_ADDR)(slot_num & 0x3) << 41;
 
   new_pc &= ~0xfLL;
 
-  write_register_pid (IA64_PSR_REGNUM, psr_value, pid);
-  write_register_pid (IA64_IP_REGNUM, new_pc, pid);
+  write_register_pid (IA64_PSR_REGNUM, psr_value, ptid);
+  write_register_pid (IA64_IP_REGNUM, new_pc, ptid);
 }
 
 #define IS_NaT_COLLECTION_ADDR(addr) ((((addr) >> 3) & 0x3f) == 0x3f)
@@ -629,10 +689,9 @@ rse_address_add(CORE_ADDR addr, int nslots)
    even really hard to compute the frame chain, but it can be
    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() and write_fp() are
-   actually read_sp() and write_sp() below in ia64_gdbarch_init()
-   below.) 
+   chain, knowing that we'll have to make some small adjustments in
+   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.
@@ -644,43 +703,113 @@ 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 (frame->signal_handler_caller)
+  if ((get_frame_type (frame) == SIGTRAMP_FRAME))
     return read_sigcontext_register (frame, sp_regnum);
-  else if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
-    return frame->frame;
+  else if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+                                       get_frame_base (frame),
+                                       get_frame_base (frame)))
+    return get_frame_base (frame);
   else
     {
-      FRAME_INIT_SAVED_REGS (frame);
-      if (frame->saved_regs[IA64_VFP_REGNUM])
-       return read_memory_integer (frame->saved_regs[IA64_VFP_REGNUM], 8);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
+      if (get_frame_saved_regs (frame)[IA64_VFP_REGNUM])
+       return read_memory_integer (get_frame_saved_regs (frame)[IA64_VFP_REGNUM], 8);
       else
-       return frame->frame + frame->extra_info->mem_stack_frame_size;
+       return (get_frame_base (frame)
+               + get_frame_extra_info (frame)->mem_stack_frame_size);
     }
 }
 
-CORE_ADDR
+static CORE_ADDR
 ia64_frame_saved_pc (struct frame_info *frame)
 {
-  if (frame->signal_handler_caller)
+  if ((get_frame_type (frame) == SIGTRAMP_FRAME))
     return read_sigcontext_register (frame, pc_regnum);
-  else if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
-    return generic_read_register_dummy (frame->pc, frame->frame, pc_regnum);
+  else if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+                                       get_frame_base (frame),
+                                       get_frame_base (frame)))
+    return deprecated_read_register_dummy (get_frame_pc (frame),
+                                          get_frame_base (frame), pc_regnum);
   else
     {
-      FRAME_INIT_SAVED_REGS (frame);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
 
-      if (frame->saved_regs[IA64_VRAP_REGNUM])
-       return read_memory_integer (frame->saved_regs[IA64_VRAP_REGNUM], 8);
-      else if (frame->next && frame->next->signal_handler_caller)
-       return read_sigcontext_register (frame->next, IA64_BR0_REGNUM);
+      if (get_frame_saved_regs (frame)[IA64_VRAP_REGNUM])
+       return read_memory_integer (get_frame_saved_regs (frame)[IA64_VRAP_REGNUM], 8);
+      else if (get_next_frame (frame)
+              && (get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME))
+       return read_sigcontext_register (get_next_frame (frame), IA64_BR0_REGNUM);
       else     /* either frameless, or not far enough along in the prologue... */
        return ia64_saved_pc_after_call (frame);
     }
 }
 
+/* Limit the number of skipped non-prologue instructions since examining
+   of the prologue is expensive.  */
+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
+   for a prologue, attempt to further refine this limit by using
+   the line data in the symbol table.  If successful, a better guess
+   on where the prologue ends is returned, otherwise the previous
+   value of lim_pc is returned.  TRUST_LIMIT is a pointer to a flag
+   which will be set to indicate whether the returned limit may be
+   used with no further scanning in the event that the function is
+   frameless.  */
+
+static CORE_ADDR
+refine_prologue_limit (CORE_ADDR pc, CORE_ADDR lim_pc, int *trust_limit)
+{
+  struct symtab_and_line prologue_sal;
+  CORE_ADDR start_pc = pc;
+
+  /* Start off not trusting the limit.  */
+  *trust_limit = 0;
+
+  prologue_sal = find_pc_line (pc, 0);
+  if (prologue_sal.line != 0)
+    {
+      int i;
+      CORE_ADDR addr = prologue_sal.end;
+
+      /* Handle the case in which compiler's optimizer/scheduler
+         has moved instructions into the prologue.  We scan ahead
+        in the function looking for address ranges whose corresponding
+        line number is less than or equal to the first one that we
+        found for the function.  (It can be less than when the
+        scheduler puts a body instruction before the first prologue
+        instruction.)  */
+      for (i = 2 * max_skip_non_prologue_insns; 
+           i > 0 && (lim_pc == 0 || addr < lim_pc);
+          i--)
+        {
+         struct symtab_and_line sal;
+
+         sal = find_pc_line (addr, 0);
+         if (sal.line == 0)
+           break;
+         if (sal.line <= prologue_sal.line 
+             && sal.symtab == prologue_sal.symtab)
+           {
+             prologue_sal = sal;
+           }
+         addr = sal.end;
+       }
+
+      if (lim_pc == 0 || prologue_sal.end < lim_pc)
+       {
+         lim_pc = prologue_sal.end;
+         if (start_pc == get_pc_function_start (lim_pc))
+           *trust_limit = 1;
+       }
+    }
+  return lim_pc;
+}
+
 #define isScratch(_regnum_) ((_regnum_) == 2 || (_regnum_) == 3 \
   || (8 <= (_regnum_) && (_regnum_) <= 11) \
   || (14 <= (_regnum_) && (_regnum_) <= 31))
@@ -708,11 +837,15 @@ 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 && !frame->saved_regs)
+  if (frame && !get_frame_saved_regs (frame))
     {
       frame_saved_regs_zalloc (frame);
       do_fsr_stuff = 1;
@@ -720,16 +853,19 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
 
   if (frame 
       && !do_fsr_stuff
-      && frame->extra_info->after_prologue != 0
-      && frame->extra_info->after_prologue <= lim_pc)
-    return frame->extra_info->after_prologue;
+      && get_frame_extra_info (frame)->after_prologue != 0
+      && get_frame_extra_info (frame)->after_prologue <= lim_pc)
+    return get_frame_extra_info (frame)->after_prologue;
 
-  /* Must start with an alloc instruction */
+  lim_pc = refine_prologue_limit (pc, lim_pc, &trust_limit);
   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);
@@ -743,7 +879,37 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
       pc = next_pc;
     }
   else
-    pc = lim_pc;       /* We're done early */
+    {
+      /* 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
      where preserved registers were spilled. */
@@ -753,10 +919,13 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
       if (next_pc == 0)
        break;
 
-      if (it == B || ((instr & 0x3fLL) != 0LL))
+      if ((it == B && ((instr & 0x1e1f800003f) != 0x04000000000))
+          || ((instr & 0x3fLL) != 0LL))
        {
-         /* Exit loop upon hitting a branch instruction or a predicated
-            instruction. */
+         /* 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))
@@ -810,12 +979,26 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
              /* Hmm... whether or not this will work will depend on
                 where the pc is.  If it's still early in the prologue
                 this'll be wrong.  FIXME */
-             spill_addr  = (frame ? frame->frame : 0)
+             spill_addr  = (frame ? get_frame_base (frame) : 0)
                          + (rM == 12 ? 0 : mem_stack_frame_size) 
                          + imm;
              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)
@@ -833,7 +1016,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
              && ((2 <= fM && fM <= 5) || (16 <= fM && fM <= 31)))
            {
              if (do_fsr_stuff)
-               frame->saved_regs[IA64_FR0_REGNUM + fM] = spill_addr;
+               get_frame_saved_regs (frame)[IA64_FR0_REGNUM + fM] = spill_addr;
 
               if ((instr & 0x1efc0000000) == 0x0eec0000000)
                spill_addr += imm;
@@ -881,6 +1064,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))
            {
@@ -892,14 +1076,14 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
                {
                  /* Track UNAT register */
                  if (do_fsr_stuff)
-                   frame->saved_regs[IA64_UNAT_REGNUM] = spill_addr;
+                   get_frame_saved_regs (frame)[IA64_UNAT_REGNUM] = spill_addr;
                  unat_save_reg = 0;
                }
              else
                {
                  /* Track PR register */
                  if (do_fsr_stuff)
-                   frame->saved_regs[IA64_PR_REGNUM] = spill_addr;
+                   get_frame_saved_regs (frame)[IA64_PR_REGNUM] = spill_addr;
                  pr_save_reg = 0;
                }
              if ((instr & 0x1efc0000000LL) == 0x0acc0000000LL)
@@ -915,6 +1099,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))
        {
@@ -929,11 +1120,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))
         {
@@ -968,7 +1167,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
                 regs.  Record the spill address and advance the spill
                 register if appropriate. */
              if (do_fsr_stuff)
-               frame->saved_regs[IA64_GR0_REGNUM + rM] = spill_addr;
+               get_frame_saved_regs (frame)[IA64_GR0_REGNUM + rM] = spill_addr;
              if ((instr & 0x1efc0000000LL) == 0x0aec0000000LL)
                /* st8.spill [rN] = rM, imm9 */
                spill_addr += imm9(instr);
@@ -989,11 +1188,11 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
     /* Extract the size of the rotating portion of the stack
        frame and the register rename base from the current
        frame marker. */
-    sor = ((frame->extra_info->cfm >> 14) & 0xf) * 8;
-    rrb_gr = (frame->extra_info->cfm >> 18) & 0x7f;
+    sor = ((get_frame_extra_info (frame)->cfm >> 14) & 0xf) * 8;
+    rrb_gr = (get_frame_extra_info (frame)->cfm >> 18) & 0x7f;
 
-    for (i = 0, addr = frame->extra_info->bsp;
-        i < frame->extra_info->sof;
+    for (i = 0, addr = get_frame_extra_info (frame)->bsp;
+        i < get_frame_extra_info (frame)->sof;
         i++, addr += 8)
       {
        if (IS_NaT_COLLECTION_ADDR (addr))
@@ -1001,25 +1200,30 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct frame_info *frame)
            addr += 8;
          }
        if (i < sor)
-         frame->saved_regs[IA64_GR32_REGNUM + ((i + (sor - rrb_gr)) % sor)] 
+         get_frame_saved_regs (frame)[IA64_GR32_REGNUM + ((i + (sor - rrb_gr)) % sor)] 
            = addr;
        else
-         frame->saved_regs[IA64_GR32_REGNUM + i] = addr;
+         get_frame_saved_regs (frame)[IA64_GR32_REGNUM + i] = addr;
 
        if (i+32 == cfm_reg)
-         frame->saved_regs[IA64_CFM_REGNUM] = addr;
+         get_frame_saved_regs (frame)[IA64_CFM_REGNUM] = addr;
        if (i+32 == ret_reg)
-         frame->saved_regs[IA64_VRAP_REGNUM] = addr;
+         get_frame_saved_regs (frame)[IA64_VRAP_REGNUM] = addr;
        if (i+32 == fp_reg)
-         frame->saved_regs[IA64_VFP_REGNUM] = addr;
+         get_frame_saved_regs (frame)[IA64_VFP_REGNUM] = addr;
       }
   }
 
-  if (frame && frame->extra_info) {
-    frame->extra_info->after_prologue = last_prologue_pc;
-    frame->extra_info->mem_stack_frame_size = mem_stack_frame_size;
-    frame->extra_info->fp_reg = fp_reg;
-  }
+  if (frame && get_frame_extra_info (frame))
+    {
+      get_frame_extra_info (frame)->after_prologue = last_prologue_pc;
+      get_frame_extra_info (frame)->mem_stack_frame_size = mem_stack_frame_size;
+      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;
 }
@@ -1030,61 +1234,61 @@ 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 (frame->saved_regs)
+  if (get_frame_saved_regs (frame))
     return;
 
-  if (frame->signal_handler_caller && SIGCONTEXT_REGISTER_ADDRESS)
+  if ((get_frame_type (frame) == SIGTRAMP_FRAME) && SIGCONTEXT_REGISTER_ADDRESS)
     {
       int regno;
 
       frame_saved_regs_zalloc (frame);
 
-      frame->saved_regs[IA64_VRAP_REGNUM] = 
-       SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_IP_REGNUM);
-      frame->saved_regs[IA64_CFM_REGNUM] = 
-       SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_CFM_REGNUM);
-      frame->saved_regs[IA64_PSR_REGNUM] = 
-       SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_PSR_REGNUM);
+      get_frame_saved_regs (frame)[IA64_VRAP_REGNUM] = 
+       SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), IA64_IP_REGNUM);
+      get_frame_saved_regs (frame)[IA64_CFM_REGNUM] = 
+       SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), IA64_CFM_REGNUM);
+      get_frame_saved_regs (frame)[IA64_PSR_REGNUM] = 
+       SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), IA64_PSR_REGNUM);
 #if 0
-      frame->saved_regs[IA64_BSP_REGNUM] = 
+      get_frame_saved_regs (frame)[IA64_BSP_REGNUM] = 
        SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_BSP_REGNUM);
 #endif
-      frame->saved_regs[IA64_RNAT_REGNUM] = 
-       SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_RNAT_REGNUM);
-      frame->saved_regs[IA64_CCV_REGNUM] = 
-       SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_CCV_REGNUM);
-      frame->saved_regs[IA64_UNAT_REGNUM] = 
-       SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_UNAT_REGNUM);
-      frame->saved_regs[IA64_FPSR_REGNUM] = 
-       SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_FPSR_REGNUM);
-      frame->saved_regs[IA64_PFS_REGNUM] = 
-       SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_PFS_REGNUM);
-      frame->saved_regs[IA64_LC_REGNUM] = 
-       SIGCONTEXT_REGISTER_ADDRESS (frame->frame, IA64_LC_REGNUM);
+      get_frame_saved_regs (frame)[IA64_RNAT_REGNUM] = 
+       SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), IA64_RNAT_REGNUM);
+      get_frame_saved_regs (frame)[IA64_CCV_REGNUM] = 
+       SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), IA64_CCV_REGNUM);
+      get_frame_saved_regs (frame)[IA64_UNAT_REGNUM] = 
+       SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), IA64_UNAT_REGNUM);
+      get_frame_saved_regs (frame)[IA64_FPSR_REGNUM] = 
+       SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), IA64_FPSR_REGNUM);
+      get_frame_saved_regs (frame)[IA64_PFS_REGNUM] = 
+       SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), IA64_PFS_REGNUM);
+      get_frame_saved_regs (frame)[IA64_LC_REGNUM] = 
+       SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), IA64_LC_REGNUM);
       for (regno = IA64_GR1_REGNUM; regno <= IA64_GR31_REGNUM; regno++)
        if (regno != sp_regnum)
-         frame->saved_regs[regno] =
-           SIGCONTEXT_REGISTER_ADDRESS (frame->frame, regno);
+         get_frame_saved_regs (frame)[regno] =
+           SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), regno);
       for (regno = IA64_BR0_REGNUM; regno <= IA64_BR7_REGNUM; regno++)
-       frame->saved_regs[regno] =
-         SIGCONTEXT_REGISTER_ADDRESS (frame->frame, regno);
+       get_frame_saved_regs (frame)[regno] =
+         SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), regno);
       for (regno = IA64_FR2_REGNUM; regno <= IA64_BR7_REGNUM; regno++)
-       frame->saved_regs[regno] =
-         SIGCONTEXT_REGISTER_ADDRESS (frame->frame, regno);
+       get_frame_saved_regs (frame)[regno] =
+         SIGCONTEXT_REGISTER_ADDRESS (get_frame_base (frame), regno);
     }
   else
     {
       CORE_ADDR func_start;
 
-      func_start = get_pc_function_start (frame->pc);
-      examine_prologue (func_start, 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,
@@ -1106,17 +1310,20 @@ ia64_get_saved_register (char *raw_buffer,
   if (lval != NULL)
     *lval = not_lval;
 
-  is_dummy_frame = PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame);
+  is_dummy_frame = DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+                                               get_frame_base (frame),
+                                               get_frame_base (frame));
 
-  if (regnum == SP_REGNUM && frame->next)
+  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), frame->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), 
-                     frame->extra_info->bsp);
+      store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), 
+                             get_frame_extra_info (frame)->bsp);
     }
   else if (regnum == IA64_VFP_REGNUM)
     {
@@ -1124,12 +1331,13 @@ ia64_get_saved_register (char *raw_buffer,
          for the frame pointer, it'll be found by ia64_find_saved_register()
         above.  If the function lacks one of these frame pointers, we can
         still provide a value since we know the size of the frame */
-      CORE_ADDR vfp = frame->frame + frame->extra_info->mem_stack_frame_size;
-      store_address (raw_buffer, REGISTER_RAW_SIZE (IA64_VFP_REGNUM), vfp);
+      CORE_ADDR vfp = (get_frame_base (frame)
+                      + get_frame_extra_info (frame)->mem_stack_frame_size);
+      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[MAX_REGISTER_RAW_SIZE];
+      char pr_raw_buffer[MAX_REGISTER_SIZE];
       int  pr_optim;
       enum lval_type pr_lval;
       CORE_ADDR pr_addr;
@@ -1140,7 +1348,7 @@ ia64_get_saved_register (char *raw_buffer,
        {
          /* Fetch predicate register rename base from current frame
             marker for this frame. */
-         int rrb_pr = (frame->extra_info->cfm >> 32) & 0x3f;
+         int rrb_pr = (get_frame_extra_info (frame)->cfm >> 32) & 0x3f;
 
          /* Adjust the register number to account for register rotation. */
          regnum = IA64_PR16_REGNUM 
@@ -1152,7 +1360,7 @@ ia64_get_saved_register (char *raw_buffer,
     }
   else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
     {
-      char unat_raw_buffer[MAX_REGISTER_RAW_SIZE];
+      char unat_raw_buffer[MAX_REGISTER_SIZE];
       int  unat_optim;
       enum lval_type unat_lval;
       CORE_ADDR unat_addr;
@@ -1173,9 +1381,9 @@ ia64_get_saved_register (char *raw_buffer,
 
       if (!is_dummy_frame)
        {
-         FRAME_INIT_SAVED_REGS (frame);
-         gr_addr = frame->saved_regs[ regnum - IA64_NAT0_REGNUM 
-                                             + IA64_GR0_REGNUM];
+         DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
+         gr_addr = get_frame_saved_regs (frame)[ regnum - IA64_NAT0_REGNUM 
+                                               + IA64_GR0_REGNUM];
        }
       if (gr_addr)
        {
@@ -1199,24 +1407,24 @@ ia64_get_saved_register (char *raw_buffer,
   else if (regnum == IA64_IP_REGNUM)
     {
       CORE_ADDR pc;
-      if (frame->next)
+      if (get_next_frame (frame))
         {
          /* FIXME: Set *addrp, *lval when possible. */
-         pc = ia64_frame_saved_pc (frame->next);
+         pc = ia64_frame_saved_pc (get_next_frame (frame));
         }
       else
         {
          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)
     {
       CORE_ADDR addr = 0;
       if (!is_dummy_frame)
        {
-         FRAME_INIT_SAVED_REGS (frame);
-         addr = frame->saved_regs[regnum];
+         DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
+         addr = get_frame_saved_regs (frame)[regnum];
        }
 
       if (addr != 0)
@@ -1240,7 +1448,7 @@ ia64_get_saved_register (char *raw_buffer,
        {
          /* Fetch floating point register rename base from current
             frame marker for this frame. */
-         int rrb_fr = (frame->extra_info->cfm >> 25) & 0x7f;
+         int rrb_fr = (get_frame_extra_info (frame)->cfm >> 25) & 0x7f;
 
          /* Adjust the floating point register number to account for
             register rotation. */
@@ -1248,8 +1456,8 @@ ia64_get_saved_register (char *raw_buffer,
                 + ((regnum - IA64_FR32_REGNUM) + rrb_fr) % 96;
        }
 
-      generic_get_saved_register (raw_buffer, optimized, addrp, frame,
-                                  regnum, lval);
+      deprecated_generic_get_saved_register (raw_buffer, optimized, addrp,
+                                            frame, regnum, lval);
     }
 }
 
@@ -1312,7 +1520,7 @@ 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. */
@@ -1323,8 +1531,8 @@ ia64_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 int
 ia64_frameless_function_invocation (struct frame_info *frame)
 {
-  /* FIXME: Implement */
-  return 0;
+  DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
+  return (get_frame_extra_info (frame)->mem_stack_frame_size == 0);
 }
 
 CORE_ADDR
@@ -1333,7 +1541,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
@@ -1341,7 +1549,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
@@ -1349,68 +1557,74 @@ 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;
-  int next_frame_is_call_dummy = ((frame->next != NULL)
-    && PC_IN_CALL_DUMMY (frame->next->pc, frame->next->frame,
-                                          frame->next->frame));
+  int next_frame_is_call_dummy = ((get_next_frame (frame) != NULL)
+    && DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (get_next_frame (frame)),
+                                   get_frame_base (get_next_frame (frame)),
+                                   get_frame_base (get_next_frame (frame))));
 
-  frame->extra_info = (struct frame_extra_info *)
-    frame_obstack_alloc (sizeof (struct frame_extra_info));
+  frame_extra_info_zalloc (frame, sizeof (struct frame_extra_info));
 
-  if (frame->next == 0)
+  if (get_next_frame (frame) == 0)
     {
       bsp = read_register (IA64_BSP_REGNUM);
       cfm = read_register (IA64_CFM_REGNUM);
 
     }
-  else if (frame->next->signal_handler_caller)
+  else if ((get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME))
     {
-      bsp = read_sigcontext_register (frame->next, IA64_BSP_REGNUM);
-      cfm = read_sigcontext_register (frame->next, IA64_CFM_REGNUM);
+      bsp = read_sigcontext_register (get_next_frame (frame), IA64_BSP_REGNUM);
+      cfm = read_sigcontext_register (get_next_frame (frame), IA64_CFM_REGNUM);
     }
   else if (next_frame_is_call_dummy)
     {
-      bsp = generic_read_register_dummy (frame->next->pc, frame->next->frame,
-                                         IA64_BSP_REGNUM);
-      cfm = generic_read_register_dummy (frame->next->pc, frame->next->frame,
-                                         IA64_CFM_REGNUM);
+      bsp = deprecated_read_register_dummy (get_frame_pc (get_next_frame (frame)),
+                                           get_frame_base (get_next_frame (frame)),
+                                           IA64_BSP_REGNUM);
+      cfm = deprecated_read_register_dummy (get_frame_pc (get_next_frame (frame)),
+                                           get_frame_base (get_next_frame (frame)),
+                                           IA64_CFM_REGNUM);
     }
   else
     {
-      struct frame_info *frn = frame->next;
-
-      FRAME_INIT_SAVED_REGS (frn);
-
-      if (frn->saved_regs[IA64_CFM_REGNUM] != 0)
-       cfm = read_memory_integer (frn->saved_regs[IA64_CFM_REGNUM], 8);
-      else if (frn->next && frn->next->signal_handler_caller)
-       cfm = read_sigcontext_register (frn->next, IA64_PFS_REGNUM);
-      else if (frn->next
-               && PC_IN_CALL_DUMMY (frn->next->pc, frn->next->frame,
-                                                  frn->next->frame))
-       cfm = generic_read_register_dummy (frn->next->pc, frn->next->frame,
-                                          IA64_PFS_REGNUM);
+      struct frame_info *frn = get_next_frame (frame);
+
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frn);
+
+      if (get_frame_saved_regs (frn)[IA64_CFM_REGNUM] != 0)
+       cfm = read_memory_integer (get_frame_saved_regs (frn)[IA64_CFM_REGNUM], 8);
+      else if (get_next_frame (frn) && (get_frame_type (get_next_frame (frn)) == SIGTRAMP_FRAME))
+       cfm = read_sigcontext_register (get_next_frame (frn), IA64_PFS_REGNUM);
+      else if (get_next_frame (frn)
+               && DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (get_next_frame (frn)),
+                                              get_frame_base (get_next_frame (frn)),
+                                              get_frame_base (get_next_frame (frn))))
+       cfm = deprecated_read_register_dummy (get_frame_pc (get_next_frame (frn)),
+                                             get_frame_base (get_next_frame (frn)),
+                                             IA64_PFS_REGNUM);
       else
        cfm = read_register (IA64_PFS_REGNUM);
 
-      bsp = frn->extra_info->bsp;
+      bsp = get_frame_extra_info (frn)->bsp;
     }
-  frame->extra_info->cfm = cfm;
-  frame->extra_info->sof = cfm & 0x7f;
-  frame->extra_info->sol = (cfm >> 7) & 0x7f;
-  if (frame->next == 0 
-      || frame->next->signal_handler_caller 
+  get_frame_extra_info (frame)->cfm = cfm;
+  get_frame_extra_info (frame)->sof = cfm & 0x7f;
+  get_frame_extra_info (frame)->sol = (cfm >> 7) & 0x7f;
+  if (get_next_frame (frame) == 0 
+      || (get_frame_type (get_next_frame (frame)) == SIGTRAMP_FRAME) 
       || next_frame_is_call_dummy)
-    frame->extra_info->bsp = rse_address_add (bsp, -frame->extra_info->sof);
+    get_frame_extra_info (frame)->bsp =
+      rse_address_add (bsp, -get_frame_extra_info (frame)->sof);
   else
-    frame->extra_info->bsp = rse_address_add (bsp, -frame->extra_info->sol);
+    get_frame_extra_info (frame)->bsp =
+      rse_address_add (bsp, -get_frame_extra_info (frame)->sol);
 
-  frame->extra_info->after_prologue = 0;
-  frame->extra_info->mem_stack_frame_size = -1;                /* Not yet determined */
-  frame->extra_info->fp_reg = 0;
+  get_frame_extra_info (frame)->after_prologue = 0;
+  get_frame_extra_info (frame)->mem_stack_frame_size = -1;             /* Not yet determined */
+  get_frame_extra_info (frame)->fp_reg = 0;
 }
 
 static int
@@ -1428,14 +1642,17 @@ is_float_or_hfa_type_recurse (struct type *t, struct type **etp)
        }
       break;
     case TYPE_CODE_ARRAY:
-      return is_float_or_hfa_type_recurse (TYPE_TARGET_TYPE (t), etp);
+      return
+       is_float_or_hfa_type_recurse (check_typedef (TYPE_TARGET_TYPE (t)),
+                                     etp);
       break;
     case TYPE_CODE_STRUCT:
       {
        int i;
 
        for (i = 0; i < TYPE_NFIELDS (t); i++)
-         if (!is_float_or_hfa_type_recurse (TYPE_FIELD_TYPE (t, i), etp))
+         if (!is_float_or_hfa_type_recurse
+             (check_typedef (TYPE_FIELD_TYPE (t, i)), etp))
            return 0;
        return 1;
       }
@@ -1459,6 +1676,40 @@ is_float_or_hfa_type (struct type *t)
 }
 
 
+/* Return 1 if the alignment of T is such that the next even slot
+   should be used.  Return 0, if the next available slot should
+   be used.  (See section 8.5.1 of the IA-64 Software Conventions
+   and Runtime manual.)  */
+
+static int
+slot_alignment_is_next_even (struct type *t)
+{
+  switch (TYPE_CODE (t))
+    {
+    case TYPE_CODE_INT:
+    case TYPE_CODE_FLT:
+      if (TYPE_LENGTH (t) > 8)
+       return 1;
+      else
+       return 0;
+    case TYPE_CODE_ARRAY:
+      return
+       slot_alignment_is_next_even (check_typedef (TYPE_TARGET_TYPE (t)));
+    case TYPE_CODE_STRUCT:
+      {
+       int i;
+
+       for (i = 0; i < TYPE_NFIELDS (t); i++)
+         if (slot_alignment_is_next_even
+             (check_typedef (TYPE_FIELD_TYPE (t, i))))
+           return 1;
+       return 0;
+      }
+    default:
+      return 0;
+    }
+}
+
 /* Attempt to find (and return) the global pointer for the given
    function.
 
@@ -1470,7 +1721,7 @@ is_float_or_hfa_type (struct type *t)
    d_un.d_ptr value is the global pointer.  */
 
 static CORE_ADDR
-find_global_pointer (CORE_ADDR faddr)
+generic_elf_find_global_pointer (CORE_ADDR faddr)
 {
   struct obj_section *faddr_sect;
      
@@ -1508,7 +1759,7 @@ 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;
@@ -1591,13 +1842,13 @@ find_func_descr (CORE_ADDR faddr, CORE_ADDR *fdaptr)
       fdesc = *fdaptr;
       *fdaptr += 16;
 
-      global_pointer = find_global_pointer (faddr);
+      global_pointer = FIND_GLOBAL_POINTER (faddr);
 
       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);
     }
@@ -1605,12 +1856,12 @@ find_func_descr (CORE_ADDR faddr, CORE_ADDR *fdaptr)
   return fdesc; 
 }
 
-CORE_ADDR
-ia64_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
+static CORE_ADDR
+ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
                    int struct_return, CORE_ADDR struct_addr)
 {
   int argno;
-  value_ptr arg;
+  struct value *arg;
   struct type *type;
   int len, argoffset;
   int nslots, rseslots, memslots, slotnum, nfuncargs;
@@ -1626,9 +1877,7 @@ ia64_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
       type = check_typedef (VALUE_TYPE (arg));
       len = TYPE_LENGTH (type);
 
-      /* FIXME: This is crude and it is wrong (IMO), but it matches
-         what gcc does, I think. */
-      if (len > 8 && (nslots & 1))
+      if ((nslots & 1) && slot_alignment_is_next_even (type))
        nslots++;
 
       if (TYPE_CODE (type) == TYPE_CODE_FUNC)
@@ -1691,9 +1940,9 @@ ia64_push_arguments (int nargs, value_ptr *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
@@ -1703,8 +1952,11 @@ ia64_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
        }
 
       /* Normal slots */
-      if (len > 8 && (slotnum & 1))
+
+      /* Skip odd slot if necessary...  */
+      if ((slotnum & 1) && slot_alignment_is_next_even (type))
        slotnum++;
+
       argoffset = 0;
       while (len > 0)
        {
@@ -1735,7 +1987,7 @@ ia64_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
                float_elt_type,
                floatreg,
                VALUE_CONTENTS (arg) + argoffset,
-               &registers[REGISTER_BYTE (floatreg)]);
+               &deprecated_registers[REGISTER_BYTE (floatreg)]);
              floatreg++;
              argoffset += TYPE_LENGTH (float_elt_type);
              len -= TYPE_LENGTH (float_elt_type);
@@ -1746,9 +1998,9 @@ ia64_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
   /* Store the struct return value in r8 if necessary. */
   if (struct_return)
     {
-      store_address (&registers[REGISTER_BYTE (IA64_GR8_REGNUM)],
-                     REGISTER_RAW_SIZE (IA64_GR8_REGNUM),
-                    struct_addr);
+      store_unsigned_integer (&deprecated_registers[REGISTER_BYTE (IA64_GR8_REGNUM)],
+                             REGISTER_RAW_SIZE (IA64_GR8_REGNUM),
+                             struct_addr);
     }
 
   /* Sync gdb's idea of what the registers are with the target. */
@@ -1769,10 +2021,10 @@ ia64_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp,
   return sp;
 }
 
-CORE_ADDR
+static CORE_ADDR
 ia64_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
-  CORE_ADDR global_pointer = find_global_pointer (pc);
+  CORE_ADDR global_pointer = FIND_GLOBAL_POINTER (pc);
 
   if (global_pointer != 0)
     write_register (IA64_GR1_REGNUM, global_pointer);
@@ -1781,21 +2033,21 @@ ia64_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
   return sp;
 }
 
-void
+static void
 ia64_store_return_value (struct type *type, char *valbuf)
 {
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
     {
       ia64_register_convert_to_raw (type, IA64_FR8_REGNUM, valbuf,
-                                 &registers[REGISTER_BYTE (IA64_FR8_REGNUM)]);
+                                   &deprecated_registers[REGISTER_BYTE (IA64_FR8_REGNUM)]);
       target_store_registers (IA64_FR8_REGNUM);
     }
   else
-    write_register_bytes (REGISTER_BYTE (IA64_GR8_REGNUM),
-                         valbuf, TYPE_LENGTH (type));
+    deprecated_write_register_bytes (REGISTER_BYTE (IA64_GR8_REGNUM),
+                                    valbuf, TYPE_LENGTH (type));
 }
 
-void
+static void
 ia64_pop_frame (void)
 {
   generic_pop_current_frame (ia64_pop_frame_regular);
@@ -1807,11 +2059,11 @@ ia64_pop_frame_regular (struct frame_info *frame)
   int regno;
   CORE_ADDR bsp, cfm, pfs;
 
-  FRAME_INIT_SAVED_REGS (frame);
+  DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
 
   for (regno = 0; regno < ia64_num_regs; regno++)
     {
-      if (frame->saved_regs[regno]
+      if (get_frame_saved_regs (frame)[regno]
          && (!(IA64_GR32_REGNUM <= regno && regno <= IA64_GR127_REGNUM))
          && regno != pc_regnum
          && regno != sp_regnum
@@ -1821,19 +2073,19 @@ ia64_pop_frame_regular (struct frame_info *frame)
          && regno != IA64_BSPSTORE_REGNUM)
        {
          write_register (regno, 
-                         read_memory_integer (frame->saved_regs[regno],
+                         read_memory_integer (get_frame_saved_regs (frame)[regno],
                                               REGISTER_RAW_SIZE (regno)));
        }
     }
 
-  write_register (sp_regnum, FRAME_CHAIN (frame));
-  write_pc (FRAME_SAVED_PC (frame));
+  write_register (sp_regnum, DEPRECATED_FRAME_CHAIN (frame));
+  write_pc (DEPRECATED_FRAME_SAVED_PC (frame));
 
   cfm = read_register (IA64_CFM_REGNUM);
 
-  if (frame->saved_regs[IA64_PFS_REGNUM])
+  if (get_frame_saved_regs (frame)[IA64_PFS_REGNUM])
     {
-      pfs = read_memory_integer (frame->saved_regs[IA64_PFS_REGNUM],
+      pfs = read_memory_integer (get_frame_saved_regs (frame)[IA64_PFS_REGNUM],
                                 REGISTER_RAW_SIZE (IA64_PFS_REGNUM));
     }
   else
@@ -1843,11 +2095,11 @@ ia64_pop_frame_regular (struct frame_info *frame)
      size of the frame and the size of the locals (both wrt the
      frame that we're going back to).  This seems kind of strange,
      especially since it seems like we ought to be subtracting the
-     size of the locals... and we should; but the linux kernel
+     size of the locals... and we should; but the Linux kernel
      wants bsp to be set at the end of all used registers.  It's
      likely that this code will need to be revised to accomodate
      other operating systems. */
-  bsp = rse_address_add (frame->extra_info->bsp,
+  bsp = rse_address_add (get_frame_extra_info (frame)->bsp,
                          (pfs & 0x7f) - ((pfs >> 7) & 0x7f));
   write_register (IA64_BSP_REGNUM, bsp);
 
@@ -1859,7 +2111,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;
@@ -1898,17 +2152,15 @@ process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
            case 0 :
              *os_ident_ptr = ELFOSABI_LINUX;
              break;
-#if 0  /* FIXME: Enable after internal repository is synced with sourceware */
            case 1 :
              *os_ident_ptr = ELFOSABI_HURD;
              break;
            case 2 :
              *os_ident_ptr = ELFOSABI_SOLARIS;
              break;
-#endif
            default :
-             internal_error (
-               "process_note_abi_sections: unknown OS number %d", os_number);
+             internal_error (__FILE__, __LINE__,
+                             "process_note_abi_sections: unknown OS number %d", os_number);
              break;
            }
        }
@@ -1927,10 +2179,11 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     {
       os_ident = elf_elfheader (info.abfd)->e_ident[EI_OSABI];
 
-      /* If os_ident is 0, it is not necessarily the case that we're on a
-         SYSV system.  (ELFOSABI_NONE is defined to be 0.) GNU/Linux uses
-        a note section to record OS/ABI info, but leaves e_ident[EI_OSABI]
-        zero.  So we have to check for note sections too. */
+      /* If os_ident is 0, it is not necessarily the case that we're
+         on a SYSV system.  (ELFOSABI_NONE is defined to be 0.)
+         GNU/Linux uses a note section to record OS/ABI info, but
+         leaves e_ident[EI_OSABI] zero.  So we have to check for note
+         sections too. */
       if (os_ident == 0)
        {
          bfd_map_over_sections (info.abfd,
@@ -1945,20 +2198,45 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
        arches != NULL;
        arches = gdbarch_list_lookup_by_info (arches->next, &info))
     {
-      if (gdbarch_tdep (current_gdbarch)->os_ident != os_ident)
-       continue;
-      return arches->gdbarch;
+      tdep = gdbarch_tdep (arches->gdbarch);
+      if (tdep &&tdep->os_ident == os_ident)
+       return arches->gdbarch;
     }
 
   tdep = xmalloc (sizeof (struct gdbarch_tdep));
   gdbarch = gdbarch_alloc (&info, tdep);
   tdep->os_ident = os_ident;
 
+  /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
+     ready to unwind the PC first (see frame.c:get_prev_frame()).  */
+  set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
+
+  /* Set the method of obtaining the sigcontext addresses at which
+     registers are saved.  The method of checking to see if
+     native_find_global_pointer is nonzero to indicate that we're
+     on AIX is kind of hokey, but I can't think of a better way
+     to do it.  */
   if (os_ident == ELFOSABI_LINUX)
     tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address;
+  else if (native_find_global_pointer != 0)
+    tdep->sigcontext_register_address = ia64_aix_sigcontext_register_address;
   else
     tdep->sigcontext_register_address = 0;
 
+  /* We know that GNU/Linux won't have to resort to the
+     native_find_global_pointer hackery.  But that's the only one we
+     know about so far, so if native_find_global_pointer is set to
+     something non-zero, then use it.  Otherwise fall back to using
+     generic_elf_find_global_pointer.  This arrangement should (in
+     theory) allow us to cross debug GNU/Linux binaries from an AIX
+     machine.  */
+  if (os_ident == ELFOSABI_LINUX)
+    tdep->find_global_pointer = generic_elf_find_global_pointer;
+  else if (native_find_global_pointer != 0)
+    tdep->find_global_pointer = native_find_global_pointer;
+  else
+    tdep->find_global_pointer = generic_elf_find_global_pointer;
+
   set_gdbarch_short_bit (gdbarch, 16);
   set_gdbarch_int_bit (gdbarch, 32);
   set_gdbarch_long_bit (gdbarch, 64);
@@ -1970,43 +2248,42 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   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_deprecated_register_size (gdbarch, 8);
+  set_gdbarch_deprecated_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_max_register_raw_size (gdbarch, 16);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 16);
   set_gdbarch_register_virtual_size (gdbarch, ia64_register_virtual_size);
-  set_gdbarch_max_register_virtual_size (gdbarch, 16);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 16);
   set_gdbarch_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_frame_chain (gdbarch, ia64_frame_chain);
-  set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid);
-  set_gdbarch_frame_saved_pc (gdbarch, ia64_frame_saved_pc);
+  set_gdbarch_deprecated_frame_chain (gdbarch, ia64_frame_chain);
+  set_gdbarch_deprecated_frame_saved_pc (gdbarch, ia64_frame_saved_pc);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, ia64_frame_init_saved_regs);
-  set_gdbarch_get_saved_register (gdbarch, ia64_get_saved_register);
+  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_use_struct_convention (gdbarch, ia64_use_struct_convention);
-  set_gdbarch_extract_return_value (gdbarch, ia64_extract_return_value);
+  set_gdbarch_deprecated_extract_return_value (gdbarch, ia64_extract_return_value);
 
-  set_gdbarch_store_struct_return (gdbarch, ia64_store_struct_return);
-  set_gdbarch_store_return_value (gdbarch, ia64_store_return_value);
-  set_gdbarch_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address);
+  set_gdbarch_deprecated_store_struct_return (gdbarch, ia64_store_struct_return);
+  set_gdbarch_deprecated_store_return_value (gdbarch, ia64_store_return_value);
+  set_gdbarch_deprecated_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address);
 
   set_gdbarch_memory_insert_breakpoint (gdbarch, ia64_memory_insert_breakpoint);
   set_gdbarch_memory_remove_breakpoint (gdbarch, ia64_memory_remove_breakpoint);
@@ -2015,45 +2292,31 @@ 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_use_generic_dummy_frames (gdbarch, 1);
-  set_gdbarch_call_dummy_length (gdbarch, 0);
-  set_gdbarch_push_arguments (gdbarch, ia64_push_arguments);
-  set_gdbarch_push_return_address (gdbarch, ia64_push_return_address);
-  set_gdbarch_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_init_extra_frame_info (gdbarch, ia64_init_extra_frame_info);
+  set_gdbarch_deprecated_push_arguments (gdbarch, ia64_push_arguments);
+  set_gdbarch_deprecated_push_return_address (gdbarch, ia64_push_return_address);
+  set_gdbarch_deprecated_pop_frame (gdbarch, ia64_pop_frame);
+
+  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);
 
-  /* 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);
-  set_gdbarch_write_fp (gdbarch, generic_target_write_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_location (gdbarch, AT_ENTRY_POINT);
-  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_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
-  set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
-  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);
+  set_gdbarch_frame_args_skip (gdbarch, 0);
 
   set_gdbarch_remote_translate_xfer_address (
     gdbarch, ia64_remote_translate_xfer_address);
@@ -2061,11 +2324,13 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   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;
+  deprecated_tm_print_insn = print_insn_ia64;
+  deprecated_tm_print_insn_info.bytes_per_line = SLOT_MULTIPLIER;
 }