|
From: Paul M. <le...@us...> - 2006-08-08 03:07:17
|
Update of /cvsroot/linuxsh/linux/arch/sh/kernel In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16840/arch/sh/kernel Modified Files: head.S irq.c vmlinux.lds.S Log Message: Stack debugging support, based on ST's old patch. Index: head.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/head.S,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- head.S 20 Oct 2005 22:51:38 -0000 1.9 +++ head.S 8 Aug 2006 03:07:13 -0000 1.10 @@ -11,6 +11,8 @@ * Head.S contains the SH exception handlers and startup code. */ #include <linux/linkage.h> +#include <asm/thread_info.h> +#include <asm/page.h> #ifdef CONFIG_CPU_SH4A #define SYNCO() synco @@ -95,7 +97,7 @@ .balign 4 1: .long 0x400080F0 ! MD=1, RB=0, BL=0, FD=1, IMASK=0xF -2: .long init_thread_union+8192 +2: .long init_thread_union+THREAD_SIZE 3: .long __bss_start 4: .long _end 5: .long start_kernel Index: irq.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/irq.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- irq.c 5 Jul 2006 08:46:48 -0000 1.28 +++ irq.c 8 Aug 2006 03:07:13 -0000 1.29 @@ -60,7 +60,6 @@ } #endif - asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs regs) @@ -69,6 +68,22 @@ irq_enter(); +#ifdef CONFIG_DEBUG_STACKOVERFLOW + /* Debugging check for stack overflow: is there less than 1KB free? */ + { + long sp; + + __asm__ __volatile__ ("and r15, %0" : + "=r" (sp) : "0" (THREAD_SIZE - 1)); + + if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) { + printk("do_IRQ: stack overflow: %ld\n", + sp - sizeof(struct thread_info)); + dump_stack(); + } + } +#endif + #ifdef CONFIG_CPU_HAS_INTEVT __asm__ __volatile__ ( #ifdef CONFIG_CPU_HAS_SR_RB Index: vmlinux.lds.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/vmlinux.lds.S,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- vmlinux.lds.S 19 Jul 2006 14:33:16 -0000 1.7 +++ vmlinux.lds.S 8 Aug 2006 03:07:13 -0000 1.8 @@ -3,6 +3,8 @@ * Written by Niibe Yutaka */ #include <linux/config.h> +#include <asm/thread_info.h> +#include <asm/page.h> #include <asm-generic/vmlinux.lds.h> #ifdef CONFIG_CPU_LITTLE_ENDIAN @@ -41,16 +43,16 @@ *(.data) /* Align the initial ramdisk image (INITRD) on page boundaries. */ - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE); __rd_start = .; *(.initrd) - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE); __rd_end = .; CONSTRUCTORS } - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE); .data.page_aligned : { *(.data.idt) } . = ALIGN(32); @@ -61,10 +63,10 @@ _edata = .; /* End of data section */ - . = ALIGN(8192); /* init_task */ + . = ALIGN(THREAD_SIZE); /* init_task */ .data.init_task : { *(.data.init_task) } - . = ALIGN(4096); /* Init code and data */ + . = ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin = .; _sinittext = .; .init.text : { *(.init.text) } @@ -95,7 +97,7 @@ __machvec_start = .; .init.machvec : { *(.init.machvec) } __machvec_end = .; - . = ALIGN(4096); + . = ALIGN(PAGE_SIZE); __init_end = .; . = ALIGN(4); |