1 /* Native-dependent code for OpenBSD/powerpc.
3 Copyright 2004 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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. */
27 #include <sys/types.h>
28 #include <sys/ptrace.h>
29 #include <machine/reg.h>
31 #include "ppcobsd-tdep.h"
33 /* OpenBSD/powerpc doesn't have PT_GETFPREGS/PT_SETFPREGS like
34 NetBSD/powerpc and FreeBSD/powerpc. */
36 /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
40 fetch_inferior_registers (int regnum
)
44 if (ptrace (PT_GETREGS
, PIDGET (inferior_ptid
),
45 (PTRACE_ARG3_TYPE
) ®s
, 0) == -1)
46 perror_with_name ("Couldn't get registers");
48 ppcobsd_supply_gregset (&ppcobsd_gregset
, current_regcache
, -1,
52 /* Store register REGNUM back into the inferior. If REGNUM is -1, do
53 this for all registers. */
56 store_inferior_registers (int regnum
)
60 if (ptrace (PT_GETREGS
, PIDGET (inferior_ptid
),
61 (PTRACE_ARG3_TYPE
) ®s
, 0) == -1)
62 perror_with_name ("Couldn't get registers");
64 ppcobsd_collect_gregset (&ppcobsd_gregset
, current_regcache
,
65 regnum
, ®s
, sizeof regs
);
67 if (ptrace (PT_SETREGS
, PIDGET (inferior_ptid
),
68 (PTRACE_ARG3_TYPE
) ®s
, 0) == -1)
69 perror_with_name ("Couldn't write registers");
73 /* Provide a prototype to silence -Wmissing-prototypes. */
74 void _initialize_ppcobsd_nat (void);
77 _initialize_ppcobsd_nat (void)
79 /* General-purpose registers. */
80 ppcobsd_reg_offsets
.r0_offset
= offsetof (struct reg
, gpr
);
81 ppcobsd_reg_offsets
.pc_offset
= offsetof (struct reg
, pc
);
82 ppcobsd_reg_offsets
.ps_offset
= offsetof (struct reg
, ps
);
83 ppcobsd_reg_offsets
.cr_offset
= offsetof (struct reg
, cnd
);
84 ppcobsd_reg_offsets
.lr_offset
= offsetof (struct reg
, lr
);
85 ppcobsd_reg_offsets
.ctr_offset
= offsetof (struct reg
, cnt
);
86 ppcobsd_reg_offsets
.xer_offset
= offsetof (struct reg
, xer
);
87 ppcobsd_reg_offsets
.mq_offset
= offsetof (struct reg
, mq
);
89 /* Floating-point registers. */
90 ppcobsd_reg_offsets
.f0_offset
= offsetof (struct reg
, fpr
);
91 ppcobsd_reg_offsets
.fpscr_offset
= -1;
93 /* AltiVec registers. */
94 ppcobsd_reg_offsets
.vr0_offset
= offsetof (struct vreg
, vreg
);
95 ppcobsd_reg_offsets
.vscr_offset
= offsetof (struct vreg
, vscr
);
96 ppcobsd_reg_offsets
.vrsave_offset
= offsetof (struct vreg
, vrsave
);
This page took 0.034524 seconds and 4 git commands to generate.