Skip to content

Commit

Permalink
Register calls use a new frame
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmay committed Jun 4, 2019
1 parent 1528120 commit 715d7ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@ impl<'a> EbpfVmMbuff<'a> {
ebpf::CALL_REG => {
let base_address = &prog[0] as *const _ as usize;
let target_address = reg[insn.imm as usize] as usize;
reg[ebpf::STACK_REG] =
frames
.push(&reg[ebpf::FIRST_SCRATCH_REG..ebpf::FIRST_SCRATCH_REG + ebpf::SCRATCH_REGS],
pc)?;
pc = (target_address - base_address) / ebpf::INSN_SIZE;
},

Expand All @@ -845,7 +849,6 @@ impl<'a> EbpfVmMbuff<'a> {
} else if let Some(ref elf) = self.elf {
if let Some(new_pc) = elf.lookup_bpf_call(insn.imm as u32) {
// make BPF to BPF call

reg[ebpf::STACK_REG] =
frames
.push(&reg[ebpf::FIRST_SCRATCH_REG..ebpf::FIRST_SCRATCH_REG + ebpf::SCRATCH_REGS],
Expand Down

0 comments on commit 715d7ff

Please sign in to comment.