lkml.org 
[lkml]   [2005]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 3/8] mutex subsystem, add atomic_*_call_if_*() to i386


On Wed, 21 Dec 2005, Linus Torvalds wrote:

> Umm. This asm is broken. It doesn't mark %eax as changed, so this is only
> reliable if the function you call is
>
> - a "fastcall" one
> - always returns as its return value the pointer to the atomic count
>
> which is not true (you verify that it's a fastcall, but it's of type
> "void").

Actually (and re-reading the email I sent that wasn't obvious at all), my
_preferred_ fix is to literally force the use of the above kind of
function: not save/restore %eax at all, but just say that any function
that is called by the magic "atomic_*_call_if()" needs to always return
the argument it gets as its return value too.

That allows the caller to not even have to care. And the callee obviously
already _has_ that value, so it might as well return it (and in the best
case it's not going to add any cost at all, either to the caller or the
callee).

So you might opt to keep the asm the same, just change the calling
conventions.

Linus
-
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/

\
 
 \ /
  Last update: 2009-11-18 23:46    [W:0.060 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site