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(a)jp.fujitsu.com>
---
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