From: Jiri Olsa <jolsa@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>
Subject: [PATCH 3/5] x86/insn-eval: Remove regs arg from insn_get_modrm_rm_off
Date: Mon, 17 Nov 2025 10:31:35 +0100 [thread overview]
Message-ID: <20251117093137.572132-4-jolsa@kernel.org> (raw)
In-Reply-To: <20251117093137.572132-1-jolsa@kernel.org>
It's not used, insn_get_modrm_rm_off returns only offset to struct
pt_regs, not the actual register values.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
arch/x86/coco/sev/vc-handle.c | 2 +-
arch/x86/include/asm/insn-eval.h | 2 +-
arch/x86/kernel/cfi.c | 2 +-
arch/x86/kernel/umip.c | 2 +-
arch/x86/lib/insn-eval.c | 5 ++---
5 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/arch/x86/coco/sev/vc-handle.c b/arch/x86/coco/sev/vc-handle.c
index f08c7505ed82..fd81bbbd8af6 100644
--- a/arch/x86/coco/sev/vc-handle.c
+++ b/arch/x86/coco/sev/vc-handle.c
@@ -467,7 +467,7 @@ static long *vc_insn_get_rm(struct es_em_ctxt *ctxt)
int offset;
reg_array = (long *)ctxt->regs;
- offset = insn_get_modrm_rm_off(&ctxt->insn, ctxt->regs);
+ offset = insn_get_modrm_rm_off(&ctxt->insn);
if (offset < 0)
return NULL;
diff --git a/arch/x86/include/asm/insn-eval.h b/arch/x86/include/asm/insn-eval.h
index 6b592040bda4..500654d9eaeb 100644
--- a/arch/x86/include/asm/insn-eval.h
+++ b/arch/x86/include/asm/insn-eval.h
@@ -19,7 +19,7 @@ int pt_regs_offset(int regno);
bool insn_has_rep_prefix(struct insn *insn);
void __user *insn_get_addr_ref(struct insn *insn, struct pt_regs *regs);
-int insn_get_modrm_rm_off(struct insn *insn, struct pt_regs *regs);
+int insn_get_modrm_rm_off(struct insn *insn);
int insn_get_modrm_reg_off(struct insn *insn, struct pt_regs *regs);
unsigned long *insn_get_modrm_reg_ptr(struct insn *insn, struct pt_regs *regs);
unsigned long insn_get_seg_base(struct pt_regs *regs, int seg_reg_idx);
diff --git a/arch/x86/kernel/cfi.c b/arch/x86/kernel/cfi.c
index 638eb5c933e0..3cf944cbd7ef 100644
--- a/arch/x86/kernel/cfi.c
+++ b/arch/x86/kernel/cfi.c
@@ -52,7 +52,7 @@ static bool decode_cfi_insn(struct pt_regs *regs, unsigned long *target,
return false;
/* Read the target address from the register. */
- offset = insn_get_modrm_rm_off(&insn, regs);
+ offset = insn_get_modrm_rm_off(&insn);
if (offset < 0)
return false;
diff --git a/arch/x86/kernel/umip.c b/arch/x86/kernel/umip.c
index d432f3824f0c..7aeb405237ac 100644
--- a/arch/x86/kernel/umip.c
+++ b/arch/x86/kernel/umip.c
@@ -388,7 +388,7 @@ bool fixup_umip_exception(struct pt_regs *regs)
* register.
*/
if (X86_MODRM_MOD(insn.modrm.value) == 3) {
- reg_offset = insn_get_modrm_rm_off(&insn, regs);
+ reg_offset = insn_get_modrm_rm_off(&insn);
/*
* Negative values are usually errors. In memory addressing,
diff --git a/arch/x86/lib/insn-eval.c b/arch/x86/lib/insn-eval.c
index 8b9c2b90d66e..71f58d437253 100644
--- a/arch/x86/lib/insn-eval.c
+++ b/arch/x86/lib/insn-eval.c
@@ -581,7 +581,7 @@ static int get_reg_offset_16(struct insn *insn, struct pt_regs *regs,
/* Operand is a register, use the generic function. */
if (X86_MODRM_MOD(insn->modrm.value) == 3) {
- *offs1 = insn_get_modrm_rm_off(insn, regs);
+ *offs1 = insn_get_modrm_rm_off(insn);
*offs2 = -EDOM;
return 0;
}
@@ -849,7 +849,6 @@ int insn_get_code_seg_params(struct pt_regs *regs)
/**
* insn_get_modrm_rm_off() - Obtain register in r/m part of the ModRM byte
* @insn: Instruction containing the ModRM byte
- * @regs: Register values as seen when entering kernel mode
*
* Returns:
*
@@ -858,7 +857,7 @@ int insn_get_code_seg_params(struct pt_regs *regs)
* cases, the returned value can be -EDOM to indicate that the particular value
* of ModRM does not refer to a register and shall be ignored.
*/
-int insn_get_modrm_rm_off(struct insn *insn, struct pt_regs *regs)
+int insn_get_modrm_rm_off(struct insn *insn)
{
return get_reg_offset(insn, REG_TYPE_RM);
}
--
2.51.1
next prev parent reply other threads:[~2025-11-17 9:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 9:31 [PATCH 1/5] x86/insn-eval: Remove unused regs arg some functions Jiri Olsa
2025-11-17 9:31 ` [PATCH 1/5] x86/insn-eval: Remove regs arg from pt_regs_offset Jiri Olsa
2025-11-17 9:31 ` [PATCH 2/5] x86/insn-eval: Remove regs arg from get_reg_offset Jiri Olsa
2025-11-17 9:31 ` Jiri Olsa [this message]
2025-11-17 9:31 ` [PATCH 4/5] x86/insn-eval: Remove regs arg from insn_get_modrm_reg_off Jiri Olsa
2025-11-17 9:31 ` [PATCH 5/5] x86/insn-eval: Remove regs arg from get_reg_offset_16 Jiri Olsa
2025-11-18 8:47 ` [PATCH 1/5] x86/insn-eval: Remove unused regs arg some functions Peter Zijlstra
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=20251117093137.572132-4-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®