1
2
3
4
5
6
7
8
9
10
11#ifndef __ASM_H8300_PROCESSOR_H
12#define __ASM_H8300_PROCESSOR_H
13
14
15
16
17
18#define current_text_addr() ({ __label__ _l; _l: &&_l;})
19
20#include <linux/compiler.h>
21#include <asm/segment.h>
22#include <asm/fpu.h>
23#include <asm/ptrace.h>
24#include <asm/current.h>
25
26static inline unsigned long rdusp(void) {
27 extern unsigned int sw_usp;
28 return(sw_usp);
29}
30
31static inline void wrusp(unsigned long usp) {
32 extern unsigned int sw_usp;
33 sw_usp = usp;
34}
35
36
37
38
39
40#define TASK_SIZE (0xFFFFFFFFUL)
41
42#ifdef __KERNEL__
43#define STACK_TOP TASK_SIZE
44#define STACK_TOP_MAX STACK_TOP
45#endif
46
47
48
49
50
51#define TASK_UNMAPPED_BASE 0
52
53struct thread_struct {
54 unsigned long ksp;
55 unsigned long usp;
56 unsigned long ccr;
57 unsigned long esp0;
58 struct {
59 unsigned short *addr;
60 unsigned short inst;
61 } breakinfo;
62};
63
64#define INIT_THREAD { \
65 .ksp = sizeof(init_stack) + (unsigned long)init_stack, \
66 .usp = 0, \
67 .ccr = PS_S, \
68 .esp0 = 0, \
69 .breakinfo = { \
70 .addr = (unsigned short *)-1, \
71 .inst = 0 \
72 } \
73}
74
75
76
77
78
79
80
81#if defined(__H8300H__)
82#define start_thread(_regs, _pc, _usp) \
83do { \
84 set_fs(USER_DS); \
85 (_regs)->pc = (_pc); \
86 (_regs)->ccr = 0x00; \
87 (_regs)->er5 = current->mm->start_data; \
88 wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \
89} while(0)
90#endif
91#if defined(__H8300S__)
92#define start_thread(_regs, _pc, _usp) \
93do { \
94 set_fs(USER_DS); \
95 (_regs)->pc = (_pc); \
96 (_regs)->ccr = 0x00; \
97 (_regs)->exr = 0x78; \
98 (_regs)->er5 = current->mm->start_data; \
99 \
100 wrusp(((unsigned long)(_usp)) - 14); \
101} while(0)
102#endif
103
104
105struct task_struct;
106
107
108static inline void release_thread(struct task_struct *dead_task)
109{
110}
111
112extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
113
114#define prepare_to_copy(tsk) do { } while (0)
115
116
117
118
119static inline void exit_thread(void)
120{
121}
122
123
124
125
126unsigned long thread_saved_pc(struct task_struct *tsk);
127unsigned long get_wchan(struct task_struct *p);
128
129#define KSTK_EIP(tsk) \
130 ({ \
131 unsigned long eip = 0; \
132 if ((tsk)->thread.esp0 > PAGE_SIZE && \
133 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
134 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
135 eip; })
136#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
137
138#define cpu_relax() barrier()
139
140#endif
141