arch/riscv/include/asm/jump_label.h
Source file repositories/reference/linux-study-clean/arch/riscv/include/asm/jump_label.h
File Facts
- System
- Linux kernel
- Corpus path
arch/riscv/include/asm/jump_label.h- Extension
.h- Size
- 1645 bytes
- Lines
- 71
- Domain
- Architecture Layer
- Bucket
- arch/riscv
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hasm/asm.h
Detected Declarations
function Copyrightfunction arch_static_branch_jump
Annotated Snippet
#ifndef __ASM_JUMP_LABEL_H
#define __ASM_JUMP_LABEL_H
#ifndef __ASSEMBLER__
#include <linux/types.h>
#include <asm/asm.h>
#define HAVE_JUMP_LABEL_BATCH
#define JUMP_LABEL_NOP_SIZE 4
#define JUMP_TABLE_ENTRY(key, label) \
".pushsection __jump_table, \"aw\" \n\t" \
".align " RISCV_LGPTR " \n\t" \
".long 1b - ., " label " - . \n\t" \
"" RISCV_PTR " " key " - . \n\t" \
".popsection \n\t"
/* This macro is also expanded on the Rust side. */
#define ARCH_STATIC_BRANCH_ASM(key, label) \
" .align 2 \n\t" \
" .option push \n\t" \
" .option norelax \n\t" \
" .option norvc \n\t" \
"1: nop \n\t" \
" .option pop \n\t" \
JUMP_TABLE_ENTRY(key, label)
static __always_inline bool arch_static_branch(struct static_key * const key,
const bool branch)
{
asm goto(
ARCH_STATIC_BRANCH_ASM("%0", "%l[label]")
: : "i"(&((char *)key)[branch]) : : label);
return false;
label:
return true;
}
#define ARCH_STATIC_BRANCH_JUMP_ASM(key, label) \
" .align 2 \n\t" \
" .option push \n\t" \
" .option norelax \n\t" \
" .option norvc \n\t" \
"1: j " label " \n\t" \
" .option pop \n\t" \
JUMP_TABLE_ENTRY(key, label)
static __always_inline bool arch_static_branch_jump(struct static_key * const key,
const bool branch)
{
asm goto(
ARCH_STATIC_BRANCH_JUMP_ASM("%0", "%l[label]")
: : "i"(&((char *)key)[branch]) : : label);
return false;
label:
return true;
}
#endif /* __ASSEMBLER__ */
#endif /* __ASM_JUMP_LABEL_H */
Annotation
- Immediate include surface: `linux/types.h`, `asm/asm.h`.
- Detected declarations: `function Copyright`, `function arch_static_branch_jump`.
- Atlas domain: Architecture Layer / arch/riscv.
- 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.