- 追加された行はこの色です。
- 削除された行はこの色です。
*参照元 [#m6a517d3]
#backlinks
*説明 [#da92c6d2]
-パス: [[linux-2.6.33/arch/x86/include/bitops.h]]
-FIXME: これは何?
--説明
**引数 [#vb9362cc]
-int nr
--ビット位置
-void *addr
--ビットをセットしたい u32 型変数へのポインタ
**返り値 [#p14fe353]
-なし
**参考 [#b5e6fcef]
*実装 [#x32b530e]
/**
* clear_bit - Clears a bit in memory
* @nr: Bit to clear
* @addr: Address to start counting from
*
* clear_bit() is atomic and may not be reordered. However, it does
* not contain a memory barrier, so if it is used for locking purposes,
* you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
* in order to ensure changes are visible on other processors.
*/
static __always_inline void
clear_bit(int nr, volatile unsigned long *addr)
{
-
--[[linux-2.6.33/__always_inline]]
if (IS_IMMEDIATE(nr)) {
asm volatile(LOCK_PREFIX "andb %1,%0"
: CONST_MASK_ADDR(nr, addr)
: "iq" ((u8)~CONST_MASK(nr)));
-
--[[linux-2.6.33/IS_IMMEDIATE()]]
-
--[[linux-2.6.33/LOCK_PREFIX]]
-
--[[linux-2.6.33/CONST_MASK_ADDR()]]
-
--[[linux-2.6.33/CONST_MASK()]]
} else {
asm volatile(LOCK_PREFIX "btr %1,%0"
: BITOP_ADDR(addr)
: "Ir" (nr));
-btr r/m32, imm8 命令は Bit Test and Reset 命令のこと。
--32ビット変数の指定された位置のビットを
キャリーフラグ(CF)に格納し、ビットを 0 にする命令。
--この関数ではテストの方の機能は使わない(=キャリーフラグは見ない)ようだ。
-
--[[linux-2.6.33/BITOP_ADDR()]]
}
}
*コメント [#xa6303a6]