Hi,

I stumbled across this bug a year ago, but still none has managed to fix it. 
Instead the PR got lost and I am now posting it a second time:

http://www.freebsd.org/cgi/query-pr.cgi?pr=80980

In FreeBSD 6-current the code for "bus_space_write_multi_1()" says:

                __asm __volatile("                              \n\
                        cld                                     \n\
                1:      lodsb                                   \n\
                        movb %%al,(%2)                          \n\
                        loop 1b"                                :
                    "=S" (addr), "=c" (count)                   :
                    "r" (bsh + offset), "0" (addr), "1" (count) :
                    "%eax", "memory", "cc");

This is equivalent to:

while(--count)
{
  /* I/O */
}

which is obviously wrong, because it doesn't check for count equal to zero. So 
how can I fix this in assembly. I am not an expert with inlined assembly, so 
maybe someone can correct me if I am wrong, but something like this needs to 
be added:

or %ecx, %ecx
jz 2

2:

Another solution would be to wrap the inlined assembly into

if(count)
{
  ...
}

So can someone have this fixed, or is there a reason not to fix it. The one 
who wrote the code has done the same mistake with every one of the 
bus_space_XXXX that does memory mapped I/O. It currently breaks my drivers.

--HPS
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to