-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selftests: bpf: move sub-register zero extension checks into subreg.c
It is better to centralize all sub-register zero extension checks into an independent file. This patch takes the first step to move existing sub-register zero extension checks into subreg.c. Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
- Loading branch information
Jiong Wang
authored and
Daniel Borkmann
committed
May 29, 2019
1 parent
bd95e67
commit 9e084bb
Showing
2 changed files
with
39 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"or32 reg zero extend check", | ||
.insns = { | ||
BPF_MOV64_IMM(BPF_REG_0, -1), | ||
BPF_MOV64_IMM(BPF_REG_2, -2), | ||
BPF_ALU32_REG(BPF_OR, BPF_REG_0, BPF_REG_2), | ||
BPF_ALU64_IMM(BPF_RSH, BPF_REG_0, 32), | ||
BPF_EXIT_INSN(), | ||
}, | ||
.prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
.result = ACCEPT, | ||
.retval = 0, | ||
}, | ||
{ | ||
"and32 reg zero extend check", | ||
.insns = { | ||
BPF_MOV64_IMM(BPF_REG_0, -1), | ||
BPF_MOV64_IMM(BPF_REG_2, -2), | ||
BPF_ALU32_REG(BPF_AND, BPF_REG_0, BPF_REG_2), | ||
BPF_ALU64_IMM(BPF_RSH, BPF_REG_0, 32), | ||
BPF_EXIT_INSN(), | ||
}, | ||
.prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
.result = ACCEPT, | ||
.retval = 0, | ||
}, | ||
{ | ||
"xor32 reg zero extend check", | ||
.insns = { | ||
BPF_MOV64_IMM(BPF_REG_0, -1), | ||
BPF_MOV64_IMM(BPF_REG_2, 0), | ||
BPF_ALU32_REG(BPF_XOR, BPF_REG_0, BPF_REG_2), | ||
BPF_ALU64_IMM(BPF_RSH, BPF_REG_0, 32), | ||
BPF_EXIT_INSN(), | ||
}, | ||
.prog_type = BPF_PROG_TYPE_SCHED_CLS, | ||
.result = ACCEPT, | ||
.retval = 0, | ||
}, |