From c24fd9547fb6836af022c99470dfdb13fa9f90fe Mon Sep 17 00:00:00 2001 From: "Jose E. Marchesi" Date: Fri, 21 Jul 2023 19:47:49 +0200 Subject: bpf: opcodes, gas: support for signed load V4 instructions This commit adds the signed load to register (ldxs*) instructions introduced in the BPF ISA version 4, including opcodes and assembler tests. Tested in bpf-unknown-none. include/ChangeLog: 2023-07-21 Jose E. Marchesi * opcode/bpf.h (enum bpf_insn_id): Add entries for signed load instructions. (BPF_MODE_SMEM): Define. opcodes/ChangeLog: 2023-07-21 Jose E. Marchesi * bpf-opc.c (bpf_opcodes): Add entries for LDXS{B,W,H,DW} instructions. gas/ChangeLog: 2023-07-21 Jose E. Marchesi * testsuite/gas/bpf/mem.s: Add signed load instructions. * testsuite/gas/bpf/mem-pseudoc.s: Likewise. * testsuite/gas/bpf/mem.d: Likewise. * testsuite/gas/bpf/mem-pseudoc.d: Likewise. * testsuite/gas/bpf/mem-be.d: Likewise. * doc/c-bpf.texi (BPF Instructions): Document the signed load instructions. --- include/ChangeLog | 6 ++++++ include/opcode/bpf.h | 3 +++ 2 files changed, 9 insertions(+) (limited to 'include') diff --git a/include/ChangeLog b/include/ChangeLog index 5872f28..ccf1661 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,5 +1,11 @@ 2023-07-21 Jose E. Marchesi + * opcode/bpf.h (enum bpf_insn_id): Add entries for signed load + instructions. + (BPF_MODE_SMEM): Define. + +2023-07-21 Jose E. Marchesi + * opcode/bpf.h (BPF_OFFSET16_MOVS8): Define. (BPF_OFFSET16_MOVS16): Likewise. (BPF_OFFSET16_MOVS32): Likewise. diff --git a/include/opcode/bpf.h b/include/opcode/bpf.h index 48f06c2..a491df6 100644 --- a/include/opcode/bpf.h +++ b/include/opcode/bpf.h @@ -112,6 +112,7 @@ typedef uint64_t bpf_insn_word; #define BPF_MODE_IND ((uint64_t)0x40 << 56) #define BPF_MODE_MEM ((uint64_t)0x60 << 56) #define BPF_MODE_ATOMIC ((uint64_t)0xc0 << 56) +#define BPF_MODE_SMEM ((uint64_t)0x80 << 56) #define BPF_SIZE_W ((uint64_t)0x00 << 56) #define BPF_SIZE_H ((uint64_t)0x08 << 56) @@ -186,6 +187,8 @@ enum bpf_insn_id BPF_INSN_LDINDB, BPF_INSN_LDINDH, BPF_INSN_LDINDW, BPF_INSN_LDINDDW, /* Generic load instructions (to register.) */ BPF_INSN_LDXB, BPF_INSN_LDXH, BPF_INSN_LDXW, BPF_INSN_LDXDW, + /* Generic signed load instructions. */ + BPF_INSN_LDXSB, BPF_INSN_LDXSH, BPF_INSN_LDXSW, BPF_INSN_LDXSDW, /* Generic store instructions (from register.) */ BPF_INSN_STXBR, BPF_INSN_STXHR, BPF_INSN_STXWR, BPF_INSN_STXDWR, BPF_INSN_STXBI, BPF_INSN_STXHI, BPF_INSN_STXWI, BPF_INSN_STXDWI, -- cgit v1.1