lkml.org 
[lkml]   [2020]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRE: remove the last set_fs() in common code, and remove it for x86 and powerpc v3
    Date
    From: Christophe Leroy
    > Sent: 10 September 2020 09:14
    >
    > Le 10/09/2020 à 10:04, David Laight a écrit :
    > > From: Linus Torvalds
    > >> Sent: 09 September 2020 22:34
    > >> On Wed, Sep 9, 2020 at 11:42 AM Segher Boessenkool
    > >> <segher@kernel.crashing.org> wrote:
    > >>>
    > >>> It will not work like this in GCC, no. The LLVM people know about that.
    > >>> I do not know why they insist on pushing this, being incompatible and
    > >>> everything.
    > >>
    > >> Umm. Since they'd be the ones supporting this, *gcc* would be the
    > >> incompatible one, not clang.
    > >
    > > I had an 'interesting' idea.
    > >
    > > Can you use a local asm register variable as an input and output to
    > > an 'asm volatile goto' statement?
    > >
    > > Well you can - but is it guaranteed to work :-)
    > >
    >
    > With gcc at least it should work according to
    > https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html
    >
    > They even explicitely tell: "The only supported use for this feature is
    > to specify registers for input and output operands when calling Extended
    > asm "

    A quick test isn't good....

    int bar(char *z)
    {
    __label__ label;
    register int eax asm ("eax") = 6;
    asm volatile goto (" mov $1, %%eax" ::: "eax" : label);

    label:
    return eax;
    }

    0000000000000040 <bar>:
    40: b8 01 00 00 00 mov $0x1,%eax
    45: b8 06 00 00 00 mov $0x6,%eax
    4a: c3 retq

    although adding:
    asm volatile ("" : "+r" (eax));
    either side of the 'asm volatile goto' does fix it.

    David

    -
    Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
    Registration No: 1397386 (Wales)
    \
     
     \ /
      Last update: 2020-09-10 11:29    [W:2.510 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site