There are several methods to get register values for active tasks such as note
information and exception frames on kernel stacks. This is the preparation
patch to support such features abstracting them as the feature collecting
active registers.
- /*
- * vmcore generated by kdump contains NT_PRSTATUS including
- * general register values for active tasks.
- */
- if (active && KDUMP_DUMPFILE()) {
- struct user_regs_struct *note_regs_p;
-
- note_regs_p = get_regs_from_elf_notes(target);
- memcpy(¬e_regs, note_regs_p, sizeof(struct user_regs_struct));
-
- /*
- * If the task was in kernel-mode at the kernel crash, note
- * information is not what we would like.
- */
- if (user_mode(¬e_regs)) {
- memcpy(regs, ¬e_regs, sizeof(struct user_regs_struct));
+ if (active && get_active_regs(target, &active_regs)) {
+ if (user_mode(&active_regs)) {
+ memcpy(regs, &active_regs, sizeof(*regs));
return 0;
}
}
@@ -1415,7 +1414,7 @@ static int genregs_get(struct task_context *target,
* entire registers are saved for special system calls.
*/
if (!gxt->is_special_syscall(nr_syscall))
- restore_rest(target->task, (struct pt_regs *)regs, ¬e_regs);
+ restore_rest(target->task, (struct pt_regs *)regs, &active_regs);
/*
* See FIXUP_TOP_OF_STACK in arch/x86/kernel/entry_64.S.
@@ -1437,7 +1436,7 @@ static int genregs_get(struct task_context *target,
/* Exceptions and NMI */
else if (vector < 20) {
restore_rest(target->task, (struct pt_regs *)regs,
- ¬e_regs);
+ &active_regs);
restore_segment_registers(target->task, regs);
}