CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    4

    GCC to MSVC ASM conversion

    Hi everyone,

    I want to know if I have converted the following ASM code correctly from gcc ASM to MSV ASM.
    Thanks a lot.
    Attached Files Attached Files

  2. #2
    Join Date
    Apr 2003
    Posts
    1,755

    Re: GCC to MSVC ASM conversion

    The conversion works correctly but it can introduce error in case somebody tries to change the structure of oro_atomic_t and add some other members in the beginning of the structure.

    To make sure that it always point to oro_atomic_t.counter, you have to explicitly index the counter member. Here's the change in the oro_atomic_add function
    Code:
    lock add dword ptr [eax][oro_atomic_t.counter], ecx
    Apply the indexing in all of your functions.

    Hope it will help you

    Edit: It is also better to remove the "dword ptr" so that the compiler validates the variable type against the other operand (ECX in case of your oro_atomic_add). It will show an error in case counter is not a 32 bit variable.
    Code:
    lock add [eax][oro_atomic_t.counter], ecx
    Last edited by rxbagain; April 10th, 2009 at 01:00 AM.

  3. #3
    Join Date
    Mar 2009
    Posts
    4

    Re: GCC to MSVC ASM conversion

    thanks a llot for your input

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured