2007-11-15 Markus Deuling <deuling@de.ibm.com>
[deliverable/binutils-gdb.git] / gdb / m68hc11-tdep.c
index 0e8c51215183c498486af3ded8f0588b4de9f87e..36ddd919eebe5ba11b51f9e7c2aa9a9a314fa22d 100644 (file)
@@ -5,22 +5,20 @@
 
    Contributed by Stephane Carrez, stcarrez@nerim.fr
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 #include "defs.h"
@@ -367,7 +365,7 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
 }
 
 static const char *
-m68hc11_register_name (int reg_nr)
+m68hc11_register_name (struct gdbarch *gdbarch, int reg_nr)
 {
   if (reg_nr == M68HC12_HARD_PC_REGNUM && USE_PAGE_REGISTER)
     return "pc";
@@ -389,10 +387,11 @@ m68hc11_register_name (int reg_nr)
 }
 
 static const unsigned char *
-m68hc11_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
+m68hc11_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
+                           int *lenptr)
 {
   static unsigned char breakpoint[] = {0x0};
-  
+
   *lenptr = sizeof (breakpoint);
   return breakpoint;
 }
@@ -765,8 +764,7 @@ m68hc11_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
   ULONGEST pc;
 
-  frame_unwind_unsigned_register (next_frame, gdbarch_pc_regnum (gdbarch),
-                                  &pc);
+  pc = frame_unwind_register_unsigned (next_frame, gdbarch_pc_regnum (gdbarch));
   return pc;
 }
 
@@ -801,7 +799,7 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame,
   /* The SP was moved to the FP.  This indicates that a new frame
      was created.  Get THIS frame's FP value by unwinding it from
      the next frame.  */
-  frame_unwind_unsigned_register (next_frame, SOFT_FP_REGNUM, &this_base);
+  this_base = frame_unwind_register_unsigned (next_frame, SOFT_FP_REGNUM);
   if (this_base == 0)
     {
       info->base = 0;
@@ -817,7 +815,7 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame,
   if (info->sp_offset != (CORE_ADDR) -1)
     {
       info->saved_regs[HARD_PC_REGNUM].addr = info->sp_offset;
-      frame_unwind_unsigned_register (next_frame, HARD_SP_REGNUM, &this_base);
+      this_base = frame_unwind_register_unsigned (next_frame, HARD_SP_REGNUM);
       prev_sp = this_base + info->sp_offset + 2;
       this_base += STACK_CORRECTION;
     }
@@ -982,7 +980,7 @@ static CORE_ADDR
 m68hc11_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
   ULONGEST sp;
-  frame_unwind_unsigned_register (next_frame, HARD_SP_REGNUM, &sp);
+  sp = frame_unwind_register_unsigned (next_frame, HARD_SP_REGNUM);
   return sp;
 }
 
@@ -997,7 +995,7 @@ m68hc11_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
   ULONGEST tos;
   CORE_ADDR pc = frame_pc_unwind (next_frame);
 
-  frame_unwind_unsigned_register (next_frame, SOFT_FP_REGNUM, &tos);
+  tos = frame_unwind_register_unsigned (next_frame, SOFT_FP_REGNUM);
   tos += 2;
   return frame_id_build (tos, pc);
 }
@@ -1350,7 +1348,7 @@ m68hc11_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
 static int
 gdb_print_insn_m68hc11 (bfd_vma memaddr, disassemble_info *info)
 {
-  if (TARGET_ARCHITECTURE->arch == bfd_arch_m68hc11)
+  if (gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_m68hc11)
     return print_insn_m68hc11 (memaddr, info);
   else
     return print_insn_m68hc12 (memaddr, info);
@@ -1398,13 +1396,14 @@ m68hc11_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
                    || regnum == SOFT_TMP_REGNUM
                    || regnum == SOFT_ZS_REGNUM
                    || regnum == SOFT_XY_REGNUM)
-                  && m68hc11_register_name (regnum)));
+                  && m68hc11_register_name (gdbarch, regnum)));
     }
 
   /* Group to identify gcc soft registers (d1..dN).  */
   if (group == m68hc11_soft_reggroup)
     {
-      return regnum >= SOFT_D1_REGNUM && m68hc11_register_name (regnum);
+      return regnum >= SOFT_D1_REGNUM
+            && m68hc11_register_name (gdbarch, regnum);
     }
 
   if (group == m68hc11_hard_reggroup)
@@ -1502,8 +1501,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
   /* Set register info.  */
   set_gdbarch_fp0_regnum (gdbarch, -1);
 
-  set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
-
   set_gdbarch_sp_regnum (gdbarch, HARD_SP_REGNUM);
   set_gdbarch_register_name (gdbarch, m68hc11_register_name);
   set_gdbarch_register_type (gdbarch, m68hc11_register_type);
This page took 0.025955 seconds and 4 git commands to generate.