KVM: SVM: clean up nestec vmload/vmsave paths
[linux/fpc-iii.git] / arch / blackfin / include / asm / processor.h
bloba36ad8dac0681914dd067af2a6c1609d39e475c5
1 #ifndef __ASM_BFIN_PROCESSOR_H
2 #define __ASM_BFIN_PROCESSOR_H
4 /*
5 * Default implementation of macro that returns current
6 * instruction pointer ("program counter").
7 */
8 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
10 #include <asm/ptrace.h>
11 #include <asm/blackfin.h>
13 static inline unsigned long rdusp(void)
15 unsigned long usp;
17 __asm__ __volatile__("%0 = usp;\n\t":"=da"(usp));
18 return usp;
21 static inline void wrusp(unsigned long usp)
23 __asm__ __volatile__("usp = %0;\n\t"::"da"(usp));
26 static inline unsigned long __get_SP(void)
28 unsigned long sp;
30 __asm__ __volatile__("%0 = sp;\n\t" : "=da"(sp));
31 return sp;
35 * User space process size: 1st byte beyond user address space.
36 * Fairly meaningless on nommu. Parts of user programs can be scattered
37 * in a lot of places, so just disable this by setting it to 0xFFFFFFFF.
39 #define TASK_SIZE 0xFFFFFFFF
41 #ifdef __KERNEL__
42 #define STACK_TOP TASK_SIZE
43 #endif
45 #define TASK_UNMAPPED_BASE 0
47 struct thread_struct {
48 unsigned long ksp; /* kernel stack pointer */
49 unsigned long usp; /* user stack pointer */
50 unsigned short seqstat; /* saved status register */
51 unsigned long esp0; /* points to SR of stack frame pt_regs */
52 unsigned long pc; /* instruction pointer */
53 void * debuggerinfo;
56 #define INIT_THREAD { \
57 sizeof(init_stack) + (unsigned long) init_stack, 0, \
58 PS_S, 0, 0 \
61 extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
62 unsigned long new_sp);
64 /* Forward declaration, a strange C thing */
65 struct task_struct;
67 /* Free all resources held by a thread. */
68 static inline void release_thread(struct task_struct *dead_task)
72 #define prepare_to_copy(tsk) do { } while (0)
74 extern int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags);
77 * Free current thread data structures etc..
79 static inline void exit_thread(void)
84 * Return saved PC of a blocked thread.
86 #define thread_saved_pc(tsk) (tsk->thread.pc)
88 unsigned long get_wchan(struct task_struct *p);
90 #define KSTK_EIP(tsk) \
91 ({ \
92 unsigned long eip = 0; \
93 if ((tsk)->thread.esp0 > PAGE_SIZE && \
94 MAP_NR((tsk)->thread.esp0) < max_mapnr) \
95 eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
96 eip; })
97 #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
99 #define cpu_relax() smp_mb()
102 /* Get the Silicon Revision of the chip */
103 static inline uint32_t __pure bfin_revid(void)
105 /* Always use CHIPID, to work around ANOMALY_05000234 */
106 uint32_t revid = (bfin_read_CHIPID() & CHIPID_VERSION) >> 28;
108 #ifdef _BOOTROM_GET_DXE_ADDRESS_TWI
110 * ANOMALY_05000364
111 * Incorrect Revision Number in DSPID Register
113 if (ANOMALY_05000364 &&
114 bfin_read16(_BOOTROM_GET_DXE_ADDRESS_TWI) == 0x2796)
115 revid = 1;
116 #endif
118 return revid;
121 static inline uint16_t __pure bfin_cpuid(void)
123 return (bfin_read_CHIPID() & CHIPID_FAMILY) >> 12;
126 static inline uint32_t __pure bfin_dspid(void)
128 return bfin_read_DSPID();
131 static inline uint32_t __pure bfin_compiled_revid(void)
133 #if defined(CONFIG_BF_REV_0_0)
134 return 0;
135 #elif defined(CONFIG_BF_REV_0_1)
136 return 1;
137 #elif defined(CONFIG_BF_REV_0_2)
138 return 2;
139 #elif defined(CONFIG_BF_REV_0_3)
140 return 3;
141 #elif defined(CONFIG_BF_REV_0_4)
142 return 4;
143 #elif defined(CONFIG_BF_REV_0_5)
144 return 5;
145 #elif defined(CONFIG_BF_REV_0_6)
146 return 6;
147 #elif defined(CONFIG_BF_REV_ANY)
148 return 0xffff;
149 #else
150 return -1;
151 #endif
154 #endif