Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux...
[pandora-kernel.git] / arch / cris / kernel / process.c
1 /*
2  *  linux/arch/cris/kernel/process.c
3  *
4  *  Copyright (C) 1995  Linus Torvalds
5  *  Copyright (C) 2000-2002  Axis Communications AB
6  *
7  *  Authors:   Bjorn Wesen (bjornw@axis.com)
8  *
9  */
10
11 /*
12  * This file handles the architecture-dependent parts of process handling..
13  */
14
15 #include <linux/atomic.h>
16 #include <asm/pgtable.h>
17 #include <asm/uaccess.h>
18 #include <asm/irq.h>
19 #include <asm/system.h>
20 #include <linux/module.h>
21 #include <linux/spinlock.h>
22 #include <linux/init_task.h>
23 #include <linux/sched.h>
24 #include <linux/fs.h>
25 #include <linux/user.h>
26 #include <linux/elfcore.h>
27 #include <linux/mqueue.h>
28 #include <linux/reboot.h>
29
30 //#define DEBUG
31
32 /*
33  * Initial task structure. Make this a per-architecture thing,
34  * because different architectures tend to have different
35  * alignment requirements and potentially different initial
36  * setup.
37  */
38
39 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
40 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
41 /*
42  * Initial thread structure.
43  *
44  * We need to make sure that this is 8192-byte aligned due to the
45  * way process stacks are handled. This is done by having a special
46  * "init_task" linker map entry..
47  */
48 union thread_union init_thread_union __init_task_data =
49         { INIT_THREAD_INFO(init_task) };
50
51 /*
52  * Initial task structure.
53  *
54  * All other task structs will be allocated on slabs in fork.c
55  */
56 struct task_struct init_task = INIT_TASK(init_task);
57
58 EXPORT_SYMBOL(init_task);
59
60 /*
61  * The hlt_counter, disable_hlt and enable_hlt is just here as a hook if
62  * there would ever be a halt sequence (for power save when idle) with
63  * some largish delay when halting or resuming *and* a driver that can't
64  * afford that delay.  The hlt_counter would then be checked before
65  * executing the halt sequence, and the driver marks the unhaltable
66  * region by enable_hlt/disable_hlt.
67  */
68
69 int cris_hlt_counter=0;
70
71 void disable_hlt(void)
72 {
73         cris_hlt_counter++;
74 }
75
76 EXPORT_SYMBOL(disable_hlt);
77
78 void enable_hlt(void)
79 {
80         cris_hlt_counter--;
81 }
82
83 EXPORT_SYMBOL(enable_hlt);
84  
85 /*
86  * The following aren't currently used.
87  */
88 void (*pm_idle)(void);
89
90 extern void default_idle(void);
91
92 void (*pm_power_off)(void);
93 EXPORT_SYMBOL(pm_power_off);
94
95 /*
96  * The idle thread. There's no useful work to be
97  * done, so just try to conserve power and have a
98  * low exit latency (ie sit in a loop waiting for
99  * somebody to say that they'd like to reschedule)
100  */
101
102 void cpu_idle (void)
103 {
104         /* endless idle loop with no priority at all */
105         while (1) {
106                 while (!need_resched()) {
107                         void (*idle)(void);
108                         /*
109                          * Mark this as an RCU critical section so that
110                          * synchronize_kernel() in the unload path waits
111                          * for our completion.
112                          */
113                         idle = pm_idle;
114                         if (!idle)
115                                 idle = default_idle;
116                         idle();
117                 }
118                 preempt_enable_no_resched();
119                 schedule();
120                 preempt_disable();
121         }
122 }
123
124 void hard_reset_now (void);
125
126 void machine_restart(char *cmd)
127 {
128         hard_reset_now();
129 }
130
131 /*
132  * Similar to machine_power_off, but don't shut off power.  Add code
133  * here to freeze the system for e.g. post-mortem debug purpose when
134  * possible.  This halt has nothing to do with the idle halt.
135  */
136
137 void machine_halt(void)
138 {
139 }
140
141 /* If or when software power-off is implemented, add code here.  */
142
143 void machine_power_off(void)
144 {
145 }
146
147 /*
148  * When a process does an "exec", machine state like FPU and debug
149  * registers need to be reset.  This is a hook function for that.
150  * Currently we don't have any such state to reset, so this is empty.
151  */
152
153 void flush_thread(void)
154 {
155 }
156
157 /* Fill in the fpu structure for a core dump. */
158 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
159 {
160         return 0;
161 }