Hi everyone,
I want to know if I have converted the following ASM code correctly from gcc ASM to MSV ASM.
Thanks a lot.
Printable View
Hi everyone,
I want to know if I have converted the following ASM code correctly from gcc ASM to MSV ASM.
Thanks a lot.
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
Apply the indexing in all of your functions.Code:lock add dword ptr [eax][oro_atomic_t.counter], ecx
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
thanks a llot for your input :)