Re: [PATCH v13 8/9] Add 32 bit VDSO time support for 32 bit kernel

From: Stefani Seibold
Date: Sun Feb 09 2014 - 06:45:17 EST


Am Sonntag, den 09.02.2014, 02:05 -0800 schrieb Andi Kleen:
> > EBX is a reserved as the base register when compiling with -fPIC.
> > Otherwise it get a "error: can't find a register in class 'BREG' while
> > reloading 'asm'".
>
> In this case you have to dwarf annotate the push/pop
>
> >
> > > Also I if this calls syscall.S:__kernel_vsyscall it clobbers more registers
> > > (ecx at least?) and you need to describe that to gcc with a +
> >
> > Sine ECX is in use as the second parameter it is still marked as
> > clobbered.
>
> No input parameters are not clobbered.
>
> > I think it should word... As i know a system call will preserve all
> > register expect the EAX, which is marked as in and out for this asm()
> > directive.
>
> Yes the syscall does, but the vsyscall stub does not (for the !0x80 case)
>

I cross check all kinds of vsyscall and all do save the ECX registers.

So IMHO i see no register modification other than EAX, which is declared
as the output register in the asm() directive.

This following is what i get with objdump -d.

./arch/x86/vdso/vdso32-sysenter.so:

__kernel_vsyscall:
push %ecx
push %edx
push %ebp
mov %esp,%ebp
sysenter
nop
nop
nop
nop
nop
nop
nop
int $0x80
pop %ebp
pop %edx
pop %ecx
ret

./arch/x86/vdso/vdso32-int80.so:

__kernel_vsyscall:
int $0x80
ret

./arch/x86/vdso/vdso32-syscall.so:

__kernel_vsyscall:
push %ebp
mov %ecx,%ebp
syscall
mov $0x2b,%ecx
mov %ecx,%ss
mov %ebp,%ecx
pop %ebp
ret

BTW, it is not possible to mark an input parameter with +, this can only
done for an output parameter.

If there is really an issue what i have overseen, a working solution
would be to use an other register for the second parameter (ESI or EDI)
and add ECX to the clobber list.

- Stefani


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