arch/csky/kernel/jump_label.c
Source file repositories/reference/linux-study-clean/arch/csky/kernel/jump_label.c
File Facts
- System
- Linux kernel
- Corpus path
arch/csky/kernel/jump_label.c- Extension
.c- Size
- 1368 bytes
- Lines
- 55
- Domain
- Architecture Layer
- Bucket
- arch/csky
- 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/jump_label.hlinux/kernel.hlinux/memory.hlinux/mutex.hlinux/uaccess.hasm/cacheflush.h
Detected Declarations
function arch_jump_label_transformfunction arch_jump_label_transform_static
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/jump_label.h>
#include <linux/kernel.h>
#include <linux/memory.h>
#include <linux/mutex.h>
#include <linux/uaccess.h>
#include <asm/cacheflush.h>
#define NOP32_HI 0xc400
#define NOP32_LO 0x4820
#define BSR_LINK 0xe000
void arch_jump_label_transform(struct jump_entry *entry,
enum jump_label_type type)
{
unsigned long addr = jump_entry_code(entry);
u16 insn[2];
int ret = 0;
if (type == JUMP_LABEL_JMP) {
long offset = jump_entry_target(entry) - jump_entry_code(entry);
if (WARN_ON(offset & 1 || offset < -67108864 || offset >= 67108864))
return;
offset = offset >> 1;
insn[0] = BSR_LINK |
((uint16_t)((unsigned long) offset >> 16) & 0x3ff);
insn[1] = (uint16_t)((unsigned long) offset & 0xffff);
} else {
insn[0] = NOP32_HI;
insn[1] = NOP32_LO;
}
ret = copy_to_kernel_nofault((void *)addr, insn, 4);
WARN_ON(ret);
flush_icache_range(addr, addr + 4);
}
void arch_jump_label_transform_static(struct jump_entry *entry,
enum jump_label_type type)
{
/*
* We use the same instructions in the arch_static_branch and
* arch_static_branch_jump inline functions, so there's no
* need to patch them up here.
* The core will call arch_jump_label_transform when those
* instructions need to be replaced.
*/
arch_jump_label_transform(entry, type);
}
Annotation
- Immediate include surface: `linux/jump_label.h`, `linux/kernel.h`, `linux/memory.h`, `linux/mutex.h`, `linux/uaccess.h`, `asm/cacheflush.h`.
- Detected declarations: `function arch_jump_label_transform`, `function arch_jump_label_transform_static`.
- Atlas domain: Architecture Layer / arch/csky.
- 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.