at v2.6.16-rc2 60 lines 1.7 kB view raw
1#ifndef _ASM_CRIS_ARCH_PROCESSOR_H 2#define _ASM_CRIS_ARCH_PROCESSOR_H 3 4#include <linux/config.h> 5 6/* Return current instruction pointer. */ 7#define current_text_addr() \ 8 ({void *pc; __asm__ __volatile__ ("lapcq .,%0" : "=rm" (pc)); pc;}) 9 10/* 11 * Since CRIS doesn't do hardware task-switching this hasn't really anything to 12 * do with the proccessor itself, it's just here for legacy reasons. This is 13 * used when task-switching using _resume defined in entry.S. The offsets here 14 * are hardcoded into _resume, so if this struct is changed, entry.S needs to be 15 * changed as well. 16 */ 17struct thread_struct { 18 unsigned long ksp; /* Kernel stack pointer. */ 19 unsigned long usp; /* User stack pointer. */ 20 unsigned long ccs; /* Saved flags register. */ 21}; 22 23/* 24 * User-space process size. This is hardcoded into a few places, so don't 25 * changed it unless everything's clear! 26 */ 27#ifndef CONFIG_ETRAXFS_SIM 28#define TASK_SIZE (0xB0000000UL) 29#else 30#define TASK_SIZE (0xA0000000UL) 31#endif 32 33/* CCS I=1, enable interrupts. */ 34#define INIT_THREAD { 0, 0, (1 << I_CCS_BITNR) } 35 36#define KSTK_EIP(tsk) \ 37({ \ 38 unsigned long eip = 0; \ 39 unsigned long regs = (unsigned long)task_pt_regs(tsk); \ 40 if (regs > PAGE_SIZE && virt_addr_valid(regs)) \ 41 eip = ((struct pt_regs *)regs)->erp; \ 42 eip; \ 43}) 44 45/* 46 * Give the thread a program location, set user-mode and switch user 47 * stackpointer. 48 */ 49#define start_thread(regs, ip, usp) \ 50do { \ 51 set_fs(USER_DS); \ 52 regs->erp = ip; \ 53 regs->ccs |= 1 << (U_CCS_BITNR + CCS_SHIFT); \ 54 wrusp(usp); \ 55} while(0) 56 57/* Nothing special to do for v32 when handling a kernel bus fault fixup. */ 58#define arch_fixup(regs) {}; 59 60#endif /* _ASM_CRIS_ARCH_PROCESSOR_H */