[PATCH 4/4] [DRIVERS] add a register dumper for debugging

From: Henrik Kretzschmar
Date: Fri Jan 22 2010 - 16:49:33 EST


Add a dumper to examine the changes of the registers before and after
calling the Toshiba SMM.

Signed-off-by: Henrik Kretzschmar <henne@xxxxxxxxxxxxxxxx>
---
drivers/char/toshiba.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 111baba..626d281 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -75,6 +75,20 @@
#define DRV_NAME "toshiba"
#define TOSH_MINOR_DEV 181

+#if TOSH_DEBUG == 1
+static void pr_smmregs(SMMRegisters *regs)
+{
+ printk(KERN_DEBUG DRV_NAME " EAX: 0x%08x EBX: 0x%08x ECX: 0x%08x\n",
+ regs->eax, regs->ebx, regs->ecx);
+ printk(KERN_DEBUG DRV_NAME " EDX: 0x%08x ESI: 0x%08x EDI: 0x%08x\n",
+ regs->edx, regs->esi, regs->edi);
+}
+#else
+static inline void pr_smmregs(SMMRegisters *regs)
+{
+}
+#endif
+
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Jonathan Buzzard <jonathan@xxxxxxxxxxxxxx>");
MODULE_DESCRIPTION("Toshiba laptop SMM driver");
@@ -220,6 +234,9 @@ int tosh_smm(SMMRegisters *regs)
{
int eax;

+ printk(KERN_DEBUG DRV_NAME " %s start\n", __func__);
+ pr_smmregs(regs);
+
asm ("# load the values into the registers\n\t" \
"pushl %%eax\n\t" \
"movl 0(%%eax),%%edx\n\t" \
@@ -249,6 +266,9 @@ int tosh_smm(SMMRegisters *regs)
: "a" (regs)
: "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");

+ pr_smmregs(regs);
+ printk(KERN_DEBUG DRV_NAME " %s done\n", __func__);
+
return eax;
}
EXPORT_SYMBOL(tosh_smm);
--
1.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/