arch/sh/include/asm/bitops.h
Source file repositories/reference/linux-study-clean/arch/sh/include/asm/bitops.h
File Facts
- System
- Linux kernel
- Corpus path
arch/sh/include/asm/bitops.h- Extension
.h- Size
- 1656 bytes
- Lines
- 73
- Domain
- Architecture Layer
- Bucket
- arch/sh
- 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
asm/byteorder.hasm/barrier.hasm/bitops-grb.hasm-generic/bitops/atomic.hasm/bitops-op32.hasm/bitops-llsc.hasm/bitops-cas.hasm-generic/bitops/non-atomic.hasm-generic/bitops/ffs.hasm-generic/bitops/hweight.hasm-generic/bitops/lock.hasm-generic/bitops/sched.hasm-generic/bitops/ext2-atomic.hasm-generic/bitops/fls.hasm-generic/bitops/__fls.hasm-generic/bitops/fls64.hasm-generic/bitops/le.h
Detected Declarations
function ffzfunction __ffs
Annotated Snippet
#ifndef __ASM_SH_BITOPS_H
#define __ASM_SH_BITOPS_H
#ifndef _LINUX_BITOPS_H
#error only <linux/bitops.h> can be included directly
#endif
/* For __swab32 */
#include <asm/byteorder.h>
#include <asm/barrier.h>
#ifdef CONFIG_GUSA_RB
#include <asm/bitops-grb.h>
#elif defined(CONFIG_CPU_SH2A)
#include <asm-generic/bitops/atomic.h>
#include <asm/bitops-op32.h>
#elif defined(CONFIG_CPU_SH4A)
#include <asm/bitops-llsc.h>
#elif defined(CONFIG_CPU_J2) && defined(CONFIG_SMP)
#include <asm/bitops-cas.h>
#else
#include <asm-generic/bitops/atomic.h>
#include <asm-generic/bitops/non-atomic.h>
#endif
static inline unsigned long __attribute_const__ ffz(unsigned long word)
{
unsigned long result;
__asm__("1:\n\t"
"shlr %1\n\t"
"bt/s 1b\n\t"
" add #1, %0"
: "=r" (result), "=r" (word)
: "0" (~0L), "1" (word)
: "t");
return result;
}
/**
* __ffs - find first bit in word.
* @word: The word to search
*
* Undefined if no bit exists, so code should check against 0 first.
*/
static inline __attribute_const__ unsigned long __ffs(unsigned long word)
{
unsigned long result;
__asm__("1:\n\t"
"shlr %1\n\t"
"bf/s 1b\n\t"
" add #1, %0"
: "=r" (result), "=r" (word)
: "0" (~0L), "1" (word)
: "t");
return result;
}
#include <asm-generic/bitops/ffs.h>
#include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/lock.h>
#include <asm-generic/bitops/sched.h>
#include <asm-generic/bitops/ext2-atomic.h>
#include <asm-generic/bitops/fls.h>
#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/fls64.h>
#include <asm-generic/bitops/le.h>
#endif /* __ASM_SH_BITOPS_H */
Annotation
- Immediate include surface: `asm/byteorder.h`, `asm/barrier.h`, `asm/bitops-grb.h`, `asm-generic/bitops/atomic.h`, `asm/bitops-op32.h`, `asm/bitops-llsc.h`, `asm/bitops-cas.h`, `asm-generic/bitops/non-atomic.h`.
- Detected declarations: `function ffz`, `function __ffs`.
- Atlas domain: Architecture Layer / arch/sh.
- 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.