Re: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h)

2005-06-14 Thread Uwe Doering
Norbert Koch wrote: 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 b

RE: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h)

2005-06-14 Thread gerarra
>No, it's a correct method to set/reset the zero flag: >(X | X) == X just as (X & X) == X > Yes but it stores result in ecx(using or, really, is not a problem)... however jecxz just is 2 bytes sized while or + jmp is 4 bytes. It means lesser FDE latency time and the pseudocode is enough simil

Re: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h)

2005-06-13 Thread Hans Petter Selasky
On Monday 13 June 2005 18:27, Joerg Sonnenberger wrote: > On Mon, Jun 13, 2005 at 05:58:24PM +0200, Hans Petter Selasky wrote: > > static void > > filter(struct fifo *f) > > { > > do { > > if(!f->len) > > { > > if(f->m) ...; > > > > f->m = get_mbuf(); > > if(!

Re: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h)

2005-06-13 Thread Joerg Sonnenberger
On Mon, Jun 13, 2005 at 05:58:24PM +0200, Hans Petter Selasky wrote: > static void > filter(struct fifo *f) > { > do { > if(!f->len) > { > if(f->m) ...; > > f->m = get_mbuf(); > if(!f->m) break; > > f->len = m->m_len; > f->ptr = m->m_data;

Re: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h)

2005-06-13 Thread Hans Petter Selasky
On Monday 13 June 2005 14:44, Joerg Sonnenberger wrote: > On Mon, Jun 13, 2005 at 02:12:38PM +0200, Hans Petter Selasky wrote: > > This is equivalent to: > > > > while(--count) > > { > > /* I/O */ > > } > > > > which is obviously wrong, because it doesn't check for count equal to > > zero. > > Wh

RE: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h)

2005-06-13 Thread Norbert Koch
> >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 > JECX

Re: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h)

2005-06-13 Thread Joerg Sonnenberger
On Mon, Jun 13, 2005 at 02:12:38PM +0200, Hans Petter Selasky wrote: > This is equivalent to: > > while(--count) > { > /* I/O */ > } > > which is obviously wrong, because it doesn't check for count equal to > zero. Why do you think it is a bug? It is part of the interface contract and useful t

RE: Obvious bug in /sys/i386/include/bus.h (was: bus_at386.h)

2005-06-13 Thread gerarra
>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