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/ptrace.h>
23#include <asm/current.h>
24
25static inline unsigned long rdusp(void)
26{
27 extern unsigned int _sw_usp;
28
29 return _sw_usp;
30}
31
32static inline void wrusp(unsigned long usp)
33{
34 extern unsigned int _sw_usp;
35
36 _sw_usp = usp;
37}
38
39
40
41
42
43#define TASK_SIZE (0xFFFFFFFFUL)
44
45#ifdef __KERNEL__
46#define STACK_TOP TASK_SIZE
47#define STACK_TOP_MAX STACK_TOP
48#endif
49
50
51
52
53
54#define TASK_UNMAPPED_BASE 0
55
56struct thread_struct {
57 unsigned long ksp;
58 unsigned long usp;
59 unsigned long ccr;
60 unsigned long esp0;
61 struct {
62 unsigned short *addr;
63 unsigned short inst;
64 } breakinfo;
65};
66
67#define INIT_THREAD { \
68 .ksp = sizeof(init_stack) + (unsigned long)init_stack, \
69 .usp = 0, \
70 .ccr = PS_S, \
71 .esp0 = 0, \
72 .breakinfo = { \
73 .addr = (unsigned short *)-1, \
74 .inst = 0 \
75 } \
76}
77
78
79
80
81
82
83
84#if defined(CONFIG_CPU_H8300H)
85#define start_thread(_regs, _pc, _usp) \
86do { \
87 (_regs)->pc = (_pc); \
88 (_regs)->ccr = 0x00; \
89 (_regs)->er5 = current->mm->start_data; \
90 (_regs)->sp = ((unsigned long)(_usp)) - sizeof(unsigned long) * 3; \
91} while (0)
92#endif
93#if defined(CONFIG_CPU_H8S)
94#define start_thread(_regs, _pc, _usp) \
95do { \
96 (_regs)->pc = (_pc); \
97 (_regs)->ccr = 0x00; \
98 (_regs)->exr = 0x78; \
99 (_regs)->er5 = current->mm->start_data; \
100 \
101 (_regs)->sp = ((unsigned long)(_usp)) - 14; \
102} while (0)
103#endif
104
105
106struct task_struct;
107
108
109static inline void release_thread(struct task_struct *dead_task)
110{
111}
112
113unsigned long get_wchan(struct task_struct *p);
114
115#define KSTK_EIP(tsk) \
116 ({ \
117 unsigned long eip = 0; \
118 if ((tsk)->thread.esp0 > PAGE_SIZE && \
119 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
120 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
121 eip; })
122
123#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
124
125#define cpu_relax() barrier()
126
127#define HARD_RESET_NOW() ({ \
128 local_irq_disable(); \
129 asm("jmp @@0"); \
130})
131
132#endif
133