aboutsummaryrefslogtreecommitdiff
path: root/gdb/spu-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-08-27 14:31:46 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-08-27 14:31:46 +0000
commit36acd84edc67e88603075300e443033f5c29b5b4 (patch)
treebf04633bd1d29a3b6bc611a831641a4a498dc2c8 /gdb/spu-tdep.c
parentc3879370e906dcb887ac90e1c146775cfb5a5983 (diff)
downloadgdb-36acd84edc67e88603075300e443033f5c29b5b4.zip
gdb-36acd84edc67e88603075300e443033f5c29b5b4.tar.gz
gdb-36acd84edc67e88603075300e443033f5c29b5b4.tar.bz2
ChangeLog gdb/:
* spu-tdep.c (spu_pointer_to_address): New function. (spu_integer_to_address): Likewise. (spu_gdbarch_init): Add spu_pointer_to_address and spu_integer_to_address to gdbarch. ChangeLog gdb/testsuite/: * gdb.cp/cp-relocate.exp (add-symbol-file): Change addresses to fit into SPU Local Store memory.
Diffstat (limited to 'gdb/spu-tdep.c')
-rw-r--r--gdb/spu-tdep.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 933b924..ed676fe 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -322,6 +322,35 @@ spu_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
return default_register_reggroup_p (gdbarch, regnum, group);
}
+/* Address conversion. */
+
+static CORE_ADDR
+spu_pointer_to_address (struct type *type, const gdb_byte *buf)
+{
+ ULONGEST addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
+ ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size. */
+
+ if (target_has_registers && target_has_stack && target_has_memory)
+ lslr = get_frame_register_unsigned (get_selected_frame (NULL),
+ SPU_LSLR_REGNUM);
+
+ return addr & lslr;
+}
+
+static CORE_ADDR
+spu_integer_to_address (struct gdbarch *gdbarch,
+ struct type *type, const gdb_byte *buf)
+{
+ ULONGEST addr = unpack_long (type, buf);
+ ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size. */
+
+ if (target_has_registers && target_has_stack && target_has_memory)
+ lslr = get_frame_register_unsigned (get_selected_frame (NULL),
+ SPU_LSLR_REGNUM);
+
+ return addr & lslr;
+}
+
/* Decoding SPU instructions. */
@@ -2006,6 +2035,10 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
+ /* Address conversion. */
+ set_gdbarch_pointer_to_address (gdbarch, spu_pointer_to_address);
+ set_gdbarch_integer_to_address (gdbarch, spu_integer_to_address);
+
/* Inferior function calls. */
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
set_gdbarch_frame_align (gdbarch, spu_frame_align);