Re: Win32 inline assembly question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wei Huang <weih@xxxxxxxxxx> writes:

>  I am trying to convert an inline assembly function (on Win32)
> 
>   NT_Tib* GetTIB()
> {
>     NT_Tib* pTib;
>     __asm
>     {
>         MOV EAX , FS:[18h]
>         MOV pTib , EAX
>     }
>     return pTib;
> }
>   to use the gcc syntax. It would be something like
> 
>   NT_Tib* GetTIB()
> {
>     NT_Tib* pTib;
> 
>     __asm__("movl %FS:0x18, %EAX\n\t"
>             "movl %EAX, pTib");
>                         ^^^ (what should this be?)
> 
> 
>     return pTib;
> }


Please read the friendly manual.

You want something like (completely untested):

    asm ("movl %fs:0x18, %eax\n\t"
         "movl %eax, %0"
         : "=rm" (pTib) : : "%eax");

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux