xref: /openbsd-src/gnu/usr.bin/binutils/gdb/gdbserver/linux-m68k-low.c (revision b725ae7711052a2233e31a66fefb8a752c388d7a)
1*b725ae77Skettenis /* GNU/Linux/m68k specific low level interface, for the remote server for GDB.
2*b725ae77Skettenis    Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003
3*b725ae77Skettenis    Free Software Foundation, Inc.
4*b725ae77Skettenis 
5*b725ae77Skettenis    This file is part of GDB.
6*b725ae77Skettenis 
7*b725ae77Skettenis    This program is free software; you can redistribute it and/or modify
8*b725ae77Skettenis    it under the terms of the GNU General Public License as published by
9*b725ae77Skettenis    the Free Software Foundation; either version 2 of the License, or
10*b725ae77Skettenis    (at your option) any later version.
11*b725ae77Skettenis 
12*b725ae77Skettenis    This program is distributed in the hope that it will be useful,
13*b725ae77Skettenis    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*b725ae77Skettenis    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*b725ae77Skettenis    GNU General Public License for more details.
16*b725ae77Skettenis 
17*b725ae77Skettenis    You should have received a copy of the GNU General Public License
18*b725ae77Skettenis    along with this program; if not, write to the Free Software
19*b725ae77Skettenis    Foundation, Inc., 59 Temple Place - Suite 330,
20*b725ae77Skettenis    Boston, MA 02111-1307, USA.  */
21*b725ae77Skettenis 
22*b725ae77Skettenis #include "server.h"
23*b725ae77Skettenis #include "linux-low.h"
24*b725ae77Skettenis 
25*b725ae77Skettenis #ifdef HAVE_SYS_REG_H
26*b725ae77Skettenis #include <sys/reg.h>
27*b725ae77Skettenis #endif
28*b725ae77Skettenis 
29*b725ae77Skettenis #define m68k_num_regs 29
30*b725ae77Skettenis 
31*b725ae77Skettenis /* This table must line up with REGISTER_NAMES in tm-m68k.h */
32*b725ae77Skettenis static int m68k_regmap[] =
33*b725ae77Skettenis {
34*b725ae77Skettenis #ifdef PT_D0
35*b725ae77Skettenis   PT_D0 * 4, PT_D1 * 4, PT_D2 * 4, PT_D3 * 4,
36*b725ae77Skettenis   PT_D4 * 4, PT_D5 * 4, PT_D6 * 4, PT_D7 * 4,
37*b725ae77Skettenis   PT_A0 * 4, PT_A1 * 4, PT_A2 * 4, PT_A3 * 4,
38*b725ae77Skettenis   PT_A4 * 4, PT_A5 * 4, PT_A6 * 4, PT_USP * 4,
39*b725ae77Skettenis   PT_SR * 4, PT_PC * 4,
40*b725ae77Skettenis #else
41*b725ae77Skettenis   14 * 4, 0 * 4, 1 * 4, 2 * 4, 3 * 4, 4 * 4, 5 * 4, 6 * 4,
42*b725ae77Skettenis   7 * 4, 8 * 4, 9 * 4, 10 * 4, 11 * 4, 12 * 4, 13 * 4, 15 * 4,
43*b725ae77Skettenis   17 * 4, 18 * 4,
44*b725ae77Skettenis #endif
45*b725ae77Skettenis #ifdef PT_FP0
46*b725ae77Skettenis   PT_FP0 * 4, PT_FP1 * 4, PT_FP2 * 4, PT_FP3 * 4,
47*b725ae77Skettenis   PT_FP4 * 4, PT_FP5 * 4, PT_FP6 * 4, PT_FP7 * 4,
48*b725ae77Skettenis   PT_FPCR * 4, PT_FPSR * 4, PT_FPIAR * 4
49*b725ae77Skettenis #else
50*b725ae77Skettenis   21 * 4, 24 * 4, 27 * 4, 30 * 4, 33 * 4, 36 * 4,
51*b725ae77Skettenis   39 * 4, 42 * 4, 45 * 4, 46 * 4, 47 * 4
52*b725ae77Skettenis #endif
53*b725ae77Skettenis };
54*b725ae77Skettenis 
55*b725ae77Skettenis static int
m68k_cannot_store_register(int regno)56*b725ae77Skettenis m68k_cannot_store_register (int regno)
57*b725ae77Skettenis {
58*b725ae77Skettenis   return (regno >= m68k_num_regs);
59*b725ae77Skettenis }
60*b725ae77Skettenis 
61*b725ae77Skettenis static int
m68k_cannot_fetch_register(int regno)62*b725ae77Skettenis m68k_cannot_fetch_register (int regno)
63*b725ae77Skettenis {
64*b725ae77Skettenis   return (regno >= m68k_num_regs);
65*b725ae77Skettenis }
66*b725ae77Skettenis 
67*b725ae77Skettenis struct linux_target_ops the_low_target = {
68*b725ae77Skettenis   m68k_num_regs,
69*b725ae77Skettenis   m68k_regmap,
70*b725ae77Skettenis   m68k_cannot_fetch_register,
71*b725ae77Skettenis   m68k_cannot_store_register,
72*b725ae77Skettenis };
73