[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 3/3] plat/common/x86: Disassemble failed instruction on crashes



Show disassembled failed instruction on crash outputs with
`uk_asmdumpk()`. This functionality is only available when a
supported disassembler backend library is included to the build
(e.g., libzydis).

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 plat/common/x86/traps.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/plat/common/x86/traps.c b/plat/common/x86/traps.c
index 3af9c499..96143867 100644
--- a/plat/common/x86/traps.c
+++ b/plat/common/x86/traps.c
@@ -39,6 +39,7 @@
 #include <x86/traps.h>
 #include <uk/print.h>
 #include <uk/assert.h>
+#include <uk/asmdump.h>
 
 /* A general word of caution when writing trap handlers. The platform trap
  * entry code is set up to properly save general-purpose registers (e.g., rsi,
@@ -78,6 +79,7 @@ void do_unhandled_trap(int trapnr, char *str, struct __regs 
*regs,
        uk_pr_info("Regs address %p\n", regs);
        /* TODO revisit when UK_CRASH will also dump the registers */
        dump_regs(regs);
+       uk_asmdumpk(KLVL_CRIT, (void *) regs->rip, 8);
        UK_CRASH("Crashing\n");
 }
 
@@ -104,6 +106,7 @@ void do_gp_fault(struct __regs *regs, long error_code)
                   regs->rip, error_code);
        dump_regs(regs);
        stack_walk_for_frame(regs->rbp);
+       uk_asmdumpk(KLVL_CRIT, (void *) regs->rip, 6);
        dump_mem(regs->rsp);
        dump_mem(regs->rbp);
        dump_mem(regs->rip);
@@ -121,6 +124,7 @@ void do_page_fault(struct __regs *regs, unsigned long 
error_code)
 
        dump_regs(regs);
        stack_walk_for_frame(regs->rbp);
+       uk_asmdumpk(KLVL_CRIT, (void *) regs->rip, 6);
        dump_mem(regs->rsp);
        dump_mem(regs->rbp);
        dump_mem(regs->rip);
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.