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)
33 #define TASK_UNMAPPED_BASE 0
35 struct thread_struct
{
36 unsigned long ksp
; /* kernel stack pointer */
37 unsigned long usp
; /* user stack pointer */
38 unsigned short seqstat
; /* saved status register */
39 unsigned long esp0
; /* points to SR of stack frame pt_regs */
40 unsigned long pc
; /* instruction pointer */
44 #define INIT_THREAD { \
45 sizeof(init_stack) + (unsigned long) init_stack, 0, \
50 * Do necessary setup to start up a newly executed thread.
52 * pass the data segment into user programs if it exists,
53 * it can't hurt anything as far as I can tell
55 #define start_thread(_regs, _pc, _usp) \
58 (_regs)->pc = (_pc); \
60 (_regs)->p5 = current->mm->start_data; \
61 task_thread_info(current)->l1_task_info.stack_start \
62 = (void *)current->mm->context.stack_start; \
63 task_thread_info(current)->l1_task_info.lowest_sp = (void *)(_usp); \
64 memcpy(L1_SCRATCH_TASK_INFO, &task_thread_info(current)->l1_task_info, \
65 sizeof(*L1_SCRATCH_TASK_INFO)); \
69 /* Forward declaration, a strange C thing */
72 /* Free all resources held by a thread. */
73 static inline void release_thread(struct task_struct
*dead_task
)
77 #define prepare_to_copy(tsk) do { } while (0)
79 extern int kernel_thread(int (*fn
) (void *), void *arg
, unsigned long flags
);
82 * Free current thread data structures etc..
84 static inline void exit_thread(void)
89 * Return saved PC of a blocked thread.
91 #define thread_saved_pc(tsk) (tsk->thread.pc)
93 unsigned long get_wchan(struct task_struct
*p
);
95 #define KSTK_EIP(tsk) \
97 unsigned long eip = 0; \
98 if ((tsk)->thread.esp0 > PAGE_SIZE && \
99 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
100 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
102 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
104 #define cpu_relax() barrier()
106 /* Get the Silicon Revision of the chip */
107 static inline __attribute_pure__
uint32_t bfin_revid(void)
109 /* stored in the upper 4 bits */
110 return bfin_read_CHIPID() >> 28;
113 static inline __attribute_pure__
uint32_t bfin_compiled_revid(void)
115 #if defined(CONFIG_BF_REV_0_0)
117 #elif defined(CONFIG_BF_REV_0_1)
119 #elif defined(CONFIG_BF_REV_0_2)
121 #elif defined(CONFIG_BF_REV_0_3)
123 #elif defined(CONFIG_BF_REV_0_4)
125 #elif defined(CONFIG_BF_REV_0_5)
127 #elif defined(CONFIG_BF_REV_ANY)