This is the mail archive of the gdb-prs@sources.redhat.com 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]

gdb/590: d10v should only do partial transfers


>Number:         590
>Category:       gdb
>Synopsis:       d10v should only do partial transfers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 26 21:08:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     ac131313@redhat.com
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
The d10v sim_read() / sim_write() functions try to transfer all of a memory block.  This is unnecessary - they should only transfer as much as possible.
>How-To-Repeat:
See mailing list:

sim/d10v:
2002-06-13  Tom Rix  <trix@redhat.com>

    * interp.c (xfer_mem): Fix transfers across multiple segments.
 
Index: sim/d10v/interp.c
===================================================================
RCS file: /cvs/src/src/sim/d10v/interp.c,v
retrieving revision 1.11
diff -d -u -p -r1.11 interp.c
--- sim/d10v/interp.c    9 Jun 2002 15:45:46 -0000    1.11
+++ sim/d10v/interp.c    13 Jun 2002 16:18:34 -0000
@@ -715,7 +715,7 @@ xfer_mem (SIM_ADDR virt,
 {
   int xfered = 0;
 
-  while (xfered < size)
+  while (0 < size)
     {
       uint8 *memory;
       unsigned long phys;
@@ -754,9 +754,10 @@ xfer_mem (SIM_ADDR virt,
       virt += phys_size;
       buffer += phys_size;
       xfered += phys_size;
+      size -= phys_size;
     }
 
-  return size;
+  return xfered;
 }

Is the problem fixed if, instead, you do a short/partial read (eliminating the loop?).

Andrew

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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