aboutsummaryrefslogtreecommitdiff
path: root/opcodes/bpf-opc.c
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2020-05-28 16:53:54 +0200
committerJose E. Marchesi <jose.marchesi@oracle.com>2020-05-28 21:52:31 +0200
commit78c1c35437a013c63acbff6926ff8d254e283d69 (patch)
tree96a630975112891435c7b7dc926c75d1204ccbc0 /opcodes/bpf-opc.c
parent989ade05525047fc6b94f24ece5fc09e076027b0 (diff)
downloadgdb-78c1c35437a013c63acbff6926ff8d254e283d69.zip
gdb-78c1c35437a013c63acbff6926ff8d254e283d69.tar.gz
gdb-78c1c35437a013c63acbff6926ff8d254e283d69.tar.bz2
cpu,opcodes: add instruction semantics to bpf.cpu and minor fixes
This patch adds semantic RTL descriptions to the eBPF instructions defined in cpu/bpf.cpu. It also contains a couple of minor improvements. Tested in bpf-unknown-none targets. No regressions. cpu/ChangeLog: 2020-05-28 Jose E. Marchesi <jose.marchesi@oracle.com> David Faust <david.faust@oracle.com> * bpf.cpu (define-alu-insn-un): Add definitions of semantics. (define-alu-insn-mov): Likewise. (daib): Likewise. (define-alu-instructions): Likewise. (define-endian-insn): Likewise. (define-lddw): Likewise. (dlabs): Likewise. (dlind): Likewise. (dxli): Likewise. (dxsi): Likewise. (dsti): Likewise. (define-ldstx-insns): Likewise. (define-st-insns): Likewise. (define-cond-jump-insn): Likewise. (dcji): Likewise. (define-condjump-insns): Likewise. (define-call-insn): Likewise. (ja): Likewise. ("exit"): Likewise. (define-atomic-insns): Likewise. (sem-exchange-and-add): New macro. * bpf.cpu ("brkpt"): New instruction. (bpfbf): Set word-bitsize to 32 and insn-endian big. (h-gpr): Prefer r0 to `a' and r6 to `ctx'. (h-pc): Expand definition. * bpf.opc (bpf_print_insn): Set endian_code to BIG. opcodes/ChangeLog: 2020-05-28 Jose E. Marchesi <jose.marchesi@oracle.com> David Faust <david.faust@oracle.com> * bpf-desc.c: Regenerate. * bpf-opc.h: Likewise. * bpf-opc.c: Likewise. * bpf-dis.c: Likewise.
Diffstat (limited to 'opcodes/bpf-opc.c')
-rw-r--r--opcodes/bpf-opc.c120
1 files changed, 66 insertions, 54 deletions
diff --git a/opcodes/bpf-opc.c b/opcodes/bpf-opc.c
index a64da68..3ecd35d 100644
--- a/opcodes/bpf-opc.c
+++ b/opcodes/bpf-opc.c
@@ -133,11 +133,11 @@ static const CGEN_IFMT ifmt_jeqrbe ATTRIBUTE_UNUSED = {
8, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_DSTBE) }, { F (F_OP_CODE) }, { F (F_SRCBE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
};
-static const CGEN_IFMT ifmt_ja ATTRIBUTE_UNUSED = {
+static const CGEN_IFMT ifmt_callle ATTRIBUTE_UNUSED = {
8, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_REGS) }, { F (F_OP_CODE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
};
-static const CGEN_IFMT ifmt_call ATTRIBUTE_UNUSED = {
+static const CGEN_IFMT ifmt_ja ATTRIBUTE_UNUSED = {
8, 64, 0xff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_REGS) }, { F (F_OP_CODE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } }
};
@@ -400,30 +400,6 @@ static const CGEN_OPCODE bpf_cgen_insn_opcode_table[MAX_INSNS] =
{ { MNEM, ' ', OP (DSTLE), ',', OP (SRCLE), 0 } },
& ifmt_addrle, { 0xac }
},
-/* mov $dstle,$imm32 */
- {
- { 0, 0, 0, 0 },
- { { MNEM, ' ', OP (DSTLE), ',', OP (IMM32), 0 } },
- & ifmt_addile, { 0xb7 }
- },
-/* mov $dstle,$srcle */
- {
- { 0, 0, 0, 0 },
- { { MNEM, ' ', OP (DSTLE), ',', OP (SRCLE), 0 } },
- & ifmt_addrle, { 0xbf }
- },
-/* mov32 $dstle,$imm32 */
- {
- { 0, 0, 0, 0 },
- { { MNEM, ' ', OP (DSTLE), ',', OP (IMM32), 0 } },
- & ifmt_addile, { 0xb4 }
- },
-/* mov32 $dstle,$srcle */
- {
- { 0, 0, 0, 0 },
- { { MNEM, ' ', OP (DSTLE), ',', OP (SRCLE), 0 } },
- & ifmt_addrle, { 0xbc }
- },
/* arsh $dstle,$imm32 */
{
{ 0, 0, 0, 0 },
@@ -460,6 +436,30 @@ static const CGEN_OPCODE bpf_cgen_insn_opcode_table[MAX_INSNS] =
{ { MNEM, ' ', OP (DSTLE), 0 } },
& ifmt_negle, { 0x84 }
},
+/* mov $dstle,$imm32 */
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, ' ', OP (DSTLE), ',', OP (IMM32), 0 } },
+ & ifmt_addile, { 0xb7 }
+ },
+/* mov $dstle,$srcle */
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, ' ', OP (DSTLE), ',', OP (SRCLE), 0 } },
+ & ifmt_addrle, { 0xbf }
+ },
+/* mov32 $dstle,$imm32 */
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, ' ', OP (DSTLE), ',', OP (IMM32), 0 } },
+ & ifmt_addile, { 0xb4 }
+ },
+/* mov32 $dstle,$srcle */
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, ' ', OP (DSTLE), ',', OP (SRCLE), 0 } },
+ & ifmt_addrle, { 0xbc }
+ },
/* add $dstbe,$imm32 */
{
{ 0, 0, 0, 0 },
@@ -700,30 +700,6 @@ static const CGEN_OPCODE bpf_cgen_insn_opcode_table[MAX_INSNS] =
{ { MNEM, ' ', OP (DSTBE), ',', OP (SRCBE), 0 } },
& ifmt_addrbe, { 0xac }
},
-/* mov $dstbe,$imm32 */
- {
- { 0, 0, 0, 0 },
- { { MNEM, ' ', OP (DSTBE), ',', OP (IMM32), 0 } },
- & ifmt_addibe, { 0xb7 }
- },
-/* mov $dstbe,$srcbe */
- {
- { 0, 0, 0, 0 },
- { { MNEM, ' ', OP (DSTBE), ',', OP (SRCBE), 0 } },
- & ifmt_addrbe, { 0xbf }
- },
-/* mov32 $dstbe,$imm32 */
- {
- { 0, 0, 0, 0 },
- { { MNEM, ' ', OP (DSTBE), ',', OP (IMM32), 0 } },
- & ifmt_addibe, { 0xb4 }
- },
-/* mov32 $dstbe,$srcbe */
- {
- { 0, 0, 0, 0 },
- { { MNEM, ' ', OP (DSTBE), ',', OP (SRCBE), 0 } },
- & ifmt_addrbe, { 0xbc }
- },
/* arsh $dstbe,$imm32 */
{
{ 0, 0, 0, 0 },
@@ -760,6 +736,30 @@ static const CGEN_OPCODE bpf_cgen_insn_opcode_table[MAX_INSNS] =
{ { MNEM, ' ', OP (DSTBE), 0 } },
& ifmt_negbe, { 0x84 }
},
+/* mov $dstbe,$imm32 */
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, ' ', OP (DSTBE), ',', OP (IMM32), 0 } },
+ & ifmt_addibe, { 0xb7 }
+ },
+/* mov $dstbe,$srcbe */
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, ' ', OP (DSTBE), ',', OP (SRCBE), 0 } },
+ & ifmt_addrbe, { 0xbf }
+ },
+/* mov32 $dstbe,$imm32 */
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, ' ', OP (DSTBE), ',', OP (IMM32), 0 } },
+ & ifmt_addibe, { 0xb4 }
+ },
+/* mov32 $dstbe,$srcbe */
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, ' ', OP (DSTBE), ',', OP (SRCBE), 0 } },
+ & ifmt_addrbe, { 0xbc }
+ },
/* endle $dstle,$endsize */
{
{ 0, 0, 0, 0 },
@@ -1540,17 +1540,23 @@ static const CGEN_OPCODE bpf_cgen_insn_opcode_table[MAX_INSNS] =
{ { MNEM, ' ', OP (DSTBE), ',', OP (SRCBE), ',', OP (DISP16), 0 } },
& ifmt_jeqrbe, { 0xde }
},
-/* ja $disp16 */
+/* call $disp32 */
{
{ 0, 0, 0, 0 },
- { { MNEM, ' ', OP (DISP16), 0 } },
- & ifmt_ja, { 0x5 }
+ { { MNEM, ' ', OP (DISP32), 0 } },
+ & ifmt_callle, { 0x85 }
},
/* call $disp32 */
{
{ 0, 0, 0, 0 },
{ { MNEM, ' ', OP (DISP32), 0 } },
- & ifmt_call, { 0x85 }
+ & ifmt_callle, { 0x85 }
+ },
+/* ja $disp16 */
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, ' ', OP (DISP16), 0 } },
+ & ifmt_ja, { 0x5 }
},
/* exit */
{
@@ -1582,6 +1588,12 @@ static const CGEN_OPCODE bpf_cgen_insn_opcode_table[MAX_INSNS] =
{ { MNEM, ' ', '[', OP (DSTBE), '+', OP (OFFSET16), ']', ',', OP (SRCBE), 0 } },
& ifmt_ldxwbe, { 0xc3 }
},
+/* brkpt */
+ {
+ { 0, 0, 0, 0 },
+ { { MNEM, 0 } },
+ & ifmt_exit, { 0x8c }
+ },
};
#undef A