Please correct this code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have following snippet of code.

Code A

__asm__ __volatile__(
                     "   lock       ;\n"
                     "   addl %1,%0 ;\n"
                     : "=m"  (my_var)
                     : "ir"  (my_int), "m" (my_var)
                     :                                 /* no clobber-list */
                     );

Code B

 __asm__ __volatile__(  "decl %0; sete %1"
                     : "=m" (my_var), "=q" (cond)
                     : "m" (my_var)
                     : "memory"
                     );

In Code A memory contents are getting updated. And in Code B memory
contents and 'cond' var are getting updated.
In Code B in cobbler column 'memory' is used to indicate that this
code modifies memory contents. But where as in Code A it was not
mentioned

Is is not that Code A is wrong, for not mentioning cobbler list
'memory' to indicate memory contents are getting updated.
Please rectify me, if I am wrong.

Also, what does '+m' constraint mean, if I use in inline assembly.
--
Regards,
Sri.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux