aboutsummaryrefslogtreecommitdiff
path: root/arch/cris/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/cris/kernel')
-rw-r--r--arch/cris/kernel/module.c14
-rw-r--r--arch/cris/kernel/process.c103
-rw-r--r--arch/cris/kernel/ptrace.c58
-rw-r--r--arch/cris/kernel/semaphore.c1
-rw-r--r--arch/cris/kernel/setup.c27
-rw-r--r--arch/cris/kernel/time.c13
-rw-r--r--arch/cris/kernel/traps.c226
7 files changed, 183 insertions, 259 deletions
diff --git a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
index 11b867df861..a187833febc 100644
--- a/arch/cris/kernel/module.c
+++ b/arch/cris/kernel/module.c
@@ -28,20 +28,28 @@
#define DEBUGP(fmt , ...)
#endif
+#ifdef CONFIG_ETRAX_KMALLOCED_MODULES
+#define MALLOC_MODULE(size) kmalloc(size, GFP_KERNEL)
+#define FREE_MODULE(region) kfree(region)
+#else
+#define MALLOC_MODULE(size) vmalloc_exec(size)
+#define FREE_MODULE(region) vfree(region)
+#endif
+
void *module_alloc(unsigned long size)
{
if (size == 0)
return NULL;
- return vmalloc_exec(size);
+ return MALLOC_MODULE(size);
}
/* Free memory returned from module_alloc */
void module_free(struct module *mod, void *module_region)
{
- vfree(module_region);
+ FREE_MODULE(module_region);
/* FIXME: If module_region == mod->init_region, trim exception
- table entries. */
+ table entries. */
}
/* We don't need anything special. */
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 9ca558fc5bc..ef2db8fd102 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -1,5 +1,4 @@
-/* $Id: process.c,v 1.21 2005/03/04 08:16:17 starvik Exp $
- *
+/*
* linux/arch/cris/kernel/process.c
*
* Copyright (C) 1995 Linus Torvalds
@@ -7,105 +6,6 @@
*
* Authors: Bjorn Wesen (bjornw@axis.com)
*
- * $Log: process.c,v $
- * Revision 1.21 2005/03/04 08:16:17 starvik
- * Merge of Linux 2.6.11.
- *
- * Revision 1.20 2005/01/18 05:57:22 starvik
- * Renamed hlt_counter to cris_hlt_counter and made it global.
- *
- * Revision 1.19 2004/10/19 13:07:43 starvik
- * Merge of Linux 2.6.9
- *
- * Revision 1.18 2004/08/16 12:37:23 starvik
- * Merge of Linux 2.6.8
- *
- * Revision 1.17 2004/04/05 13:53:48 starvik
- * Merge of Linux 2.6.5
- *
- * Revision 1.16 2003/10/27 08:04:33 starvik
- * Merge of Linux 2.6.0-test9
- *
- * Revision 1.15 2003/09/11 07:29:52 starvik
- * Merge of Linux 2.6.0-test5
- *
- * Revision 1.14 2003/06/10 10:21:12 johana
- * Moved thread_saved_pc() from arch/cris/kernel/process.c to
- * subarch specific process.c. arch-v32 has an erp, no irp.
- *
- * Revision 1.13 2003/04/09 05:20:47 starvik
- * Merge of Linux 2.5.67
- *
- * Revision 1.12 2002/12/11 15:41:11 starvik
- * Extracted v10 (ETRAX 100LX) specific stuff to arch/cris/arch-v10/kernel
- *
- * Revision 1.11 2002/12/10 09:00:10 starvik
- * Merge of Linux 2.5.51
- *
- * Revision 1.10 2002/11/27 08:42:34 starvik
- * Argument to user_regs() is thread_info*
- *
- * Revision 1.9 2002/11/26 09:44:21 starvik
- * New threads exits through ret_from_fork (necessary for preemptive scheduling)
- *
- * Revision 1.8 2002/11/19 14:35:24 starvik
- * Changes from linux 2.4
- * Changed struct initializer syntax to the currently prefered notation
- *
- * Revision 1.7 2002/11/18 07:39:42 starvik
- * thread_saved_pc moved here from processor.h
- *
- * Revision 1.6 2002/11/14 06:51:27 starvik
- * Made cpu_idle more similar with other archs
- * init_task_union -> init_thread_union
- * Updated for new interrupt macros
- * sys_clone and do_fork have a new argument, user_tid
- *
- * Revision 1.5 2002/11/05 06:45:11 starvik
- * Merge of Linux 2.5.45
- *
- * Revision 1.4 2002/02/05 15:37:44 bjornw
- * Need init_task.h
- *
- * Revision 1.3 2002/01/21 15:22:49 bjornw
- * current->counter is gone
- *
- * 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.
- *
- * Revision 1.19 2001/09/26 11:52:54 bjornw
- * INIT_MMAP is gone in 2.4.10
- *
- * Revision 1.18 2001/08/21 21:43:51 hp
- * Move last watchdog fix inside #ifdef CONFIG_ETRAX_WATCHDOG
- *
- * Revision 1.17 2001/08/21 13:48:01 jonashg
- * Added fix by HP to avoid oops when doing a hard_reset_now.
- *
- * Revision 1.16 2001/06/21 02:00:40 hp
- * * entry.S: Include asm/unistd.h.
- * (_sys_call_table): Use section .rodata, not .data.
- * (_kernel_thread): Move from...
- * * process.c: ... here.
- * * entryoffsets.c (VAL): Break out from...
- * (OF): Use VAL.
- * (LCLONE_VM): New asmified value from CLONE_VM.
- *
- * Revision 1.15 2001/06/20 16:31:57 hp
- * Add comments to describe empty functions according to review.
- *
- * Revision 1.14 2001/05/29 11:27:59 markusl
- * Fixed so that hard_reset_now will do reset even if watchdog wasn't enabled
- *
- * Revision 1.13 2001/03/20 19:44:06 bjornw
- * Use the 7th syscall argument for regs instead of current_regs
- *
*/
/*
@@ -206,6 +106,7 @@ EXPORT_SYMBOL(pm_power_off);
* low exit latency (ie sit in a loop waiting for
* somebody to say that they'd like to reschedule)
*/
+
void cpu_idle (void)
{
/* endless idle loop with no priority at all */
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c
index 3ccd20e85dc..b326023baab 100644
--- a/arch/cris/kernel/ptrace.c
+++ b/arch/cris/kernel/ptrace.c
@@ -2,65 +2,11 @@
* linux/arch/cris/kernel/ptrace.c
*
* Parts taken from the m68k port.
- *
+ *
* Copyright (c) 2000, 2001, 2002 Axis Communications AB
*
* Authors: Bjorn Wesen
*
- * $Log: ptrace.c,v $
- * Revision 1.10 2004/09/22 11:50:01 orjanf
- * * Moved get_reg/put_reg to arch-specific files.
- * * Added functions to access debug registers (CRISv32).
- * * Added support for PTRACE_SINGLESTEP (CRISv32).
- * * Added S flag to CCS_MASK (CRISv32).
- *
- * Revision 1.9 2003/07/04 12:56:11 tobiasa
- * Moved arch-specific code to arch-specific files.
- *
- * Revision 1.8 2003/04/09 05:20:47 starvik
- * Merge of Linux 2.5.67
- *
- * Revision 1.7 2002/11/27 08:42:34 starvik
- * Argument to user_regs() is thread_info*
- *
- * Revision 1.6 2002/11/20 11:56:11 starvik
- * Merge of Linux 2.5.48
- *
- * Revision 1.5 2002/11/18 07:41:19 starvik
- * Removed warning
- *
- * Revision 1.4 2002/11/11 12:47:28 starvik
- * SYSCALL_TRACE has been moved to thread flags
- *
- * Revision 1.3 2002/02/05 15:37:18 bjornw
- * * Add do_notify_resume (replaces do_signal in the callchain)
- * * syscall_trace is now do_syscall_trace
- * * current->ptrace flag PT_TRACESYS -> PT_SYSCALLTRACE
- * * Keep track of the current->work.syscall_trace counter
- *
- * Revision 1.2 2001/12/18 13:35:20 bjornw
- * Applied the 2.4.13->2.4.16 CRIS patch to 2.5.1 (is a copy of 2.4.15).
- *
- * 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
- *
- * Revision 1.6 2001/07/25 16:08:47 bjornw
- * PTRACE_ATTACH bulk moved into arch-independent code in 2.4.7
- *
- * Revision 1.5 2001/03/26 14:24:28 orjanf
- * * Changed loop condition.
- * * Added comment documenting non-standard ptrace behaviour.
- *
- * Revision 1.4 2001/03/20 19:44:41 bjornw
- * Use the user_regs macro instead of thread.esp0
- *
- * Revision 1.3 2000/12/18 23:45:25 bjornw
- * Linux/CRIS first version
- *
- *
*/
#include <linux/kernel.h>
@@ -85,7 +31,7 @@ extern int do_signal(int canrestart, struct pt_regs *regs);
void do_notify_resume(int canrestart, struct pt_regs *regs,
- __u32 thread_info_flags )
+ __u32 thread_info_flags)
{
/* deal with pending signal delivery */
if (thread_info_flags & _TIF_SIGPENDING)
diff --git a/arch/cris/kernel/semaphore.c b/arch/cris/kernel/semaphore.c
index b884263d3cd..f137a439041 100644
--- a/arch/cris/kernel/semaphore.c
+++ b/arch/cris/kernel/semaphore.c
@@ -4,7 +4,6 @@
*/
#include <linux/sched.h>
-#include <linux/init.h>
#include <asm/semaphore-helper.h>
/*
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index c34fb235b09..04d48dd91dd 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -18,7 +18,7 @@
#include <linux/screen_info.h>
#include <linux/utsname.h>
#include <linux/pfn.h>
-
+#include <linux/cpu.h>
#include <asm/setup.h>
/*
@@ -36,6 +36,8 @@ extern unsigned long dram_start, dram_end;
extern unsigned long romfs_start, romfs_length, romfs_in_flash; /* from head.S */
+static struct cpu cpu_devices[NR_CPUS];
+
extern void show_etrax_copyright(void); /* arch-vX/kernel/setup.c */
/* This mainly sets up the memory area, and can be really confusing.
@@ -45,24 +47,23 @@ extern void show_etrax_copyright(void); /* arch-vX/kernel/setup.c */
* given by the macro __pa().
*
* In this DRAM, the kernel code and data is loaded, in the beginning.
- * It really starts at c0004000 to make room for some special pages -
+ * It really starts at c0004000 to make room for some special pages -
* the start address is text_start. The kernel data ends at _end. After
* this the ROM filesystem is appended (if there is any).
- *
+ *
* Between this address and dram_end, we have RAM pages usable to the
* boot code and the system.
*
*/
-void __init
-setup_arch(char **cmdline_p)
+void __init setup_arch(char **cmdline_p)
{
extern void init_etrax_debug(void);
unsigned long bootmap_size;
unsigned long start_pfn, max_pfn;
unsigned long memory_start;
- /* register an initial console printing routine for printk's */
+ /* register an initial console printing routine for printk's */
init_etrax_debug();
@@ -121,7 +122,7 @@ setup_arch(char **cmdline_p)
min_low_pfn = PAGE_OFFSET >> PAGE_SHIFT;
bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
- min_low_pfn,
+ min_low_pfn,
max_low_pfn);
/* And free all memory not belonging to the kernel (addr, size) */
@@ -187,4 +188,16 @@ const struct seq_operations cpuinfo_op = {
.show = show_cpuinfo,
};
+static int __init topology_init(void)
+{
+ int i;
+
+ for_each_possible_cpu(i) {
+ return register_cpu(&cpu_devices[i], i);
+ }
+
+ return 0;
+}
+
+subsys_initcall(topology_init);
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 7a2cc7efbcf..ff4c6aa75de 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -1,5 +1,4 @@
-/* $Id: time.c,v 1.18 2005/03/04 08:16:17 starvik Exp $
- *
+/*
* linux/arch/cris/kernel/time.c
*
* Copyright (C) 1991, 1992, 1995 Linus Torvalds
@@ -18,7 +17,7 @@
* Linux/CRIS specific code:
*
* Authors: Bjorn Wesen
- * Johan Adolfsson
+ * Johan Adolfsson
*
*/
@@ -208,10 +207,16 @@ cris_do_profile(struct pt_regs* regs)
#endif
#ifdef CONFIG_PROFILING
- profile_tick(CPU_PROFILING);
+ profile_tick(CPU_PROFILING);
#endif
}
+unsigned long long sched_clock(void)
+{
+ return (unsigned long long)jiffies * (1000000000 / HZ) +
+ get_ns_in_jiffie();
+}
+
static int
__init init_udelay(void)
{
diff --git a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c
index 520d92205fe..541efbf0937 100644
--- a/arch/cris/kernel/traps.c
+++ b/arch/cris/kernel/traps.c
@@ -1,66 +1,78 @@
-/* $Id: traps.c,v 1.11 2005/01/24 16:03:19 orjanf Exp $
- *
+/*
* linux/arch/cris/traps.c
*
- * Here we handle the break vectors not used by the system call
- * mechanism, as well as some general stack/register dumping
+ * Here we handle the break vectors not used by the system call
+ * mechanism, as well as some general stack/register dumping
* things.
- *
- * Copyright (C) 2000-2002 Axis Communications AB
+ *
+ * Copyright (C) 2000-2007 Axis Communications AB
*
* Authors: Bjorn Wesen
- * Hans-Peter Nilsson
+ * Hans-Peter Nilsson
*
*/
#include <linux/init.h>
#include <linux/module.h>
+
#include <asm/pgtable.h>
#include <asm/uaccess.h>
+extern void arch_enable_nmi(void);
+extern void stop_watchdog(void);
+extern void reset_watchdog(void);
+extern void show_registers(struct pt_regs *regs);
+
+#ifdef CONFIG_DEBUG_BUGVERBOSE
+extern void handle_BUG(struct pt_regs *regs);
+#else
+#define handle_BUG(regs)
+#endif
+
static int kstack_depth_to_print = 24;
-extern int raw_printk(const char *fmt, ...);
+void (*nmi_handler)(struct pt_regs *);
-void show_trace(unsigned long * stack)
+void
+show_trace(unsigned long *stack)
{
unsigned long addr, module_start, module_end;
extern char _stext, _etext;
int i;
- raw_printk("\nCall Trace: ");
+ printk("\nCall Trace: ");
- i = 1;
- module_start = VMALLOC_START;
- module_end = VMALLOC_END;
+ i = 1;
+ module_start = VMALLOC_START;
+ module_end = VMALLOC_END;
- while (((long) stack & (THREAD_SIZE-1)) != 0) {
- if (__get_user (addr, stack)) {
+ 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. */
- raw_printk ("Failing address 0x%lx\n", (unsigned long)stack);
+ 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))
- raw_printk("\n ");
- raw_printk("[<%08lx>] ", addr);
- i++;
- }
- }
+ /*
+ * 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++;
+ }
+ }
}
/*
@@ -78,109 +90,149 @@ void show_trace(unsigned long * stack)
* with the ksymoops maintainer.
*/
-void
+void
show_stack(struct task_struct *task, unsigned long *sp)
{
- unsigned long *stack, addr;
- int i;
+ unsigned long *stack, addr;
+ int i;
/*
* debugging aid: "show_stack(NULL);" prints a
* back trace.
*/
- if(sp == NULL) {
+ if (sp == NULL) {
if (task)
sp = (unsigned long*)task->thread.ksp;
else
sp = (unsigned long*)rdsp();
}
- stack = sp;
+ stack = sp;
- raw_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;
- if (i && ((i % 8) == 0))
- raw_printk("\n ");
- if (__get_user (addr, 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;
+ if (i && ((i % 8) == 0))
+ printk("\n ");
+ 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. */
- raw_printk ("Failing address 0x%lx\n", (unsigned long)stack);
+ printk("Failing address 0x%lx\n", (unsigned long)stack);
break;
}
stack++;
- raw_printk("%08lx ", addr);
- }
+ printk("%08lx ", addr);
+ }
show_trace(sp);
}
-static void (*nmi_handler)(struct pt_regs*);
-extern void arch_enable_nmi(void);
+#if 0
+/* displays a short stack trace */
-void set_nmi_handler(void (*handler)(struct pt_regs*))
+int
+show_stack(void)
{
- nmi_handler = handler;
- arch_enable_nmi();
+ unsigned long *sp = (unsigned long *)rdusp();
+ int i;
+
+ printk("Stack dump [0x%08lx]:\n", (unsigned long)sp);
+ for (i = 0; i < 16; i++)
+ printk("sp + %d: 0x%08lx\n", i*4, sp[i]);
+ return 0;
}
+#endif
-void handle_nmi(struct pt_regs* regs)
+void
+dump_stack(void)
{
- if (nmi_handler)
- nmi_handler(regs);
+ show_stack(NULL, NULL);
+}
+EXPORT_SYMBOL(dump_stack);
+
+void
+set_nmi_handler(void (*handler)(struct pt_regs *))
+{
+ nmi_handler = handler;
+ arch_enable_nmi();
}
#ifdef CONFIG_DEBUG_NMI_OOPS
-void oops_nmi_handler(struct pt_regs* regs)
+void
+oops_nmi_handler(struct pt_regs *regs)
{
- stop_watchdog();
- raw_printk("NMI!\n");
- show_registers(regs);
+ stop_watchdog();
+ oops_in_progress = 1;
+ printk("NMI!\n");
+ show_registers(regs);
+ oops_in_progress = 0;
}
-static int
-__init oops_nmi_register(void)
+static int __init
+oops_nmi_register(void)
{
- set_nmi_handler(oops_nmi_handler);
- return 0;
+ set_nmi_handler(oops_nmi_handler);
+ return 0;
}
__initcall(oops_nmi_register);
#endif
-#if 0
-/* displays a short stack trace */
-
-int
-show_stack()
+/*
+ * This gets called from entry.S when the watchdog has bitten. Show something
+ * similiar to an Oops dump, and if the kernel is configured to be a nice
+ * doggy, then halt instead of reboot.
+ */
+void
+watchdog_bite_hook(struct pt_regs *regs)
{
- unsigned long *sp = (unsigned long *)rdusp();
- int i;
- raw_printk("Stack dump [0x%08lx]:\n", (unsigned long)sp);
- for(i = 0; i < 16; i++)
- raw_printk("sp + %d: 0x%08lx\n", i*4, sp[i]);
- return 0;
-}
+#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
+ local_irq_disable();
+ stop_watchdog();
+ show_registers(regs);
+
+ while (1)
+ ; /* Do nothing. */
+#else
+ show_registers(regs);
#endif
+}
-void dump_stack(void)
+/* This is normally the Oops function. */
+void
+die_if_kernel(const char *str, struct pt_regs *regs, long err)
{
- show_stack(NULL, NULL);
-}
+ if (user_mode(regs))
+ return;
-EXPORT_SYMBOL(dump_stack);
+#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
+ /*
+ * This printout might take too long and could trigger
+ * the watchdog normally. If NICE_DOGGY is set, simply
+ * stop the watchdog during the printout.
+ */
+ stop_watchdog();
+#endif
-void __init
-trap_init(void)
-{
- /* Nothing needs to be done */
+ handle_BUG(regs);
+
+ printk("%s: %04lx\n", str, err & 0xffff);
+
+ show_registers(regs);
+
+ oops_in_progress = 0;
+
+#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
+ reset_watchdog();
+#endif
+ do_exit(SIGSEGV);
}
-void spinning_cpu(void* addr)
+void __init
+trap_init(void)
{
- raw_printk("CPU %d spinning on %X\n", smp_processor_id(), addr);
- dump_stack();
+ /* Nothing needs to be done */
}