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
9 #include <asm/ptrace.h>
10 #include <asm/types.h>
11 #include <asm/sigcontext.h>
13 #define KERNEL_STACK_SIZE PAGE_SIZE
14 #define STACK_TOP TASK_SIZE
15 #define STACK_TOP_MAX TASK_SIZE
32 struct thread_struct
{
33 struct cpu_context cpu_context
; /* cpu context */
35 unsigned long address
;
36 unsigned long trap_no
;
37 unsigned long error_code
;
39 struct fpu_struct fpu
;
42 #define INIT_THREAD { }
45 #define PSW_DE PSW_mskBE
51 #define PSW_valWBNA PSW_mskWBNA
53 #define PSW_valWBNA 0x0
57 #define PSW_valINIT (PSW_CPL_ANY | PSW_mskAEN | PSW_valWBNA | PSW_mskDT | PSW_mskIT | PSW_DE | PSW_mskGIE)
59 #define PSW_valINIT (PSW_CPL_ANY | PSW_valWBNA | PSW_mskDT | PSW_mskIT | PSW_DE | PSW_mskGIE)
62 #define start_thread(regs,pc,stack) \
64 memzero(regs, sizeof(struct pt_regs)); \
65 forget_syscall(regs); \
66 regs->ipsw = PSW_valINIT; \
67 regs->ir0 = (PSW_CPL_ANY | PSW_valWBNA | PSW_mskDT | PSW_mskIT | PSW_DE | PSW_SYSTEM | PSW_INTL_1); \
72 /* Forward declaration, a strange C thing */
75 /* Free all resources held by a thread. */
76 #define release_thread(thread) do { } while(0)
77 #if IS_ENABLED(CONFIG_FPU)
78 #if !IS_ENABLED(CONFIG_UNLAZU_FPU)
79 extern struct task_struct
*last_task_used_math
;
83 /* Prepare to copy thread state - unlazy all lazy status */
84 #define prepare_to_copy(tsk) do { } while (0)
86 unsigned long get_wchan(struct task_struct
*p
);
88 #define cpu_relax() barrier()
90 #define task_pt_regs(task) \
91 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
95 * Create a new kernel thread
97 extern int kernel_thread(int (*fn
) (void *), void *arg
, unsigned long flags
);
99 #define KSTK_EIP(tsk) instruction_pointer(task_pt_regs(tsk))
100 #define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk))
104 #endif /* __ASM_NDS32_PROCESSOR_H */