Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Oct 1995 17:55:47 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        hackers@freeBSD.org, julian@ref.tfs.com
Subject:   Re: netisr code..
Message-ID:  <199510170755.RAA00245@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
> Why is it done like this?

>swi_net:
>        MCOUNT
>        bsfl    _netisr,%eax
>        je      swi_net_done
>swi_net_more:
>        btrl    %eax,_netisr
>        jnc     swi_net_next         <------should never happen
>        call    *_netisrs(,%eax,4)
>swi_net_next:
>        bsfl    _netisr,%eax
>        jne     swi_net_more
>swi_net_done:
>        ret

I think you're right - netisrs (including this code) are masked here, and
nothing except the above btrl clears bits in _netisr.  The jnc may be
left over from when netisrs weren't masked here.  It's cheap insurance -
much faster than the btrl.

>casual inspection suggests that the following would be as good..
>swi_net:
>        MCOUNT
>swi_net_next:
>        bsfl    _netisr,%eax
>        je      swi_net_done
>        btrl    %eax,_netisr
>        call    *_netisrs(,%eax,4)
>        jmp     swi_net_next
>swi_net_done:
>        ret

That is slower at the end.  However, micro-optimizations here are probably
not important.  Everything except the atomic btrl could be written in C
and you probably wouldn't notice the difference.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510170755.RAA00245>