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
8 * Default implementation of macro that returns current
9 * instruction pointer ("program counter").
11 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
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
38 struct thread_struct
{
39 struct cpu_context cpu_context
; /* cpu context */
41 unsigned long address
;
42 unsigned long trap_no
;
43 unsigned long error_code
;
46 #define INIT_THREAD { }
49 #define PSW_DE PSW_mskBE
55 #define PSW_valWBNA PSW_mskWBNA
57 #define PSW_valWBNA 0x0
61 #define PSW_valINIT (PSW_CPL_ANY | PSW_mskAEN | PSW_valWBNA | PSW_mskDT | PSW_mskIT | PSW_DE | PSW_mskGIE)
63 #define PSW_valINIT (PSW_CPL_ANY | PSW_valWBNA | PSW_mskDT | PSW_mskIT | PSW_DE | PSW_mskGIE)
66 #define start_thread(regs,pc,stack) \
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); \
76 /* Forward declaration, a strange C thing */
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 \
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))
103 #endif /* __ASM_NDS32_PROCESSOR_H */