From d2ed6730f2ef390d50a47ea03ee3a5b1dd5e37f0 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sat, 19 Jun 2010 17:36:51 +0000 Subject: ChangeLog: * spu-multiarch.c (spu_xfer_partial): Wrap around local store limit on local store memory accesses. * spu-linux-nat.c (spu_xfer_partial): Likewise. * spu-tdep.c (spu_lslr): Remove. (spu_pointer_to_address): Do not truncate addresses. (spu_integer_to_address): Likewise. (spu_overlay_new_objfile): Use SPU_OVERLAY_LMA. * spu-tdep.h: Add comments. (SPUADDR_SPU): Respect SPU_OVERLAY_LMA bit. (SPU_OVERLAY_LMA): Define. gdbserver/ChangeLog: * spu-low.c (spu_read_memory): Wrap around local store limit. (spu_write_memory): Likewise. testsuite/ChangeLog: * gdb.arch/spu-ls.exp: New file. * gdb.arch/spu-ls.c: Likewise. --- gdb/spu-multiarch.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'gdb/spu-multiarch.c') diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c index d072032a51..450aa42fc5 100644 --- a/gdb/spu-multiarch.c +++ b/gdb/spu-multiarch.c @@ -259,14 +259,35 @@ spu_xfer_partial (struct target_ops *ops, enum target_object object, { int fd = SPUADDR_SPU (offset); CORE_ADDR addr = SPUADDR_ADDR (offset); - char mem_annex[32]; + char mem_annex[32], lslr_annex[32]; + gdb_byte buf[32]; + ULONGEST lslr; + LONGEST ret; - if (fd >= 0 && addr < SPU_LS_SIZE) + if (fd >= 0) { xsnprintf (mem_annex, sizeof mem_annex, "%d/mem", fd); + ret = ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU, + mem_annex, readbuf, writebuf, + addr, len); + if (ret > 0) + return ret; + + /* SPU local store access wraps the address around at the + local store limit. We emulate this here. To avoid needing + an extra access to retrieve the LSLR, we only do that after + trying the original address first, and getting end-of-file. */ + xsnprintf (lslr_annex, sizeof lslr_annex, "%d/lslr", fd); + memset (buf, 0, sizeof buf); + if (ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU, + lslr_annex, buf, NULL, + 0, sizeof buf) <= 0) + return ret; + + lslr = strtoulst (buf, NULL, 16); return ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU, mem_annex, readbuf, writebuf, - addr, len); + addr & lslr, len); } } -- cgit v1.2.3