GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / m68k / include / asm / processor.h
blob7a6a7590cc02cd584d28fd9e2a98d9d1b8b30797
1 /*
2 * include/asm-m68k/processor.h
4 * Copyright (C) 1995 Hamish Macdonald
5 */
7 #ifndef __ASM_M68K_PROCESSOR_H
8 #define __ASM_M68K_PROCESSOR_H
11 * Default implementation of macro that returns current
12 * instruction pointer ("program counter").
14 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
16 #include <linux/thread_info.h>
17 #include <asm/segment.h>
18 #include <asm/fpu.h>
19 #include <asm/ptrace.h>
21 static inline unsigned long rdusp(void)
23 #ifdef CONFIG_COLDFIRE
24 extern unsigned int sw_usp;
25 return sw_usp;
26 #else
27 unsigned long usp;
28 __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
29 return usp;
30 #endif
33 static inline void wrusp(unsigned long usp)
35 #ifdef CONFIG_COLDFIRE
36 extern unsigned int sw_usp;
37 sw_usp = usp;
38 #else
39 __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
40 #endif
44 * User space process size: 3.75GB. This is hardcoded into a few places,
45 * so don't change it unless you know what you are doing.
47 #ifdef CONFIG_MMU
48 #ifndef CONFIG_SUN3
49 #define TASK_SIZE (0xF0000000UL)
50 #else
51 #define TASK_SIZE (0x0E000000UL)
52 #endif
53 #else
54 #define TASK_SIZE (0xFFFFFFFFUL)
55 #endif
57 #ifdef __KERNEL__
58 #define STACK_TOP TASK_SIZE
59 #define STACK_TOP_MAX STACK_TOP
60 #endif
62 /* This decides where the kernel will search for a free chunk of vm
63 * space during mmap's.
65 #ifdef CONFIG_MMU
66 #ifndef CONFIG_SUN3
67 #define TASK_UNMAPPED_BASE 0xC0000000UL
68 #else
69 #define TASK_UNMAPPED_BASE 0x0A000000UL
70 #endif
71 #define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
72 #else
73 #define TASK_UNMAPPED_BASE 0
74 #endif
76 struct thread_struct {
77 unsigned long ksp; /* kernel stack pointer */
78 unsigned long usp; /* user stack pointer */
79 unsigned short sr; /* saved status register */
80 unsigned short fs; /* saved fs (sfc, dfc) */
81 unsigned long crp[2]; /* cpu root pointer */
82 unsigned long esp0; /* points to SR of stack frame */
83 unsigned long faddr; /* info about last fault */
84 int signo, code;
85 unsigned long fp[8*3];
86 unsigned long fpcntl[3]; /* fp control regs */
87 unsigned char fpstate[FPSTATESIZE]; /* floating point state */
88 struct thread_info info;
91 #define INIT_THREAD { \
92 .ksp = sizeof(init_stack) + (unsigned long) init_stack, \
93 .sr = PS_S, \
94 .fs = __KERNEL_DS, \
95 .info = INIT_THREAD_INFO(init_task), \
98 #ifdef CONFIG_MMU
100 * Do necessary setup to start up a newly executed thread.
102 static inline void start_thread(struct pt_regs * regs, unsigned long pc,
103 unsigned long usp)
105 /* reads from user space */
106 set_fs(USER_DS);
108 regs->pc = pc;
109 regs->sr &= ~0x2000;
110 wrusp(usp);
113 #else
116 * Coldfire stacks need to be re-aligned on trap exit, conventional
117 * 68k can handle this case cleanly.
119 #ifdef CONFIG_COLDFIRE
120 #define reformat(_regs) do { (_regs)->format = 0x4; } while(0)
121 #else
122 #define reformat(_regs) do { } while (0)
123 #endif
125 #define start_thread(_regs, _pc, _usp) \
126 do { \
127 set_fs(USER_DS); /* reads from user space */ \
128 (_regs)->pc = (_pc); \
129 ((struct switch_stack *)(_regs))[-1].a6 = 0; \
130 reformat(_regs); \
131 if (current->mm) \
132 (_regs)->d5 = current->mm->start_data; \
133 (_regs)->sr &= ~0x2000; \
134 wrusp(_usp); \
135 } while(0)
137 #endif
139 /* Forward declaration, a strange C thing */
140 struct task_struct;
142 /* Free all resources held by a thread. */
143 static inline void release_thread(struct task_struct *dead_task)
147 /* Prepare to copy thread state - unlazy all lazy status */
148 #define prepare_to_copy(tsk) do { } while (0)
150 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
153 * Free current thread data structures etc..
155 static inline void exit_thread(void)
159 extern unsigned long thread_saved_pc(struct task_struct *tsk);
161 unsigned long get_wchan(struct task_struct *p);
163 #define KSTK_EIP(tsk) \
164 ({ \
165 unsigned long eip = 0; \
166 if ((tsk)->thread.esp0 > PAGE_SIZE && \
167 (virt_addr_valid((tsk)->thread.esp0))) \
168 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
169 eip; })
170 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
172 #define task_pt_regs(tsk) ((struct pt_regs *) ((tsk)->thread.esp0))
174 #define cpu_relax() barrier()
176 #endif