* symfile.h (struct sym_fns): Delete member "sym_flavour".
[deliverable/binutils-gdb.git] / gdb / sparc-tdep.c
index 00bca01b915b10c230b1e0756c441dd65a7d111a..880d2768883fb258dd8c0cc334ec8dcd53dde609 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for SPARC.
 
-   Copyright (C) 2003-2012 Free Software Foundation, Inc.
+   Copyright (C) 2003-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -39,6 +39,7 @@
 #include "gdb_string.h"
 
 #include "sparc-tdep.h"
+#include "sparc-ravenscar-thread.h"
 
 struct regset;
 
@@ -602,7 +603,6 @@ static struct sparc_frame_cache *
 sparc_alloc_frame_cache (void)
 {
   struct sparc_frame_cache *cache;
-  int i;
 
   cache = FRAME_OBSTACK_ZALLOC (struct sparc_frame_cache);
 
@@ -855,7 +855,7 @@ sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
      dynamic linker patches up the first PLT with some code that
      starts with a SAVE instruction.  Patch up PC such that it points
      at the start of our PLT entry.  */
-  if (tdep->plt_entry_size > 0 && in_plt_section (current_pc, NULL))
+  if (tdep->plt_entry_size > 0 && in_plt_section (current_pc))
     pc = current_pc - ((current_pc - pc) % tdep->plt_entry_size);
 
   insn = sparc_fetch_instruction (pc);
@@ -1354,7 +1354,7 @@ sparc32_store_return_value (struct type *type, struct regcache *regcache,
 }
 
 static enum return_value_convention
-sparc32_return_value (struct gdbarch *gdbarch, struct type *func_type,
+sparc32_return_value (struct gdbarch *gdbarch, struct value *function,
                      struct type *type, struct regcache *regcache,
                      gdb_byte *readbuf, const gdb_byte *writebuf)
 {
@@ -1370,15 +1370,21 @@ sparc32_return_value (struct gdbarch *gdbarch, struct type *func_type,
   if (sparc_structure_or_union_p (type)
       || (sparc_floating_p (type) && TYPE_LENGTH (type) == 16))
     {
+      ULONGEST sp;
+      CORE_ADDR addr;
+
       if (readbuf)
        {
-         ULONGEST sp;
-         CORE_ADDR addr;
-
          regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp);
          addr = read_memory_unsigned_integer (sp + 64, 4, byte_order);
          read_memory (addr, readbuf, TYPE_LENGTH (type));
        }
+      if (writebuf)
+       {
+         regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp);
+         addr = read_memory_unsigned_integer (sp + 64, 4, byte_order);
+         write_memory (addr, writebuf, TYPE_LENGTH (type));
+       }
 
       return RETURN_VALUE_ABI_PRESERVES_ADDRESS;
     }
@@ -1684,6 +1690,8 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     set_gdbarch_regset_from_core_section (gdbarch,
                                          sparc_regset_from_core_section);
 
+  register_sparc_ravenscar_ops (gdbarch);
+
   return gdbarch;
 }
 \f
@@ -1954,7 +1962,8 @@ sparc32_collect_gregset (const struct sparc_gregset *gregset,
 }
 
 void
-sparc32_supply_fpregset (struct regcache *regcache,
+sparc32_supply_fpregset (const struct sparc_fpregset *fpregset,
+                        struct regcache *regcache,
                         int regnum, const void *fpregs)
 {
   const gdb_byte *regs = fpregs;
@@ -1963,15 +1972,18 @@ sparc32_supply_fpregset (struct regcache *regcache,
   for (i = 0; i < 32; i++)
     {
       if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
-       regcache_raw_supply (regcache, SPARC_F0_REGNUM + i, regs + (i * 4));
+       regcache_raw_supply (regcache, SPARC_F0_REGNUM + i,
+                            regs + fpregset->r_f0_offset + (i * 4));
     }
 
   if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
-    regcache_raw_supply (regcache, SPARC32_FSR_REGNUM, regs + (32 * 4) + 4);
+    regcache_raw_supply (regcache, SPARC32_FSR_REGNUM,
+                        regs + fpregset->r_fsr_offset);
 }
 
 void
-sparc32_collect_fpregset (const struct regcache *regcache,
+sparc32_collect_fpregset (const struct sparc_fpregset *fpregset,
+                         const struct regcache *regcache,
                          int regnum, void *fpregs)
 {
   gdb_byte *regs = fpregs;
@@ -1980,11 +1992,13 @@ sparc32_collect_fpregset (const struct regcache *regcache,
   for (i = 0; i < 32; i++)
     {
       if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
-       regcache_raw_collect (regcache, SPARC_F0_REGNUM + i, regs + (i * 4));
+       regcache_raw_collect (regcache, SPARC_F0_REGNUM + i,
+                             regs + fpregset->r_f0_offset + (i * 4));
     }
 
   if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
-    regcache_raw_collect (regcache, SPARC32_FSR_REGNUM, regs + (32 * 4) + 4);
+    regcache_raw_collect (regcache, SPARC32_FSR_REGNUM,
+                         regs + fpregset->r_fsr_offset);
 }
 \f
 
@@ -2002,6 +2016,18 @@ const struct sparc_gregset sparc32_sunos4_gregset =
   4 * 4,                       /* %g1 */
   -1                           /* %l0 */
 };
+
+const struct sparc_fpregset sparc32_sunos4_fpregset =
+{
+  0 * 4,                       /* %f0 */
+  33 * 4,                      /* %fsr */
+};
+
+const struct sparc_fpregset sparc32_bsd_fpregset =
+{
+  0 * 4,                       /* %f0 */
+  32 * 4,                      /* %fsr */
+};
 \f
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
This page took 0.101656 seconds and 4 git commands to generate.