lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTik76t-BUv0SUMOCBaoiGhH0PKq7cQwM8Q1Lmkei@mail.gmail.com>
Date:	Mon, 31 Jan 2011 23:28:52 +0530
From:	Rajat Sharma <fs.rajat@...il.com>
To:	Sri Ram Vemulpali <sri.ram.gmu06@...il.com>
Cc:	Kernel-newbies <kernelnewbies@...linux.org>,
	linux-kernel-mail <linux-kernel@...r.kernel.org>
Subject: Re: Please correct this code

> 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.

>From Code B, it looks like instruction to compiler for not using extra
memory location other than ones specified for input param and output
param. Is it some sort of memory synchronization code?

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

It means the memory location for param is both Readable and Writable

Rajat

On Mon, Jan 31, 2011 at 10:07 PM, Sri Ram Vemulpali
<sri.ram.gmu06@...il.com> wrote:
> 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@...nelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ