This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Win32 inline assembly question
Wei Huang <weih@google.com> 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