Implement BPF_GET_SMP_PROCESSOR_ID helper

This commit is contained in:
Pragyansh Chaturvedi
2025-11-01 14:05:50 +05:30
parent 82cac8f8ef
commit 19dedede53

View File

@ -514,6 +514,29 @@ def bpf_probe_read_emitter(
return result, ir.IntType(64)
@HelperHandlerRegistry.register("smp_processor_id")
def bpf_get_smp_processor_id_emitter(
call,
map_ptr,
module,
builder,
func,
local_sym_tab=None,
struct_sym_tab=None,
map_sym_tab=None,
):
"""
Emit LLVM IR for bpf_get_smp_processor_id helper function call.
"""
helper_id = ir.Constant(ir.IntType(64), BPFHelperID.BPF_GET_SMP_PROCESSOR_ID.value)
fn_type = ir.FunctionType(ir.IntType(32), [], var_arg=False)
fn_ptr_type = ir.PointerType(fn_type)
fn_ptr = builder.inttoptr(helper_id, fn_ptr_type)
result = builder.call(fn_ptr, [], tail=False)
logger.info("Emitted bpf_get_smp_processor_id call")
return result, ir.IntType(32)
def handle_helper_call(
call,
module,