MCPcopy Create free account
hub / github.com/F-Stack/f-stack / emit_shift

Function emit_shift

dpdk/lib/bpf/bpf_jit_x86.c:409–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409static void
410emit_shift(struct bpf_jit_state *st, uint32_t op, uint32_t dreg)
411{
412 uint8_t mod;
413 uint32_t bop, opx;
414
415 static const uint8_t ops[] = {0xC1, 0xD3};
416 static const uint8_t mods[] = {
417 [GET_BPF_OP(BPF_LSH)] = 4,
418 [GET_BPF_OP(BPF_RSH)] = 5,
419 [GET_BPF_OP(EBPF_ARSH)] = 7,
420 };
421
422 bop = GET_BPF_OP(op);
423 mod = mods[bop];
424 opx = (BPF_SRC(op) == BPF_X);
425
426 emit_rex(st, op, 0, dreg);
427 emit_bytes(st, &ops[opx], sizeof(ops[opx]));
428 emit_modregrm(st, MOD_DIRECT, mod, dreg);
429}
430
431/*
432 * emit one of:

Callers 2

emit_shift_immFunction · 0.85
emit_shift_regFunction · 0.85

Calls 3

emit_rexFunction · 0.85
emit_bytesFunction · 0.85
emit_modregrmFunction · 0.85

Tested by

no test coverage detected