OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-6.8/] [pre-binutils-2.20.1-sync/] [gdb/] [gdbserver/] [linux-sh-low.c] - Diff between revs 157 and 223

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 157 Rev 223
/* GNU/Linux/SH specific low level interface, for the remote server for GDB.
/* GNU/Linux/SH specific low level interface, for the remote server for GDB.
   Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007,
   Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007,
   2008 Free Software Foundation, Inc.
   2008 Free Software Foundation, Inc.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   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
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
#include "server.h"
#include "server.h"
#include "linux-low.h"
#include "linux-low.h"
 
 
#ifdef HAVE_SYS_REG_H
#ifdef HAVE_SYS_REG_H
#include <sys/reg.h>
#include <sys/reg.h>
#endif
#endif
 
 
#include <asm/ptrace.h>
#include <asm/ptrace.h>
 
 
#define sh_num_regs 41
#define sh_num_regs 41
 
 
/* Currently, don't check/send MQ.  */
/* Currently, don't check/send MQ.  */
static int sh_regmap[] = {
static int sh_regmap[] = {
 0,      4,      8,      12,     16,     20,     24,     28,
 0,      4,      8,      12,     16,     20,     24,     28,
 32,    36,     40,     44,     48,     52,     56,     60,
 32,    36,     40,     44,     48,     52,     56,     60,
 
 
 REG_PC*4,   REG_PR*4,   REG_GBR*4,  -1,
 REG_PC*4,   REG_PR*4,   REG_GBR*4,  -1,
 REG_MACH*4, REG_MACL*4, REG_SR*4,
 REG_MACH*4, REG_MACL*4, REG_SR*4,
 REG_FPUL*4, REG_FPSCR*4,
 REG_FPUL*4, REG_FPSCR*4,
 
 
 REG_FPREG0*4+0,   REG_FPREG0*4+4,   REG_FPREG0*4+8,   REG_FPREG0*4+12,
 REG_FPREG0*4+0,   REG_FPREG0*4+4,   REG_FPREG0*4+8,   REG_FPREG0*4+12,
 REG_FPREG0*4+16,  REG_FPREG0*4+20,  REG_FPREG0*4+24,  REG_FPREG0*4+28,
 REG_FPREG0*4+16,  REG_FPREG0*4+20,  REG_FPREG0*4+24,  REG_FPREG0*4+28,
 REG_FPREG0*4+32,  REG_FPREG0*4+36,  REG_FPREG0*4+40,  REG_FPREG0*4+44,
 REG_FPREG0*4+32,  REG_FPREG0*4+36,  REG_FPREG0*4+40,  REG_FPREG0*4+44,
 REG_FPREG0*4+48,  REG_FPREG0*4+52,  REG_FPREG0*4+56,  REG_FPREG0*4+60,
 REG_FPREG0*4+48,  REG_FPREG0*4+52,  REG_FPREG0*4+56,  REG_FPREG0*4+60,
};
};
 
 
static int
static int
sh_cannot_store_register (int regno)
sh_cannot_store_register (int regno)
{
{
  return 0;
  return 0;
}
}
 
 
static int
static int
sh_cannot_fetch_register (int regno)
sh_cannot_fetch_register (int regno)
{
{
  return 0;
  return 0;
}
}
 
 
static CORE_ADDR
static CORE_ADDR
sh_get_pc ()
sh_get_pc ()
{
{
  unsigned long pc;
  unsigned long pc;
  collect_register_by_name ("pc", &pc);
  collect_register_by_name ("pc", &pc);
  return pc;
  return pc;
}
}
 
 
static void
static void
sh_set_pc (CORE_ADDR pc)
sh_set_pc (CORE_ADDR pc)
{
{
  unsigned long newpc = pc;
  unsigned long newpc = pc;
  supply_register_by_name ("pc", &newpc);
  supply_register_by_name ("pc", &newpc);
}
}
 
 
/* Correct in either endianness, obviously.  */
/* Correct in either endianness, obviously.  */
static const unsigned short sh_breakpoint = 0xc3c3;
static const unsigned short sh_breakpoint = 0xc3c3;
#define sh_breakpoint_len 2
#define sh_breakpoint_len 2
 
 
static int
static int
sh_breakpoint_at (CORE_ADDR where)
sh_breakpoint_at (CORE_ADDR where)
{
{
  unsigned short insn;
  unsigned short insn;
 
 
  (*the_target->read_memory) (where, (unsigned char *) &insn, 2);
  (*the_target->read_memory) (where, (unsigned char *) &insn, 2);
  if (insn == sh_breakpoint)
  if (insn == sh_breakpoint)
    return 1;
    return 1;
 
 
  /* If necessary, recognize more trap instructions here.  GDB only uses the
  /* If necessary, recognize more trap instructions here.  GDB only uses the
     one.  */
     one.  */
  return 0;
  return 0;
}
}
 
 
/* Provide only a fill function for the general register set.  ps_lgetregs
/* Provide only a fill function for the general register set.  ps_lgetregs
   will use this for NPTL support.  */
   will use this for NPTL support.  */
 
 
static void sh_fill_gregset (void *buf)
static void sh_fill_gregset (void *buf)
{
{
  int i;
  int i;
 
 
  for (i = 0; i < 23; i++)
  for (i = 0; i < 23; i++)
    if (sh_regmap[i] != -1)
    if (sh_regmap[i] != -1)
      collect_register (i, (char *) buf + sh_regmap[i]);
      collect_register (i, (char *) buf + sh_regmap[i]);
}
}
 
 
struct regset_info target_regsets[] = {
struct regset_info target_regsets[] = {
  { 0, 0, 0, GENERAL_REGS, sh_fill_gregset, NULL },
  { 0, 0, 0, GENERAL_REGS, sh_fill_gregset, NULL },
  { 0, 0, -1, -1, NULL, NULL }
  { 0, 0, -1, -1, NULL, NULL }
};
};
 
 
struct linux_target_ops the_low_target = {
struct linux_target_ops the_low_target = {
  sh_num_regs,
  sh_num_regs,
  sh_regmap,
  sh_regmap,
  sh_cannot_fetch_register,
  sh_cannot_fetch_register,
  sh_cannot_store_register,
  sh_cannot_store_register,
  sh_get_pc,
  sh_get_pc,
  sh_set_pc,
  sh_set_pc,
  (const unsigned char *) &sh_breakpoint,
  (const unsigned char *) &sh_breakpoint,
  sh_breakpoint_len,
  sh_breakpoint_len,
  NULL,
  NULL,
  0,
  0,
  sh_breakpoint_at,
  sh_breakpoint_at,
};
};
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.