Linux M68K Architecture development
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@gmail.com>
To: gerg@linux-m68k.org
Cc: linux-m68k@vger.kernel.org, geert@linux-m68k.org,
	Michael Schmitz <schmitzmic@gmail.com>
Subject: [PATCH RFC] m68k/kernel: fix register dump for ColdFire format 4 exception frame
Date: Sun, 11 Oct 2026 11:29:30 +1300	[thread overview]
Message-ID: <20261010222930.30616-1-schmitzmic@gmail.com> (raw)

On ColdFire, no extra processor state information is saved after an
exception frame. Take fault status and vector number from pt_regs.fmtvec
instead of from the longword following the exception frame (which would
be pt_regs.fmtvec from a prior exception on the stack).
Likewise, report the PC from pt_regs (redundant).

Untested ...

Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
---
 arch/m68k/kernel/traps.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index 60759ba3cbd4..ec5cf9703e15 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -868,6 +868,21 @@ void show_registers(struct pt_regs *regs)
 		addr += sizeof(fp->un.fmt3);
 		break;
 	case 0x4:
+#if defined(CONFIG_COLDFIRE) && defined(CONFIG_MMU)
+		/* ColdFire format 4 frame has all information in pt_regs */
+		if (CPU_IS_COLDFIRE) {
+			unsigned int fs = (regs->vector & 0x3) |
+					 ((regs->vector & 0xc00) >> 8);
+			int vector = (regs->vector >> 2) & 0xff;
+
+			pr_cont("fault status=%0x vector=%u pc=%08lx\n",
+				fs, vector, regs->pc);
+			/* Frame format 4 extra size on ColdFire is 0
+			 * so don't advance addr
+			 */
+			break;
+		}
+#endif /* CONFIG_COLDFIRE && CONFIG_MMU */
 		if (CPU_IS_060)
 			pr_cont("fault addr=%08lx fslw=%08lx\n",
 				fp->un.fmt4.effaddr, fp->un.fmt4.pc);
-- 
2.17.1


                 reply	other threads:[~2026-10-10 22:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261010222930.30616-1-schmitzmic@gmail.com \
    --to=schmitzmic@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=gerg@linux-m68k.org \
    --cc=linux-m68k@vger.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