]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/gdbserver/linux-mips-low.c
2002-02-14 Daniel Jacobowitz <drow@mvista.com>
[thirdparty/binutils-gdb.git] / gdb / gdbserver / linux-mips-low.c
1 /* GNU/Linux/MIPS specific low level interface, for the remote server for GDB.
2 Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002
3 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 2 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, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 #include "server.h"
23
24 #ifdef HAVE_SYS_REG_H
25 #include <sys/reg.h>
26 #endif
27
28 int num_regs = 90;
29
30 #include <asm/ptrace.h>
31
32 /* Return the ptrace ``address'' of register REGNO. */
33
34 /* Matches mips_generic32_regs */
35 int regmap[] = {
36 0, 1, 2, 3, 4, 5, 6, 7,
37 8, 9, 10, 11, 12, 13, 14, 15,
38 16, 17, 18, 19, 20, 21, 22, 23,
39 24, 25, 26, 27, 28, 29, 30, 31,
40
41 -1, MMLO, MMHI, BADVADDR, CAUSE, PC,
42
43 FPR_BASE, FPR_BASE + 1, FPR_BASE + 2, FPR_BASE + 3,
44 FPR_BASE + 4, FPR_BASE + 5, FPR_BASE + 6, FPR_BASE + 7,
45 FPR_BASE + 8, FPR_BASE + 8, FPR_BASE + 10, FPR_BASE + 11,
46 FPR_BASE + 12, FPR_BASE + 13, FPR_BASE + 14, FPR_BASE + 15,
47 FPR_BASE + 16, FPR_BASE + 17, FPR_BASE + 18, FPR_BASE + 19,
48 FPR_BASE + 20, FPR_BASE + 21, FPR_BASE + 22, FPR_BASE + 23,
49 FPR_BASE + 24, FPR_BASE + 25, FPR_BASE + 26, FPR_BASE + 27,
50 FPR_BASE + 28, FPR_BASE + 29, FPR_BASE + 30, FPR_BASE + 31,
51 FPC_CSR, FPC_EIR,
52
53 -1, -1,
54 -1, -1, -1, -1, -1, -1, -1, -1,
55 -1, -1, -1, -1, -1, -1, -1, -1,
56 };
57
58 /* From mips-linux-nat.c. */
59
60 /* Pseudo registers can not be read. ptrace does not provide a way to
61 read (or set) PS_REGNUM, and there's no point in reading or setting
62 ZERO_REGNUM. We also can not set BADVADDR, CAUSE, or FCRIR via
63 ptrace(). */
64
65 int
66 cannot_fetch_register (int regno)
67 {
68 struct reg *reg;
69
70 if (regmap[regno] == -1)
71 return 1;
72
73 reg = find_register_by_number (regno);
74
75 if (strcmp (reg->name, "zero") == 0)
76 return 1;
77
78 return 0;
79 }
80
81 int
82 cannot_store_register (int regno)
83 {
84 struct reg *reg;
85
86 if (regmap[regno] == -1)
87 return 1;
88
89 reg = find_register_by_number (regno);
90
91 if (strcmp (reg->name, "zero") == 0)
92 return 1;
93
94 if (strcmp (reg->name, "cause") == 0)
95 return 1;
96
97 if (strcmp (reg->name, "bad") == 0)
98 return 1;
99
100 if (strcmp (reg->name, "fir") == 0)
101 return 1;
102
103 return 0;
104 }