arch/arm/net/bpf_jit_32.c
Source file repositories/reference/linux-study-clean/arch/arm/net/bpf_jit_32.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/net/bpf_jit_32.c- Extension
.c- Size
- 61019 bytes
- Lines
- 2273
- Domain
- Architecture Layer
- Bucket
- arch/arm
- 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/bpf.hlinux/bitops.hlinux/compiler.hlinux/errno.hlinux/filter.hlinux/netdevice.hlinux/string.hlinux/slab.hlinux/if_vlan.hlinux/math64.hasm/cacheflush.hasm/hwcap.hasm/opcodes.hasm/system_info.hbpf_jit_32.h
Detected Declarations
struct jit_ctxfunction jit_udiv32function jit_mod32function jit_sdiv32function jit_smod32function jit_udiv64function jit_mod64function jit_sdiv64function jit_smod64function _emitfunction emitfunction imm12function arm_bpf_ldst_imm12function arm_bpf_ldst_imm8function jit_fill_holefunction imm_offsetfunction bpf2a32_offsetfunction emit_mov_i_no8mfunction emit_mov_ifunction emit_bx_rfunction emit_blx_rfunction epilogue_offsetfunction emit_udivmodfunction emit_udivmod64function is_stackedfunction arm_bpf_get_reg32function arm_bpf_put_reg32function arm_bpf_put_reg64function emit_a32_mov_ifunction emit_a32_mov_i64function emit_a32_mov_se_i64function emit_a32_add_rfunction emit_a32_sub_rfunction emit_alu_rfunction emit_a32_alu_r64function emit_a32_mov_rfunction emit_a32_mov_r64function emit_a32_movsx_r64function emit_a32_alu_ifunction emit_a32_neg64function emit_a32_lsh_r64function emit_a32_arsh_r64function emit_a32_rsh_r64function emit_a32_lsh_i64function emit_a32_rsh_i64function emit_a32_arsh_i64function emit_a32_mul_r64function is_ldst_imm
Annotated Snippet
struct jit_ctx {
const struct bpf_prog *prog;
unsigned int idx;
unsigned int prologue_bytes;
unsigned int epilogue_offset;
unsigned int cpu_architecture;
u32 flags;
u32 *offsets;
u32 *target;
u32 stack_size;
#if __LINUX_ARM_ARCH__ < 7
u16 epilogue_bytes;
u16 imm_count;
u32 *imms;
#endif
};
/*
* Wrappers which handle both OABI and EABI and assures Thumb2 interworking
* (where the assembly routines like __aeabi_uidiv could cause problems).
*/
static u32 jit_udiv32(u32 dividend, u32 divisor)
{
return dividend / divisor;
}
static u32 jit_mod32(u32 dividend, u32 divisor)
{
return dividend % divisor;
}
static s32 jit_sdiv32(s32 dividend, s32 divisor)
{
return dividend / divisor;
}
static s32 jit_smod32(s32 dividend, s32 divisor)
{
return dividend % divisor;
}
/* Wrappers for 64-bit div/mod */
static u64 jit_udiv64(u64 dividend, u64 divisor)
{
return div64_u64(dividend, divisor);
}
static u64 jit_mod64(u64 dividend, u64 divisor)
{
u64 rem;
div64_u64_rem(dividend, divisor, &rem);
return rem;
}
static s64 jit_sdiv64(s64 dividend, s64 divisor)
{
return div64_s64(dividend, divisor);
}
static s64 jit_smod64(s64 dividend, s64 divisor)
{
u64 q;
q = div64_s64(dividend, divisor);
return dividend - q * divisor;
}
static inline void _emit(int cond, u32 inst, struct jit_ctx *ctx)
{
inst |= (cond << 28);
inst = __opcode_to_mem_arm(inst);
if (ctx->target != NULL)
ctx->target[ctx->idx] = inst;
ctx->idx++;
}
/*
* Emit an instruction that will be executed unconditionally.
*/
static inline void emit(u32 inst, struct jit_ctx *ctx)
{
_emit(ARM_COND_AL, inst, ctx);
}
/*
* This is rather horrid, but necessary to convert an integer constant
Annotation
- Immediate include surface: `linux/bpf.h`, `linux/bitops.h`, `linux/compiler.h`, `linux/errno.h`, `linux/filter.h`, `linux/netdevice.h`, `linux/string.h`, `linux/slab.h`.
- Detected declarations: `struct jit_ctx`, `function jit_udiv32`, `function jit_mod32`, `function jit_sdiv32`, `function jit_smod32`, `function jit_udiv64`, `function jit_mod64`, `function jit_sdiv64`, `function jit_smod64`, `function _emit`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.