Re: out-of-line x86 "put_user()" implementation

2005-03-12 Thread Coywolf Qi Hunt
On Sun, 6 Feb 2005 22:23:51 -0800 (PST), Linus Torvalds <[EMAIL PROTECTED]> wrote: > > I was looking at some of the code we generate, and happened to notice that > we have this strange situation where the x86 "get_user()" macros generate > out-of-line code to do all the address verification etc, b

Re: out-of-line x86 "put_user()" implementation

2005-02-11 Thread Linus Torvalds
On Fri, 11 Feb 2005, Chuck Ebbert wrote: > > And in any case is it too much to ask for an 80-column limit? ;) Yes. Dammit, especially for something like this, the long-line version is just _so_ much more readable. Compare my and your version wrt being able to tell what the differences betwe

Re: out-of-line x86 "put_user()" implementation

2005-02-11 Thread Chuck Ebbert
On Tue, 8 Feb 2005 at 18:27:08 -0800, Linus Torvalds wrote: > +/* > + * Strange magic calling convention: pointer in %ecx, > + * value in %eax(:%edx), return value in %eax, no clobbers. > + */ > +extern void __put_user_1(void); > +extern void __put_user_2(void); > +extern void __put_user_4(void);

Re: out-of-line x86 "put_user()" implementation

2005-02-11 Thread H. Peter Anvin
Followup to: <[EMAIL PROTECTED]> By author:Richard Henderson <[EMAIL PROTECTED]> In newsgroup: linux.dev.kernel > > On Tue, Feb 08, 2005 at 06:27:08PM -0800, Linus Torvalds wrote: > > That brings up another issue: if I don't care which registers a 64-bit > > value goes into, can I get the "lo

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Richard Henderson
On Tue, Feb 08, 2005 at 06:16:15PM -0800, Linus Torvalds wrote: > I'd happily use your version, but I thought that some versions of gcc > require that input output registers cannot overlap, and would refuse to do > that thing? But if you tell me differently.. No, you're thinking of asm("

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Richard Henderson
On Tue, Feb 08, 2005 at 06:27:08PM -0800, Linus Torvalds wrote: > That brings up another issue: if I don't care which registers a 64-bit > value goes into, can I get the "low reg" and "high reg" names some way? Nope. We never needed one in the i386 backend itself, so we never added anything like

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Linus Torvalds
On Tue, 8 Feb 2005, Andrew Morton wrote: > > I'll take patches from anyone ;) You'll never live it down. Once you get a name for being easy, you'll always be known as Andrew "patch-ho" Morton. Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in th

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Linus Torvalds
On Tue, 8 Feb 2005, Linus Torvalds wrote: > > Hmm.. I always thought "A" was the _pairing_ of %eax/%edx, not "eax or > edx"? Ahh. Some testing shows that gcc really seems to think of it as "eax or edx", ie you can do asm("uglee %0 %1": :"a" (1), "A" (2)); and it will output

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Andrew Morton
Linus Torvalds <[EMAIL PROTECTED]> wrote: > > Andrew - do you want to put it in -mm? I'll take patches from anyone ;) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-in

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Linus Torvalds
On Tue, 8 Feb 2005, Richard Henderson wrote: > > On Mon, Feb 07, 2005 at 05:20:06PM -0800, Linus Torvalds wrote: > > +#define __put_user_8(x, ptr) __asm__ __volatile__("call __put_user_8":"=A" > > (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr)) > > This is not constrained enough. The compiler

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Linus Torvalds
On Tue, 8 Feb 2005, Richard Henderson wrote: > > The first 3 gets lost. Thanks. So here's v3 (which also removes the now stale __put_user_check() macro). Andrew - do you want to put it in -mm? Linus --- # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet #

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Richard Henderson
On Mon, Feb 07, 2005 at 05:20:06PM -0800, Linus Torvalds wrote: > +#define __put_user_8(x, ptr) __asm__ __volatile__("call __put_user_8":"=A" > (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr)) This is not constrained enough. The compiler could choose to put the return value in edx. You want

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Richard Henderson
On Mon, Feb 07, 2005 at 05:20:06PM -0800, Linus Torvalds wrote: > +3: movl %eax,(%ecx) ... > +3: movl %eax,(%ecx) > +4: movl %edx,4(%ecx) ... > + .long 3b,bad_put_user > + .long 4b,bad_put_user The first 3 gets lost. r~ - To unsubscribe from this list: send the line "unsubscribe li

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Valdis . Kletnieks
On Mon, 07 Feb 2005 17:20:06 PST, Linus Torvalds said: > I'm not going to put this into 2.6.11, since I worry about compiler > interactions, but the more people who test it anyway, the better. Well, since I'm a known glutton for punishment. ;) a 2.6.11-rc3-RT tree I had handy from last night sh

Re: out-of-line x86 "put_user()" implementation

2005-02-08 Thread Pavel Machek
Hi! > > boots fine and shrinks the image size quite noticeably: > > > > [Nr] Name TypeAddr OffSize > > [ 1] .textPROGBITSc010 001000 2771a9 [vmlinux-orig] > > [ 1] .textPROGBITSc010 001000 2742dd [vmlinux-patched] > > > > that's 11980 bytes o

Re: out-of-line x86 "put_user()" implementation

2005-02-07 Thread Linus Torvalds
On Mon, 7 Feb 2005, Ingo Molnar wrote: > > boots fine and shrinks the image size quite noticeably: > > [Nr] Name TypeAddr OffSize > [ 1] .textPROGBITSc010 001000 2771a9 [vmlinux-orig] > [ 1] .textPROGBITSc010 001000 2742dd [vmlinux-patched] >

Re: out-of-line x86 "put_user()" implementation

2005-02-07 Thread Ingo Molnar
* Linus Torvalds <[EMAIL PROTECTED]> wrote: > I no longer use x86 as my main machine, so this patch is totally > untested. I've compiled it to see that things look somewhat sane, but > that doesn't mean much. If I forgot some register or screwed something > else up, this will result in a totally

out-of-line x86 "put_user()" implementation

2005-02-06 Thread Linus Torvalds
I was looking at some of the code we generate, and happened to notice that we have this strange situation where the x86 "get_user()" macros generate out-of-line code to do all the address verification etc, but the "put_user()" ones do not, and do everything inline. I also noticed that (probabl