This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / asm-m32r / processor.h
1 #ifndef _ASM_M32R_PROCESSOR_H
2 #define _ASM_M32R_PROCESSOR_H
3
4 /* $Id$ */
5
6 /*
7  * This file is subject to the terms and conditions of the GNU General Public
8  * License.  See the file "COPYING" in the main directory of this archive
9  * for more details.
10  *
11  * Copyright (C) 2001  by Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto
12  */
13
14 /*
15  * include/asm-m32r/processor.h
16  *
17  * Copyright (C) 1994 Linus Torvalds
18  */
19 #include <linux/kernel.h>
20 #include <linux/config.h>
21 #include <asm/cache.h>
22 #include <asm/ptrace.h>  /* pt_regs */
23
24 #include <asm/cachectl.h>
25
26 /*
27  * Default implementation of macro that returns current
28  * instruction pointer ("program counter").
29  */
30 #define current_text_addr() ({ __label__ _l; _l: &&_l; })
31
32 /*
33  *  CPU type and hardware bug flags. Kept separately for each CPU.
34  *  Members of this structure are referenced in head.S, so think twice
35  *  before touching them. [mj]
36  */
37
38 struct cpuinfo_m32r {
39         unsigned long pgtable_cache_sz;
40         unsigned long cpu_clock;
41         unsigned long bus_clock;
42         unsigned long timer_divide;
43         unsigned long loops_per_jiffy;
44 };
45
46 /*
47  * capabilities of CPUs
48  */
49
50 extern struct cpuinfo_m32r boot_cpu_data;
51
52 #ifdef CONFIG_SMP
53 extern struct cpuinfo_m32r cpu_data[];
54 #define current_cpu_data cpu_data[smp_processor_id()]
55 #else
56 #define cpu_data &boot_cpu_data
57 #define current_cpu_data boot_cpu_data
58 #endif
59
60 /*
61  * User space process size: 2GB (default).
62  */
63 #ifdef CONFIG_MMU
64 #define TASK_SIZE  (0x80000000UL)
65 #else
66 #define TASK_SIZE  (0x00400000UL)
67 #endif
68
69 /* This decides where the kernel will search for a free chunk of vm
70  * space during mmap's.
71  */
72 #define TASK_UNMAPPED_BASE      PAGE_ALIGN(TASK_SIZE / 3)
73
74 typedef struct {
75         unsigned long seg;
76 } mm_segment_t;
77
78 struct debug_trap {
79         int nr_trap;
80         unsigned long   addr;
81         unsigned long   insn;
82 };
83
84 struct thread_struct {
85         unsigned long address;
86         unsigned long trap_no;          /* Trap number  */
87         unsigned long error_code;       /* Error code of trap */
88         unsigned long lr;               /* saved pc */
89         unsigned long sp;               /* user stack pointer */
90         struct debug_trap debug_trap;
91 };
92
93 #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
94
95 #define INIT_THREAD     {       \
96         .sp = INIT_SP,          \
97 }
98
99 /*
100  * Do necessary setup to start up a newly executed thread.
101  */
102
103 /* User process Backup PSW */
104 #define USERPS_BPSW (M32R_PSW_BSM|M32R_PSW_BIE|M32R_PSW_BPM)
105
106 #define start_thread(regs, new_pc, new_spu)                             \
107         do {                                                            \
108                 set_fs(USER_DS);                                        \
109                 regs->psw = (regs->psw | USERPS_BPSW) & 0x0000FFFFUL;   \
110                 regs->bpc = new_pc;                                     \
111                 regs->spu = new_spu;                                    \
112         } while (0)
113
114 /* Forward declaration, a strange C thing */
115 struct task_struct;
116 struct mm_struct;
117
118 /* Free all resources held by a thread. */
119 extern void release_thread(struct task_struct *);
120
121 #define prepare_to_copy(tsk)    do { } while (0)
122
123 /*
124  * create a kernel thread without removing it from tasklists
125  */
126 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
127
128 /* Copy and release all segment info associated with a VM */
129 extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
130 extern void release_segments(struct mm_struct * mm);
131
132 extern unsigned long thread_saved_pc(struct task_struct *);
133
134 /* Copy and release all segment info associated with a VM */
135 #define copy_segments(p, mm)  do { } while (0)
136 #define release_segments(mm)  do { } while (0)
137
138 unsigned long get_wchan(struct task_struct *p);
139 #define KSTK_EIP(tsk)  ((tsk)->thread.lr)
140 #define KSTK_ESP(tsk)  ((tsk)->thread.sp)
141
142 #define THREAD_SIZE (2*PAGE_SIZE)
143
144 /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
145 static __inline__ void rep_nop(void)
146 {
147         __asm__ __volatile__(
148                 "nop \n\t"
149                 "nop \n\t"
150                 :
151                 :
152                 : "memory");
153 }
154
155 #define cpu_relax()     rep_nop()
156
157 #endif /* _ASM_M32R_PROCESSOR_H */