perf tools: Don't clone maps from parent when synthesizing forks
[linux/fpc-iii.git] / arch / nds32 / include / asm / processor.h
blob9c83caf4269f52314c3d35550628d91f29053c70
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2005-2017 Andes Technology Corporation
4 #ifndef __ASM_NDS32_PROCESSOR_H
5 #define __ASM_NDS32_PROCESSOR_H
7 /*
8 * Default implementation of macro that returns current
9 * instruction pointer ("program counter").
11 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
13 #ifdef __KERNEL__
15 #include <asm/ptrace.h>
16 #include <asm/types.h>
17 #include <asm/sigcontext.h>
19 #define KERNEL_STACK_SIZE PAGE_SIZE
20 #define STACK_TOP TASK_SIZE
21 #define STACK_TOP_MAX TASK_SIZE
23 struct cpu_context {
24 unsigned long r6;
25 unsigned long r7;
26 unsigned long r8;
27 unsigned long r9;
28 unsigned long r10;
29 unsigned long r11;
30 unsigned long r12;
31 unsigned long r13;
32 unsigned long r14;
33 unsigned long fp;
34 unsigned long pc;
35 unsigned long sp;
38 struct thread_struct {
39 struct cpu_context cpu_context; /* cpu context */
40 /* fault info */
41 unsigned long address;
42 unsigned long trap_no;
43 unsigned long error_code;
46 #define INIT_THREAD { }
48 #ifdef __NDS32_EB__
49 #define PSW_DE PSW_mskBE
50 #else
51 #define PSW_DE 0x0
52 #endif
54 #ifdef CONFIG_WBNA
55 #define PSW_valWBNA PSW_mskWBNA
56 #else
57 #define PSW_valWBNA 0x0
58 #endif
60 #ifdef CONFIG_HWZOL
61 #define PSW_valINIT (PSW_CPL_ANY | PSW_mskAEN | PSW_valWBNA | PSW_mskDT | PSW_mskIT | PSW_DE | PSW_mskGIE)
62 #else
63 #define PSW_valINIT (PSW_CPL_ANY | PSW_valWBNA | PSW_mskDT | PSW_mskIT | PSW_DE | PSW_mskGIE)
64 #endif
66 #define start_thread(regs,pc,stack) \
67 ({ \
68 memzero(regs, sizeof(struct pt_regs)); \
69 forget_syscall(regs); \
70 regs->ipsw = PSW_valINIT; \
71 regs->ir0 = (PSW_CPL_ANY | PSW_valWBNA | PSW_mskDT | PSW_mskIT | PSW_DE | PSW_SYSTEM | PSW_INTL_1); \
72 regs->ipc = pc; \
73 regs->sp = stack; \
76 /* Forward declaration, a strange C thing */
77 struct task_struct;
79 /* Free all resources held by a thread. */
80 #define release_thread(thread) do { } while(0)
82 /* Prepare to copy thread state - unlazy all lazy status */
83 #define prepare_to_copy(tsk) do { } while (0)
85 unsigned long get_wchan(struct task_struct *p);
87 #define cpu_relax() barrier()
89 #define task_pt_regs(task) \
90 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
91 - 8) - 1)
94 * Create a new kernel thread
96 extern int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags);
98 #define KSTK_EIP(tsk) instruction_pointer(task_pt_regs(tsk))
99 #define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk))
101 #endif
103 #endif /* __ASM_NDS32_PROCESSOR_H */