Re: Why do some net drivers require __OPTIMIZE__?

From: Robert Love (rml@tech9.net)
Date: Mon Jan 06 2003 - 12:48:34 EST


On Mon, 2003-01-06 at 10:56, Richard B. Johnson wrote:

> When you call a function, that function gets a copy of the
> parameters passed to it. In-line code accesses those parameters
> directly. That's why the spin-lock code, for instance, won't work
> (with the current macros) unless they are in-lined.

Huh?

        void dog(int i)
        {
                i++;
        }

        main()
        {
                int x = 1;
                dog(x);
        }

Are you saying x will be 2 after the call? _Wrong_

Macros, yes. Inlines, no.

Inline functions have the same behavior as callable functions, with a
few exceptions (they do not act as compiler barriers, for one).

The spin lock C functions will work fine if they are not inlined, as far
as I can tell. If not, it is just because the inline assembly assumes
they are inline (i.e. what certain registers contain, etc.).

The macros, of course, will need trivial adjustments to use pointers
instead of copies, etc.

Again, the only reason inline vs. not will break anything, as far as I
can tell, is because inline asm assumes a function is inlined.

        Robert Love

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jan 07 2003 - 22:00:32 EST