Re: post 2.6.7 BK change breaks Java?

From: Linus Torvalds
Date: Mon Jul 12 2004 - 11:02:17 EST




On Mon, 12 Jul 2004, Brian Gerst wrote:
>
> I see Linus commited a changeset that avoids a tailcall from this
> function, which messes up the stack if CONFIG_REGPARM=n. Specifically,
> it clobbers %edx in the pt_regs image

Yes.

There's more information about why this is needed in the commit message,
but it basically boils down to an optimization in the system call path
where the save-register-area is used _directly_ as the system call
argument frame on the stack. It's a very worthwhile optimization, since it
works very well in 99% of all cases and it makes a very hot path faster,
but gcc thinking that the callee owns the arguments has bitten us before,
and there is no way to tell gcc that it is wrong.

Personally, I think that if you wanted the callee to own the arguments,
you should use the "stdcall" attribute, which _literally_ is all about the
callee owning the stack (and can often generate better code for _other_
reasons than tail-calls), but lacking that, I'd have preferred some other
explicit way to tell gcc about the special "asmlinkage" rules.

No such way exists, so I just fooled gcc by hand. Ugly.

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