public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* In line ASM magic?  What is this?
@ 2000-11-15 20:55 George Anzinger
  2000-11-15 22:17 ` Timur Tabi
  0 siblings, 1 reply; 3+ messages in thread
From: George Anzinger @ 2000-11-15 20:55 UTC (permalink / raw)
  To: linux-kernel@vger.redhat.com

I am trying to understand what is going on in the following code.  The
reference for %2, i.e. "m"(*__xg(ptr)) seems like magic (from
.../include/i386/system.h).  At the same time, the code "m" (*mem) from
the second __asm__ below (my code) seems to generate the required asm
code.  Before I go with the simple version, could someone tell me why? 
Inquiring minds want to know.

struct __xchg_dummy { unsigned long a[100]; };
#define __xg(x) ((struct __xchg_dummy *)(x))

		__asm__ __volatile__(LOCK_PREFIX "cmpxchgl %b1,%2"
				     : "=a"(prev)
				     : "q"(new), "m"(*__xg(ptr)), "0"(old)
				     : "memory");


	__asm__ __volatile__(
                             LOCK "cmpxchgl %1,%2\n\t"
                             :"=a" (result)
                             :"r" (new),
                              "m" (*mem),
                              "a0" (test)
                             : "memory");


George
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-11-15 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-15 20:55 In line ASM magic? What is this? George Anzinger
2000-11-15 22:17 ` Timur Tabi
2000-11-15 22:32   ` George Anzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox