1 #ifndef __ASM_BFIN_PROCESSOR_H
2 #define __ASM_BFIN_PROCESSOR_H
5 * Default implementation of macro that returns current
6 * instruction pointer ("program counter").
8 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
10 #include <asm/blackfin.h>
11 #include <asm/segment.h>
12 #include <linux/compiler.h>
14 static inline unsigned long rdusp(void)
18 __asm__
__volatile__("%0 = usp;\n\t":"=da"(usp
));
22 static inline void wrusp(unsigned long usp
)
24 __asm__
__volatile__("usp = %0;\n\t"::"da"(usp
));
28 * User space process size: 1st byte beyond user address space.
30 extern unsigned long memory_end
;
31 #define TASK_SIZE (memory_end)
34 #define STACK_TOP TASK_SIZE
37 #define TASK_UNMAPPED_BASE 0
39 struct thread_struct
{
40 unsigned long ksp
; /* kernel stack pointer */
41 unsigned long usp
; /* user stack pointer */
42 unsigned short seqstat
; /* saved status register */
43 unsigned long esp0
; /* points to SR of stack frame pt_regs */
44 unsigned long pc
; /* instruction pointer */
48 #define INIT_THREAD { \
49 sizeof(init_stack) + (unsigned long) init_stack, 0, \
54 * Do necessary setup to start up a newly executed thread.
56 * pass the data segment into user programs if it exists,
57 * it can't hurt anything as far as I can tell
59 #define start_thread(_regs, _pc, _usp) \
62 (_regs)->pc = (_pc); \
64 (_regs)->p5 = current->mm->start_data; \
65 task_thread_info(current)->l1_task_info.stack_start \
66 = (void *)current->mm->context.stack_start; \
67 task_thread_info(current)->l1_task_info.lowest_sp = (void *)(_usp); \
68 memcpy(L1_SCRATCH_TASK_INFO, &task_thread_info(current)->l1_task_info, \
69 sizeof(*L1_SCRATCH_TASK_INFO)); \
73 /* Forward declaration, a strange C thing */
76 /* Free all resources held by a thread. */
77 static inline void release_thread(struct task_struct
*dead_task
)
81 #define prepare_to_copy(tsk) do { } while (0)
83 extern int kernel_thread(int (*fn
) (void *), void *arg
, unsigned long flags
);
86 * Free current thread data structures etc..
88 static inline void exit_thread(void)
93 * Return saved PC of a blocked thread.
95 #define thread_saved_pc(tsk) (tsk->thread.pc)
97 unsigned long get_wchan(struct task_struct
*p
);
99 #define KSTK_EIP(tsk) \
101 unsigned long eip = 0; \
102 if ((tsk)->thread.esp0 > PAGE_SIZE && \
103 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
104 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
106 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
108 #define cpu_relax() barrier()
110 /* Get the Silicon Revision of the chip */
111 static inline uint32_t __pure
bfin_revid(void)
113 /* stored in the upper 4 bits */
114 return bfin_read_CHIPID() >> 28;
117 static inline uint32_t __pure
bfin_compiled_revid(void)
119 #if defined(CONFIG_BF_REV_0_0)
121 #elif defined(CONFIG_BF_REV_0_1)
123 #elif defined(CONFIG_BF_REV_0_2)
125 #elif defined(CONFIG_BF_REV_0_3)
127 #elif defined(CONFIG_BF_REV_0_4)
129 #elif defined(CONFIG_BF_REV_0_5)
131 #elif defined(CONFIG_BF_REV_ANY)