Skip to content

Commit

Permalink
Fix register mapping to avoid volatile registers and issues with R12
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
  • Loading branch information
Alan Jowett committed Jun 1, 2021
1 parent c7c019c commit 86a5001
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions vm/ubpf_jit_x86_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,21 @@ static int platform_parameter_registers[] = {
RCX, RDX, R8, R9
};
#define RCX_ALT R15
// Register assignments:
// BPF R0-R4 are "volatile"
// BPF R5-R10 are "non-volatile"
// Map BPF volatile registers to x64 volatile and map BPF non-volatile to
// x64 non-volatile.
// Avoid R12 as we don't support encoding modrm modifier for using R12.
static int register_map[REGISTER_MAP_SIZE] = {
RAX,
R15,
RDX,
R8,
R9,
R10,
R11,
R12,
RBX,
RDI,
RSI,
R13,
R14,
RBP,
Expand Down

0 comments on commit 86a5001

Please sign in to comment.