From: Dave A. <ai...@us...> - 2003-06-10 02:07:53
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/cris/kernel In directory sc8-pr-cvs1:/tmp/cvs-serv23180/arch/cris/kernel Modified Files: entry.S head.S irq.c ksyms.c process.c ptrace.c setup.c time.c traps.c Log Message: DA: sync to Marcelo 2.4.18 + remove init_mmap (no longer needed) Index: entry.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/cris/kernel/entry.S,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- entry.S 9 Apr 2002 17:03:16 -0000 1.2 +++ entry.S 10 Jun 2003 01:45:52 -0000 1.3 @@ -7,8 +7,20 @@ * Authors: Bjorn Wesen (bj...@ax...) * * $Log$ - * Revision 1.2 2002/04/09 17:03:16 atp - * synch 2.4.15 commit 29 + * Revision 1.3 2003/06/10 01:45:52 airlied + * DA: sync to Marcelo 2.4.18 + remove init_mmap (no longer needed) + * + * Revision 1.38 2002/01/16 15:15:30 bjornw + * Use a C-code compatible watchdog reset when NICE_DOGGY is enabled + * + * Revision 1.37 2001/12/07 17:03:55 bjornw + * Call a c-hook called watchdog_bite_hook instead of show_registers directly + * + * Revision 1.36 2001/11/22 13:36:36 bjornw + * * In ret_from_intr, check regs->dccr for usermode reentrance instead of + * DCCR explicitely (because the latter might not reflect current reality) + * * In mmu_bus_fault, set $r9 _after_ calling the C-code instead of before + * since $r9 is call-clobbered and is potentially needed afterwards * * Revision 1.35 2001/10/30 17:10:15 bjornw * Add some syscalls @@ -220,8 +232,11 @@ ret_from_intr: ;; check for resched only if we're going back to user-mode - - move $ccr, $r0 + ;; this test matches the user_regs(regs) macro + ;; we cannot simply test $dccr, because that does not necessarily + ;; reflect what mode we'll return into. + + move.d [$sp + LDCCR], $r0; regs->dccr btstq 8, $r0 ; U-flag bpl _Rexit ; go back directly nop @@ -471,8 +486,6 @@ moveq 1, $r10 push $r10 ; frametype == 1, BUSFAULT frame type - moveq 0, $r9 ; busfault is equivalent to an irq - move.d $sp, $r10 ; pt_regs argument to handle_mmu_bus_fault jsr handle_mmu_bus_fault ; in arch/cris/mm/fault.c @@ -482,6 +495,8 @@ ;; process due to a SEGV, scheduled due to a page blocking or ;; whatever. + moveq 0, $r9 ; busfault is equivalent to an irq + ba ret_from_intr nop @@ -562,6 +577,16 @@ ;; We'll see this in ksymoops dumps. Watchdog_bite: +#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY + ;; We just restart the watchdog here to be sure we dont get + ;; hit while printing the watchdogmsg below + ;; This restart is compatible with the rest of the C-code, so + ;; the C-code can keep restarting the watchdog after this point. + ;; The non-NICE_DOGGY code below though, disables the possibility + ;; to restart since it changes the watchdog key, to avoid any + ;; buggy loops etc. keeping the watchdog alive after this. + jsr reset_watchdog +#else ;; We need to extend the 3.3ms after the NMI at watchdog bite, so we have ;; time for an oops-dump over a 115k2 serial wire. Another 100ms should do. @@ -578,7 +603,8 @@ ^ WD_INIT) \ | IO_STATE (R_WATCHDOG, enable, start), $r10 move.d $r10, [$r11] - +#endif + ;; Note that we don't do "setf m" here (or after two necessary NOPs), ;; since *not* doing that saves us from re-entrancy checks. We don't want ;; to get here again due to possible subsequent NMIs; we want the watchdog @@ -588,7 +614,7 @@ jsr printk move.d $sp, $r10 - jsr show_registers + jsr watchdog_bite_hook ;; This nop is here so we see the "Watchdog_bite" label in ksymoops dumps ;; rather than "spurious_interrupt". Index: head.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/cris/kernel/head.S,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- head.S 9 Apr 2002 17:03:16 -0000 1.2 +++ head.S 10 Jun 2003 01:45:52 -0000 1.3 @@ -7,8 +7,14 @@ * Authors: Bjorn Wesen (bj...@ax...) * * $Log$ - * Revision 1.2 2002/04/09 17:03:16 atp - * synch 2.4.15 commit 29 + * Revision 1.3 2003/06/10 01:45:52 airlied + * DA: sync to Marcelo 2.4.18 + remove init_mmap (no longer needed) + * + * Revision 1.43 2001/11/08 15:09:43 starvik + * Only start MII clock if Ethernet is configured + * + * Revision 1.42 2001/11/08 14:37:34 starvik + * Start MII clock early to make sure that it is running at tranceiver reset * * Revision 1.41 2001/10/29 14:55:58 pkj * Corrected pa$r0 to par0. @@ -159,7 +165,10 @@ #define CRAMFS_MAGIC 0x28cd3d45 #define RAM_INIT_MAGIC 0x56902387 - + +#define START_ETHERNET_CLOCK IO_STATE(R_NETWORK_GEN_CONFIG, enable, on) |\ + IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk) + ;; exported symbols .globl etrax_irv @@ -304,6 +313,12 @@ ;; after init. .section ".text.init" _inflash: +#ifdef CONFIG_ETRAX_ETHERNET + ;; Start MII clock to make sure it is running when tranceiver is reset + move.d START_ETHERNET_CLOCK, $r0 + move.d $r0, [R_NETWORK_GEN_CONFIG] +#endif + ;; We need to initialze DRAM registers before we start using the DRAM cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized? Index: irq.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/cris/kernel/irq.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- irq.c 9 Apr 2002 17:03:16 -0000 1.2 +++ irq.c 10 Jun 2003 01:45:52 -0000 1.3 @@ -137,7 +137,7 @@ /* IRQ0 and 1 are special traps */ void hwbreakpoint(void); void IRQ1_interrupt(void); -BUILD_IRQ(2, 0x04) /* the timer interrupt */ +BUILD_TIMER_IRQ(2, 0x04) /* the timer interrupt is somewhat special */ BUILD_IRQ(3, 0x08) BUILD_IRQ(4, 0x10) BUILD_IRQ(5, 0x20) Index: ksyms.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/cris/kernel/ksyms.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ksyms.c 9 Apr 2002 17:03:16 -0000 1.2 +++ ksyms.c 10 Jun 2003 01:45:52 -0000 1.3 @@ -23,34 +23,44 @@ extern void dump_thread(struct pt_regs *, struct user *); extern unsigned long get_cmos_time(void); +extern void __Udiv(void); extern void __ashrdi3(void); extern void iounmap(void *addr); -/* platform dependent support */ - +/* Platform dependent support */ EXPORT_SYMBOL(dump_thread); EXPORT_SYMBOL(enable_irq); EXPORT_SYMBOL(disable_irq); EXPORT_SYMBOL(kernel_thread); EXPORT_SYMBOL(get_cmos_time); +EXPORT_SYMBOL(loops_per_usec); +/* String functions */ +EXPORT_SYMBOL(memcmp); +EXPORT_SYMBOL(memmove); EXPORT_SYMBOL(strtok); EXPORT_SYMBOL(strpbrk); -EXPORT_SYMBOL(simple_strtol); EXPORT_SYMBOL(strstr); - +EXPORT_SYMBOL(strcpy); EXPORT_SYMBOL(strchr); EXPORT_SYMBOL(strcmp); EXPORT_SYMBOL(strlen); EXPORT_SYMBOL(strncat); EXPORT_SYMBOL(strncmp); + +/* Math functions */ +EXPORT_SYMBOL(__Udiv); EXPORT_SYMBOL(__ashrdi3); +/* Memory functions */ EXPORT_SYMBOL(__ioremap); EXPORT_SYMBOL(iounmap); -/* export shadow registers for the CPU I/O pins */ +/* Semaphore functions */ +EXPORT_SYMBOL(__up); +EXPORT_SYMBOL(__down); +/* Export shadow registers for the CPU I/O pins */ EXPORT_SYMBOL(genconfig_shadow); EXPORT_SYMBOL(port_pa_data_shadow); EXPORT_SYMBOL(port_pa_dir_shadow); @@ -59,8 +69,7 @@ EXPORT_SYMBOL(port_pb_config_shadow); EXPORT_SYMBOL(port_g_data_shadow); -/* other stuff */ - +/* Userspace access functions */ EXPORT_SYMBOL(strncpy_from_user); EXPORT_SYMBOL(__strncpy_from_user); EXPORT_SYMBOL(__generic_copy_from_user); @@ -71,8 +80,8 @@ #undef memcpy #undef memset -extern void * memset(void *,int,__kernel_size_t); -extern void * memcpy(void *,const void *,__kernel_size_t); +extern void * memset(void *, int, __kernel_size_t); +extern void * memcpy(void *, const void *, __kernel_size_t); EXPORT_SYMBOL_NOVERS(memcpy); EXPORT_SYMBOL_NOVERS(memset); Index: process.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/cris/kernel/process.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- process.c 9 Apr 2002 17:03:16 -0000 1.2 +++ process.c 10 Jun 2003 01:45:52 -0000 1.3 @@ -8,8 +8,14 @@ * Authors: Bjorn Wesen (bj...@ax...) * * $Log$ - * Revision 1.2 2002/04/09 17:03:16 atp - * synch 2.4.15 commit 29 + * Revision 1.3 2003/06/10 01:45:52 airlied + * DA: sync to Marcelo 2.4.18 + remove init_mmap (no longer needed) + * + * Revision 1.22 2001/11/13 09:40:43 orjanf + * Added dump_fpu (needed for core dumps). + * + * Revision 1.21 2001/11/12 18:26:21 pkj + * Fixed compiler warnings. * * Revision 1.20 2001/10/03 08:21:39 jonashg * cause_of_death does not exist if CONFIG_SVINTO_SIM is defined. @@ -60,6 +66,7 @@ #include <linux/slab.h> #include <linux/user.h> #include <linux/a.out.h> +#include <linux/elfcore.h> #include <linux/interrupt.h> #include <linux/delay.h> @@ -80,7 +87,6 @@ * setup. */ -static struct vm_area_struct init_mmap = INIT_MMAP; static struct fs_struct init_fs = INIT_FS; static struct files_struct init_files = INIT_FILES; static struct signal_struct init_signals = INIT_SIGNALS; @@ -139,14 +145,15 @@ * code to know about it than the watchdog handler in entry.S and * this code, implementing hard reset through the watchdog. */ +#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) extern int cause_of_death; +#endif printk("*** HARD RESET ***\n"); cli(); #if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) cause_of_death = 0xbedead; - #else /* Since we dont plan to keep on reseting the watchdog, the key can be arbitrary hence three */ @@ -247,9 +254,10 @@ */ void dump_thread(struct pt_regs * regs, struct user * dump) { - int i; #if 0 -/* changed the size calculations - should hopefully work better. lbt */ + int i; + + /* changed the size calculations - should hopefully work better. lbt */ dump->magic = CMAGIC; dump->start_code = 0; dump->start_stack = regs->esp & ~(PAGE_SIZE - 1); @@ -267,6 +275,12 @@ dump->u_fpvalid = dump_fpu (regs, &dump->i387); #endif +} + +/* Fill in the fpu structure for a core dump. */ +int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) +{ + return 0; } /* Index: ptrace.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/cris/kernel/ptrace.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ptrace.c 9 Apr 2002 17:03:16 -0000 1.2 +++ ptrace.c 10 Jun 2003 01:45:53 -0000 1.3 @@ -8,8 +8,11 @@ * Authors: Bjorn Wesen * * $Log$ - * Revision 1.2 2002/04/09 17:03:16 atp - * synch 2.4.15 commit 29 + * Revision 1.3 2003/06/10 01:45:53 airlied + * DA: sync to Marcelo 2.4.18 + remove init_mmap (no longer needed) + * + * Revision 1.8 2001/11/12 18:26:21 pkj + * Fixed compiler warnings. * * Revision 1.7 2001/09/26 11:53:49 bjornw * PTRACE_DETACH works more simple in 2.4.10 @@ -77,8 +80,6 @@ static inline int put_reg(struct task_struct *task, unsigned int regno, unsigned long data) { - unsigned long *addr; - if (regno == PT_USP) task->thread.usp = data; else if (regno < PT_MAX) @@ -210,9 +211,7 @@ break; case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ - case PTRACE_CONT: { /* restart after signal. */ - long tmp; - + case PTRACE_CONT: /* restart after signal. */ ret = -EIO; if ((unsigned long) data > _NSIG) break; @@ -225,16 +224,13 @@ wake_up_process(child); ret = 0; break; - } /* * make the child exit. Best I can do is send it a sigkill. * perhaps it should be put in the status that it wants to * exit. */ - case PTRACE_KILL: { - long tmp; - + case PTRACE_KILL: ret = 0; if (child->state == TASK_ZOMBIE) /* already dead */ break; @@ -242,11 +238,8 @@ /* TODO: make sure any pending breakpoint is killed */ wake_up_process(child); break; - } - - case PTRACE_SINGLESTEP: { /* set the trap flag. */ - long tmp; + case PTRACE_SINGLESTEP: /* set the trap flag. */ ret = -EIO; if ((unsigned long) data > _NSIG) break; @@ -259,7 +252,6 @@ wake_up_process(child); ret = 0; break; - } case PTRACE_DETACH: ret = ptrace_detach(child, data); Index: setup.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/cris/kernel/setup.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- setup.c 9 Apr 2002 17:03:16 -0000 1.2 +++ setup.c 10 Jun 2003 01:45:53 -0000 1.3 @@ -26,10 +26,12 @@ #include <linux/config.h> #include <linux/init.h> #include <linux/bootmem.h> +#include <linux/seq_file.h> #include <asm/segment.h> #include <asm/system.h> #include <asm/smp.h> +#include <asm/pgtable.h> #include <asm/types.h> #include <asm/svinto.h> @@ -72,10 +74,10 @@ void __init setup_arch(char **cmdline_p) { - unsigned long bootmap_size; + extern void init_etrax_debug(void); + unsigned long bootmap_size; unsigned long start_pfn, max_pfn; unsigned long memory_start; - extern void console_print_etrax(const char *b); /* register an initial console printing routine for printk's */ @@ -87,12 +89,12 @@ if(romfs_in_flash || !romfs_length) { /* if we have the romfs in flash, or if there is no rom filesystem, - * our free area starts directly after the BSS + * our free area starts directly after the BSS */ memory_start = (unsigned long) &_end; } else { /* otherwise the free area starts after the ROM filesystem */ - printk("ROM fs in RAM, size %d bytes\n", romfs_length); + printk("ROM fs in RAM, size %lu bytes\n", romfs_length); memory_start = romfs_start + romfs_length; } @@ -193,7 +195,7 @@ #define HAS_ATA 0x0020 #define HAS_USB 0x0040 #define HAS_IRQ_BUG 0x0080 -#define HAS_MMU_BUG 0x0100 +#define HAS_MMU_BUG 0x0100 static struct cpu_info { char *model; @@ -213,50 +215,27 @@ { "ETRAX 100", 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_IRQ_BUG }, { "ETRAX 100", 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA }, { "ETRAX 100LX", 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB | HAS_MMU | HAS_MMU_BUG }, - { "ETRAX 100LX v2", 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB | HAS_MMU }, + { "ETRAX 100LX v2", 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB | HAS_MMU }, { "Unknown", 0, 0 } /* This entry MUST be the last */ }; -/* - * get_cpuinfo - Get information on one CPU for use by the procfs. - * - * Prints info on the next CPU into buffer. Beware, doesn't check for - * buffer overflow. Current implementation of procfs assumes that the - * resulting data is <= 1K. - * - * BUFFER is PAGE_SIZE - 1K bytes long. - * - * Args: - * buffer -- you guessed it, the data buffer - * cpu_np -- Input: next cpu to get (start at 0). Output: Updated. - * - * Returns number of bytes written to buffer. - */ -int get_cpuinfo(char *buffer, unsigned *cpu_np) +static int show_cpuinfo(struct seq_file *m, void *v) { - int revision; - struct cpu_info *info; - unsigned n; + unsigned long revision; + struct cpu_info *info; /* read the version register in the CPU and print some stuff */ revision = rdvr(); - if (revision < 0 || revision >= sizeof cpu_info/sizeof *cpu_info) { + if (revision >= sizeof cpu_info/sizeof *cpu_info) info = &cpu_info[sizeof cpu_info/sizeof *cpu_info - 1]; - } else + else info = &cpu_info[revision]; - /* No SMP at the moment, so just toggle 0/1 */ - n = *cpu_np; - *cpu_np = 1; - if (n != 0) { - return (0); - } - - return sprintf(buffer, + return seq_printf(m, "cpu\t\t: CRIS\n" - "cpu revision\t: %d\n" + "cpu revision\t: %lu\n" "cpu model\t: %s\n" "cache size\t: %d kB\n" "fpu\t\t: %s\n" @@ -283,4 +262,28 @@ (loops_per_jiffy * HZ + 500) / 500000, ((loops_per_jiffy * HZ + 500) / 5000) % 100); } + +static void *c_start(struct seq_file *m, loff_t *pos) +{ + /* We only got one CPU... */ + return *pos < 1 ? (void *)1 : NULL; +} + +static void *c_next(struct seq_file *m, void *v, loff_t *pos) +{ + ++*pos; + return NULL; +} + +static void c_stop(struct seq_file *m, void *v) +{ +} + +struct seq_operations cpuinfo_op = { + start: c_start, + next: c_next, + stop: c_stop, + show: show_cpuinfo, +}; + #endif /* CONFIG_PROC_FS */ Index: time.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/cris/kernel/time.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- time.c 9 Apr 2002 17:03:16 -0000 1.2 +++ time.c 10 Jun 2003 01:45:53 -0000 1.3 @@ -18,6 +18,7 @@ * Linux/CRIS specific code: * * Authors: Bjorn Wesen + * Johan Adolfsson * */ @@ -61,6 +62,7 @@ static unsigned long do_slow_gettimeoffset(void) { unsigned long count; + unsigned long usec_count = 0; static unsigned long count_p = LATCH; /* for the first call after boot */ static unsigned long jiffies_p = 0; @@ -93,16 +95,20 @@ */ if( jiffies_t == jiffies_p ) { if( count > count_p ) { + /* Timer wrapped */ + count = count_p; + usec_count = 1000000/CLOCK_TICK_RATE/2; } } else jiffies_p = jiffies_t; - count_p = count; - + /* Convert timer value to usec using table lookup */ + usec_count += cris_timer0_value_us[count]; +#if 0 count = ((LATCH-1) - count) * TICK_SIZE; count = (count + LATCH/2) / LATCH; - - return count; +#endif + return usec_count; } static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset; @@ -160,9 +166,8 @@ { int retval = 0; int real_seconds, real_minutes, cmos_minutes; - unsigned char save_control, save_freq_select; - printk("set_rtc_mmss(%d)\n", nowtime); + printk("set_rtc_mmss(%lu)\n", nowtime); if(!have_rtc) return 0; @@ -225,7 +230,9 @@ /* right now, starting the watchdog is the same as resetting it */ #define start_watchdog reset_watchdog +#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) static int watchdog_key = 0; /* arbitrary number */ +#endif /* number of pages to consider "out of memory". it is normal that the memory * is used though, so put this really low. @@ -306,12 +313,12 @@ if ((time_status & STA_UNSYNC) == 0 && xtime.tv_sec > last_rtc_update + 660 && xtime.tv_usec > 500000 - (tick >> 1) && - xtime.tv_usec < 500000 + (tick >> 1)) + xtime.tv_usec < 500000 + (tick >> 1)) { if (set_rtc_mmss(xtime.tv_sec) == 0) last_rtc_update = xtime.tv_sec; else last_rtc_update = xtime.tv_sec - 600; - + } } #if 0 @@ -322,6 +329,7 @@ { unsigned long flags; unsigned int newjiff; + save_flags(flags); cli(); newjiff = (myjiff << 16) | (unsigned short)(-*R_TIMER01_DATA); @@ -337,7 +345,6 @@ get_cmos_time(void) { unsigned int year, mon, day, hour, min, sec; - int i; sec = CMOS_READ(RTC_SECONDS); min = CMOS_READ(RTC_MINUTES); Index: traps.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/cris/kernel/traps.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- traps.c 9 Apr 2002 17:03:16 -0000 1.2 +++ traps.c 10 Jun 2003 01:45:53 -0000 1.3 @@ -30,6 +30,55 @@ int kstack_depth_to_print = 24; +void show_trace(unsigned long * stack) +{ + unsigned long addr, module_start, module_end; + extern char _stext, _etext; + int i; + + printk("\nCall Trace: "); + + i = 1; + module_start = VMALLOC_START; + module_end = VMALLOC_END; + + while (((long) stack & (THREAD_SIZE-1)) != 0) { + if (__get_user (addr, stack)) { + /* This message matches "failing address" marked + s390 in ksymoops, so lines containing it will + not be filtered out by ksymoops. */ + printk ("Failing address 0x%lx\n", (unsigned long)stack); + break; + } + stack++; + + /* + * If the address is either in the text segment of the + * kernel, or in the region which contains vmalloc'ed + * memory, it *may* be the address of a calling + * routine; if so, print it so that someone tracing + * down the cause of the crash will be able to figure + * out the call path that was taken. + */ + if (((addr >= (unsigned long) &_stext) && + (addr <= (unsigned long) &_etext)) || + ((addr >= module_start) && (addr <= module_end))) { + if (i && ((i % 8) == 0)) + printk("\n "); + printk("[<%08lx>] ", addr); + i++; + } + } +} + +void show_trace_task(struct task_struct *tsk) +{ + /* TODO, this is not really useful since its called from + * SysRq-T and we don't have a keyboard.. :) + */ +} + + /* * These constants are for searching for possible module text * segments. MODULE_RANGE is a guess of how much space is likely @@ -48,9 +97,8 @@ void show_stack(unsigned long *sp) { - unsigned long *stack, addr, module_start, module_end; + unsigned long *stack, addr; int i; - extern char _stext, _etext; /* * debugging aid: "show_stack(NULL);" prints a @@ -62,7 +110,7 @@ stack = sp; - printk("\nStack from %08lx:\n ", stack); + printk("\nStack from %08lx:\n ", (unsigned long)stack); for(i = 0; i < kstack_depth_to_print; i++) { if (((long) stack & (THREAD_SIZE-1)) == 0) break; @@ -72,45 +120,13 @@ /* This message matches "failing address" marked s390 in ksymoops, so lines containing it will not be filtered out by ksymoops. */ - printk ("Failing address 0x%lx\n", stack); + printk ("Failing address 0x%lx\n", (unsigned long)stack); break; } stack++; printk("%08lx ", addr); } - - printk("\nCall Trace: "); - stack = sp; - i = 1; - module_start = VMALLOC_START; - module_end = VMALLOC_END; - while (((long) stack & (THREAD_SIZE-1)) != 0) { - if (__get_user (addr, stack)) { - /* This message matches "failing address" marked - s390 in ksymoops, so lines containing it will - not be filtered out by ksymoops. */ - printk ("Failing address 0x%lx\n", stack); - break; - } - stack++; - - /* - * If the address is either in the text segment of the - * kernel, or in the region which contains vmalloc'ed - * memory, it *may* be the address of a calling - * routine; if so, print it so that someone tracing - * down the cause of the crash will be able to figure - * out the call path that was taken. - */ - if (((addr >= (unsigned long) &_stext) && - (addr <= (unsigned long) &_etext)) || - ((addr >= module_start) && (addr <= module_end))) { - if (i && ((i % 8) == 0)) - printk("\n "); - printk("[<%08lx>] ", addr); - i++; - } - } + show_trace(sp); } #if 0 @@ -148,7 +164,7 @@ regs->r8, regs->r9, regs->r10, regs->r11); printk("r12: %08lx r13: %08lx oR10: %08lx\n", regs->r12, regs->r13, regs->orig_r10); - printk("R_MMU_CAUSE: %08lx\n", *R_MMU_CAUSE); + printk("R_MMU_CAUSE: %08lx\n", (unsigned long)*R_MMU_CAUSE); printk("Process %s (pid: %d, stackpage=%08lx)\n", current->comm, current->pid, (unsigned long)current); @@ -195,25 +211,56 @@ } } +/* Called from entry.S when the watchdog has bitten + * We print out something resembling an oops dump, and if + * we have the nice doggy development flag set, we halt here + * instead of rebooting. + */ + +void +watchdog_bite_hook(struct pt_regs *regs) +{ +#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY + cli(); + stop_watchdog(); + show_registers(regs); + while(1) /* nothing */; +#else + show_registers(regs); +#endif +} + +/* This is normally the 'Oops' routine */ + void die_if_kernel(const char * str, struct pt_regs * regs, long err) { + extern void reset_watchdog(void); + extern void stop_watchdog(void); + if(user_mode(regs)) return; +#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY + /* This printout might take too long and trigger the + * watchdog normally. If we're in the nice doggy + * development mode, stop the watchdog during printout. + */ stop_watchdog(); +#endif printk("%s: %04lx\n", str, err & 0xffff); show_registers(regs); +#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY reset_watchdog(); - +#endif do_exit(SIGSEGV); } void __init trap_init(void) { - /* Nothing needs to be done */ + /* Nothing needs to be done */ } |