1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 2 /* 3 * Copyright (C) 2014-15 Synopsys, Inc. (www.s 4 * Copyright (C) 2004, 2007-2010, 2011-2012 Sy 5 */ 6 7 #ifndef __ASM_ARC_ENTRY_H 8 #define __ASM_ARC_ENTRY_H 9 10 #include <asm/unistd.h> /* For NR_sysc 11 #include <asm/arcregs.h> 12 #include <asm/ptrace.h> 13 #include <asm/processor.h> /* For VMALLOC 14 #include <asm/mmu.h> 15 16 #ifdef __ASSEMBLY__ 17 18 #ifdef CONFIG_ISA_ARCOMPACT 19 #include <asm/entry-compact.h> /* ISA specifi 20 #else 21 #include <asm/entry-arcv2.h> 22 #endif 23 24 /* 25 * save user mode callee regs as struct callee 26 * - needed by fork/do_signal/unaligned-acces 27 */ 28 .macro SAVE_CALLEE_SAVED_USER 29 SAVE_ABI_CALLEE_REGS 30 .endm 31 32 /* 33 * restore user mode callee regs as struct cal 34 * - could have been changed by ptrace tracer 35 */ 36 .macro RESTORE_CALLEE_SAVED_USER 37 RESTORE_ABI_CALLEE_REGS 38 .endm 39 40 /* 41 * save/restore kernel mode callee regs at the 42 */ 43 .macro SAVE_CALLEE_SAVED_KERNEL 44 SAVE_ABI_CALLEE_REGS 45 .endm 46 47 .macro RESTORE_CALLEE_SAVED_KERNEL 48 RESTORE_ABI_CALLEE_REGS 49 .endm 50 51 /*-------------------------------------------- 52 * Super FAST Restore callee saved regs by sim 53 *-------------------------------------------- 54 .macro DISCARD_CALLEE_SAVED_USER 55 add sp, sp, SZ_CALLEE_REGS 56 .endm 57 58 /*-------------------------------------------- 59 * given a tsk struct, get to the base of its 60 * tsk->thread_info is really a PAGE, whose bo 61 * which grows upwards towards thread_info 62 *-------------------------------------------- 63 64 .macro GET_TSK_STACK_BASE tsk, out 65 66 /* Get task->thread_info (this is esse 67 ld \out, [\tsk, TASK_THREAD_INFO] 68 69 /* Go to end of page where stack begin 70 add2 \out, \out, (THREAD_SIZE)/4 71 72 .endm 73 74 /* 75 * @reg [OUT] thread_info->flags of "current" 76 */ 77 .macro GET_CURR_THR_INFO_FLAGS reg 78 GET_CURR_THR_INFO_FROM_SP \reg 79 ld \reg, [\reg, THREAD_INFO_FLAGS] 80 .endm 81 82 #ifdef CONFIG_SMP 83 84 /* 85 * Retrieve the current running task on this C 86 * - loads it from backing _current_task[] (a 87 * caching reg for current task 88 */ 89 .macro GET_CURR_TASK_ON_CPU reg 90 GET_CPU_ID \reg 91 ld.as \reg, [@_current_task, \reg] 92 .endm 93 94 /*-------------------------------------------- 95 * Save a new task as the "current" task on th 96 * 1. Determine curr CPU id. 97 * 2. Use it to index into _current_task[ ] 98 * 99 * Coded differently than GET_CURR_TASK_ON_CPU 100 * because ST r0, [r1, offset] can ONLY have s 101 * while LD can take s9 (4 byte insn) or LIM 102 */ 103 104 .macro SET_CURR_TASK_ON_CPU tsk, tmp 105 GET_CPU_ID \tmp 106 add2 \tmp, @_current_task, \tmp 107 st \tsk, [\tmp] 108 #ifdef CONFIG_ARC_CURR_IN_REG 109 mov gp, \tsk 110 #endif 111 112 .endm 113 114 115 #else /* Uniprocessor implementation of macr 116 117 .macro GET_CURR_TASK_ON_CPU reg 118 ld \reg, [@_current_task] 119 .endm 120 121 .macro SET_CURR_TASK_ON_CPU tsk, tmp 122 st \tsk, [@_current_task] 123 #ifdef CONFIG_ARC_CURR_IN_REG 124 mov gp, \tsk 125 #endif 126 .endm 127 128 #endif /* SMP / UNI */ 129 130 /* 131 * Get the ptr to some field of Current Task a 132 * - Uses current task cached in reg if enabl 133 */ 134 #ifdef CONFIG_ARC_CURR_IN_REG 135 136 .macro GET_CURR_TASK_FIELD_PTR off, reg 137 add \reg, gp, \off 138 .endm 139 140 #else 141 142 .macro GET_CURR_TASK_FIELD_PTR off, reg 143 GET_CURR_TASK_ON_CPU \reg 144 add \reg, \reg, \off 145 .endm 146 147 #endif /* CONFIG_ARC_CURR_IN_REG */ 148 149 #else /* !__ASSEMBLY__ */ 150 151 extern void do_signal(struct pt_regs *); 152 extern void do_notify_resume(struct pt_regs *) 153 extern int do_privilege_fault(unsigned long, s 154 extern int do_extension_fault(unsigned long, s 155 extern int insterror_is_error(unsigned long, s 156 extern int do_memory_error(unsigned long, stru 157 extern int trap_is_brkpt(unsigned long, struct 158 extern int do_misaligned_error(unsigned long, 159 extern int do_trap5_error(unsigned long, struc 160 extern int do_misaligned_access(unsigned long, 161 extern void do_machine_check_fault(unsigned lo 162 extern void do_non_swi_trap(unsigned long, str 163 extern void do_insterror_or_kprobe(unsigned lo 164 extern void do_page_fault(unsigned long, struc 165 166 #endif 167 168 #endif /* __ASM_ARC_ENTRY_H */ 169
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.