19d42c84fSVineet Gupta /* 29d42c84fSVineet Gupta * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 39d42c84fSVineet Gupta * 49d42c84fSVineet Gupta * This program is free software; you can redistribute it and/or modify 59d42c84fSVineet Gupta * it under the terms of the GNU General Public License version 2 as 69d42c84fSVineet Gupta * published by the Free Software Foundation. 79d42c84fSVineet Gupta * 84788a594SVineet Gupta * Vineetg: March 2009 (Supporting 2 levels of Interrupts) 94788a594SVineet Gupta * Stack switching code can no longer reliably rely on the fact that 104788a594SVineet Gupta * if we are NOT in user mode, stack is switched to kernel mode. 114788a594SVineet Gupta * e.g. L2 IRQ interrupted a L1 ISR which had not yet completed 124788a594SVineet Gupta * it's prologue including stack switching from user mode 134788a594SVineet Gupta * 149d42c84fSVineet Gupta * Vineetg: Aug 28th 2008: Bug #94984 159d42c84fSVineet Gupta * -Zero Overhead Loop Context shd be cleared when entering IRQ/EXcp/Trap 169d42c84fSVineet Gupta * Normally CPU does this automatically, however when doing FAKE rtie, 179d42c84fSVineet Gupta * we also need to explicitly do this. The problem in macros 189d42c84fSVineet Gupta * FAKE_RET_FROM_EXCPN and FAKE_RET_FROM_EXCPN_LOCK_IRQ was that this bit 199d42c84fSVineet Gupta * was being "CLEARED" rather then "SET". Actually "SET" clears ZOL context 209d42c84fSVineet Gupta * 219d42c84fSVineet Gupta * Vineetg: May 5th 2008 22080c3747SVineet Gupta * -Modified CALLEE_REG save/restore macros to handle the fact that 23080c3747SVineet Gupta * r25 contains the kernel current task ptr 249d42c84fSVineet Gupta * - Defined Stack Switching Macro to be reused in all intr/excp hdlrs 259d42c84fSVineet Gupta * - Shaved off 11 instructions from RESTORE_ALL_INT1 by using the 269d42c84fSVineet Gupta * address Write back load ld.ab instead of seperate ld/add instn 279d42c84fSVineet Gupta * 289d42c84fSVineet Gupta * Amit Bhor, Sameer Dhavale: Codito Technologies 2004 299d42c84fSVineet Gupta */ 309d42c84fSVineet Gupta 319d42c84fSVineet Gupta #ifndef __ASM_ARC_ENTRY_H 329d42c84fSVineet Gupta #define __ASM_ARC_ENTRY_H 339d42c84fSVineet Gupta 349d42c84fSVineet Gupta #ifdef __ASSEMBLY__ 359d42c84fSVineet Gupta #include <asm/unistd.h> /* For NR_syscalls defination */ 369d42c84fSVineet Gupta #include <asm/asm-offsets.h> 379d42c84fSVineet Gupta #include <asm/arcregs.h> 389d42c84fSVineet Gupta #include <asm/ptrace.h> 39080c3747SVineet Gupta #include <asm/processor.h> /* For VMALLOC_START */ 409d42c84fSVineet Gupta #include <asm/thread_info.h> /* For THREAD_SIZE */ 419d42c84fSVineet Gupta 429d42c84fSVineet Gupta /* Note on the LD/ST addr modes with addr reg wback 439d42c84fSVineet Gupta * 449d42c84fSVineet Gupta * LD.a same as LD.aw 459d42c84fSVineet Gupta * 469d42c84fSVineet Gupta * LD.a reg1, [reg2, x] => Pre Incr 479d42c84fSVineet Gupta * Eff Addr for load = [reg2 + x] 489d42c84fSVineet Gupta * 499d42c84fSVineet Gupta * LD.ab reg1, [reg2, x] => Post Incr 509d42c84fSVineet Gupta * Eff Addr for load = [reg2] 519d42c84fSVineet Gupta */ 529d42c84fSVineet Gupta 539d42c84fSVineet Gupta /*-------------------------------------------------------------- 549d42c84fSVineet Gupta * Save caller saved registers (scratch registers) ( r0 - r12 ) 559d42c84fSVineet Gupta * Registers are pushed / popped in the order defined in struct ptregs 569d42c84fSVineet Gupta * in asm/ptrace.h 579d42c84fSVineet Gupta *-------------------------------------------------------------*/ 589d42c84fSVineet Gupta .macro SAVE_CALLER_SAVED 599d42c84fSVineet Gupta st.a r0, [sp, -4] 609d42c84fSVineet Gupta st.a r1, [sp, -4] 619d42c84fSVineet Gupta st.a r2, [sp, -4] 629d42c84fSVineet Gupta st.a r3, [sp, -4] 639d42c84fSVineet Gupta st.a r4, [sp, -4] 649d42c84fSVineet Gupta st.a r5, [sp, -4] 659d42c84fSVineet Gupta st.a r6, [sp, -4] 669d42c84fSVineet Gupta st.a r7, [sp, -4] 679d42c84fSVineet Gupta st.a r8, [sp, -4] 689d42c84fSVineet Gupta st.a r9, [sp, -4] 699d42c84fSVineet Gupta st.a r10, [sp, -4] 709d42c84fSVineet Gupta st.a r11, [sp, -4] 719d42c84fSVineet Gupta st.a r12, [sp, -4] 729d42c84fSVineet Gupta .endm 739d42c84fSVineet Gupta 749d42c84fSVineet Gupta /*-------------------------------------------------------------- 759d42c84fSVineet Gupta * Restore caller saved registers (scratch registers) 769d42c84fSVineet Gupta *-------------------------------------------------------------*/ 779d42c84fSVineet Gupta .macro RESTORE_CALLER_SAVED 789d42c84fSVineet Gupta ld.ab r12, [sp, 4] 799d42c84fSVineet Gupta ld.ab r11, [sp, 4] 809d42c84fSVineet Gupta ld.ab r10, [sp, 4] 819d42c84fSVineet Gupta ld.ab r9, [sp, 4] 829d42c84fSVineet Gupta ld.ab r8, [sp, 4] 839d42c84fSVineet Gupta ld.ab r7, [sp, 4] 849d42c84fSVineet Gupta ld.ab r6, [sp, 4] 859d42c84fSVineet Gupta ld.ab r5, [sp, 4] 869d42c84fSVineet Gupta ld.ab r4, [sp, 4] 879d42c84fSVineet Gupta ld.ab r3, [sp, 4] 889d42c84fSVineet Gupta ld.ab r2, [sp, 4] 899d42c84fSVineet Gupta ld.ab r1, [sp, 4] 909d42c84fSVineet Gupta ld.ab r0, [sp, 4] 919d42c84fSVineet Gupta .endm 929d42c84fSVineet Gupta 939d42c84fSVineet Gupta 949d42c84fSVineet Gupta /*-------------------------------------------------------------- 959d42c84fSVineet Gupta * Save callee saved registers (non scratch registers) ( r13 - r25 ) 969d42c84fSVineet Gupta * on kernel stack. 979d42c84fSVineet Gupta * User mode callee regs need to be saved in case of 989d42c84fSVineet Gupta * -fork and friends for replicating from parent to child 999d42c84fSVineet Gupta * -before going into do_signal( ) for ptrace/core-dump 1009d42c84fSVineet Gupta * Special case handling is required for r25 in case it is used by kernel 1019d42c84fSVineet Gupta * for caching task ptr. Low level exception/ISR save user mode r25 1029d42c84fSVineet Gupta * into task->thread.user_r25. So it needs to be retrieved from there and 1039d42c84fSVineet Gupta * saved into kernel stack with rest of callee reg-file 1049d42c84fSVineet Gupta *-------------------------------------------------------------*/ 1059d42c84fSVineet Gupta .macro SAVE_CALLEE_SAVED_USER 1069d42c84fSVineet Gupta st.a r13, [sp, -4] 1079d42c84fSVineet Gupta st.a r14, [sp, -4] 1089d42c84fSVineet Gupta st.a r15, [sp, -4] 1099d42c84fSVineet Gupta st.a r16, [sp, -4] 1109d42c84fSVineet Gupta st.a r17, [sp, -4] 1119d42c84fSVineet Gupta st.a r18, [sp, -4] 1129d42c84fSVineet Gupta st.a r19, [sp, -4] 1139d42c84fSVineet Gupta st.a r20, [sp, -4] 1149d42c84fSVineet Gupta st.a r21, [sp, -4] 1159d42c84fSVineet Gupta st.a r22, [sp, -4] 1169d42c84fSVineet Gupta st.a r23, [sp, -4] 1179d42c84fSVineet Gupta st.a r24, [sp, -4] 118080c3747SVineet Gupta 119080c3747SVineet Gupta #ifdef CONFIG_ARC_CURR_IN_REG 120080c3747SVineet Gupta ; Retrieve orig r25 and save it on stack 121080c3747SVineet Gupta ld r12, [r25, TASK_THREAD + THREAD_USER_R25] 122080c3747SVineet Gupta st.a r12, [sp, -4] 123080c3747SVineet Gupta #else 1249d42c84fSVineet Gupta st.a r25, [sp, -4] 125080c3747SVineet Gupta #endif 1269d42c84fSVineet Gupta 1279d42c84fSVineet Gupta /* move up by 1 word to "create" callee_regs->"stack_place_holder" */ 1289d42c84fSVineet Gupta sub sp, sp, 4 1299d42c84fSVineet Gupta .endm 1309d42c84fSVineet Gupta 1319d42c84fSVineet Gupta /*-------------------------------------------------------------- 1329d42c84fSVineet Gupta * Save callee saved registers (non scratch registers) ( r13 - r25 ) 1339d42c84fSVineet Gupta * kernel mode callee regs needed to be saved in case of context switch 1349d42c84fSVineet Gupta * If r25 is used for caching task pointer then that need not be saved 1359d42c84fSVineet Gupta * as it can be re-created from current task global 1369d42c84fSVineet Gupta *-------------------------------------------------------------*/ 1379d42c84fSVineet Gupta .macro SAVE_CALLEE_SAVED_KERNEL 1389d42c84fSVineet Gupta st.a r13, [sp, -4] 1399d42c84fSVineet Gupta st.a r14, [sp, -4] 1409d42c84fSVineet Gupta st.a r15, [sp, -4] 1419d42c84fSVineet Gupta st.a r16, [sp, -4] 1429d42c84fSVineet Gupta st.a r17, [sp, -4] 1439d42c84fSVineet Gupta st.a r18, [sp, -4] 1449d42c84fSVineet Gupta st.a r19, [sp, -4] 1459d42c84fSVineet Gupta st.a r20, [sp, -4] 1469d42c84fSVineet Gupta st.a r21, [sp, -4] 1479d42c84fSVineet Gupta st.a r22, [sp, -4] 1489d42c84fSVineet Gupta st.a r23, [sp, -4] 1499d42c84fSVineet Gupta st.a r24, [sp, -4] 150080c3747SVineet Gupta #ifdef CONFIG_ARC_CURR_IN_REG 151080c3747SVineet Gupta sub sp, sp, 8 152080c3747SVineet Gupta #else 1539d42c84fSVineet Gupta st.a r25, [sp, -4] 1549d42c84fSVineet Gupta sub sp, sp, 4 155080c3747SVineet Gupta #endif 1569d42c84fSVineet Gupta .endm 1579d42c84fSVineet Gupta 1589d42c84fSVineet Gupta /*-------------------------------------------------------------- 1599d42c84fSVineet Gupta * RESTORE_CALLEE_SAVED_KERNEL: 1609d42c84fSVineet Gupta * Loads callee (non scratch) Reg File by popping from Kernel mode stack. 1619d42c84fSVineet Gupta * This is reverse of SAVE_CALLEE_SAVED, 1629d42c84fSVineet Gupta * 1639d42c84fSVineet Gupta * NOTE: 1649d42c84fSVineet Gupta * Ideally this shd only be called in switch_to for loading 1659d42c84fSVineet Gupta * switched-IN task's CALLEE Reg File. 1669d42c84fSVineet Gupta * For all other cases RESTORE_CALLEE_SAVED_FAST must be used 1679d42c84fSVineet Gupta * which simply pops the stack w/o touching regs. 1689d42c84fSVineet Gupta *-------------------------------------------------------------*/ 1699d42c84fSVineet Gupta .macro RESTORE_CALLEE_SAVED_KERNEL 1709d42c84fSVineet Gupta 171080c3747SVineet Gupta 172080c3747SVineet Gupta #ifdef CONFIG_ARC_CURR_IN_REG 173080c3747SVineet Gupta add sp, sp, 8 /* skip callee_reg gutter and user r25 placeholder */ 174080c3747SVineet Gupta #else 1759d42c84fSVineet Gupta add sp, sp, 4 /* skip "callee_regs->stack_place_holder" */ 1769d42c84fSVineet Gupta ld.ab r25, [sp, 4] 177080c3747SVineet Gupta #endif 178080c3747SVineet Gupta 1799d42c84fSVineet Gupta ld.ab r24, [sp, 4] 1809d42c84fSVineet Gupta ld.ab r23, [sp, 4] 1819d42c84fSVineet Gupta ld.ab r22, [sp, 4] 1829d42c84fSVineet Gupta ld.ab r21, [sp, 4] 1839d42c84fSVineet Gupta ld.ab r20, [sp, 4] 1849d42c84fSVineet Gupta ld.ab r19, [sp, 4] 1859d42c84fSVineet Gupta ld.ab r18, [sp, 4] 1869d42c84fSVineet Gupta ld.ab r17, [sp, 4] 1879d42c84fSVineet Gupta ld.ab r16, [sp, 4] 1889d42c84fSVineet Gupta ld.ab r15, [sp, 4] 1899d42c84fSVineet Gupta ld.ab r14, [sp, 4] 1909d42c84fSVineet Gupta ld.ab r13, [sp, 4] 1919d42c84fSVineet Gupta 1929d42c84fSVineet Gupta .endm 1939d42c84fSVineet Gupta 1949d42c84fSVineet Gupta /*-------------------------------------------------------------- 195c3581039SVineet Gupta * RESTORE_CALLEE_SAVED_USER: 196c3581039SVineet Gupta * This is called after do_signal where tracer might have changed callee regs 197c3581039SVineet Gupta * thus we need to restore the reg file. 198c3581039SVineet Gupta * Special case handling is required for r25 in case it is used by kernel 199c3581039SVineet Gupta * for caching task ptr. Ptrace would have modified on-kernel-stack value of 200c3581039SVineet Gupta * r25, which needs to be shoved back into task->thread.user_r25 where from 201c3581039SVineet Gupta * Low level exception/ISR return code will retrieve to populate with rest of 202c3581039SVineet Gupta * callee reg-file. 203c3581039SVineet Gupta *-------------------------------------------------------------*/ 204c3581039SVineet Gupta .macro RESTORE_CALLEE_SAVED_USER 205c3581039SVineet Gupta 206c3581039SVineet Gupta add sp, sp, 4 /* skip "callee_regs->stack_place_holder" */ 207c3581039SVineet Gupta 208c3581039SVineet Gupta #ifdef CONFIG_ARC_CURR_IN_REG 209c3581039SVineet Gupta ld.ab r12, [sp, 4] 210c3581039SVineet Gupta st r12, [r25, TASK_THREAD + THREAD_USER_R25] 211c3581039SVineet Gupta #else 212c3581039SVineet Gupta ld.ab r25, [sp, 4] 213c3581039SVineet Gupta #endif 214c3581039SVineet Gupta 215c3581039SVineet Gupta ld.ab r24, [sp, 4] 216c3581039SVineet Gupta ld.ab r23, [sp, 4] 217c3581039SVineet Gupta ld.ab r22, [sp, 4] 218c3581039SVineet Gupta ld.ab r21, [sp, 4] 219c3581039SVineet Gupta ld.ab r20, [sp, 4] 220c3581039SVineet Gupta ld.ab r19, [sp, 4] 221c3581039SVineet Gupta ld.ab r18, [sp, 4] 222c3581039SVineet Gupta ld.ab r17, [sp, 4] 223c3581039SVineet Gupta ld.ab r16, [sp, 4] 224c3581039SVineet Gupta ld.ab r15, [sp, 4] 225c3581039SVineet Gupta ld.ab r14, [sp, 4] 226c3581039SVineet Gupta ld.ab r13, [sp, 4] 227c3581039SVineet Gupta .endm 228c3581039SVineet Gupta 229c3581039SVineet Gupta /*-------------------------------------------------------------- 2309d42c84fSVineet Gupta * Super FAST Restore callee saved regs by simply re-adjusting SP 2319d42c84fSVineet Gupta *-------------------------------------------------------------*/ 2329d42c84fSVineet Gupta .macro DISCARD_CALLEE_SAVED_USER 2339d42c84fSVineet Gupta add sp, sp, 14 * 4 2349d42c84fSVineet Gupta .endm 2359d42c84fSVineet Gupta 2369d42c84fSVineet Gupta /*-------------------------------------------------------------- 2379d42c84fSVineet Gupta * Restore User mode r25 saved in task_struct->thread.user_r25 2389d42c84fSVineet Gupta *-------------------------------------------------------------*/ 2399d42c84fSVineet Gupta .macro RESTORE_USER_R25 2409d42c84fSVineet Gupta ld r25, [r25, TASK_THREAD + THREAD_USER_R25] 2419d42c84fSVineet Gupta .endm 2429d42c84fSVineet Gupta 2439d42c84fSVineet Gupta /*------------------------------------------------------------- 2449d42c84fSVineet Gupta * given a tsk struct, get to the base of it's kernel mode stack 2459d42c84fSVineet Gupta * tsk->thread_info is really a PAGE, whose bottom hoists stack 2469d42c84fSVineet Gupta * which grows upwards towards thread_info 2479d42c84fSVineet Gupta *------------------------------------------------------------*/ 2489d42c84fSVineet Gupta 2499d42c84fSVineet Gupta .macro GET_TSK_STACK_BASE tsk, out 2509d42c84fSVineet Gupta 2519d42c84fSVineet Gupta /* Get task->thread_info (this is essentially start of a PAGE) */ 2529d42c84fSVineet Gupta ld \out, [\tsk, TASK_THREAD_INFO] 2539d42c84fSVineet Gupta 2549d42c84fSVineet Gupta /* Go to end of page where stack begins (grows upwards) */ 2559d42c84fSVineet Gupta add2 \out, \out, (THREAD_SIZE - 4)/4 /* one word GUTTER */ 2569d42c84fSVineet Gupta 2579d42c84fSVineet Gupta .endm 2589d42c84fSVineet Gupta 2599d42c84fSVineet Gupta /*-------------------------------------------------------------- 2609d42c84fSVineet Gupta * Switch to Kernel Mode stack if SP points to User Mode stack 2619d42c84fSVineet Gupta * 2629d42c84fSVineet Gupta * Entry : r9 contains pre-IRQ/exception/trap status32 2639d42c84fSVineet Gupta * Exit : SP is set to kernel mode stack pointer 264080c3747SVineet Gupta * If CURR_IN_REG, r25 set to "current" task pointer 2659d42c84fSVineet Gupta * Clobbers: r9 2669d42c84fSVineet Gupta *-------------------------------------------------------------*/ 2679d42c84fSVineet Gupta 2689d42c84fSVineet Gupta .macro SWITCH_TO_KERNEL_STK 2699d42c84fSVineet Gupta 2709d42c84fSVineet Gupta /* User Mode when this happened ? Yes: Proceed to switch stack */ 2719d42c84fSVineet Gupta bbit1 r9, STATUS_U_BIT, 88f 2729d42c84fSVineet Gupta 2739d42c84fSVineet Gupta /* OK we were already in kernel mode when this event happened, thus can 2749d42c84fSVineet Gupta * assume SP is kernel mode SP. _NO_ need to do any stack switching 2759d42c84fSVineet Gupta */ 2769d42c84fSVineet Gupta 2774788a594SVineet Gupta #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 2784788a594SVineet Gupta /* However.... 2794788a594SVineet Gupta * If Level 2 Interrupts enabled, we may end up with a corner case: 2804788a594SVineet Gupta * 1. User Task executing 2814788a594SVineet Gupta * 2. L1 IRQ taken, ISR starts (CPU auto-switched to KERNEL mode) 2824788a594SVineet Gupta * 3. But before it could switch SP from USER to KERNEL stack 2834788a594SVineet Gupta * a L2 IRQ "Interrupts" L1 2844788a594SVineet Gupta * Thay way although L2 IRQ happened in Kernel mode, stack is still 2854788a594SVineet Gupta * not switched. 2864788a594SVineet Gupta * To handle this, we may need to switch stack even if in kernel mode 2874788a594SVineet Gupta * provided SP has values in range of USER mode stack ( < 0x7000_0000 ) 2884788a594SVineet Gupta */ 2894788a594SVineet Gupta brlo sp, VMALLOC_START, 88f 2904788a594SVineet Gupta 2914788a594SVineet Gupta /* TODO: vineetg: 2924788a594SVineet Gupta * We need to be a bit more cautious here. What if a kernel bug in 2934788a594SVineet Gupta * L1 ISR, caused SP to go whaco (some small value which looks like 2944788a594SVineet Gupta * USER stk) and then we take L2 ISR. 2954788a594SVineet Gupta * Above brlo alone would treat it as a valid L1-L2 sceanrio 2964788a594SVineet Gupta * instead of shouting alound 2974788a594SVineet Gupta * The only feasible way is to make sure this L2 happened in 2984788a594SVineet Gupta * L1 prelogue ONLY i.e. ilink2 is less than a pre-set marker in 2994788a594SVineet Gupta * L1 ISR before it switches stack 3004788a594SVineet Gupta */ 3014788a594SVineet Gupta 3024788a594SVineet Gupta #endif 3034788a594SVineet Gupta 3049d42c84fSVineet Gupta /* Save Pre Intr/Exception KERNEL MODE SP on kernel stack 3059d42c84fSVineet Gupta * safe-keeping not really needed, but it keeps the epilogue code 3069d42c84fSVineet Gupta * (SP restore) simpler/uniform. 3079d42c84fSVineet Gupta */ 3089d42c84fSVineet Gupta b.d 77f 3099d42c84fSVineet Gupta 3109d42c84fSVineet Gupta st.a sp, [sp, -12] ; Make room for orig_r0 and orig_r8 3119d42c84fSVineet Gupta 3129d42c84fSVineet Gupta 88: /*------Intr/Ecxp happened in user mode, "switch" stack ------ */ 3139d42c84fSVineet Gupta 3149d42c84fSVineet Gupta GET_CURR_TASK_ON_CPU r9 3159d42c84fSVineet Gupta 316080c3747SVineet Gupta #ifdef CONFIG_ARC_CURR_IN_REG 317080c3747SVineet Gupta 318080c3747SVineet Gupta /* If current task pointer cached in r25, time to 319080c3747SVineet Gupta * -safekeep USER r25 in task->thread_struct->user_r25 320080c3747SVineet Gupta * -load r25 with current task ptr 321080c3747SVineet Gupta */ 322080c3747SVineet Gupta st.as r25, [r9, (TASK_THREAD + THREAD_USER_R25)/4] 323080c3747SVineet Gupta mov r25, r9 324080c3747SVineet Gupta #endif 325080c3747SVineet Gupta 3269d42c84fSVineet Gupta /* With current tsk in r9, get it's kernel mode stack base */ 3279d42c84fSVineet Gupta GET_TSK_STACK_BASE r9, r9 3289d42c84fSVineet Gupta 3299d42c84fSVineet Gupta #ifdef PT_REGS_CANARY 3309d42c84fSVineet Gupta st 0xabcdabcd, [r9, 0] 3319d42c84fSVineet Gupta #endif 3329d42c84fSVineet Gupta 3339d42c84fSVineet Gupta /* Save Pre Intr/Exception User SP on kernel stack */ 3349d42c84fSVineet Gupta st.a sp, [r9, -12] ; Make room for orig_r0 and orig_r8 3359d42c84fSVineet Gupta 3369d42c84fSVineet Gupta /* CAUTION: 3379d42c84fSVineet Gupta * SP should be set at the very end when we are done with everything 3389d42c84fSVineet Gupta * In case of 2 levels of interrupt we depend on value of SP to assume 3399d42c84fSVineet Gupta * that everything else is done (loading r25 etc) 3409d42c84fSVineet Gupta */ 3419d42c84fSVineet Gupta 3429d42c84fSVineet Gupta /* set SP to point to kernel mode stack */ 3439d42c84fSVineet Gupta mov sp, r9 3449d42c84fSVineet Gupta 3459d42c84fSVineet Gupta 77: /* ----- Stack Switched to kernel Mode, Now save REG FILE ----- */ 3469d42c84fSVineet Gupta 3479d42c84fSVineet Gupta .endm 3489d42c84fSVineet Gupta 3499d42c84fSVineet Gupta /*------------------------------------------------------------ 3509d42c84fSVineet Gupta * "FAKE" a rtie to return from CPU Exception context 3519d42c84fSVineet Gupta * This is to re-enable Exceptions within exception 3529d42c84fSVineet Gupta * Look at EV_ProtV to see how this is actually used 3539d42c84fSVineet Gupta *-------------------------------------------------------------*/ 3549d42c84fSVineet Gupta 3559d42c84fSVineet Gupta .macro FAKE_RET_FROM_EXCPN reg 3569d42c84fSVineet Gupta 3579d42c84fSVineet Gupta ld \reg, [sp, PT_status32] 3589d42c84fSVineet Gupta bic \reg, \reg, (STATUS_U_MASK|STATUS_DE_MASK) 3599d42c84fSVineet Gupta bset \reg, \reg, STATUS_L_BIT 3609d42c84fSVineet Gupta sr \reg, [erstatus] 3619d42c84fSVineet Gupta mov \reg, 55f 3629d42c84fSVineet Gupta sr \reg, [eret] 3639d42c84fSVineet Gupta 3649d42c84fSVineet Gupta rtie 3659d42c84fSVineet Gupta 55: 3669d42c84fSVineet Gupta .endm 3679d42c84fSVineet Gupta 3689d42c84fSVineet Gupta /* 3699d42c84fSVineet Gupta * @reg [OUT] &thread_info of "current" 3709d42c84fSVineet Gupta */ 3719d42c84fSVineet Gupta .macro GET_CURR_THR_INFO_FROM_SP reg 3729d42c84fSVineet Gupta and \reg, sp, ~(THREAD_SIZE - 1) 3739d42c84fSVineet Gupta .endm 3749d42c84fSVineet Gupta 3759d42c84fSVineet Gupta /* 3769d42c84fSVineet Gupta * @reg [OUT] thread_info->flags of "current" 3779d42c84fSVineet Gupta */ 3789d42c84fSVineet Gupta .macro GET_CURR_THR_INFO_FLAGS reg 3799d42c84fSVineet Gupta GET_CURR_THR_INFO_FROM_SP \reg 3809d42c84fSVineet Gupta ld \reg, [\reg, THREAD_INFO_FLAGS] 3819d42c84fSVineet Gupta .endm 3829d42c84fSVineet Gupta 3839d42c84fSVineet Gupta /*-------------------------------------------------------------- 3849d42c84fSVineet Gupta * For early Exception Prologue, a core reg is temporarily needed to 3859d42c84fSVineet Gupta * code the rest of prolog (stack switching). This is done by stashing 3869d42c84fSVineet Gupta * it to memory (non-SMP case) or SCRATCH0 Aux Reg (SMP). 3879d42c84fSVineet Gupta * 3889d42c84fSVineet Gupta * Before saving the full regfile - this reg is restored back, only 3899d42c84fSVineet Gupta * to be saved again on kernel mode stack, as part of ptregs. 3909d42c84fSVineet Gupta *-------------------------------------------------------------*/ 3919d42c84fSVineet Gupta .macro EXCPN_PROLOG_FREEUP_REG reg 39241195d23SVineet Gupta #ifdef CONFIG_SMP 39341195d23SVineet Gupta sr \reg, [ARC_REG_SCRATCH_DATA0] 39441195d23SVineet Gupta #else 3959d42c84fSVineet Gupta st \reg, [@ex_saved_reg1] 39641195d23SVineet Gupta #endif 3979d42c84fSVineet Gupta .endm 3989d42c84fSVineet Gupta 3999d42c84fSVineet Gupta .macro EXCPN_PROLOG_RESTORE_REG reg 40041195d23SVineet Gupta #ifdef CONFIG_SMP 40141195d23SVineet Gupta lr \reg, [ARC_REG_SCRATCH_DATA0] 40241195d23SVineet Gupta #else 4039d42c84fSVineet Gupta ld \reg, [@ex_saved_reg1] 40441195d23SVineet Gupta #endif 4059d42c84fSVineet Gupta .endm 4069d42c84fSVineet Gupta 4079d42c84fSVineet Gupta /*-------------------------------------------------------------- 4089d42c84fSVineet Gupta * Save all registers used by Exceptions (TLB Miss, Prot-V, Mem err etc) 4099d42c84fSVineet Gupta * Requires SP to be already switched to kernel mode Stack 4109d42c84fSVineet Gupta * sp points to the next free element on the stack at exit of this macro. 4119d42c84fSVineet Gupta * Registers are pushed / popped in the order defined in struct ptregs 4129d42c84fSVineet Gupta * in asm/ptrace.h 4139d42c84fSVineet Gupta * Note that syscalls are implemented via TRAP which is also a exception 4149d42c84fSVineet Gupta * from CPU's point of view 4159d42c84fSVineet Gupta *-------------------------------------------------------------*/ 4169d42c84fSVineet Gupta .macro SAVE_ALL_EXCEPTION marker 4179d42c84fSVineet Gupta 418*367f3fcdSVineet Gupta st \marker, [sp, 8] /* orig_r8 */ 4195c39c0abSVineet Gupta st r0, [sp, 4] /* orig_r0, needed only for sys calls */ 4205c39c0abSVineet Gupta 4219d42c84fSVineet Gupta /* Restore r9 used to code the early prologue */ 4229d42c84fSVineet Gupta EXCPN_PROLOG_RESTORE_REG r9 4239d42c84fSVineet Gupta 4249d42c84fSVineet Gupta SAVE_CALLER_SAVED 4259d42c84fSVineet Gupta st.a r26, [sp, -4] /* gp */ 4269d42c84fSVineet Gupta st.a fp, [sp, -4] 4279d42c84fSVineet Gupta st.a blink, [sp, -4] 4289d42c84fSVineet Gupta lr r9, [eret] 4299d42c84fSVineet Gupta st.a r9, [sp, -4] 4309d42c84fSVineet Gupta lr r9, [erstatus] 4319d42c84fSVineet Gupta st.a r9, [sp, -4] 4329d42c84fSVineet Gupta st.a lp_count, [sp, -4] 4339d42c84fSVineet Gupta lr r9, [lp_end] 4349d42c84fSVineet Gupta st.a r9, [sp, -4] 4359d42c84fSVineet Gupta lr r9, [lp_start] 4369d42c84fSVineet Gupta st.a r9, [sp, -4] 4379d42c84fSVineet Gupta lr r9, [erbta] 4389d42c84fSVineet Gupta st.a r9, [sp, -4] 4399d42c84fSVineet Gupta 4409d42c84fSVineet Gupta #ifdef PT_REGS_CANARY 4419d42c84fSVineet Gupta mov r9, 0xdeadbeef 4429d42c84fSVineet Gupta st r9, [sp, -4] 4439d42c84fSVineet Gupta #endif 4449d42c84fSVineet Gupta 4459d42c84fSVineet Gupta /* move up by 1 word to "create" pt_regs->"stack_place_holder" */ 4469d42c84fSVineet Gupta sub sp, sp, 4 4479d42c84fSVineet Gupta .endm 4489d42c84fSVineet Gupta 4499d42c84fSVineet Gupta /*-------------------------------------------------------------- 4509d42c84fSVineet Gupta * Save scratch regs for exceptions 4519d42c84fSVineet Gupta *-------------------------------------------------------------*/ 4529d42c84fSVineet Gupta .macro SAVE_ALL_SYS 4535c39c0abSVineet Gupta SAVE_ALL_EXCEPTION orig_r8_IS_EXCPN 4549d42c84fSVineet Gupta .endm 4559d42c84fSVineet Gupta 4569d42c84fSVineet Gupta /*-------------------------------------------------------------- 4579d42c84fSVineet Gupta * Save scratch regs for sys calls 4589d42c84fSVineet Gupta *-------------------------------------------------------------*/ 4599d42c84fSVineet Gupta .macro SAVE_ALL_TRAP 4605c39c0abSVineet Gupta /* 4615c39c0abSVineet Gupta * Setup pt_regs->orig_r8. 4625c39c0abSVineet Gupta * Encode syscall number (r8) in upper short word of event type (r9) 4635c39c0abSVineet Gupta * N.B. #1: This is already endian safe (see ptrace.h) 4645c39c0abSVineet Gupta * #2: Only r9 can be used as scratch as it is already clobbered 4655c39c0abSVineet Gupta * and it's contents are no longer needed by the latter part 4665c39c0abSVineet Gupta * of exception prologue 4675c39c0abSVineet Gupta */ 4685c39c0abSVineet Gupta lsl r9, r8, 16 4695c39c0abSVineet Gupta or r9, r9, orig_r8_IS_SCALL 4705c39c0abSVineet Gupta 4715c39c0abSVineet Gupta SAVE_ALL_EXCEPTION r9 4729d42c84fSVineet Gupta .endm 4739d42c84fSVineet Gupta 4749d42c84fSVineet Gupta /*-------------------------------------------------------------- 4759d42c84fSVineet Gupta * Restore all registers used by system call or Exceptions 4769d42c84fSVineet Gupta * SP should always be pointing to the next free stack element 4779d42c84fSVineet Gupta * when entering this macro. 4789d42c84fSVineet Gupta * 4799d42c84fSVineet Gupta * NOTE: 4809d42c84fSVineet Gupta * 4819d42c84fSVineet Gupta * It is recommended that lp_count/ilink1/ilink2 not be used as a dest reg 4829d42c84fSVineet Gupta * for memory load operations. If used in that way interrupts are deffered 4839d42c84fSVineet Gupta * by hardware and that is not good. 4849d42c84fSVineet Gupta *-------------------------------------------------------------*/ 4859d42c84fSVineet Gupta .macro RESTORE_ALL_SYS 4869d42c84fSVineet Gupta 4879d42c84fSVineet Gupta add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */ 4889d42c84fSVineet Gupta 4899d42c84fSVineet Gupta ld.ab r9, [sp, 4] 4909d42c84fSVineet Gupta sr r9, [erbta] 4919d42c84fSVineet Gupta ld.ab r9, [sp, 4] 4929d42c84fSVineet Gupta sr r9, [lp_start] 4939d42c84fSVineet Gupta ld.ab r9, [sp, 4] 4949d42c84fSVineet Gupta sr r9, [lp_end] 4959d42c84fSVineet Gupta ld.ab r9, [sp, 4] 4969d42c84fSVineet Gupta mov lp_count, r9 4979d42c84fSVineet Gupta ld.ab r9, [sp, 4] 4989d42c84fSVineet Gupta sr r9, [erstatus] 4999d42c84fSVineet Gupta ld.ab r9, [sp, 4] 5009d42c84fSVineet Gupta sr r9, [eret] 5019d42c84fSVineet Gupta ld.ab blink, [sp, 4] 5029d42c84fSVineet Gupta ld.ab fp, [sp, 4] 5039d42c84fSVineet Gupta ld.ab r26, [sp, 4] /* gp */ 5049d42c84fSVineet Gupta RESTORE_CALLER_SAVED 5059d42c84fSVineet Gupta 5069d42c84fSVineet Gupta ld sp, [sp] /* restore original sp */ 5079d42c84fSVineet Gupta /* orig_r0 and orig_r8 skipped automatically */ 5089d42c84fSVineet Gupta .endm 5099d42c84fSVineet Gupta 5109d42c84fSVineet Gupta 5119d42c84fSVineet Gupta /*-------------------------------------------------------------- 5129d42c84fSVineet Gupta * Save all registers used by interrupt handlers. 5139d42c84fSVineet Gupta *-------------------------------------------------------------*/ 5149d42c84fSVineet Gupta .macro SAVE_ALL_INT1 5159d42c84fSVineet Gupta 5169d42c84fSVineet Gupta /* restore original r9 , saved in int1_saved_reg 5179d42c84fSVineet Gupta * It will be saved on stack in macro: SAVE_CALLER_SAVED 5189d42c84fSVineet Gupta */ 51941195d23SVineet Gupta #ifdef CONFIG_SMP 52041195d23SVineet Gupta lr r9, [ARC_REG_SCRATCH_DATA0] 52141195d23SVineet Gupta #else 5229d42c84fSVineet Gupta ld r9, [@int1_saved_reg] 52341195d23SVineet Gupta #endif 5249d42c84fSVineet Gupta 5259d42c84fSVineet Gupta /* now we are ready to save the remaining context :) */ 5265c39c0abSVineet Gupta st orig_r8_IS_IRQ1, [sp, 8] /* Event Type */ 5279d42c84fSVineet Gupta st 0, [sp, 4] /* orig_r0 , N/A for IRQ */ 5289d42c84fSVineet Gupta SAVE_CALLER_SAVED 5299d42c84fSVineet Gupta st.a r26, [sp, -4] /* gp */ 5309d42c84fSVineet Gupta st.a fp, [sp, -4] 5319d42c84fSVineet Gupta st.a blink, [sp, -4] 5329d42c84fSVineet Gupta st.a ilink1, [sp, -4] 5339d42c84fSVineet Gupta lr r9, [status32_l1] 5349d42c84fSVineet Gupta st.a r9, [sp, -4] 5359d42c84fSVineet Gupta st.a lp_count, [sp, -4] 5369d42c84fSVineet Gupta lr r9, [lp_end] 5379d42c84fSVineet Gupta st.a r9, [sp, -4] 5389d42c84fSVineet Gupta lr r9, [lp_start] 5399d42c84fSVineet Gupta st.a r9, [sp, -4] 5409d42c84fSVineet Gupta lr r9, [bta_l1] 5419d42c84fSVineet Gupta st.a r9, [sp, -4] 5429d42c84fSVineet Gupta 5439d42c84fSVineet Gupta #ifdef PT_REGS_CANARY 5449d42c84fSVineet Gupta mov r9, 0xdeadbee1 5459d42c84fSVineet Gupta st r9, [sp, -4] 5469d42c84fSVineet Gupta #endif 5479d42c84fSVineet Gupta /* move up by 1 word to "create" pt_regs->"stack_place_holder" */ 5489d42c84fSVineet Gupta sub sp, sp, 4 5499d42c84fSVineet Gupta .endm 5509d42c84fSVineet Gupta 5514788a594SVineet Gupta .macro SAVE_ALL_INT2 5524788a594SVineet Gupta 5534788a594SVineet Gupta /* TODO-vineetg: SMP we can't use global nor can we use 5544788a594SVineet Gupta * SCRATCH0 as we do for int1 because while int1 is using 5554788a594SVineet Gupta * it, int2 can come 5564788a594SVineet Gupta */ 5574788a594SVineet Gupta /* retsore original r9 , saved in sys_saved_r9 */ 5584788a594SVineet Gupta ld r9, [@int2_saved_reg] 5594788a594SVineet Gupta 5604788a594SVineet Gupta /* now we are ready to save the remaining context :) */ 5614788a594SVineet Gupta st orig_r8_IS_IRQ2, [sp, 8] /* Event Type */ 5624788a594SVineet Gupta st 0, [sp, 4] /* orig_r0 , N/A for IRQ */ 5634788a594SVineet Gupta SAVE_CALLER_SAVED 5644788a594SVineet Gupta st.a r26, [sp, -4] /* gp */ 5654788a594SVineet Gupta st.a fp, [sp, -4] 5664788a594SVineet Gupta st.a blink, [sp, -4] 5674788a594SVineet Gupta st.a ilink2, [sp, -4] 5684788a594SVineet Gupta lr r9, [status32_l2] 5694788a594SVineet Gupta st.a r9, [sp, -4] 5704788a594SVineet Gupta st.a lp_count, [sp, -4] 5714788a594SVineet Gupta lr r9, [lp_end] 5724788a594SVineet Gupta st.a r9, [sp, -4] 5734788a594SVineet Gupta lr r9, [lp_start] 5744788a594SVineet Gupta st.a r9, [sp, -4] 5754788a594SVineet Gupta lr r9, [bta_l2] 5764788a594SVineet Gupta st.a r9, [sp, -4] 5774788a594SVineet Gupta 5784788a594SVineet Gupta #ifdef PT_REGS_CANARY 5794788a594SVineet Gupta mov r9, 0xdeadbee2 5804788a594SVineet Gupta st r9, [sp, -4] 5814788a594SVineet Gupta #endif 5824788a594SVineet Gupta 5834788a594SVineet Gupta /* move up by 1 word to "create" pt_regs->"stack_place_holder" */ 5844788a594SVineet Gupta sub sp, sp, 4 5854788a594SVineet Gupta .endm 5864788a594SVineet Gupta 5879d42c84fSVineet Gupta /*-------------------------------------------------------------- 5889d42c84fSVineet Gupta * Restore all registers used by interrupt handlers. 5899d42c84fSVineet Gupta * 5909d42c84fSVineet Gupta * NOTE: 5919d42c84fSVineet Gupta * 5929d42c84fSVineet Gupta * It is recommended that lp_count/ilink1/ilink2 not be used as a dest reg 5939d42c84fSVineet Gupta * for memory load operations. If used in that way interrupts are deffered 5949d42c84fSVineet Gupta * by hardware and that is not good. 5959d42c84fSVineet Gupta *-------------------------------------------------------------*/ 5969d42c84fSVineet Gupta 5979d42c84fSVineet Gupta .macro RESTORE_ALL_INT1 5989d42c84fSVineet Gupta add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */ 5999d42c84fSVineet Gupta 6009d42c84fSVineet Gupta ld.ab r9, [sp, 4] /* Actual reg file */ 6019d42c84fSVineet Gupta sr r9, [bta_l1] 6029d42c84fSVineet Gupta ld.ab r9, [sp, 4] 6039d42c84fSVineet Gupta sr r9, [lp_start] 6049d42c84fSVineet Gupta ld.ab r9, [sp, 4] 6059d42c84fSVineet Gupta sr r9, [lp_end] 6069d42c84fSVineet Gupta ld.ab r9, [sp, 4] 6079d42c84fSVineet Gupta mov lp_count, r9 6089d42c84fSVineet Gupta ld.ab r9, [sp, 4] 6099d42c84fSVineet Gupta sr r9, [status32_l1] 6109d42c84fSVineet Gupta ld.ab r9, [sp, 4] 6119d42c84fSVineet Gupta mov ilink1, r9 6129d42c84fSVineet Gupta ld.ab blink, [sp, 4] 6139d42c84fSVineet Gupta ld.ab fp, [sp, 4] 6149d42c84fSVineet Gupta ld.ab r26, [sp, 4] /* gp */ 6159d42c84fSVineet Gupta RESTORE_CALLER_SAVED 6169d42c84fSVineet Gupta 6179d42c84fSVineet Gupta ld sp, [sp] /* restore original sp */ 6189d42c84fSVineet Gupta /* orig_r0 and orig_r8 skipped automatically */ 6199d42c84fSVineet Gupta .endm 6209d42c84fSVineet Gupta 6214788a594SVineet Gupta .macro RESTORE_ALL_INT2 6224788a594SVineet Gupta add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */ 6234788a594SVineet Gupta 6244788a594SVineet Gupta ld.ab r9, [sp, 4] 6254788a594SVineet Gupta sr r9, [bta_l2] 6264788a594SVineet Gupta ld.ab r9, [sp, 4] 6274788a594SVineet Gupta sr r9, [lp_start] 6284788a594SVineet Gupta ld.ab r9, [sp, 4] 6294788a594SVineet Gupta sr r9, [lp_end] 6304788a594SVineet Gupta ld.ab r9, [sp, 4] 6314788a594SVineet Gupta mov lp_count, r9 6324788a594SVineet Gupta ld.ab r9, [sp, 4] 6334788a594SVineet Gupta sr r9, [status32_l2] 6344788a594SVineet Gupta ld.ab r9, [sp, 4] 6354788a594SVineet Gupta mov ilink2, r9 6364788a594SVineet Gupta ld.ab blink, [sp, 4] 6374788a594SVineet Gupta ld.ab fp, [sp, 4] 6384788a594SVineet Gupta ld.ab r26, [sp, 4] /* gp */ 6394788a594SVineet Gupta RESTORE_CALLER_SAVED 6404788a594SVineet Gupta 6414788a594SVineet Gupta ld sp, [sp] /* restore original sp */ 6424788a594SVineet Gupta /* orig_r0 and orig_r8 skipped automatically */ 6434788a594SVineet Gupta 6444788a594SVineet Gupta .endm 6454788a594SVineet Gupta 6464788a594SVineet Gupta 6479d42c84fSVineet Gupta /* Get CPU-ID of this core */ 6489d42c84fSVineet Gupta .macro GET_CPU_ID reg 6499d42c84fSVineet Gupta lr \reg, [identity] 6509d42c84fSVineet Gupta lsr \reg, \reg, 8 6519d42c84fSVineet Gupta bmsk \reg, \reg, 7 6529d42c84fSVineet Gupta .endm 6539d42c84fSVineet Gupta 65441195d23SVineet Gupta #ifdef CONFIG_SMP 65541195d23SVineet Gupta 65641195d23SVineet Gupta /*------------------------------------------------- 65741195d23SVineet Gupta * Retrieve the current running task on this CPU 65841195d23SVineet Gupta * 1. Determine curr CPU id. 65941195d23SVineet Gupta * 2. Use it to index into _current_task[ ] 66041195d23SVineet Gupta */ 66141195d23SVineet Gupta .macro GET_CURR_TASK_ON_CPU reg 66241195d23SVineet Gupta GET_CPU_ID \reg 66341195d23SVineet Gupta ld.as \reg, [@_current_task, \reg] 66441195d23SVineet Gupta .endm 66541195d23SVineet Gupta 66641195d23SVineet Gupta /*------------------------------------------------- 66741195d23SVineet Gupta * Save a new task as the "current" task on this CPU 66841195d23SVineet Gupta * 1. Determine curr CPU id. 66941195d23SVineet Gupta * 2. Use it to index into _current_task[ ] 67041195d23SVineet Gupta * 67141195d23SVineet Gupta * Coded differently than GET_CURR_TASK_ON_CPU (which uses LD.AS) 67241195d23SVineet Gupta * because ST r0, [r1, offset] can ONLY have s9 @offset 67341195d23SVineet Gupta * while LD can take s9 (4 byte insn) or LIMM (8 byte insn) 67441195d23SVineet Gupta */ 67541195d23SVineet Gupta 67641195d23SVineet Gupta .macro SET_CURR_TASK_ON_CPU tsk, tmp 67741195d23SVineet Gupta GET_CPU_ID \tmp 67841195d23SVineet Gupta add2 \tmp, @_current_task, \tmp 67941195d23SVineet Gupta st \tsk, [\tmp] 68041195d23SVineet Gupta #ifdef CONFIG_ARC_CURR_IN_REG 68141195d23SVineet Gupta mov r25, \tsk 68241195d23SVineet Gupta #endif 68341195d23SVineet Gupta 68441195d23SVineet Gupta .endm 68541195d23SVineet Gupta 68641195d23SVineet Gupta 68741195d23SVineet Gupta #else /* Uniprocessor implementation of macros */ 68841195d23SVineet Gupta 6899d42c84fSVineet Gupta .macro GET_CURR_TASK_ON_CPU reg 6909d42c84fSVineet Gupta ld \reg, [@_current_task] 6919d42c84fSVineet Gupta .endm 6929d42c84fSVineet Gupta 6939d42c84fSVineet Gupta .macro SET_CURR_TASK_ON_CPU tsk, tmp 6949d42c84fSVineet Gupta st \tsk, [@_current_task] 695080c3747SVineet Gupta #ifdef CONFIG_ARC_CURR_IN_REG 696080c3747SVineet Gupta mov r25, \tsk 697080c3747SVineet Gupta #endif 6989d42c84fSVineet Gupta .endm 6999d42c84fSVineet Gupta 70041195d23SVineet Gupta #endif /* SMP / UNI */ 70141195d23SVineet Gupta 7029d42c84fSVineet Gupta /* ------------------------------------------------------------------ 7039d42c84fSVineet Gupta * Get the ptr to some field of Current Task at @off in task struct 704080c3747SVineet Gupta * -Uses r25 for Current task ptr if that is enabled 7059d42c84fSVineet Gupta */ 7069d42c84fSVineet Gupta 707080c3747SVineet Gupta #ifdef CONFIG_ARC_CURR_IN_REG 708080c3747SVineet Gupta 709080c3747SVineet Gupta .macro GET_CURR_TASK_FIELD_PTR off, reg 710080c3747SVineet Gupta add \reg, r25, \off 711080c3747SVineet Gupta .endm 712080c3747SVineet Gupta 713080c3747SVineet Gupta #else 714080c3747SVineet Gupta 7159d42c84fSVineet Gupta .macro GET_CURR_TASK_FIELD_PTR off, reg 7169d42c84fSVineet Gupta GET_CURR_TASK_ON_CPU \reg 7179d42c84fSVineet Gupta add \reg, \reg, \off 7189d42c84fSVineet Gupta .endm 7199d42c84fSVineet Gupta 720080c3747SVineet Gupta #endif /* CONFIG_ARC_CURR_IN_REG */ 721080c3747SVineet Gupta 7229d42c84fSVineet Gupta #endif /* __ASSEMBLY__ */ 7239d42c84fSVineet Gupta 7249d42c84fSVineet Gupta #endif /* __ASM_ARC_ENTRY_H */ 725