1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_CRIS_ARCH_PROCESSOR_H
3 #define __ASM_CRIS_ARCH_PROCESSOR_H
6 * Default implementation of macro that returns current
7 * instruction pointer ("program counter").
9 #define current_text_addr() ({void *pc; __asm__ ("move.d $pc,%0" : "=rm" (pc)); pc; })
11 /* CRIS has no problems with write protection */
14 /* CRIS thread_struct. this really has nothing to do with the processor itself, since
15 * CRIS does not do any hardware task-switching, but it's here for legacy reasons.
16 * The thread_struct here is used when task-switching using _resume defined in entry.S.
17 * The offsets here are hardcoded into _resume - if you change this struct, you need to
18 * change them as well!!!
21 struct thread_struct {
22 unsigned long ksp; /* kernel stack pointer */
23 unsigned long usp; /* user stack pointer */
24 unsigned long dccr; /* saved flag register */
28 * User space process size. This is hardcoded into a few places,
29 * so don't change it unless you know what you are doing.
32 #ifdef CONFIG_CRIS_LOW_MAP
33 #define TASK_SIZE (0x50000000UL) /* 1.25 GB */
35 #define TASK_SIZE (0xA0000000UL) /* 2.56 GB */
38 #define INIT_THREAD { \
39 0, 0, 0x20 } /* ccr = int enable, nothing else */
41 #define KSTK_EIP(tsk) \
43 unsigned long eip = 0; \
44 unsigned long regs = (unsigned long)task_pt_regs(tsk); \
45 if (regs > PAGE_SIZE && \
46 virt_addr_valid(regs)) \
47 eip = ((struct pt_regs *)regs)->irp; \
51 /* give the thread a program location
52 * set user-mode (The 'U' flag (User mode flag) is CCR/DCCR bit 8)
53 * switch user-stackpointer
56 #define start_thread(regs, ip, usp) do { \
58 regs->dccr |= 1 << U_DCCR_BITNR; \
62 /* Called when handling a kernel bus fault fixup.
64 * After a fixup we do not want to return by restoring the CPU-state
65 * anymore, so switch frame-types (see ptrace.h)
67 #define arch_fixup(regs) \
68 regs->frametype = CRIS_FRAME_NORMAL;