blob: f4f82beb350889b3c69531797d8b9db11127eb6f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
Jeff Dike95906b22008-02-04 22:31:20 -08007#include <linux/kernel.h>
8#include <linux/module.h>
9#include <linux/sched.h>
10#include <linux/utsname.h>
11#include <asm/current.h>
12#include <asm/ptrace.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include "sysrq.h"
14
Jeff Dike95906b22008-02-04 22:31:20 -080015void __show_regs(struct pt_regs *regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -070016{
17 printk("\n");
18 print_modules();
Jeff Dike95906b22008-02-04 22:31:20 -080019 printk(KERN_INFO "Pid: %d, comm: %.20s %s %s\n", task_pid_nr(current),
Alexey Dobriyan19c58702007-10-18 23:40:41 -070020 current->comm, print_tainted(), init_utsname()->release);
Jeff Dike95906b22008-02-04 22:31:20 -080021 printk(KERN_INFO "RIP: %04lx:[<%016lx>]\n", PT_REGS_CS(regs) & 0xffff,
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 PT_REGS_RIP(regs));
Jeff Dike95906b22008-02-04 22:31:20 -080023 printk(KERN_INFO "RSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs),
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 PT_REGS_EFLAGS(regs));
Jeff Dike95906b22008-02-04 22:31:20 -080025 printk(KERN_INFO "RAX: %016lx RBX: %016lx RCX: %016lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 PT_REGS_RAX(regs), PT_REGS_RBX(regs), PT_REGS_RCX(regs));
Jeff Dike95906b22008-02-04 22:31:20 -080027 printk(KERN_INFO "RDX: %016lx RSI: %016lx RDI: %016lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 PT_REGS_RDX(regs), PT_REGS_RSI(regs), PT_REGS_RDI(regs));
Jeff Dike95906b22008-02-04 22:31:20 -080029 printk(KERN_INFO "RBP: %016lx R08: %016lx R09: %016lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 PT_REGS_RBP(regs), PT_REGS_R8(regs), PT_REGS_R9(regs));
Jeff Dike95906b22008-02-04 22:31:20 -080031 printk(KERN_INFO "R10: %016lx R11: %016lx R12: %016lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 PT_REGS_R10(regs), PT_REGS_R11(regs), PT_REGS_R12(regs));
Jeff Dike95906b22008-02-04 22:31:20 -080033 printk(KERN_INFO "R13: %016lx R14: %016lx R15: %016lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 PT_REGS_R13(regs), PT_REGS_R14(regs), PT_REGS_R15(regs));
35}
36
37void show_regs(struct pt_regs *regs)
38{
39 __show_regs(regs);
Paolo 'Blaisorblade' Giarrussob3461032005-05-28 15:52:00 -070040 show_trace(current, (unsigned long *) &regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070041}