1 /* m32rx simulator support code
2 Copyright (C) 1997, 1998 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
5 This file is part of GDB, the GNU debugger.
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, or (at your option)
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 along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 #define WANT_CPU_M32RX
26 #include "libiberty.h"
28 /* FIXME: need to provide general mechanism for accessing target files
29 these. For now this is a hack to avoid getting the host version. */
30 #include "../../libgloss/m32r/sys/syscall.h"
31 #include "targ-vals.h"
33 /* The contents of BUF are in target byte order. */
36 m32rx_fetch_register (sd, rn, buf)
41 SIM_CPU *current_cpu = STATE_CPU (sd, 0);
44 SETTWI (buf, GET_H_GR (rn));
46 SETTWI (buf, GET_H_CR (rn - 16));
49 SETTWI (buf, GET_H_PC ());
52 SETTWI (buf, GETLODI (GET_H_ACCUM ()));
55 SETTWI (buf, GETHIDI (GET_H_ACCUM ()));
58 case 23: *reg = STATE_CPU_CPU (sd, 0)->h_cond; break;
59 case 24: *reg = STATE_CPU_CPU (sd, 0)->h_sm; break;
60 case 25: *reg = STATE_CPU_CPU (sd, 0)->h_bsm; break;
61 case 26: *reg = STATE_CPU_CPU (sd, 0)->h_ie; break;
62 case 27: *reg = STATE_CPU_CPU (sd, 0)->h_bie; break;
63 case 28: *reg = STATE_CPU_CPU (sd, 0)->h_bcarry; break; /* rename: bc */
64 case 29: memcpy (buf, &STATE_CPU_CPU (sd, 0)->h_bpc, sizeof(WI)); break; /* duplicate */
70 /* The contents of BUF are in target byte order. */
73 m32rx_store_register (sd, rn, buf)
78 SIM_CPU *current_cpu = STATE_CPU (sd, 0);
81 SET_H_GR (rn, GETTWI (buf));
83 SET_H_CR (rn - 16, GETTWI (buf));
86 SET_H_PC (GETTWI (buf));
89 SETLODI (CPU (h_accum), GETTWI (buf));
92 SETHIDI (CPU (h_accum), GETTWI (buf));
95 case 23: STATE_CPU_CPU (sd, 0)->h_cond = *reg; break;
96 case 24: STATE_CPU_CPU (sd, 0)->h_sm = *reg; break;
97 case 25: STATE_CPU_CPU (sd, 0)->h_bsm = *reg; break;
98 case 26: STATE_CPU_CPU (sd, 0)->h_ie = *reg; break;
99 case 27: STATE_CPU_CPU (sd, 0)->h_bie = *reg; break;
100 case 28: STATE_CPU_CPU (sd, 0)->h_bcarry = *reg; break; /* rename: bc */
101 case 29: memcpy (&STATE_CPU_CPU (sd, 0)->h_bpc, buf, sizeof(DI)); break; /* duplicate */
106 /* Cover fn to access h-accums. */
109 m32rx_h_accums_get (SIM_CPU *current_cpu, UINT accum)