* h8300-tdep.c (NEXT_PROLOGUE_INSN): Make pword1 an INSN_WORD *
not short *.
* findvar.c, defs.h
({extract,store}_{signed_integer,unsigned_integer,address}):
New routines to replace SWAP_TARGET_AND_HOST.
All over: All uses of SWAP_TARGET_AND_HOST on integers replaced.
Fri Jul 9 12:36:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
Fri Jul 9 12:36:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
+ * values.c, value.h (modify_field), callers: Make fieldval a LONGEST.
+
+ * h8300-tdep.c (NEXT_PROLOGUE_INSN): Make pword1 an INSN_WORD *
+ not short *.
+
* findvar.c, defs.h
({extract,store}_{signed_integer,unsigned_integer,address}):
New routines to replace SWAP_TARGET_AND_HOST.
* findvar.c, defs.h
({extract,store}_{signed_integer,unsigned_integer,address}):
New routines to replace SWAP_TARGET_AND_HOST.
CORE_ADDR memaddr;
int len;
{
CORE_ADDR memaddr;
int len;
{
+ char buf[sizeof (LONGEST)];
read_memory (memaddr, buf, len);
return extract_signed_integer (buf, len);
}
read_memory (memaddr, buf, len);
return extract_signed_integer (buf, len);
}
CORE_ADDR memaddr;
int len;
{
CORE_ADDR memaddr;
int len;
{
+ char buf[sizeof (unsigned LONGEST)];
read_memory (memaddr, buf, len);
return extract_unsigned_integer (buf, len);
}
read_memory (memaddr, buf, len);
return extract_unsigned_integer (buf, len);
}
NEXT_PROLOGUE_INSN (addr, lim, pword1)
CORE_ADDR addr;
CORE_ADDR lim;
NEXT_PROLOGUE_INSN (addr, lim, pword1)
CORE_ADDR addr;
CORE_ADDR lim;
{
char buf[2];
if (addr < lim + 8)
{
char buf[2];
if (addr < lim + 8)
- modify_field (addr, (int) value_as_long (newval),
+ modify_field (addr, value_as_long (newval),
bitpos, bitsize);
else
memcpy (addr, VALUE_CONTENTS (newval), TYPE_LENGTH (VALUE_TYPE (newval)));
bitpos, bitsize);
else
memcpy (addr, VALUE_CONTENTS (newval), TYPE_LENGTH (VALUE_TYPE (newval)));
void
modify_field (addr, fieldval, bitpos, bitsize)
char *addr;
void
modify_field (addr, fieldval, bitpos, bitsize)
char *addr;
/* Reject values too big to fit in the field in question,
otherwise adjoining fields may be corrupted. */
if (bitsize < (8 * sizeof (fieldval))
&& 0 != (fieldval & ~((1<<bitsize)-1)))
/* Reject values too big to fit in the field in question,
otherwise adjoining fields may be corrupted. */
if (bitsize < (8 * sizeof (fieldval))
&& 0 != (fieldval & ~((1<<bitsize)-1)))
- error ("Value %d does not fit in %d bits.", fieldval, bitsize);
+ {
+ /* FIXME: would like to include fieldval in the message, but
+ we don't have a sprintf_longest. */
+ error ("Value does not fit in %d bits.", bitsize);
+ }
oword = extract_signed_integer (addr, sizeof oword);
oword = extract_signed_integer (addr, sizeof oword);
bitpos = sizeof (oword) * 8 - bitpos - bitsize;
#endif
bitpos = sizeof (oword) * 8 - bitpos - bitsize;
#endif
- /* Mask out old value, while avoiding shifts >= longword size */
+ /* Mask out old value, while avoiding shifts >= size of oword */
if (bitsize < 8 * sizeof (oword))
if (bitsize < 8 * sizeof (oword))
- oword &= ~(((((unsigned long)1) << bitsize) - 1) << bitpos);
+ oword &= ~(((((unsigned LONGEST)1) << bitsize) - 1) << bitpos);
- oword &= ~((-1) << bitpos);
+ oword &= ~((~(unsigned LONGEST)0) << bitpos);
oword |= fieldval << bitpos;
store_signed_integer (addr, sizeof oword, oword);
oword |= fieldval << bitpos;
store_signed_integer (addr, sizeof oword, oword);