arch/m68k/include/asm/bitops.h
Source file repositories/reference/linux-study-clean/arch/m68k/include/asm/bitops.h
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/include/asm/bitops.h- Extension
.h- Size
- 13794 bytes
- Lines
- 573
- Domain
- Architecture Layer
- Bucket
- arch/m68k
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
Dependency Surface
linux/compiler.hasm/barrier.hasm-generic/bitops/ffz.hasm-generic/bitops/ffs.hasm-generic/bitops/__ffs.hasm-generic/bitops/fls.hasm-generic/bitops/__fls.hasm-generic/bitops/non-instrumented-non-atomic.hasm-generic/bitops/ext2-atomic.hasm-generic/bitops/fls64.hasm-generic/bitops/sched.hasm-generic/bitops/hweight.hasm-generic/bitops/le.h
Detected Declarations
function bset_reg_set_bitfunction bset_mem_set_bitfunction bfset_mem_set_bitfunction bset_mem_set_bitfunction bclr_reg_clear_bitfunction bclr_mem_clear_bitfunction bfclr_mem_clear_bitfunction bclr_mem_clear_bitfunction bchg_reg_change_bitfunction bchg_mem_change_bitfunction bfchg_mem_change_bitfunction bchg_mem_change_bitfunction bset_reg_test_and_set_bitfunction bset_mem_test_and_set_bitfunction bfset_mem_test_and_set_bitfunction bset_mem_test_and_set_bitfunction bclr_reg_test_and_clear_bitfunction bclr_mem_test_and_clear_bitfunction bfclr_mem_test_and_clear_bitfunction bclr_mem_test_and_clear_bitfunction bchg_reg_test_and_change_bitfunction bchg_mem_test_and_change_bitfunction bfchg_mem_test_and_change_bitfunction bchg_mem_test_and_change_bitfunction xor_unlock_is_negative_bytefunction find_first_zero_bitfunction find_next_zero_bitfunction find_first_bitfunction find_next_bitfunction ffzfunction __ffsfunction ffsfunction ffzfunction __ffsfunction flsfunction __fls
Annotated Snippet
if (res < 32) {
offset += res ^ 31;
return offset < size ? offset : size;
}
offset += 32;
if (offset >= size)
return size;
}
/* No zero yet, search remaining full bytes for a zero */
return offset + find_first_zero_bit(p, size - offset);
}
#define find_next_zero_bit find_next_zero_bit
static inline unsigned long find_first_bit(const unsigned long *vaddr,
unsigned long size)
{
const unsigned long *p = vaddr;
unsigned long res = 32;
unsigned long words;
unsigned long num;
if (!size)
return 0;
words = (size + 31) >> 5;
while (!(num = *p++)) {
if (!--words)
goto out;
}
__asm__ __volatile__ ("bfffo %1{#0,#0},%0"
: "=d" (res) : "d" (num & -num));
res ^= 31;
out:
res += ((long)p - (long)vaddr - 4) * 8;
return res < size ? res : size;
}
#define find_first_bit find_first_bit
static inline unsigned long find_next_bit(const unsigned long *vaddr,
unsigned long size,
unsigned long offset)
{
const unsigned long *p = vaddr + (offset >> 5);
int bit = offset & 31UL, res;
if (offset >= size)
return size;
if (bit) {
unsigned long num = *p++ & (~0UL << bit);
offset -= bit;
/* Look for one in first longword */
__asm__ __volatile__ ("bfffo %1{#0,#0},%0"
: "=d" (res) : "d" (num & -num));
if (res < 32) {
offset += res ^ 31;
return offset < size ? offset : size;
}
offset += 32;
if (offset >= size)
return size;
}
/* No one yet, search remaining full bytes for a one */
return offset + find_first_bit(p, size - offset);
}
#define find_next_bit find_next_bit
/*
* ffz = Find First Zero in word. Undefined if no zero exists,
* so code should check against ~0UL first..
*/
static inline unsigned long __attribute_const__ ffz(unsigned long word)
{
int res;
__asm__ __volatile__ ("bfffo %1{#0,#0},%0"
: "=d" (res) : "d" (~word & -~word));
return res ^ 31;
}
#endif
#ifdef __KERNEL__
#if defined(CONFIG_CPU_HAS_NO_BITFIELDS)
Annotation
- Immediate include surface: `linux/compiler.h`, `asm/barrier.h`, `asm-generic/bitops/ffz.h`, `asm-generic/bitops/ffs.h`, `asm-generic/bitops/__ffs.h`, `asm-generic/bitops/fls.h`, `asm-generic/bitops/__fls.h`, `asm-generic/bitops/non-instrumented-non-atomic.h`.
- Detected declarations: `function bset_reg_set_bit`, `function bset_mem_set_bit`, `function bfset_mem_set_bit`, `function bset_mem_set_bit`, `function bclr_reg_clear_bit`, `function bclr_mem_clear_bit`, `function bfclr_mem_clear_bit`, `function bclr_mem_clear_bit`, `function bchg_reg_change_bit`, `function bchg_mem_change_bit`.
- Atlas domain: Architecture Layer / arch/m68k.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.