1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_SCORE_PROCESSOR_H 3 #define _ASM_SCORE_PROCESSOR_H 4 5 #include <linux/cpumask.h> 6 #include <linux/threads.h> 7 8 #include <asm/segment.h> 9 10 struct task_struct; 11 12 /* 13 * System setup and hardware flags.. 14 */ 15 extern void (*cpu_wait)(void); 16 17 extern void start_thread(struct pt_regs *regs, 18 unsigned long pc, unsigned long sp); 19 extern unsigned long get_wchan(struct task_struct *p); 20 21 /* 22 * Return current * instruction pointer ("program counter"). 23 */ 24 #define current_text_addr() ({ __label__ _l; _l: &&_l; }) 25 26 #define cpu_relax() barrier() 27 #define release_thread(thread) do {} while (0) 28 29 /* 30 * User space process size: 2GB. This is hardcoded into a few places, 31 * so don't change it unless you know what you are doing. 32 */ 33 #define TASK_SIZE 0x7fff8000UL 34 35 /* 36 * This decides where the kernel will search for a free chunk of vm 37 * space during mmap's. 38 */ 39 #define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE)) 40 41 #ifdef __KERNEL__ 42 #define STACK_TOP TASK_SIZE 43 #define STACK_TOP_MAX TASK_SIZE 44 #endif 45 46 /* 47 * If you change thread_struct remember to change the #defines below too! 48 */ 49 struct thread_struct { 50 unsigned long reg0, reg2, reg3; 51 unsigned long reg12, reg13, reg14, reg15, reg16; 52 unsigned long reg17, reg18, reg19, reg20, reg21; 53 54 unsigned long cp0_psr; 55 unsigned long cp0_ema; /* Last user fault */ 56 unsigned long cp0_badvaddr; /* Last user fault */ 57 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */ 58 unsigned long error_code; 59 unsigned long trap_no; 60 61 unsigned long mflags; 62 unsigned long reg29; 63 64 unsigned long single_step; 65 unsigned long ss_nextcnt; 66 67 unsigned long insn1_type; 68 unsigned long addr1; 69 unsigned long insn1; 70 71 unsigned long insn2_type; 72 unsigned long addr2; 73 unsigned long insn2; 74 75 mm_segment_t current_ds; 76 }; 77 78 #define INIT_THREAD { \ 79 .reg0 = 0, \ 80 .reg2 = 0, \ 81 .reg3 = 0, \ 82 .reg12 = 0, \ 83 .reg13 = 0, \ 84 .reg14 = 0, \ 85 .reg15 = 0, \ 86 .reg16 = 0, \ 87 .reg17 = 0, \ 88 .reg18 = 0, \ 89 .reg19 = 0, \ 90 .reg20 = 0, \ 91 .reg21 = 0, \ 92 .cp0_psr = 0, \ 93 .error_code = 0, \ 94 .trap_no = 0, \ 95 } 96 97 #define kstk_tos(tsk) \ 98 ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32) 99 #define task_pt_regs(tsk) ((struct pt_regs *)kstk_tos(tsk) - 1) 100 101 #define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc) 102 #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29]) 103 104 #endif /* _ASM_SCORE_PROCESSOR_H */ 105