__asm...

Ralf Habacker ralf.habacker at freenet.de
Thu Feb 16 15:40:04 CET 2006


Paulo Moura Guedes schrieb:
> It seems gcc support a different inline assembly sintax: 
> asm("assembly code");
>
> If anyone who knows assembly would be so kind to port this to gcc would be 
> great. Documentation can be found here:
> http://www-128.ibm.com/developerworks/library/l-ia.html
> http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
>
>   
Can anyone tell me what the instruction

    mov EAX, FS:[18h]

means. Does it means 
   
    add 18hex to the value of 'fs' register and store it into eax

This syntax seems something special and is not documented in 
http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html

+------------------------------+------------------------------------+
|       Intel Code             |      AT&T Code                     |
+------------------------------+------------------------------------+
| mov     eax,1                |  movl    $1,%eax                   |   
| mov     ebx,0ffh             |  movl    $0xff,%ebx                |   
| int     80h                  |  int     $0x80                     |   
| mov     ebx, eax             |  movl    %eax, %ebx                |
| mov     eax,[ecx]            |  movl    (%ecx),%eax               |
| mov     eax,[ebx+3]          |  movl    3(%ebx),%eax              | 
| mov     eax,[ebx+20h]        |  movl    0x20(%ebx),%eax           |
| add     eax,[ebx+ecx*2h]     |  addl    (%ebx,%ecx,0x2),%eax      |
| lea     eax,[ebx+ecx]        |  leal    (%ebx,%ecx),%eax          |
| sub     eax,[ebx+ecx*4h-20h] |  subl    -0x20(%ebx,%ecx,0x4),%eax |
+------------------------------+------------------------------------+


BTW: It seems to me that the original asm code seems to be required only 
because the used pthread release returns a wrong value for the stack. 
Are I'm right with this suggestion or does it have a deeper reason, i 
cannot see at now ?

Ralf

> Paulo
>
> On Wednesday 15 February 2006 18:44, Paulo Jorge Guedes wrote:
>   
>> Hi,
>>
>> I think __asm doesn't work with gcc :(
>>
>> d:/kde/trunk/kdelibs/kjs/collector.cpp: In static member function
>> `static void KJS::Collector::markCurrentThreadConservatively()':
>> d:/kde/trunk/kdelibs/kjs/collector.cpp:309: error: expected `(' before
>> '{' token
>> d:/kde/trunk/kdelibs/kjs/collector.cpp:309: error: expected asm body
>> before '{' token
>> d:/kde/trunk/kdelibs/kjs/collector.cpp:310: error: `MOV' undeclared
>> (first use this function)
>> d:/kde/trunk/kdelibs/kjs/collector.cpp:310: error: (Each undeclared
>> identifier is reported only once for each function it appears in.)
>> d:/kde/trunk/kdelibs/kjs/collector.cpp:310: error: expected `;' before
>> "EAX"
>> d:/kde/trunk/kdelibs/kjs/collector.cpp:310:22: invalid suffix "h" on
>> integer constant
>> make[2]: *** [kjs/CMakeFiles/kjs.dir/collector.obj] Error 1
>> make[2]: Leaving directory `/d/kde/trunk/kdelibs'
>> make[1]: *** [kjs/CMakeFiles/kjs.dir/all] Error 2
>> make[1]: Leaving directory `/d/kde/trunk/kdelibs'
>> make: *** [all] Error 2
>>
>> Paulo
>> _______________________________________________
>> Kde-buildsystem mailing list
>> Kde-buildsystem at kde.org
>> https://mail.kde.org/mailman/listinfo/kde-buildsystem
>>     
> _______________________________________________
> Kde-buildsystem mailing list
> Kde-buildsystem at kde.org
> https://mail.kde.org/mailman/listinfo/kde-buildsystem
>   



More information about the Kde-buildsystem mailing list