License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-2.6-block.git] / arch / cris / include / arch-v32 / arch / processor.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_CRIS_ARCH_PROCESSOR_H
3 #define _ASM_CRIS_ARCH_PROCESSOR_H
4
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  */
17 struct 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  * change it unless everything's clear!
26  */
27 #define TASK_SIZE       (0xB0000000UL)
28
29 #define INIT_THREAD { }
30
31 #define KSTK_EIP(tsk)           \
32 ({                              \
33         unsigned long eip = 0;  \
34         unsigned long regs = (unsigned long)task_pt_regs(tsk); \
35         if (regs > PAGE_SIZE && virt_addr_valid(regs))      \
36                 eip = ((struct pt_regs *)regs)->erp;        \
37         eip; \
38 })
39
40 /*
41  * Give the thread a program location, set user-mode and switch user
42  * stackpointer.
43  */
44 #define start_thread(regs, ip, usp) \
45 do { \
46         regs->erp = ip; \
47         regs->ccs |= 1 << (U_CCS_BITNR + CCS_SHIFT); \
48         wrusp(usp); \
49 } while(0)
50
51 /* Nothing special to do for v32 when handling a kernel bus fault fixup. */
52 #define arch_fixup(regs) {};
53
54 #endif /* _ASM_CRIS_ARCH_PROCESSOR_H */