Re: uml and -regparm=3

Jeff Dike
2008-01-10T02:14:47Z

On Wed, Jan 09, 2008 at 10:50:48PM +0100, Miklos Szeredi wrote:
> > FASTCALL is useless and should not make a difference. It enables
> > regparm on specific functions, but that should not make a difference
> > if it works or not.
>
> __down_write() in include/asm-x86/rwsem.h seems to assume, that the
> semaphore pointer is passed in %eax down to rwsem_down_write_failed(),
> so regparm does make a difference there.

And rwsem_down_write_failed seems to think it's getting the pointer in
%eax:

Dump of assembler code for function rwsem_down_write_failed:
0x08193599 <rwsem_down_write_failed+0>: push %ebp
0x0819359a <rwsem_down_write_failed+1>: mov %esp,%ebp
0x0819359c <rwsem_down_write_failed+3>: push %ebx
0x0819359d <rwsem_down_write_failed+4>: mov %eax,%ebx
0x0819359f <rwsem_down_write_failed+6>: sub $0x10,%esp
0x081935a2 <rwsem_down_write_failed+9>: push $0xffffffff
0x081935a4 <rwsem_down_write_failed+11>: lea 0xffffffec(%ebp),%eax
0x081935a7 <rwsem_down_write_failed+14>: push %eax
0x081935a8 <rwsem_down_write_failed+15>: push %ebx
0x081935a9 <rwsem_down_write_failed+16>: movl $0x2,0xfffffff8(%ebp)
0x081935b0 <rwsem_down_write_failed+23>: call 0x8193423 <rwsem_down_failed_common>

This is clearly taking something from %eax and something on the stack
(and a -1) and passing it to rwsem_down_failed_common, corresponding
to this:
rwsem_down_failed_common(sem, &waiter,
RWSEM_WAITING_BIAS - RWSEM_ACTIVE_BIAS);

So, this does look right to me.

Jeff

--
Work email - jdike at linux dot intel dot com