summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2019-07-15 16:00:28 +0200
committerJose E. Marchesi <jose.marchesi@oracle.com>2019-07-15 16:00:28 +0200
commit3719fd55b6f89662653d50d33bb267c5f21127a5 (patch)
tree7c046c3a10249178af42ff1ab11ba51468b62d6c /cpu
parent5b9d7a9a647260ba754fbd2a176d37806f15acc8 (diff)
downloadbinutils-gdb-3719fd55b6f89662653d50d33bb267c5f21127a5.tar.gz
cpu,opcodes,gas: fix explicit arguments to eBPF ldabs instructions
This patch fixes the eBPF CPU description in order to reflect the right explicit arguments passed to the ldabs{b,h,w,dw} instructions, updates the corresponding GAS tests, and updates the BPF section of the GAS manual. cpu/ChangeLog: 2019-07-15 Jose E. Marchesi <jose.marchesi@oracle.com> * bpf.cpu (dlabs): New pmacro. (dlind): Likewise. opcodes/ChangeLog: 2019-07-15 Jose E. Marchesi <jose.marchesi@oracle.com> * bpf-desc.c: Regenerate. * bpf-opc.c: Likewise. * bpf-opc.h: Likewise. gas/ChangeLog: 2019-07-15 Jose E. Marchesi <jose.marchesi@oracle.com> * testsuite/gas/bpf/mem.s: ldabs instructions do not take a `src' register as an argument. * testsuite/gas/bpf/mem.d: Updated accordingly. * testsuite/gas/bpf/mem-be.d: Likewise. * doc/c-bpf.texi (BPF Opcodes): Update to reflect the correct explicit arguments to ldabs and ldind instructions.
Diffstat (limited to 'cpu')
-rw-r--r--cpu/ChangeLog5
-rw-r--r--cpu/bpf.cpu63
2 files changed, 43 insertions, 25 deletions
diff --git a/cpu/ChangeLog b/cpu/ChangeLog
index 49940034bb0..41d008f0e17 100644
--- a/cpu/ChangeLog
+++ b/cpu/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-15 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * bpf.cpu (dlabs): New pmacro.
+ (dlind): Likewise.
+
2019-07-14 Jose E. Marchesi <jose.marchesi@oracle.com>
* bpf.cpu (dlsi): ldabs and ldind instructions do not take an
diff --git a/cpu/bpf.cpu b/cpu/bpf.cpu
index 60e89fb71c4..b8a3a92e66e 100644
--- a/cpu/bpf.cpu
+++ b/cpu/bpf.cpu
@@ -466,36 +466,49 @@
(define-lddw le)
(define-lddw be)
-;; The absolute/indirect load instructions are non-generic loads
-;; designed to be used in socket filters. They come in several
-;; variants:
+;; The absolute load instructions are non-generic loads designed to be
+;; used in socket filters. They come in several variants:
+;;
+;; LDABS{w,h,b,dw}
+
+(define-pmacro (dlabs x-suffix x-size)
+ (dni (.sym "ldabs" x-suffix)
+ (.str "ldabs" x-suffix)
+ (all-isas)
+ (.str "ldabs" x-suffix " $imm32")
+ (+ imm32 (f-offset16 0) (f-regs 0)
+ OP_CLASS_LD OP_MODE_ABS (.sym OP_SIZE_ x-size))
+ () ()))
+
+(dlabs "w" W)
+(dlabs "h" H)
+(dlabs "b" B)
+(dlabs "dw" DW)
+
+;; The indirect load instructions are non-generic loads designed to be
+;; used in socket filters. They come in several variants:
;;
-;; LD{abs,ind}{w,h,b,dw}le for the little-endian ISA
-;; LD{abs,ind}[w,h,b,dw}be for the big-endian ISA
+;; LDIND{w,h,b,dw}le for the little-endian ISA
+;; LDIND[w,h,b,dw}be for the big-endian ISA
-(define-pmacro (dlsi x-basename x-suffix x-class x-size x-mode x-endian)
- (dni (.sym x-basename x-suffix x-endian)
- (.str x-basename x-suffix)
+(define-pmacro (dlind x-suffix x-size x-endian)
+ (dni (.sym "ldind" x-suffix x-endian)
+ (.str "ldind" x-suffix)
((ISA (.sym ebpf x-endian)))
- (.str x-basename x-suffix " $src" x-endian ",$imm32")
+ (.str "ldind" x-suffix " $src" x-endian ",$imm32")
(+ imm32 (f-offset16 0) ((.sym f-dst x-endian) 0) (.sym src x-endian)
- (.sym OP_CLASS_ x-class) (.sym OP_SIZE_ x-size)
- (.sym OP_MODE_ x-mode)) () ()))
+ OP_CLASS_LD OP_MODE_IND (.sym OP_SIZE_ x-size))
+ () ()))
-(define-pmacro (define-ldabsind x-endian)
- (begin
- (dlsi "ldabs" "w" LD W ABS x-endian)
- (dlsi "ldabs" "h" LD H ABS x-endian)
- (dlsi "ldabs" "b" LD B ABS x-endian)
- (dlsi "ldabs" "dw" LD DW ABS x-endian)
-
- (dlsi "ldind" "w" LD W IND x-endian)
- (dlsi "ldind" "h" LD H IND x-endian)
- (dlsi "ldind" "b" LD B IND x-endian)
- (dlsi "ldind" "dw" LD DW IND x-endian)))
-
-(define-ldabsind le)
-(define-ldabsind be)
+(define-pmacro (define-ldind x-endian)
+ (begin
+ (dlind "w" W x-endian)
+ (dlind "h" H x-endian)
+ (dlind "b" B x-endian)
+ (dlind "dw" DW x-endian)))
+
+(define-ldind le)
+(define-ldind be)
;; Generic load and store instructions are provided for several word
;; sizes. They come in several variants: