- 追加された行はこの色です。
- 削除された行はこの色です。
*参照元 [#jf6b6ac2]
#backlinks
*説明 [#wbd09bbd]
-パス: [[linux-2.6.33/]]
-パス: [[linux-2.6.33/arch/x86/include/bitops.h]]
-FIXME: これは何?
--説明
-u32 型変数の指定されたビット位置にビットをセット、つまり 1 にする。
**引数 [#n33cd205]
-int nr
--ビット位置
-void *addr
--ビットをセットしたい u32 型変数へのポインタ
**返り値 [#e8e27508]
-なし
**参考 [#m6f17b58]
*実装 [#d0a29139]
static inline void set_bit(int nr, void *addr)
/**
* set_bit - Atomically set a bit in memory
* @nr: the bit to set
* @addr: the address to start counting from
*
* This function is atomic and may not be reordered. See __set_bit()
* if you do not require the atomic guarantees.
*
* Note: there are no guarantees that this function will not be reordered
* on non x86 architectures, so if you are writing portable code,
* make sure not to rely on its reordering guarantees.
*
* Note that @nr may be almost arbitrarily large; this function is not
* restricted to acting on a single-word quantity.
*/
static __always_inline void
set_bit(unsigned int nr, volatile unsigned long *addr)
{
asm("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr));
-
--[[linux-2.6.33/__always_inline]]
if (IS_IMMEDIATE(nr)) {
asm volatile(LOCK_PREFIX "orb %1,%0"
: CONST_MASK_ADDR(nr, addr)
: "iq" ((u8)CONST_MASK(nr))
: "memory");
-
--[[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 "bts %1,%0"
: BITOP_ADDR(addr) : "Ir" (nr) : "memory");
-bts r/m32, imm8 命令は Bit Test and Set 命令のこと。
--32ビット変数の指定された位置のビットを
キャリーフラグ(CF)に格納し、ビットを 1にする命令。
--この関数ではテストの方の機能は使わない(=キャリーフラグは見ない)ようだ。
-
--[[linux-2.6.33/BITOP_ADDR()]]
}
}
*コメント [#l451831e]