This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Remove hard-coded SPU local store size


Hello,

in two places, spu-tdep.c uses a hard-coded value for the size
of the local store.  This patch removes this (unnecessary)
dependency by using the value of the LSLR instead.

Tested on spu-elf, committed to mainline.

Bye,
Ulrich


ChangeLog:

	* spu-tdep.c (spu_frame_unwind_cache): Use LSLR register
	value instead of hard-coded SPU_LS_SIZE.
	(spu_software_single_step): Likewise.
	* spu-tdep.h (SPU_LS_SIZE): Remove.

Index: gdb/spu-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/spu-tdep.c,v
retrieving revision 1.59
diff -u -p -r1.59 spu-tdep.c
--- gdb/spu-tdep.c	19 Jun 2010 17:36:50 -0000	1.59
+++ gdb/spu-tdep.c	19 Jun 2010 17:40:29 -0000
@@ -987,8 +987,14 @@ spu_frame_unwind_cache (struct frame_inf
     {
       CORE_ADDR reg;
       LONGEST backchain;
+      ULONGEST lslr;
       int status;
 
+      /* Get local store limit.  */
+      lslr = get_frame_register_unsigned (this_frame, SPU_LSLR_REGNUM);
+      if (!lslr)
+	lslr = (ULONGEST) -1;
+
       /* Get the backchain.  */
       reg = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM);
       status = safe_read_memory_integer (SPUADDR (id, reg), 4, byte_order,
@@ -996,10 +1002,10 @@ spu_frame_unwind_cache (struct frame_inf
 
       /* A zero backchain terminates the frame chain.  Also, sanity
          check against the local store size limit.  */
-      if (status && backchain > 0 && backchain < SPU_LS_SIZE)
+      if (status && backchain > 0 && backchain <= lslr)
 	{
 	  /* Assume the link register is saved into its slot.  */
-	  if (backchain + 16 < SPU_LS_SIZE)
+	  if (backchain + 16 <= lslr)
 	    info->saved_regs[SPU_LR_REGNUM].addr = SPUADDR (id, backchain + 16);
 
           /* Frame bases.  */
@@ -1501,6 +1507,7 @@ spu_software_single_step (struct frame_i
   unsigned int insn;
   int offset, reg;
   gdb_byte buf[4];
+  ULONGEST lslr;
 
   pc = get_frame_pc (frame);
 
@@ -1508,13 +1515,18 @@ spu_software_single_step (struct frame_i
     return 1;
   insn = extract_unsigned_integer (buf, 4, byte_order);
 
+  /* Get local store limit.  */
+  lslr = get_frame_register_unsigned (frame, SPU_LSLR_REGNUM);
+  if (!lslr)
+    lslr = (ULONGEST) -1;
+
   /* Next sequential instruction is at PC + 4, except if the current
      instruction is a PPE-assisted call, in which case it is at PC + 8.
      Wrap around LS limit to be on the safe side.  */
   if ((insn & 0xffffff00) == 0x00002100)
-    next_pc = (SPUADDR_ADDR (pc) + 8) & (SPU_LS_SIZE - 1);
+    next_pc = (SPUADDR_ADDR (pc) + 8) & lslr;
   else
-    next_pc = (SPUADDR_ADDR (pc) + 4) & (SPU_LS_SIZE - 1);
+    next_pc = (SPUADDR_ADDR (pc) + 4) & lslr;
 
   insert_single_step_breakpoint (gdbarch,
 				 aspace, SPUADDR (SPUADDR_SPU (pc), next_pc));
@@ -1531,7 +1543,7 @@ spu_software_single_step (struct frame_i
 	  target += extract_unsigned_integer (buf, 4, byte_order) & -4;
 	}
 
-      target = target & (SPU_LS_SIZE - 1);
+      target = target & lslr;
       if (target != next_pc)
 	insert_single_step_breakpoint (gdbarch, aspace,
 				       SPUADDR (SPUADDR_SPU (pc), target));
Index: gdb/spu-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/spu-tdep.h,v
retrieving revision 1.10
diff -u -p -r1.10 spu-tdep.h
--- gdb/spu-tdep.h	19 Jun 2010 17:36:50 -0000	1.10
+++ gdb/spu-tdep.h	19 Jun 2010 17:40:29 -0000
@@ -47,9 +47,6 @@ enum spu_regnum
   SPU_DECR_STATUS_REGNUM = 135	/* Decrementer status.  */
 };
 
-/* Local store.  */
-#define SPU_LS_SIZE          0x40000
-
 /* Address conversions.
 
    In a combined PPU/SPU debugging session, we have to consider multiple
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]