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