From: Will Hawkins <hawkinsw@obs.cr>
To: binutils@sourceware.org
Cc: Will Hawkins <hawkinsw@obs.cr>
Subject: [PATCH 1/1] objdump: Add callx support for BPF CPU v1
Date: Fri, 9 Feb 2024 13:07:32 -0500 [thread overview]
Message-ID: <20240209180734.443763-2-hawkinsw@obs.cr> (raw)
In-Reply-To: <20240209180734.443763-1-hawkinsw@obs.cr>
Add support for disassembling the callx instruction back to CPU v1.
include/ChangeLog:
* opcode/bpf.h (enum bpf_insn_id):
opcodes/ChangeLog:
* bpf-opc.c:
ChangeLog:
* sim/bpf/bpf-sim.c (execute):
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
---
include/opcode/bpf.h | 2 +-
opcodes/bpf-opc.c | 2 ++
sim/bpf/bpf-sim.c | 4 ++++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/opcode/bpf.h b/include/opcode/bpf.h
index df1e3bd0918..48cef368e4e 100644
--- a/include/opcode/bpf.h
+++ b/include/opcode/bpf.h
@@ -202,7 +202,7 @@ enum bpf_insn_id
BPF_INSN_JAR, BPF_INSN_JEQR, BPF_INSN_JGTR, BPF_INSN_JSGTR,
BPF_INSN_JGER, BPF_INSN_JSGER, BPF_INSN_JLTR, BPF_INSN_JSLTR,
BPF_INSN_JSLER, BPF_INSN_JLER, BPF_INSN_JSETR, BPF_INSN_JNER,
- BPF_INSN_CALLR, BPF_INSN_CALL, BPF_INSN_EXIT,
+ BPF_INSN_CALLR, BPF_INSN_CALLX, BPF_INSN_CALL, BPF_INSN_EXIT,
/* Compare-and-jump instructions (reg OP imm.) */
BPF_INSN_JEQI, BPF_INSN_JGTI, BPF_INSN_JSGTI,
BPF_INSN_JGEI, BPF_INSN_JSGEI, BPF_INSN_JLTI, BPF_INSN_JSLTI,
diff --git a/opcodes/bpf-opc.c b/opcodes/bpf-opc.c
index 19e096501a2..3f030a39c1b 100644
--- a/opcodes/bpf-opc.c
+++ b/opcodes/bpf-opc.c
@@ -274,6 +274,8 @@ const struct bpf_opcode bpf_opcodes[] =
BPF_V1, BPF_CODE, BPF_CLASS_JMP|BPF_CODE_JNE|BPF_SRC_X},
{BPF_INSN_CALLR, "call%W%dr", "callx%w%dr",
BPF_XBPF, BPF_CODE, BPF_CLASS_JMP|BPF_CODE_CALL|BPF_SRC_X},
+ {BPF_INSN_CALLX, "callx%W%dr", "callx%w%dr",
+ BPF_V1, BPF_CODE, BPF_CLASS_JMP|BPF_CODE_CALL|BPF_SRC_X},
{BPF_INSN_CALL, "call%W%d32", "call%w%d32",
BPF_V1, BPF_CODE, BPF_CLASS_JMP|BPF_CODE_CALL|BPF_SRC_K},
{BPF_INSN_EXIT, "exit", "exit",
diff --git a/sim/bpf/bpf-sim.c b/sim/bpf/bpf-sim.c
index c1f103823fb..a3976d0b4bf 100644
--- a/sim/bpf/bpf-sim.c
+++ b/sim/bpf/bpf-sim.c
@@ -1096,6 +1096,10 @@ execute (SIM_CPU *cpu, struct bpf_insn *insn)
BPF_TRACE ("BPF_INSN_CALLR\n");
bpf_call (cpu, DISP (bpf_regs[insn->dst]), insn->src);
break;
+ case BPF_INSN_CALLX:
+ BPF_TRACE ("BPF_INSN_CALLX\n");
+ bpf_call (cpu, DISP (bpf_regs[insn->dst]), insn->src);
+ break;
case BPF_INSN_CALL:
BPF_TRACE ("BPF_INSN_CALL\n");
bpf_call (cpu, insn->imm32, insn->src);
--
2.43.0
next prev parent reply other threads:[~2024-02-09 18:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 18:07 [PATCH 0/1] " Will Hawkins
2024-02-09 18:07 ` Will Hawkins [this message]
2024-02-10 4:47 ` [PATCH 1/1] " Hans-Peter Nilsson
2024-02-10 6:13 ` Will Hawkins
2024-02-11 23:26 ` Will Hawkins
2024-02-12 17:01 ` [PATCH 0/1] " Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240209180734.443763-2-hawkinsw@obs.cr \
--to=hawkinsw@obs.cr \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).