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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [mipsnbsd-nat.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/* Native-dependent code for MIPS systems running NetBSD.
2
   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
3
 
4
   This file is part of GDB.
5
 
6
   This program is free software; you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License as published by
8
   the Free Software Foundation; either version 2 of the License, or
9
   (at your option) any later version.
10
 
11
   This program is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
   GNU General Public License for more details.
15
 
16
   You should have received a copy of the GNU General Public License
17
   along with this program; if not, write to the Free Software
18
   Foundation, Inc., 59 Temple Place - Suite 330,
19
   Boston, MA 02111-1307, USA.  */
20
 
21
#include "defs.h"
22
#include "inferior.h"
23
#include "regcache.h"
24
 
25
#include "mipsnbsd-tdep.h"
26
 
27
#include <sys/types.h>
28
#include <sys/ptrace.h>
29
#include <machine/reg.h>
30
 
31
/* Determine if PT_GETREGS fetches this register.  */
32
static int
33
getregs_supplies (int regno)
34
{
35
  return ((regno) >= ZERO_REGNUM && (regno) <= PC_REGNUM);
36
}
37
 
38
void
39
fetch_inferior_registers (int regno)
40
{
41
  if (regno == -1 || getregs_supplies (regno))
42
    {
43
      struct reg regs;
44
 
45
      if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
46
                  (PTRACE_ARG3_TYPE) &regs, 0) == -1)
47
        perror_with_name ("Couldn't get registers");
48
 
49
      mipsnbsd_supply_reg ((char *) &regs, regno);
50
      if (regno != -1)
51
        return;
52
    }
53
 
54
  if (regno == -1 || regno >= FP0_REGNUM)
55
    {
56
      struct fpreg fpregs;
57
 
58
      if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
59
                  (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
60
        perror_with_name ("Couldn't get floating point status");
61
 
62
      mipsnbsd_supply_fpreg ((char *) &fpregs, regno);
63
    }
64
}
65
 
66
void
67
store_inferior_registers (int regno)
68
{
69
  if (regno == -1 || getregs_supplies (regno))
70
    {
71
      struct reg regs;
72
 
73
      if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
74
                  (PTRACE_ARG3_TYPE) &regs, 0) == -1)
75
        perror_with_name ("Couldn't get registers");
76
 
77
      mipsnbsd_fill_reg ((char *) &regs, regno);
78
 
79
      if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
80
                  (PTRACE_ARG3_TYPE) &regs, 0) == -1)
81
        perror_with_name ("Couldn't write registers");
82
 
83
      if (regno != -1)
84
        return;
85
    }
86
 
87
  if (regno == -1 || regno >= FP0_REGNUM)
88
    {
89
      struct fpreg fpregs;
90
 
91
      if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
92
                  (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
93
        perror_with_name ("Couldn't get floating point status");
94
 
95
      mipsnbsd_fill_fpreg ((char *) &fpregs, regno);
96
 
97
      if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
98
                  (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
99
        perror_with_name ("Couldn't write floating point status");
100
    }
101
}

powered by: WebSVN 2.1.0

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