kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86: Print error code for unhandled exceptions
@ 2025-07-24 19:15 Mathias Krause
  0 siblings, 0 replies; only message in thread
From: Mathias Krause @ 2025-07-24 19:15 UTC (permalink / raw)
  To: Paolo Bonzini, kvm; +Cc: Mathias Krause

Print the error code for unhandled exceptions too, to ease debugging.

Also use the symbolic name for the #PF vector.

Signed-off-by: Mathias Krause <minipli@grsecurity.net>
---
 lib/x86/desc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/x86/desc.c b/lib/x86/desc.c
index fca37b9a5cee..f4cdfbc92c56 100644
--- a/lib/x86/desc.c
+++ b/lib/x86/desc.c
@@ -141,10 +141,10 @@ const char* exception_mnemonic(int vector)
 
 void unhandled_exception(struct ex_regs *regs, bool cpu)
 {
-	printf("Unhandled %sexception %ld %s at ip %016lx\n",
+	printf("Unhandled %sexception %ld %s(%lx) at ip %016lx\n",
 	       cpu ? "cpu " : "", regs->vector,
-	       exception_mnemonic(regs->vector), regs->rip);
-	if (regs->vector == 14)
+	       exception_mnemonic(regs->vector), regs->error_code, regs->rip);
+	if (regs->vector == PF_VECTOR)
 		printf("PF at %#lx addr %#lx\n", regs->rip, read_cr2());
 
 	printf("error_code=%04lx      rflags=%08lx      cs=%08lx\n"
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-24 19:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-24 19:15 [kvm-unit-tests PATCH] x86: Print error code for unhandled exceptions Mathias Krause

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 NNTP newsgroup(s).