This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Win32 inline assembly question


Hi,

 I apologize if this is out of the scope of this mailing list, but it
was recommanded to me that I ask here.

 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;
}
  how do I represent the variable "pTib" in the gcc assembly? I tried

      movl %EAX, pTib      or     movl %EAX, _pTib

  both I get the following linker error.

   > undefined reference to `pTib'    (or '_pTib')

  anyone knows the correct syntax for representing a C variable in gnu assembly?

  thanks!

  Wei


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]