2002-06-06 Michael Snyder <msnyder@redhat.com>

* d10v-tdep.c (d10v_store_return_value): Char return values
	must be shifted over by one byte in R0.
        (d10v_extract_return_value): Delete extra braces, re-indent.
This commit is contained in:
Michael Snyder 2002-06-06 18:47:35 +00:00
parent 9691d64f9a
commit 3d79a47c75
2 changed files with 44 additions and 21 deletions

View file

@ -1,3 +1,9 @@
2002-06-06 Michael Snyder <msnyder@redhat.com>
* d10v-tdep.c (d10v_store_return_value): Char return values
must be shifted over by one byte in R0.
(d10v_extract_return_value): Delete extra braces, re-indent.
2002-06-06 Elena Zannoni <ezannoni@redhat.com> 2002-06-06 Elena Zannoni <ezannoni@redhat.com>
* d10v-tdep.c (d10v_read_sp, d10v_read_fp): Add prototype. * d10v-tdep.c (d10v_read_sp, d10v_read_fp): Add prototype.

View file

@ -482,6 +482,17 @@ d10v_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
static void static void
d10v_store_return_value (struct type *type, char *valbuf) d10v_store_return_value (struct type *type, char *valbuf)
{ {
char tmp = 0;
/* Only char return values need to be shifted right within R0. */
if (TYPE_LENGTH (type) == 1
&& TYPE_CODE (type) == TYPE_CODE_INT)
{
write_register_bytes (REGISTER_BYTE (RET1_REGNUM),
&tmp, 1); /* zero the high byte */
write_register_bytes (REGISTER_BYTE (RET1_REGNUM) + 1,
valbuf, 1); /* copy the low byte */
}
else
write_register_bytes (REGISTER_BYTE (RET1_REGNUM), write_register_bytes (REGISTER_BYTE (RET1_REGNUM),
valbuf, valbuf,
TYPE_LENGTH (type)); TYPE_LENGTH (type));
@ -1137,12 +1148,19 @@ d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES],
char *valbuf) char *valbuf)
{ {
int len; int len;
/* printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type), TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM))); */ #if 0
{ printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type),
TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM,
(int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM),
REGISTER_RAW_SIZE (RET1_REGNUM)));
#endif
len = TYPE_LENGTH (type); len = TYPE_LENGTH (type);
if (len == 1) if (len == 1)
{ {
unsigned short c = extract_unsigned_integer (regbuf + REGISTER_BYTE (RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM)); unsigned short c;
c = extract_unsigned_integer (regbuf + REGISTER_BYTE (RET1_REGNUM),
REGISTER_RAW_SIZE (RET1_REGNUM));
store_unsigned_integer (valbuf, 1, c); store_unsigned_integer (valbuf, 1, c);
} }
else if ((len & 1) == 0) else if ((len & 1) == 0)
@ -1157,7 +1175,6 @@ d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES],
memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM) + 1, len); memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM) + 1, len);
} }
} }
}
/* Translate a GDB virtual ADDR/LEN into a format the remote target /* Translate a GDB virtual ADDR/LEN into a format the remote target
understands. Returns number of bytes that can be transfered understands. Returns number of bytes that can be transfered