* mips-linux-tdep.c (mips_supply_gregset): Renamed from supply_gregset.
[deliverable/binutils-gdb.git] / gdb / mips-linux-nat.c
CommitLineData
75c9abc6 1/* Native-dependent code for GNU/Linux on MIPS processors.
a094c6fb 2
dc60ece8
DJ
3 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
4 Free Software Foundation, Inc.
2aa830e4
DJ
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
197e01b6
EZ
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
2aa830e4
DJ
22
23#include "defs.h"
6b753f60 24#include "mips-tdep.h"
10d6c8cd
DJ
25#include "target.h"
26#include "linux-nat.h"
2aa830e4 27
dc60ece8
DJ
28#include "gdb_proc_service.h"
29
30#ifndef PTRACE_GET_THREAD_AREA
31#define PTRACE_GET_THREAD_AREA 25
32#endif
33
2aa830e4 34/* Pseudo registers can not be read. ptrace does not provide a way to
24e05951
AC
35 read (or set) MIPS_PS_REGNUM, and there's no point in reading or
36 setting MIPS_ZERO_REGNUM. We also can not set BADVADDR, CAUSE, or
37 FCRIR via ptrace(). */
2aa830e4
DJ
38
39int
40mips_linux_cannot_fetch_register (int regno)
41{
613e114f 42 if (regno > MIPS_ZERO_REGNUM && regno < MIPS_ZERO_REGNUM + 32)
2aa830e4 43 return 0;
56cea623
AC
44 else if (regno >= mips_regnum (current_gdbarch)->fp0
45 && regno <= mips_regnum (current_gdbarch)->fp0 + 32)
fd8f87c5 46 return 0;
56cea623
AC
47 else if (regno == mips_regnum (current_gdbarch)->lo
48 || regno == mips_regnum (current_gdbarch)->hi
49 || regno == mips_regnum (current_gdbarch)->badvaddr
50 || regno == mips_regnum (current_gdbarch)->cause
51 || regno == mips_regnum (current_gdbarch)->pc
52 || regno == mips_regnum (current_gdbarch)->fp_control_status
53 || regno == mips_regnum (current_gdbarch)->fp_implementation_revision)
54 return 0;
55 else
56 return 1;
2aa830e4
DJ
57}
58
59int
60mips_linux_cannot_store_register (int regno)
61{
613e114f 62 if (regno > MIPS_ZERO_REGNUM && regno < MIPS_ZERO_REGNUM + 32)
2aa830e4 63 return 0;
fd8f87c5
DJ
64 else if (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 32)
65 return 0;
56cea623
AC
66 else if (regno == mips_regnum (current_gdbarch)->lo
67 || regno == mips_regnum (current_gdbarch)->hi
68 || regno == mips_regnum (current_gdbarch)->pc
69 || regno == mips_regnum (current_gdbarch)->fp_control_status)
70 return 0;
71 else
72 return 1;
2aa830e4 73}
10d6c8cd 74
dc60ece8
DJ
75/* Fetch the thread-local storage pointer for libthread_db. */
76
77ps_err_e
78ps_get_thread_area (const struct ps_prochandle *ph,
79 lwpid_t lwpid, int idx, void **base)
80{
81 if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
82 return PS_ERR;
83
84 /* IDX is the bias from the thread pointer to the beginning of the
85 thread descriptor. It has to be subtracted due to implementation
86 quirks in libthread_db. */
87 *base = (void *) ((char *)*base - idx);
88
89 return PS_OK;
90}
91
10d6c8cd
DJ
92void _initialize_mips_linux_nat (void);
93
94void
95_initialize_mips_linux_nat (void)
96{
97 add_target (linux_target ());
98}
This page took 0.403848 seconds and 4 git commands to generate.