OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [gdbserver/] [linux-sh-low.c] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* GNU/Linux/SH specific low level interface, for the remote server for GDB.
2
   Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007,
3
   2008 Free Software Foundation, Inc.
4
 
5
   This file is part of GDB.
6
 
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3 of the License, or
10
   (at your option) any later version.
11
 
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
 
20
#include "server.h"
21
#include "linux-low.h"
22
 
23
#ifdef HAVE_SYS_REG_H
24
#include <sys/reg.h>
25
#endif
26
 
27
#include <asm/ptrace.h>
28
 
29
#define sh_num_regs 41
30
 
31
/* Currently, don't check/send MQ.  */
32
static int sh_regmap[] = {
33
 0,      4,      8,      12,     16,     20,     24,     28,
34
 32,    36,     40,     44,     48,     52,     56,     60,
35
 
36
 REG_PC*4,   REG_PR*4,   REG_GBR*4,  -1,
37
 REG_MACH*4, REG_MACL*4, REG_SR*4,
38
 REG_FPUL*4, REG_FPSCR*4,
39
 
40
 REG_FPREG0*4+0,   REG_FPREG0*4+4,   REG_FPREG0*4+8,   REG_FPREG0*4+12,
41
 REG_FPREG0*4+16,  REG_FPREG0*4+20,  REG_FPREG0*4+24,  REG_FPREG0*4+28,
42
 REG_FPREG0*4+32,  REG_FPREG0*4+36,  REG_FPREG0*4+40,  REG_FPREG0*4+44,
43
 REG_FPREG0*4+48,  REG_FPREG0*4+52,  REG_FPREG0*4+56,  REG_FPREG0*4+60,
44
};
45
 
46
static int
47
sh_cannot_store_register (int regno)
48
{
49
  return 0;
50
}
51
 
52
static int
53
sh_cannot_fetch_register (int regno)
54
{
55
  return 0;
56
}
57
 
58
static CORE_ADDR
59
sh_get_pc ()
60
{
61
  unsigned long pc;
62
  collect_register_by_name ("pc", &pc);
63
  return pc;
64
}
65
 
66
static void
67
sh_set_pc (CORE_ADDR pc)
68
{
69
  unsigned long newpc = pc;
70
  supply_register_by_name ("pc", &newpc);
71
}
72
 
73
/* Correct in either endianness, obviously.  */
74
static const unsigned short sh_breakpoint = 0xc3c3;
75
#define sh_breakpoint_len 2
76
 
77
static int
78
sh_breakpoint_at (CORE_ADDR where)
79
{
80
  unsigned short insn;
81
 
82
  (*the_target->read_memory) (where, (unsigned char *) &insn, 2);
83
  if (insn == sh_breakpoint)
84
    return 1;
85
 
86
  /* If necessary, recognize more trap instructions here.  GDB only uses the
87
     one.  */
88
  return 0;
89
}
90
 
91
/* Provide only a fill function for the general register set.  ps_lgetregs
92
   will use this for NPTL support.  */
93
 
94
static void sh_fill_gregset (void *buf)
95
{
96
  int i;
97
 
98
  for (i = 0; i < 23; i++)
99
    if (sh_regmap[i] != -1)
100
      collect_register (i, (char *) buf + sh_regmap[i]);
101
}
102
 
103
struct regset_info target_regsets[] = {
104
  { 0, 0, 0, GENERAL_REGS, sh_fill_gregset, NULL },
105
  { 0, 0, -1, -1, NULL, NULL }
106
};
107
 
108
struct linux_target_ops the_low_target = {
109
  sh_num_regs,
110
  sh_regmap,
111
  sh_cannot_fetch_register,
112
  sh_cannot_store_register,
113
  sh_get_pc,
114
  sh_set_pc,
115
  (const unsigned char *) &sh_breakpoint,
116
  sh_breakpoint_len,
117
  NULL,
118
  0,
119
  sh_breakpoint_at,
120
};

powered by: WebSVN 2.1.0

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