On Fri, 2011-04-08 at 08:18 -0400, Josh Boyer wrote:
> The ml and and mz commands in xmon currently only work on 32-bit values.
> This leads to odd issues when trying to use them on a ppc64 machine.  If
> one specified 64-bit addresses to mz, it would loop on the same output
> indefinitely.  The ml command would fail to find any 64-bit values in a
> memory range, even though one could clearly see them present with the d
> command.
> 
> This adds a small function that mimics GETWORD, but works for 64-bit
> values.  The data types involved in these commands are also changed to
> 'unsigned long' instead of just 'unsigned'.
> 
> Signed-off-by: Josh Boyer <jwbo...@linux.vnet.ibm.com>

Well if you're going to mimic GETWORD, why not replace it everywhere ?

Or just do that :-)

#if BITS_PER_LONG == 32
#define GETLONG(v)      GETWORD(v)
#else
#define GETLONG(v)      ((GETWORD(v) << 32) | GETWORD(v + 4))
#endif

Cheers,
Ben.
 
>  static void
>  memlocate(void)
>  {
> -     unsigned a, n;
> -     unsigned char val[4];
> +     unsigned long a, n;
> +     unsigned char val[sizeof(unsigned long)];
> +     int size = sizeof(unsigned long);
>  
>       last_cmd = "ml";
>       scanhex((void *)&mdest);
> @@ -2280,10 +2306,10 @@ memlocate(void)
>               }
>       }
>       n = 0;
> -     for (a = mdest; a < mend; a += 4) {
> -             if (mread(a, val, 4) == 4
> -                     && ((GETWORD(val) ^ mval) & mask) == 0) {
> -                     printf("%.16x:  %.16x\n", a, GETWORD(val));
> +     for (a = mdest; a < mend; a += size) {
> +             if (mread(a, val, size) == size
> +                     && ((xmon_getval(val) ^ mval) & mask) == 0) {
> +                     printf("%.16lx:  %.16lx\n", a, xmon_getval(val));
>                       if (++n >= 10)
>                               break;
>               }
> @@ -2297,7 +2323,7 @@ static void
>  memzcan(void)
>  {
>       unsigned char v;
> -     unsigned a;
> +     unsigned long a;
>       int ok, ook;
>  
>       scanhex(&mdest);


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to