diff options
author | Puranjay Mohan <puranjay12@gmail.com> | 2023-09-07 23:05:44 +0000 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-09-15 17:16:56 -0700 |
commit | fc832653fa0dba174bf8fee9db85f3f9d1450b8a (patch) | |
tree | 7417f53634357702e1a188cbfb9ea6a33ee836ef /tools | |
parent | f9e6981b1f1ce5e954e4e9b82e6d3e564d4a3254 (diff) | |
download | linux-stable-fc832653fa0dba174bf8fee9db85f3f9d1450b8a.tar.gz linux-stable-fc832653fa0dba174bf8fee9db85f3f9d1450b8a.tar.bz2 linux-stable-fc832653fa0dba174bf8fee9db85f3f9d1450b8a.zip |
arm32, bpf: add support for sign-extension mov instruction
The cpuv4 added a new BPF_MOVSX instruction that sign extends the src
before moving it to the destination.
BPF_ALU | BPF_MOVSX sign extends 8-bit and 16-bit operands into 32-bit
operands, and zeroes the remaining upper 32 bits.
BPF_ALU64 | BPF_MOVSX sign extends 8-bit, 16-bit, and 32-bit operands
into 64-bit operands.
The offset field of the instruction is used to tell the number of bit to
use for sign-extension. BPF_MOV and BPF_MOVSX have the same code but the
former sets offset to 0 and the later one sets the offset to 8, 16 or 32
The behaviour of this instruction is dst = (s8,s16,s32)src
On ARM32 the implementation uses LSH and ARSH to extend the 8/16 bits to
a 32-bit register and then it is sign extended to the upper 32-bit
register using ARSH. For 32-bit we just move it to the destination
register and use ARSH to extend it to the upper 32-bit register.
Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/20230907230550.1417590-4-puranjay12@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions