
Hi Jerry
On Thu, 7 Feb 2008, Jerry Van Baren wrote:
Guennadi Liakhovetski wrote:
Hi all,
looking through the common/cmd_mem.c::do_mem_mtest() function, I couldn't understand the following place:
addr_mask = ((ulong)end - (ulong)start)/sizeof(vu_long);
... for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) { start[offset] = pattern; }
why (offset & addr_mask) != 0 and not just offset < addr_mask? Suppose
end = 0xbf; start = 0;
addr_mask = 0x2f;
The loop will iterate over offset = 1, 2, 4, 8, and on 0x10 it will abort and 0x10 and 0x20 will stay untested. Whereas if we just had "offset < addr_mask" it would just function correctly, wouldn't it? Yes, I do realise, that it is at least unusual to set the end address to anything other than start address + ((1 << x) - 1), but still.
Thanks Guennadi
Hi Guennadi,
The address test is stepping through the address lines 0x01, 0x02, 0x04, 0x08, 0x10, 0x20 Your end of 0xBF with a mask of 0x2F indicates that the address lines 0x10, 0x40, and 0x80 are not present (even though address line 0x80 looks like it is part of the test since 0xBF includes 0x80 - but it isn't tested).
I think, you are making a mistake here. Look above how addr_mask is calculated:
addr_mask = ((ulong)end - (ulong)start)/sizeof(vu_long);
That means, it is just calculated based upon your memory range being tested. So if for some reason you want to test a strange address range like (0x10000) to (0x10000 + 0xbf) then the 0x40 address line will not be tested, although it is needed to cover all addresses in this range:-) Or am I still missing anything?
Thanks Guennadi --- Guennadi Liakhovetski