Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-mmc
[deliverable/linux.git] / include / asm-h8300 / processor.h
1 /*
2 * include/asm-h8300/processor.h
3 *
4 * Copyright (C) 2002 Yoshinori Sato
5 *
6 * Based on: linux/asm-m68nommu/processor.h
7 *
8 * Copyright (C) 1995 Hamish Macdonald
9 */
10
11 #ifndef __ASM_H8300_PROCESSOR_H
12 #define __ASM_H8300_PROCESSOR_H
13
14 /*
15 * Default implementation of macro that returns current
16 * instruction pointer ("program counter").
17 */
18 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
19
20 #include <asm/segment.h>
21 #include <asm/fpu.h>
22 #include <asm/ptrace.h>
23 #include <asm/current.h>
24
25 static inline unsigned long rdusp(void) {
26 extern unsigned int sw_usp;
27 return(sw_usp);
28 }
29
30 static inline void wrusp(unsigned long usp) {
31 extern unsigned int sw_usp;
32 sw_usp = usp;
33 }
34
35 /*
36 * User space process size: 3.75GB. This is hardcoded into a few places,
37 * so don't change it unless you know what you are doing.
38 */
39 #define TASK_SIZE (0xFFFFFFFFUL)
40
41 /*
42 * This decides where the kernel will search for a free chunk of vm
43 * space during mmap's. We won't be using it
44 */
45 #define TASK_UNMAPPED_BASE 0
46
47 struct thread_struct {
48 unsigned long ksp; /* kernel stack pointer */
49 unsigned long usp; /* user stack pointer */
50 unsigned long ccr; /* saved status register */
51 unsigned long esp0; /* points to SR of stack frame */
52 struct {
53 unsigned short *addr;
54 unsigned short inst;
55 } breakinfo;
56 };
57
58 #define INIT_THREAD { \
59 .ksp = sizeof(init_stack) + (unsigned long)init_stack, \
60 .usp = 0, \
61 .ccr = PS_S, \
62 .esp0 = 0, \
63 .breakinfo = { \
64 .addr = (unsigned short *)-1, \
65 .inst = 0 \
66 } \
67 }
68
69 /*
70 * Do necessary setup to start up a newly executed thread.
71 *
72 * pass the data segment into user programs if it exists,
73 * it can't hurt anything as far as I can tell
74 */
75 #if defined(__H8300H__)
76 #define start_thread(_regs, _pc, _usp) \
77 do { \
78 set_fs(USER_DS); /* reads from user space */ \
79 (_regs)->pc = (_pc); \
80 (_regs)->ccr &= 0x00; /* clear kernel flag */ \
81 (_regs)->er5 = current->mm->start_data; /* GOT base */ \
82 wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \
83 } while(0)
84 #endif
85 #if defined(__H8300S__)
86 #define start_thread(_regs, _pc, _usp) \
87 do { \
88 set_fs(USER_DS); /* reads from user space */ \
89 (_regs)->pc = (_pc); \
90 (_regs)->ccr = 0x00; /* clear kernel flag */ \
91 (_regs)->exr = 0x78; /* enable all interrupts */ \
92 (_regs)->er5 = current->mm->start_data; /* GOT base */ \
93 /* 14 = space for retaddr(4), vector(4), er0(4) and ext(2) on stack */ \
94 wrusp(((unsigned long)(_usp)) - 14); \
95 } while(0)
96 #endif
97
98 /* Forward declaration, a strange C thing */
99 struct task_struct;
100
101 /* Free all resources held by a thread. */
102 static inline void release_thread(struct task_struct *dead_task)
103 {
104 }
105
106 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
107
108 #define prepare_to_copy(tsk) do { } while (0)
109
110 /*
111 * Free current thread data structures etc..
112 */
113 static inline void exit_thread(void)
114 {
115 }
116
117 /*
118 * Return saved PC of a blocked thread.
119 */
120 unsigned long thread_saved_pc(struct task_struct *tsk);
121 unsigned long get_wchan(struct task_struct *p);
122
123 #define KSTK_EIP(tsk) \
124 ({ \
125 unsigned long eip = 0; \
126 if ((tsk)->thread.esp0 > PAGE_SIZE && \
127 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
128 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
129 eip; })
130 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
131
132 #define cpu_relax() do { } while (0)
133
134 #endif
This page took 0.035257 seconds and 6 git commands to generate.