]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
51533b61 MS |
2 | #ifndef _ASM_CRIS_ARCH_PROCESSOR_H |
3 | #define _ASM_CRIS_ARCH_PROCESSOR_H | |
4 | ||
51533b61 MS |
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 | |
d75d806c | 25 | * change it unless everything's clear! |
51533b61 | 26 | */ |
51533b61 | 27 | #define TASK_SIZE (0xB0000000UL) |
51533b61 | 28 | |
06aca924 | 29 | #define INIT_THREAD { } |
51533b61 MS |
30 | |
31 | #define KSTK_EIP(tsk) \ | |
32 | ({ \ | |
33 | unsigned long eip = 0; \ | |
cfa0f29b | 34 | unsigned long regs = (unsigned long)task_pt_regs(tsk); \ |
51533b61 MS |
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 { \ | |
51533b61 MS |
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 */ |