]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/cris/kernel/process.c
7f65be6f7f17741153222d11618a716593fbbb91
[karo-tx-linux.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 <linux/module.h>
20 #include <linux/spinlock.h>
21 #include <linux/init_task.h>
22 #include <linux/sched.h>
23 #include <linux/fs.h>
24 #include <linux/user.h>
25 #include <linux/elfcore.h>
26 #include <linux/mqueue.h>
27 #include <linux/reboot.h>
28 #include <linux/rcupdate.h>
29
30 //#define DEBUG
31
32 /*
33  * The hlt_counter, disable_hlt and enable_hlt is just here as a hook if
34  * there would ever be a halt sequence (for power save when idle) with
35  * some largish delay when halting or resuming *and* a driver that can't
36  * afford that delay.  The hlt_counter would then be checked before
37  * executing the halt sequence, and the driver marks the unhaltable
38  * region by enable_hlt/disable_hlt.
39  */
40
41 int cris_hlt_counter=0;
42
43 void disable_hlt(void)
44 {
45         cris_hlt_counter++;
46 }
47
48 EXPORT_SYMBOL(disable_hlt);
49
50 void enable_hlt(void)
51 {
52         cris_hlt_counter--;
53 }
54
55 EXPORT_SYMBOL(enable_hlt);
56  
57 /*
58  * The following aren't currently used.
59  */
60 void (*pm_idle)(void);
61
62 extern void default_idle(void);
63
64 void (*pm_power_off)(void);
65 EXPORT_SYMBOL(pm_power_off);
66
67 /*
68  * The idle thread. There's no useful work to be
69  * done, so just try to conserve power and have a
70  * low exit latency (ie sit in a loop waiting for
71  * somebody to say that they'd like to reschedule)
72  */
73
74 void cpu_idle (void)
75 {
76         /* endless idle loop with no priority at all */
77         while (1) {
78                 rcu_idle_enter();
79                 while (!need_resched()) {
80                         void (*idle)(void);
81                         /*
82                          * Mark this as an RCU critical section so that
83                          * synchronize_kernel() in the unload path waits
84                          * for our completion.
85                          */
86                         idle = pm_idle;
87                         if (!idle)
88                                 idle = default_idle;
89                         idle();
90                 }
91                 rcu_idle_exit();
92                 schedule_preempt_disabled();
93         }
94 }
95
96 void hard_reset_now (void);
97
98 void machine_restart(char *cmd)
99 {
100         hard_reset_now();
101 }
102
103 /*
104  * Similar to machine_power_off, but don't shut off power.  Add code
105  * here to freeze the system for e.g. post-mortem debug purpose when
106  * possible.  This halt has nothing to do with the idle halt.
107  */
108
109 void machine_halt(void)
110 {
111 }
112
113 /* If or when software power-off is implemented, add code here.  */
114
115 void machine_power_off(void)
116 {
117 }
118
119 /*
120  * When a process does an "exec", machine state like FPU and debug
121  * registers need to be reset.  This is a hook function for that.
122  * Currently we don't have any such state to reset, so this is empty.
123  */
124
125 void flush_thread(void)
126 {
127 }
128
129 /* Fill in the fpu structure for a core dump. */
130 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
131 {
132         return 0;
133 }