From 92434a14b97bf07546701613a16aaf4d8a3b3eca Mon Sep 17 00:00:00 2001 From: "Jose E. Marchesi" Date: Sun, 14 Jul 2019 14:45:31 +0200 Subject: [PATCH] cpu,opcodes,gas: fix arguments to ldabs and ldind eBPF instructions The eBPF non-generic load instructions ldind{b,h,w,dw} and ldabs{b,h,w,dw} do not take an explicit destination register as an argument. Instead, they put the loaded value in %r0, implicitly. This patch fixes the CPU BPF description to not expect a 'dst' argument in these arguments, regenerates the corresponding files in opcodes, and updates the impacted GAS tests. Tested in a x86-64 host. cpu/ChangeLog: 2019-07-14 Jose E. Marchesi * bpf.cpu (dlsi): ldabs and ldind instructions do not take an explicit 'dst' argument. opcodes/ChangeLog: 2019-07-14 Jose E. Marchesi * bpf-desc.c: Regenerate. * bpf-opc.c: Likewise. gas/ChangeLog: 2019-07-14 Jose E. Marchesi * testsuite/gas/bpf/mem.s: Do not use explicit arguments for ldabs and ldind instructions. * testsuite/gas/bpf/mem.d: Updated accordingly. * testsuite/gas/bpf/mem-be.d: Likewise. --- cpu/ChangeLog | 5 +++ cpu/bpf.cpu | 4 +-- gas/ChangeLog | 7 ++++ gas/testsuite/gas/bpf/mem-be.d | 16 ++++----- gas/testsuite/gas/bpf/mem.d | 16 ++++----- gas/testsuite/gas/bpf/mem.s | 16 ++++----- opcodes/ChangeLog | 5 +++ opcodes/bpf-desc.c | 32 ++++++++--------- opcodes/bpf-opc.c | 64 +++++++++++++++++----------------- 9 files changed, 91 insertions(+), 74 deletions(-) diff --git a/cpu/ChangeLog b/cpu/ChangeLog index 1ac7b2bf03d..49940034bb0 100644 --- a/cpu/ChangeLog +++ b/cpu/ChangeLog @@ -1,3 +1,8 @@ +2019-07-14 Jose E. Marchesi + + * bpf.cpu (dlsi): ldabs and ldind instructions do not take an + explicit 'dst' argument. + 2019-06-13 Stafford Horne * or1korfpx.cpu (float-setflag-insn-base): Add 'sf' to symbol. diff --git a/cpu/bpf.cpu b/cpu/bpf.cpu index 85bac2152f5..60e89fb71c4 100644 --- a/cpu/bpf.cpu +++ b/cpu/bpf.cpu @@ -477,8 +477,8 @@ (dni (.sym x-basename x-suffix x-endian) (.str x-basename x-suffix) ((ISA (.sym ebpf x-endian))) - (.str x-basename x-suffix " $dst" x-endian ",$src" x-endian ",$imm32") - (+ imm32 (f-offset16 0) (.sym src x-endian) (.sym dst x-endian) + (.str x-basename 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)) () ())) diff --git a/gas/ChangeLog b/gas/ChangeLog index 0ec0d52b360..fb44aa3d6f6 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2019-07-14 Jose E. Marchesi + + * testsuite/gas/bpf/mem.s: Do not use explicit arguments for + ldabs and ldind instructions. + * testsuite/gas/bpf/mem.d: Updated accordingly. + * testsuite/gas/bpf/mem-be.d: Likewise. + 2019-07-09 Alan Modra * config/obj-elf.c (elf_frob_symbol): Remove mips hacks. diff --git a/gas/testsuite/gas/bpf/mem-be.d b/gas/testsuite/gas/bpf/mem-be.d index 70d8806bc51..7a258bcd550 100644 --- a/gas/testsuite/gas/bpf/mem-be.d +++ b/gas/testsuite/gas/bpf/mem-be.d @@ -8,14 +8,14 @@ Disassembly of section .text: 0+ <.text>: - 0: 20 23 00 00 00 00 be ef ldabsw %r2,%r3,0xbeef - 8: 28 45 00 00 00 00 be ef ldabsh %r4,%r5,0xbeef - 10: 30 67 00 00 00 00 be ef ldabsb %ctx,%r7,0xbeef - 18: 38 89 00 00 00 00 be ef ldabsdw %r8,%r9,0xbeef - 20: 40 23 00 00 00 00 be ef ldindw %r2,%r3,0xbeef - 28: 48 45 00 00 00 00 be ef ldindh %r4,%r5,0xbeef - 30: 50 67 00 00 00 00 be ef ldindb %ctx,%r7,0xbeef - 38: 58 89 00 00 00 00 be ef ldinddw %r8,%r9,0xbeef + 0: 20 03 00 00 00 00 be ef ldabsw %r3,0xbeef + 8: 28 05 00 00 00 00 be ef ldabsh %r5,0xbeef + 10: 30 07 00 00 00 00 be ef ldabsb %r7,0xbeef + 18: 38 09 00 00 00 00 be ef ldabsdw %r9,0xbeef + 20: 40 03 00 00 00 00 be ef ldindw %r3,0xbeef + 28: 48 05 00 00 00 00 be ef ldindh %r5,0xbeef + 30: 50 07 00 00 00 00 be ef ldindb %r7,0xbeef + 38: 58 09 00 00 00 00 be ef ldinddw %r9,0xbeef 40: 61 21 7e ef 00 00 00 00 ldxw %r2,\[%r1\+0x7eef\] 48: 69 21 7e ef 00 00 00 00 ldxh %r2,\[%r1\+0x7eef\] 50: 71 21 7e ef 00 00 00 00 ldxb %r2,\[%r1\+0x7eef\] diff --git a/gas/testsuite/gas/bpf/mem.d b/gas/testsuite/gas/bpf/mem.d index 53492767fd0..4587ffdbe76 100644 --- a/gas/testsuite/gas/bpf/mem.d +++ b/gas/testsuite/gas/bpf/mem.d @@ -7,14 +7,14 @@ Disassembly of section .text: 0+ <.text>: - 0: 20 32 00 00 ef be 00 00 ldabsw %r2,%r3,0xbeef - 8: 28 54 00 00 ef be 00 00 ldabsh %r4,%r5,0xbeef - 10: 30 76 00 00 ef be 00 00 ldabsb %ctx,%r7,0xbeef - 18: 38 98 00 00 ef be 00 00 ldabsdw %r8,%r9,0xbeef - 20: 40 32 00 00 ef be 00 00 ldindw %r2,%r3,0xbeef - 28: 48 54 00 00 ef be 00 00 ldindh %r4,%r5,0xbeef - 30: 50 76 00 00 ef be 00 00 ldindb %ctx,%r7,0xbeef - 38: 58 98 00 00 ef be 00 00 ldinddw %r8,%r9,0xbeef + 0: 20 30 00 00 ef be 00 00 ldabsw %r3,0xbeef + 8: 28 50 00 00 ef be 00 00 ldabsh %r5,0xbeef + 10: 30 70 00 00 ef be 00 00 ldabsb %r7,0xbeef + 18: 38 90 00 00 ef be 00 00 ldabsdw %r9,0xbeef + 20: 40 30 00 00 ef be 00 00 ldindw %r3,0xbeef + 28: 48 50 00 00 ef be 00 00 ldindh %r5,0xbeef + 30: 50 70 00 00 ef be 00 00 ldindb %r7,0xbeef + 38: 58 90 00 00 ef be 00 00 ldinddw %r9,0xbeef 40: 61 12 ef 7e 00 00 00 00 ldxw %r2,\[%r1\+0x7eef\] 48: 69 12 ef 7e 00 00 00 00 ldxh %r2,\[%r1\+0x7eef\] 50: 71 12 ef 7e 00 00 00 00 ldxb %r2,\[%r1\+0x7eef\] diff --git a/gas/testsuite/gas/bpf/mem.s b/gas/testsuite/gas/bpf/mem.s index cc5329c4ca8..f0f1d08e202 100644 --- a/gas/testsuite/gas/bpf/mem.s +++ b/gas/testsuite/gas/bpf/mem.s @@ -2,14 +2,14 @@ .text - ldabsw %r2, %r3, 0xbeef - ldabsh %r4, %r5, 0xbeef - ldabsb %r6, %r7, 0xbeef - ldabsdw %r8, %r9, 0xbeef - ldindw %r2, %r3, 0xbeef - ldindh %r4, %r5, 0xbeef - ldindb %r6, %r7, 0xbeef - ldinddw %r8, %r9, 0xbeef + ldabsw %r3, 0xbeef + ldabsh %r5, 0xbeef + ldabsb %r7, 0xbeef + ldabsdw %r9, 0xbeef + ldindw %r3, 0xbeef + ldindh %r5, 0xbeef + ldindb %r7, 0xbeef + ldinddw %r9, 0xbeef ldxw %r2, [%r1+0x7eef] ldxh %r2, [%r1+0x7eef] ldxb %r2, [%r1+0x7eef] diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 6b55f5c3b10..e1de65b5d4d 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2019-07-14 Jose E. Marchesi + + * bpf-desc.c: Regenerate. + * bpf-opc.c: Likewise. + 2019-07-10 Hans-Peter Nilsson * arm-dis.c (print_insn_coprocessor): Rename index to diff --git a/opcodes/bpf-desc.c b/opcodes/bpf-desc.c index 4c94723baff..3b943353dcf 100644 --- a/opcodes/bpf-desc.c +++ b/opcodes/bpf-desc.c @@ -824,82 +824,82 @@ static const CGEN_IBASE bpf_cgen_insn_table[MAX_INSNS] = BPF_INSN_LDDWBE, "lddwbe", "lddw", 128, { 0, { { { (1<