1
2
3
4
5
6
7
8#ifndef __ASM_M68K_PROCESSOR_H
9#define __ASM_M68K_PROCESSOR_H
10
11
12
13
14
15#define current_text_addr() ({ __label__ _l; _l: &&_l;})
16
17#include <linux/thread_info.h>
18#include <asm/segment.h>
19#include <asm/fpu.h>
20#include <asm/ptrace.h>
21
22static inline unsigned long rdusp(void)
23{
24#ifdef CONFIG_COLDFIRE_SW_A7
25 extern unsigned int sw_usp;
26 return sw_usp;
27#else
28 register unsigned long usp __asm__("a0");
29
30 __asm__ __volatile__(".word 0x4e68" : "=a" (usp));
31 return usp;
32#endif
33}
34
35static inline void wrusp(unsigned long usp)
36{
37#ifdef CONFIG_COLDFIRE_SW_A7
38 extern unsigned int sw_usp;
39 sw_usp = usp;
40#else
41 register unsigned long a0 __asm__("a0") = usp;
42
43 __asm__ __volatile__(".word 0x4e60" : : "a" (a0) );
44#endif
45}
46
47
48
49
50
51#ifdef CONFIG_MMU
52#if defined(CONFIG_COLDFIRE)
53#define TASK_SIZE (0xC0000000UL)
54#elif defined(CONFIG_SUN3)
55#define TASK_SIZE (0x0E000000UL)
56#else
57#define TASK_SIZE (0xF0000000UL)
58#endif
59#else
60#define TASK_SIZE (0xFFFFFFFFUL)
61#endif
62
63#ifdef __KERNEL__
64#define STACK_TOP TASK_SIZE
65#define STACK_TOP_MAX STACK_TOP
66#endif
67
68
69
70
71#ifdef CONFIG_MMU
72#if defined(CONFIG_COLDFIRE)
73#define TASK_UNMAPPED_BASE 0x60000000UL
74#elif defined(CONFIG_SUN3)
75#define TASK_UNMAPPED_BASE 0x0A000000UL
76#else
77#define TASK_UNMAPPED_BASE 0xC0000000UL
78#endif
79#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
80#else
81#define TASK_UNMAPPED_BASE 0
82#endif
83
84struct thread_struct {
85 unsigned long ksp;
86 unsigned long usp;
87 unsigned short sr;
88 unsigned short fs;
89 unsigned long crp[2];
90 unsigned long esp0;
91 unsigned long faddr;
92 int signo, code;
93 unsigned long fp[8*3];
94 unsigned long fpcntl[3];
95 unsigned char fpstate[FPSTATESIZE];
96};
97
98#define INIT_THREAD { \
99 .ksp = sizeof(init_stack) + (unsigned long) init_stack, \
100 .sr = PS_S, \
101 .fs = __KERNEL_DS, \
102}
103
104
105
106
107
108#ifdef CONFIG_COLDFIRE
109#define setframeformat(_regs) do { (_regs)->format = 0x4; } while(0)
110#else
111#define setframeformat(_regs) do { } while (0)
112#endif
113
114
115
116
117static inline void start_thread(struct pt_regs * regs, unsigned long pc,
118 unsigned long usp)
119{
120 regs->pc = pc;
121 regs->sr &= ~0x2000;
122 setframeformat(regs);
123 wrusp(usp);
124}
125
126
127struct task_struct;
128
129
130static inline void release_thread(struct task_struct *dead_task)
131{
132}
133
134unsigned long get_wchan(struct task_struct *p);
135
136#define KSTK_EIP(tsk) \
137 ({ \
138 unsigned long eip = 0; \
139 if ((tsk)->thread.esp0 > PAGE_SIZE && \
140 (virt_addr_valid((tsk)->thread.esp0))) \
141 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
142 eip; })
143#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
144
145#define task_pt_regs(tsk) ((struct pt_regs *) ((tsk)->thread.esp0))
146
147#define cpu_relax() barrier()
148
149#endif
150