Skip to content

Commit

Permalink
Record PC -> offset after adjusting stack
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
  • Loading branch information
Alan-Jowett committed May 14, 2024
1 parent 3faf6c9 commit 4edbfa6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vm/ubpf_jit_x86_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ translate(struct ubpf_vm* vm, struct jit_state* state, char** errmsg)
}

struct ebpf_inst inst = ubpf_fetch_instruction(vm, i);
state->pc_locs[i] = state->offset;

int dst = map_register(inst.dst);
int src = map_register(inst.src);
Expand All @@ -314,6 +313,8 @@ translate(struct ubpf_vm* vm, struct jit_state* state, char** errmsg)
emit_alu64_imm32(state, 0x81, 5, RSP, 8);
}

state->pc_locs[i] = state->offset;

switch (inst.opcode) {
case EBPF_OP_ADD_IMM:
emit_alu32_imm32(state, 0x81, 0, dst, inst.imm);
Expand Down

0 comments on commit 4edbfa6

Please sign in to comment.