>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:

This is wrong beacause the result is stored in ecx. Better using JECXZ 
instruction
before the loop.

Greeting,
rookie


_______________________________________________
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