Patchwork [U-Boot,07/32] x86: Add stack dump to register dump

login
register
mail settings
Submitter Graeme Russ
Date Feb. 4, 2011, 12:35 p.m.
Message ID <1296822959-3927-8-git-send-email-graeme.russ@gmail.com>
Download mbox | patch
Permalink /patch/81862/
State Accepted
Commit ca56a4ceec47ca4358d99b17d7314042f8411544
Delegated to: Graeme Russ
Headers show

Comments

Graeme Russ - Feb. 4, 2011, 12:35 p.m.
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
---
 arch/i386/cpu/interrupts.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
Graeme Russ - Feb. 12, 2011, 4:27 a.m.
On 04/02/11 23:35, Graeme Russ wrote:
> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
> ---
>  arch/i386/cpu/interrupts.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 

Applied to u-boot-x86

Regards,

Graeme

Patch

diff --git a/arch/i386/cpu/interrupts.c b/arch/i386/cpu/interrupts.c
index e4d0868..cdff3d9 100644
--- a/arch/i386/cpu/interrupts.c
+++ b/arch/i386/cpu/interrupts.c
@@ -29,6 +29,7 @@ 
 
 #include <common.h>
 #include <asm/interrupt.h>
+#include <asm/io.h>
 
 #define DECLARE_INTERRUPT(x) \
 	".globl irq_"#x"\n" \
@@ -108,6 +109,7 @@  void dump_regs(struct irq_regs *regs)
 {
 	unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
 	unsigned long d0, d1, d2, d3, d6, d7;
+	unsigned long sp;
 
 	printf("EIP: %04x:[<%08lx>] EFLAGS: %08lx\n",
 			(u16)regs->xcs, regs->eip, regs->eflags);
@@ -139,6 +141,20 @@  void dump_regs(struct irq_regs *regs)
 	d7 = get_debugreg(7);
 	printf("DR6: %08lx DR7: %08lx\n",
 			d6, d7);
+
+	printf("Stack:\n");
+	sp = regs->esp;
+
+	sp += 64;
+
+	while (sp > (regs->esp - 16)) {
+		if (sp == regs->esp)
+			printf("--->");
+		else
+			printf("    ");
+		printf("0x%8.8lx : 0x%8.8lx\n", sp, (ulong)readl(sp));
+		sp -= 4;
+	}
 }
 
 struct idt_entry {