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