1
1
/* Remote debugging interface to m32r and mon2000 ROM monitors for GDB,
4
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2004, 2005
4
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2004, 2005, 2007
5
5
Free Software Foundation, Inc.
7
7
Adapted by Michael Snyder of Cygnus Support.
11
11
This program is free software; you can redistribute it and/or modify
12
12
it under the terms of the GNU General Public License as published by
13
the Free Software Foundation; either version 2 of the License, or
13
the Free Software Foundation; either version 3 of the License, or
14
14
(at your option) any later version.
16
16
This program is distributed in the hope that it will be useful,
19
19
GNU General Public License for more details.
21
21
You should have received a copy of the GNU General Public License
22
along with this program; if not, write to the Free Software
23
Foundation, Inc., 51 Franklin Street, Fifth Floor,
24
Boston, MA 02110-1301, USA. */
22
along with this program. If not, see <http://www.gnu.org/licenses/>. */
26
24
/* This module defines communication with the Renesas m32r monitor */
213
m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
211
m32r_supply_register (struct regcache *regcache, char *regname,
212
int regnamelen, char *val, int vallen)
216
215
int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
225
224
if (regno == ACCL_REGNUM)
226
225
{ /* special handling for 64-bit acc reg */
227
monitor_supply_register (ACCH_REGNUM, val);
226
monitor_supply_register (regcache, ACCH_REGNUM, val);
228
227
val = strchr (val, ':'); /* skip past ':' to get 2nd word */
230
monitor_supply_register (ACCL_REGNUM, val + 1);
229
monitor_supply_register (regcache, ACCL_REGNUM, val + 1);
234
monitor_supply_register (regno, val);
233
monitor_supply_register (regcache, regno, val);
235
234
if (regno == PSW_REGNUM)
237
236
unsigned long psw = strtoul (val, NULL, 16);
241
240
/* Stack mode bit */
242
monitor_supply_register (SM_REGNUM, (psw & 0x80) ? one : zero);
241
monitor_supply_register (regcache, SM_REGNUM, (psw & 0x80) ? one : zero);
244
243
#ifdef BSM_REGNUM
245
244
/* Backup stack mode bit */
246
monitor_supply_register (BSM_REGNUM, (psw & 0x8000) ? one : zero);
245
monitor_supply_register (regcache, BSM_REGNUM, (psw & 0x8000) ? one : zero);
249
248
/* Interrupt enable bit */
250
monitor_supply_register (IE_REGNUM, (psw & 0x40) ? one : zero);
249
monitor_supply_register (regcache, IE_REGNUM, (psw & 0x40) ? one : zero);
252
251
#ifdef BIE_REGNUM
253
252
/* Backup interrupt enable bit */
254
monitor_supply_register (BIE_REGNUM, (psw & 0x4000) ? one : zero);
253
monitor_supply_register (regcache, BIE_REGNUM, (psw & 0x4000) ? one : zero);
256
255
#ifdef COND_REGNUM
257
256
/* Condition bit (carry etc.) */
258
monitor_supply_register (COND_REGNUM, (psw & 0x1) ? one : zero);
257
monitor_supply_register (regcache, COND_REGNUM, (psw & 0x1) ? one : zero);
260
259
#ifdef CBR_REGNUM
261
monitor_supply_register (CBR_REGNUM, (psw & 0x1) ? one : zero);
260
monitor_supply_register (regcache, CBR_REGNUM, (psw & 0x1) ? one : zero);
263
262
#ifdef BPC_REGNUM
264
monitor_supply_register (BPC_REGNUM, zero); /* KLUDGE: (???????) */
263
monitor_supply_register (regcache, BPC_REGNUM, zero); /* KLUDGE: (???????) */
266
265
#ifdef BCARRY_REGNUM
267
monitor_supply_register (BCARRY_REGNUM, zero); /* KLUDGE: (??????) */
266
monitor_supply_register (regcache, BCARRY_REGNUM, zero); /* KLUDGE: (??????) */
271
270
if (regno == SPI_REGNUM || regno == SPU_REGNUM)
272
271
{ /* special handling for stack pointer (spu or spi) */
273
272
ULONGEST stackmode, psw;
274
regcache_cooked_read_unsigned (current_regcache, PSW_REGNUM, &psw);
273
regcache_cooked_read_unsigned (regcache, PSW_REGNUM, &psw);
275
274
stackmode = psw & 0x80;
277
276
if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */
278
monitor_supply_register (SP_REGNUM, val);
277
monitor_supply_register (regcache,
278
gdbarch_sp_regnum (current_gdbarch), val);
279
279
else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */
280
monitor_supply_register (SP_REGNUM, val);
280
monitor_supply_register (regcache,
281
gdbarch_sp_regnum (current_gdbarch), val);