Hi,

> Date: Thu, 15 Mar 2012 19:11:45 +0100
> From: drasko.drasko...@gmail.com
> To: salva...@telecable.es
> CC: openocd-devel@lists.sourceforge.net
> Subject: Re: [OpenOCD-devel] Bug in mips32_pracc_read_mem32
> 
> On Thu, Mar 15, 2012 at 6:44 PM, salvador <salva...@telecable.es> wrote:
> > On 03/14/2012 07:24 PM, salvador wrote:
> > 1.-   There is no call to mips32_pracc_read_mem32()  in
> > mips_m4k_read_memory().
> Yes, there is. It is called implicitly, by mips32_pracc_read_mem().
> Anyway, count parameter is propagated.
> Looking in the mips_m4k_read_memory() you can easily see that it is
> used to count __BYTES__ :
> 
> t = malloc(count * size * sizeof(uint8_t));
> 
> 
> > 2.-   I guess you mean a call to mips32_pracc_read_mem(). This function
> > has a parameter  "int size".
> 
> Yes. Size of variable does not meter. It is a placeholder for integer
> - a number. This number, however, can be a number of apples, ducks or,
> as in this case - bytes.
> 
> >
> > 3.-   The function mips32_pracc_read_mem() is defined in mips32_pracc.c
> > .     This function calls mips32_pracc_read_mem32() only if the
> > parameter size is 4 (WORD) and count >1.
> 
> Yes. 'size' is the "acces width" : w, hw or b. Independantly, 'count'
> is nb of bytes.

i think  'count' is not nb of bytes. see the followin code from the function ―― 
mips_m4k_read_memory    for(i = 0; i < (count*size); i += size) {               
switch(size)            {               case 4:                 t32 = 
le_to_h_u32(&buffer[i]);                  
target_buffer_set_u32(target,&buffer[i], t32);                  break;          
  ......................
if 'count' is really nb of bytes, i think the code should be the follwing 
instead of the above: for(i = 0; i < (count); i += size)           
.......................In my opinion ,     for  a "word access" , 'count' is nb 
of word    for  a "halfword access" , 'count' is nb of halfword
    for  a "byte access" , 'count' is nb of byte 

> 'size' parameter is used in the switch in mips32_pracc_read_mem() in
> order to call correct miniprogram - one that reads w, hw or b.
> 
> 
> > 4.-   In function mips32_pracc_read_mem32(),  in the call to
> > mips32_pracc_exec() the variable bytesread is used as an index in a
> > matrix of uint32_t (WORDS).
> >
> >
> > Sorry but i can not  find anything in the code that says "bytesread" or
> > "count" counts bytes. But WORDS, yes.
> 
> Sorry, but everything is there, written black on white (or whatever
> syntax coloring you use ;)).
> You'll just have to inspect the code more carefully and follow the
> call graph. Use cscope, if that will help you.
> 
> As a hint follow the propagation of "count" parameter - find it's
> origin and you'll see that it holds a nb of octets.
> 
> BR,
> Drasko
> 
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here 
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> OpenOCD-devel mailing list
> OpenOCD-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openocd-devel
                                          
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to