github.com/dylandreimerink/gobpfld@v0.6.1-0.20220205171531-e79c330ad608/ebpf/call_bpf.go (about) 1 package ebpf 2 3 import "fmt" 4 5 var ( 6 _ Instruction = (*CallBPF)(nil) 7 _ Jumper = (*CallBPF)(nil) 8 ) 9 10 type CallBPF struct { 11 Offset int32 12 } 13 14 func (c *CallBPF) Raw() ([]RawInstruction, error) { 15 return []RawInstruction{ 16 {Op: BPF_CALL | BPF_JMP, Reg: NewReg(PSEUDO_CALL, 0), Imm: c.Offset}, 17 }, nil 18 } 19 20 func (c *CallBPF) String() string { 21 return fmt.Sprintf("call %+d", c.Offset) 22 } 23 24 func (c *CallBPF) SetJumpTarget(relAddr int16) { 25 c.Offset = int32(relAddr) 26 }