[PATCH 5/6] x86: Collect register values for active tasks from KVMDUMP notes

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

 



KVMDUMP format contains register values for active tasks. So, get the
register values in case of KVMDUMP format.

Signed-off-by: HATAYAMA Daisuke <d.hatayama@xxxxxxxxxxxxxx>
---
 src/libgcore/gcore_x86.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/src/libgcore/gcore_x86.c b/src/libgcore/gcore_x86.c
index 03c3579..8c129d3 100644
--- a/src/libgcore/gcore_x86.c
+++ b/src/libgcore/gcore_x86.c
@@ -1742,6 +1742,30 @@ void gcore_x86_64_regsets_init(void)
 #endif /* X86_64 */
 
 #ifdef X86
+static void
+get_regs_from_kvmdump_notes(struct task_context *target,
+			    struct user_regs_struct *regs)
+{
+	struct register_set *r = &kvm->registers[target->processor];
+
+	regs->ax = r->regs[0];
+	regs->cx = r->regs[1];
+	regs->dx = r->regs[2];
+	regs->bx = r->regs[3];
+	regs->sp = r->regs[4];
+	regs->bp = r->regs[5];
+	regs->si = r->regs[6];
+	regs->di = r->regs[7];
+	regs->cs = r->cs;
+	regs->ss = r->ss;
+	regs->ds = r->ds;
+	regs->es = r->es;
+	regs->fs = r->fs;
+	regs->gs = r->gs;
+	regs->ip = r->ip;
+	regs->flags = r->flags;
+}
+
 static int genregs_get32(struct task_context *target,
 			 const struct user_regset *regset,
 			 unsigned int size, void *buf)
@@ -1750,6 +1774,13 @@ static int genregs_get32(struct task_context *target,
 	char *pt_regs_buf;
 	ulonglong pt_regs_addr;
 
+	if (is_task_active(target->task) && KVMDUMP_DUMPFILE()) {
+		get_regs_from_kvmdump_notes(target, regs);
+		if (user_mode(regs)) {
+			return TRUE;
+		}
+	}
+
 	pt_regs_buf = GETBUF(SIZE(pt_regs));
 
 	pt_regs_addr = machdep->get_stacktop(target->task) - SIZE(pt_regs);
-- 
1.7.4


--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility


[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux