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