阅读:2417回复:2
哪位好心人解释一下mb() 函数的意思吧?
我在/linux/include/asm-x86/system.h中看到这段代码:
291 292 /* 293 * Force strict CPU ordering. 294 * And yes, this is required on UP too when we're talking 295 * to devices. 296 */ 297 #ifdef CONFIG_X86_32 311 #define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2) 312 #define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2) 313 #define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM) 314 #else 315 #define mb() asm volatile("mfence":::"memory") 316 #define rmb() asm volatile("lfence":::"memory") 317 #define wmb() asm volatile("sfence" ::: "memory") 318 #endif 319 我想请问,alternative是不是说如果没有mfence指令就用lock; addl $0,0(%%esp)来代替? |
|
沙发#
发布于:2009-03-20 09:36
memory barrier?
|
|
板凳#
发布于:2009-03-20 19:54
mb内存栅,作为一种数据同步的手段
|
|
|