Hi,
Le Thu, 16 Aug 2007 10:03:47 +0530,
Venky Shankar <[EMAIL PROTECTED]> a écrit :
> #define mb() alternative("lock; addl $0,0(%%esp)", "mfence",
> X86_FEATURE_XMM2)
>
> can someone please help me understanding the alternative inline
> assembly, i am finding it a bit confusing. source is in :
You can read http://lwn.net/Articles/164121/, which explains how the
alternatives mechanism works, by precisely taking the mb() example.
Briefly, the alternatives mechanism allows the kernel to optimize
itself at boot-time, depending on the capabilities of the processor.
Here, it means that mb() will either be implemented as "lock; addl
$0,0(%%esp)" or as "mfence", depending on whether the processor
supports MMX2 or not.
Sincerly,
Thomas
--
Thomas Petazzoni - [EMAIL PROTECTED]
http://{thomas,sos,kos}.enix.org - http://www.toulibre.org
http://www.{livret,agenda}dulibre.org
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ