Date: Mon, 13 Jun 2005 14:26:14 +0200 From: gerarra@tin.it To: freebsd-hackers@freebsd.org Cc: hselasky@c2i.net Subject: RE: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h) Message-ID: <429C8E8F00015E63@ims3a.cp.tin.it> In-Reply-To: <200506131412.38967.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
>http://www.freebsd.org/cgi/query-pr.cgi?pr=3D80980 > >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" : > "=3DS" (addr), "=3Dc" (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 ze= ro. >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 need= s >to >be added: > >or %ecx, %ecx >jz 2 > >2: This is wrong beacause the result is stored in ecx. Better using JECXZ in= struction before the loop. Greeting, rookie
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?429C8E8F00015E63>