initial commit with v2.6.9
[linux-2.6.9-moxart.git] / include / asm-m32r / processor.h
blob24caabea938cb17c9932dcfc33b4a4ad7f09bfb9
1 #ifndef _ASM_M32R_PROCESSOR_H
2 #define _ASM_M32R_PROCESSOR_H
4 /* $Id$ */
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.
11 * Copyright (C) 2001 by Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto
15 * include/asm-m32r/processor.h
17 * Copyright (C) 1994 Linus Torvalds
19 #include <linux/kernel.h>
20 #include <linux/config.h>
21 #include <asm/cache.h>
22 #include <asm/ptrace.h> /* pt_regs */
24 #include <asm/cachectl.h>
27 * Default implementation of macro that returns current
28 * instruction pointer ("program counter").
30 #define current_text_addr() ({ __label__ _l; _l: &&_l; })
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]
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;
47 * capabilities of CPUs
50 extern struct cpuinfo_m32r boot_cpu_data;
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
61 * User space process size: 2GB (default).
63 #ifdef CONFIG_MMU
64 #define TASK_SIZE (0x80000000UL)
65 #else
66 #define TASK_SIZE (0x00400000UL)
67 #endif
69 /* This decides where the kernel will search for a free chunk of vm
70 * space during mmap's.
72 #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
74 typedef struct {
75 unsigned long seg;
76 } mm_segment_t;
78 struct debug_trap {
79 int nr_trap;
80 unsigned long addr;
81 unsigned long insn;
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;
93 #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
95 #define INIT_THREAD { \
96 .sp = INIT_SP, \
100 * Do necessary setup to start up a newly executed thread.
103 /* User process Backup PSW */
104 #define USERPS_BPSW (M32R_PSW_BSM|M32R_PSW_BIE|M32R_PSW_BPM)
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)
114 /* Forward declaration, a strange C thing */
115 struct task_struct;
116 struct mm_struct;
118 /* Free all resources held by a thread. */
119 extern void release_thread(struct task_struct *);
121 #define prepare_to_copy(tsk) do { } while (0)
124 * create a kernel thread without removing it from tasklists
126 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
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);
132 extern unsigned long thread_saved_pc(struct task_struct *);
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)
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)
142 #define THREAD_SIZE (2*PAGE_SIZE)
144 /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
145 static __inline__ void rep_nop(void)
147 __asm__ __volatile__(
148 "nop \n\t"
149 "nop \n\t"
152 : "memory");
155 #define cpu_relax() rep_nop()
157 #endif /* _ASM_M32R_PROCESSOR_H */