Date: Mon, 13 Jun 2005 14:12:38 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-hackers@freebsd.org Subject: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h) Message-ID: <200506131412.38967.hselasky@c2i.net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506131412.38967.hselasky>