Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Heiko Carstens | 54dfe5d | 2006-02-01 03:06:38 -0800 | [diff] [blame] | 2 | * arch/s390/kernel/entry64.S |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * S390 low-level entry points. |
| 4 | * |
Carsten Otte | cd3b70f | 2010-05-17 10:00:04 +0200 | [diff] [blame^] | 5 | * Copyright (C) IBM Corp. 1999,2010 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 7 | * Hartmut Penner (hp@de.ibm.com), |
| 8 | * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 9 | * Heiko Carstens <heiko.carstens@de.ibm.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/linkage.h> |
Heiko Carstens | 2bc89b5 | 2008-02-05 16:50:40 +0100 | [diff] [blame] | 13 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <asm/cache.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <asm/errno.h> |
| 16 | #include <asm/ptrace.h> |
| 17 | #include <asm/thread_info.h> |
Sam Ravnborg | 0013a85 | 2005-09-09 20:57:26 +0200 | [diff] [blame] | 18 | #include <asm/asm-offsets.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #include <asm/unistd.h> |
| 20 | #include <asm/page.h> |
| 21 | |
| 22 | /* |
| 23 | * Stack layout for the system_call stack entry. |
| 24 | * The first few entries are identical to the user_regs_struct. |
| 25 | */ |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 26 | SP_PTREGS = STACK_FRAME_OVERHEAD |
| 27 | SP_ARGS = STACK_FRAME_OVERHEAD + __PT_ARGS |
| 28 | SP_PSW = STACK_FRAME_OVERHEAD + __PT_PSW |
| 29 | SP_R0 = STACK_FRAME_OVERHEAD + __PT_GPRS |
| 30 | SP_R1 = STACK_FRAME_OVERHEAD + __PT_GPRS + 8 |
| 31 | SP_R2 = STACK_FRAME_OVERHEAD + __PT_GPRS + 16 |
| 32 | SP_R3 = STACK_FRAME_OVERHEAD + __PT_GPRS + 24 |
| 33 | SP_R4 = STACK_FRAME_OVERHEAD + __PT_GPRS + 32 |
| 34 | SP_R5 = STACK_FRAME_OVERHEAD + __PT_GPRS + 40 |
| 35 | SP_R6 = STACK_FRAME_OVERHEAD + __PT_GPRS + 48 |
| 36 | SP_R7 = STACK_FRAME_OVERHEAD + __PT_GPRS + 56 |
| 37 | SP_R8 = STACK_FRAME_OVERHEAD + __PT_GPRS + 64 |
| 38 | SP_R9 = STACK_FRAME_OVERHEAD + __PT_GPRS + 72 |
| 39 | SP_R10 = STACK_FRAME_OVERHEAD + __PT_GPRS + 80 |
| 40 | SP_R11 = STACK_FRAME_OVERHEAD + __PT_GPRS + 88 |
| 41 | SP_R12 = STACK_FRAME_OVERHEAD + __PT_GPRS + 96 |
| 42 | SP_R13 = STACK_FRAME_OVERHEAD + __PT_GPRS + 104 |
| 43 | SP_R14 = STACK_FRAME_OVERHEAD + __PT_GPRS + 112 |
| 44 | SP_R15 = STACK_FRAME_OVERHEAD + __PT_GPRS + 120 |
| 45 | SP_ORIG_R2 = STACK_FRAME_OVERHEAD + __PT_ORIG_GPR2 |
| 46 | SP_ILC = STACK_FRAME_OVERHEAD + __PT_ILC |
Martin Schwidefsky | 59da213 | 2008-11-27 11:05:55 +0100 | [diff] [blame] | 47 | SP_SVCNR = STACK_FRAME_OVERHEAD + __PT_SVCNR |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 48 | SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 50 | STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER |
| 51 | STACK_SIZE = 1 << STACK_SHIFT |
| 52 | |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 53 | _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ |
Heiko Carstens | 54dfe5d | 2006-02-01 03:06:38 -0800 | [diff] [blame] | 54 | _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 55 | _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ |
Heiko Carstens | 54dfe5d | 2006-02-01 03:06:38 -0800 | [diff] [blame] | 56 | _TIF_MCCK_PENDING) |
Heiko Carstens | 9bf1226 | 2009-06-12 10:26:47 +0200 | [diff] [blame] | 57 | _TIF_SYSCALL = (_TIF_SYSCALL_TRACE>>8 | _TIF_SYSCALL_AUDIT>>8 | \ |
Josh Stone | 6670000 | 2009-08-24 14:43:11 -0700 | [diff] [blame] | 58 | _TIF_SECCOMP>>8 | _TIF_SYSCALL_TRACEPOINT>>8) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
| 60 | #define BASED(name) name-system_call(%r13) |
| 61 | |
Carsten Otte | cd3b70f | 2010-05-17 10:00:04 +0200 | [diff] [blame^] | 62 | .macro HANDLE_SIE_INTERCEPT |
| 63 | #if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) |
| 64 | lg %r3,__LC_SIE_HOOK |
| 65 | ltgr %r3,%r3 |
| 66 | jz 0f |
| 67 | basr %r14,%r3 |
| 68 | 0: |
| 69 | #endif |
| 70 | .endm |
| 71 | |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 72 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 73 | .macro TRACE_IRQS_ON |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 74 | basr %r2,%r0 |
| 75 | brasl %r14,trace_hardirqs_on_caller |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 76 | .endm |
| 77 | |
| 78 | .macro TRACE_IRQS_OFF |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 79 | basr %r2,%r0 |
| 80 | brasl %r14,trace_hardirqs_off_caller |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 81 | .endm |
Heiko Carstens | 523b44c | 2007-10-11 22:11:12 +0200 | [diff] [blame] | 82 | |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 83 | .macro TRACE_IRQS_CHECK_ON |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 84 | tm SP_PSW(%r15),0x03 # irqs enabled? |
| 85 | jz 0f |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 86 | TRACE_IRQS_ON |
| 87 | 0: |
| 88 | .endm |
| 89 | |
| 90 | .macro TRACE_IRQS_CHECK_OFF |
| 91 | tm SP_PSW(%r15),0x03 # irqs enabled? |
| 92 | jz 0f |
| 93 | TRACE_IRQS_OFF |
| 94 | 0: |
Heiko Carstens | 523b44c | 2007-10-11 22:11:12 +0200 | [diff] [blame] | 95 | .endm |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 96 | #else |
| 97 | #define TRACE_IRQS_ON |
| 98 | #define TRACE_IRQS_OFF |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 99 | #define TRACE_IRQS_CHECK_ON |
| 100 | #define TRACE_IRQS_CHECK_OFF |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 101 | #endif |
| 102 | |
| 103 | #ifdef CONFIG_LOCKDEP |
| 104 | .macro LOCKDEP_SYS_EXIT |
| 105 | tm SP_PSW+1(%r15),0x01 # returning to user ? |
| 106 | jz 0f |
| 107 | brasl %r14,lockdep_sys_exit |
| 108 | 0: |
| 109 | .endm |
| 110 | #else |
Heiko Carstens | 523b44c | 2007-10-11 22:11:12 +0200 | [diff] [blame] | 111 | #define LOCKDEP_SYS_EXIT |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 112 | #endif |
| 113 | |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 114 | .macro UPDATE_VTIME lc_from,lc_to,lc_sum |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | lg %r10,\lc_from |
| 116 | slg %r10,\lc_to |
| 117 | alg %r10,\lc_sum |
| 118 | stg %r10,\lc_sum |
| 119 | .endm |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | |
| 121 | /* |
| 122 | * Register usage in interrupt handlers: |
| 123 | * R9 - pointer to current task structure |
| 124 | * R13 - pointer to literal pool |
| 125 | * R14 - return register for function calls |
| 126 | * R15 - kernel stack pointer |
| 127 | */ |
| 128 | |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 129 | .macro SAVE_ALL_BASE savearea |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | stmg %r12,%r15,\savearea |
| 131 | larl %r13,system_call |
| 132 | .endm |
| 133 | |
Martin Schwidefsky | 987ad70 | 2007-07-10 11:24:18 +0200 | [diff] [blame] | 134 | .macro SAVE_ALL_SVC psworg,savearea |
| 135 | la %r12,\psworg |
| 136 | lg %r15,__LC_KERNEL_STACK # problem state -> load ksp |
| 137 | .endm |
| 138 | |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 139 | .macro SAVE_ALL_SYNC psworg,savearea |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | la %r12,\psworg |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | tm \psworg+1,0x01 # test problem state bit |
| 142 | jz 2f # skip stack setup save |
| 143 | lg %r15,__LC_KERNEL_STACK # problem state -> load ksp |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 144 | #ifdef CONFIG_CHECK_STACK |
| 145 | j 3f |
| 146 | 2: tml %r15,STACK_SIZE - CONFIG_STACK_GUARD |
| 147 | jz stack_overflow |
| 148 | 3: |
| 149 | #endif |
| 150 | 2: |
| 151 | .endm |
| 152 | |
| 153 | .macro SAVE_ALL_ASYNC psworg,savearea |
| 154 | la %r12,\psworg |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | tm \psworg+1,0x01 # test problem state bit |
| 156 | jnz 1f # from user -> load kernel stack |
| 157 | clc \psworg+8(8),BASED(.Lcritical_end) |
| 158 | jhe 0f |
| 159 | clc \psworg+8(8),BASED(.Lcritical_start) |
| 160 | jl 0f |
| 161 | brasl %r14,cleanup_critical |
Peter Oberparleiter | 6add9f7 | 2005-09-16 19:27:42 -0700 | [diff] [blame] | 162 | tm 1(%r12),0x01 # retest problem state after cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | jnz 1f |
| 164 | 0: lg %r14,__LC_ASYNC_STACK # are we already on the async. stack ? |
| 165 | slgr %r14,%r15 |
| 166 | srag %r14,%r14,STACK_SHIFT |
| 167 | jz 2f |
| 168 | 1: lg %r15,__LC_ASYNC_STACK # load async stack |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | #ifdef CONFIG_CHECK_STACK |
| 170 | j 3f |
| 171 | 2: tml %r15,STACK_SIZE - CONFIG_STACK_GUARD |
| 172 | jz stack_overflow |
| 173 | 3: |
| 174 | #endif |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 175 | 2: |
| 176 | .endm |
| 177 | |
| 178 | .macro CREATE_STACK_FRAME psworg,savearea |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 179 | aghi %r15,-SP_SIZE # make room for registers & psw |
| 180 | mvc SP_PSW(16,%r15),0(%r12) # move user PSW to stack |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | stg %r2,SP_ORIG_R2(%r15) # store original content of gpr 2 |
Martin Schwidefsky | 59da213 | 2008-11-27 11:05:55 +0100 | [diff] [blame] | 182 | icm %r12,3,__LC_SVC_ILC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | stmg %r0,%r11,SP_R0(%r15) # store gprs %r0-%r11 to kernel stack |
Martin Schwidefsky | 59da213 | 2008-11-27 11:05:55 +0100 | [diff] [blame] | 184 | st %r12,SP_SVCNR(%r15) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | mvc SP_R12(32,%r15),\savearea # move %r12-%r15 to stack |
| 186 | la %r12,0 |
| 187 | stg %r12,__SF_BACKCHAIN(%r15) |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 188 | .endm |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 190 | .macro RESTORE_ALL psworg,sync |
| 191 | mvc \psworg(16),SP_PSW(%r15) # move user PSW to lowcore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | .if !\sync |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 193 | ni \psworg+1,0xfd # clear wait state bit |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | .endif |
Martin Schwidefsky | c742b31 | 2008-12-31 15:11:42 +0100 | [diff] [blame] | 195 | lg %r14,__LC_VDSO_PER_CPU |
| 196 | lmg %r0,%r13,SP_R0(%r15) # load gprs 0-13 of user |
Martin Schwidefsky | c185b78 | 2008-12-25 13:39:25 +0100 | [diff] [blame] | 197 | stpt __LC_EXIT_TIMER |
Martin Schwidefsky | c742b31 | 2008-12-31 15:11:42 +0100 | [diff] [blame] | 198 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER |
| 199 | lmg %r14,%r15,SP_R14(%r15) # load grps 14-15 of user |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 200 | lpswe \psworg # back to caller |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | .endm |
| 202 | |
| 203 | /* |
| 204 | * Scheduler resume function, called by switch_to |
| 205 | * gpr2 = (task_struct *) prev |
| 206 | * gpr3 = (task_struct *) next |
| 207 | * Returns: |
| 208 | * gpr2 = prev |
| 209 | */ |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 210 | .globl __switch_to |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | __switch_to: |
| 212 | tm __THREAD_per+4(%r3),0xe8 # is the new process using per ? |
| 213 | jz __switch_to_noper # if not we're fine |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 214 | stctg %c9,%c11,__SF_EMPTY(%r15)# We are using per stuff |
| 215 | clc __THREAD_per(24,%r3),__SF_EMPTY(%r15) |
| 216 | je __switch_to_noper # we got away without bashing TLB's |
| 217 | lctlg %c9,%c11,__THREAD_per(%r3) # Nope we didn't |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | __switch_to_noper: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 219 | lg %r4,__THREAD_info(%r2) # get thread_info of prev |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 220 | tm __TI_flags+7(%r4),_TIF_MCCK_PENDING # machine check pending? |
| 221 | jz __switch_to_no_mcck |
| 222 | ni __TI_flags+7(%r4),255-_TIF_MCCK_PENDING # clear flag in prev |
| 223 | lg %r4,__THREAD_info(%r3) # get thread_info of next |
| 224 | oi __TI_flags+7(%r4),_TIF_MCCK_PENDING # set it in next |
| 225 | __switch_to_no_mcck: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 226 | stmg %r6,%r15,__SF_GPRS(%r15)# store __switch_to registers of prev task |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | stg %r15,__THREAD_ksp(%r2) # store kernel stack to prev->tss.ksp |
| 228 | lg %r15,__THREAD_ksp(%r3) # load kernel stack from next->tss.ksp |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 229 | lmg %r6,%r15,__SF_GPRS(%r15)# load __switch_to registers of next task |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | stg %r3,__LC_CURRENT # __LC_CURRENT = current task struct |
| 231 | lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4 |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 232 | lg %r3,__THREAD_info(%r3) # load thread_info from task struct |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | stg %r3,__LC_THREAD_INFO |
| 234 | aghi %r3,STACK_SIZE |
| 235 | stg %r3,__LC_KERNEL_STACK # __LC_KERNEL_STACK = new kernel stack |
| 236 | br %r14 |
| 237 | |
| 238 | __critical_start: |
| 239 | /* |
| 240 | * SVC interrupt handler routine. System calls are synchronous events and |
| 241 | * are executed with interrupts enabled. |
| 242 | */ |
| 243 | |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 244 | .globl system_call |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | system_call: |
Martin Schwidefsky | c185b78 | 2008-12-25 13:39:25 +0100 | [diff] [blame] | 246 | stpt __LC_SYNC_ENTER_TIMER |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | sysc_saveall: |
| 248 | SAVE_ALL_BASE __LC_SAVE_AREA |
Martin Schwidefsky | 987ad70 | 2007-07-10 11:24:18 +0200 | [diff] [blame] | 249 | SAVE_ALL_SVC __LC_SVC_OLD_PSW,__LC_SAVE_AREA |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 250 | CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA |
| 251 | llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | sysc_vtime: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER |
| 254 | sysc_stime: |
| 255 | UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER |
| 256 | sysc_update: |
| 257 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | sysc_do_svc: |
| 259 | lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct |
Martin Schwidefsky | 59da213 | 2008-11-27 11:05:55 +0100 | [diff] [blame] | 260 | ltgr %r7,%r7 # test for svc 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | jnz sysc_nr_ok |
| 262 | # svc 0: system call number in %r1 |
| 263 | cl %r1,BASED(.Lnr_syscalls) |
| 264 | jnl sysc_nr_ok |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 265 | lgfr %r7,%r1 # clear high word in r1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | sysc_nr_ok: |
| 267 | mvc SP_ARGS(8,%r15),SP_R7(%r15) |
| 268 | sysc_do_restart: |
Martin Schwidefsky | 59da213 | 2008-11-27 11:05:55 +0100 | [diff] [blame] | 269 | sth %r7,SP_SVCNR(%r15) |
| 270 | sllg %r7,%r7,2 # svc number * 4 |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 271 | larl %r10,sys_call_table |
Martin Schwidefsky | 347a8dc | 2006-01-06 00:19:28 -0800 | [diff] [blame] | 272 | #ifdef CONFIG_COMPAT |
Heiko Carstens | c563077 | 2005-09-03 15:58:04 -0700 | [diff] [blame] | 273 | tm __TI_flags+5(%r9),(_TIF_31BIT>>16) # running in 31 bit mode ? |
| 274 | jno sysc_noemu |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 275 | larl %r10,sys_call_table_emu # use 31 bit emulation system calls |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | sysc_noemu: |
| 277 | #endif |
Heiko Carstens | bcf5cef | 2009-06-12 10:26:26 +0200 | [diff] [blame] | 278 | tm __TI_flags+6(%r9),_TIF_SYSCALL |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 279 | lgf %r8,0(%r7,%r10) # load address of system call routine |
| 280 | jnz sysc_tracesys |
| 281 | basr %r14,%r8 # call sys_xxxx |
| 282 | stg %r2,SP_R2(%r15) # store return value (change R2 on stack) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
| 284 | sysc_return: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 285 | LOCKDEP_SYS_EXIT |
| 286 | sysc_tif: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | tm __TI_flags+7(%r9),_TIF_WORK_SVC |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 288 | jnz sysc_work # there is work to do (signals etc.) |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 289 | sysc_restore: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 290 | RESTORE_ALL __LC_RETURN_PSW,1 |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 291 | sysc_done: |
| 292 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | # |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 294 | # There is work to do, but first we need to check if we return to userspace. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | # |
| 296 | sysc_work: |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 297 | tm SP_PSW+1(%r15),0x01 # returning to user ? |
| 298 | jno sysc_restore |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 299 | |
| 300 | # |
| 301 | # One of the work bits is on. Find out which one. |
| 302 | # |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 303 | sysc_work_tif: |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 304 | tm __TI_flags+7(%r9),_TIF_MCCK_PENDING |
| 305 | jo sysc_mcck_pending |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | tm __TI_flags+7(%r9),_TIF_NEED_RESCHED |
| 307 | jo sysc_reschedule |
Roland McGrath | 02a029b | 2008-04-30 00:53:08 -0700 | [diff] [blame] | 308 | tm __TI_flags+7(%r9),_TIF_SIGPENDING |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 309 | jo sysc_sigpending |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 310 | tm __TI_flags+7(%r9),_TIF_NOTIFY_RESUME |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 311 | jo sysc_notify_resume |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | tm __TI_flags+7(%r9),_TIF_RESTART_SVC |
| 313 | jo sysc_restart |
| 314 | tm __TI_flags+7(%r9),_TIF_SINGLE_STEP |
| 315 | jo sysc_singlestep |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 316 | j sysc_return # beware of critical section cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | |
| 318 | # |
| 319 | # _TIF_NEED_RESCHED is set, call schedule |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 320 | # |
| 321 | sysc_reschedule: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 322 | larl %r14,sysc_return |
| 323 | jg schedule # return point is sysc_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | |
| 325 | # |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 326 | # _TIF_MCCK_PENDING is set, call handler |
| 327 | # |
| 328 | sysc_mcck_pending: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 329 | larl %r14,sysc_return |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 330 | jg s390_handle_mcck # TIF bit will be cleared by handler |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 331 | |
| 332 | # |
Roland McGrath | 02a029b | 2008-04-30 00:53:08 -0700 | [diff] [blame] | 333 | # _TIF_SIGPENDING is set, call do_signal |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | # |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 335 | sysc_sigpending: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | ni __TI_flags+7(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 337 | la %r2,SP_PTREGS(%r15) # load pt_regs |
| 338 | brasl %r14,do_signal # call do_signal |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | tm __TI_flags+7(%r9),_TIF_RESTART_SVC |
| 340 | jo sysc_restart |
| 341 | tm __TI_flags+7(%r9),_TIF_SINGLE_STEP |
| 342 | jo sysc_singlestep |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 343 | j sysc_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | |
| 345 | # |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 346 | # _TIF_NOTIFY_RESUME is set, call do_notify_resume |
| 347 | # |
| 348 | sysc_notify_resume: |
| 349 | la %r2,SP_PTREGS(%r15) # load pt_regs |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 350 | larl %r14,sysc_return |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 351 | jg do_notify_resume # call do_notify_resume |
| 352 | |
| 353 | # |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | # _TIF_RESTART_SVC is set, set up registers and restart svc |
| 355 | # |
| 356 | sysc_restart: |
| 357 | ni __TI_flags+7(%r9),255-_TIF_RESTART_SVC # clear TIF_RESTART_SVC |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 358 | lg %r7,SP_R2(%r15) # load new svc number |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | mvc SP_R2(8,%r15),SP_ORIG_R2(%r15) # restore first argument |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 360 | lmg %r2,%r6,SP_R2(%r15) # load svc arguments |
| 361 | j sysc_do_restart # restart svc |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | |
| 363 | # |
| 364 | # _TIF_SINGLE_STEP is set, call do_single_step |
| 365 | # |
| 366 | sysc_singlestep: |
Martin Schwidefsky | 59da213 | 2008-11-27 11:05:55 +0100 | [diff] [blame] | 367 | ni __TI_flags+7(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP |
| 368 | xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | la %r2,SP_PTREGS(%r15) # address of register-save area |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 370 | larl %r14,sysc_return # load adr. of system return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | jg do_single_step # branch to do_sigtrap |
| 372 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | # |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 374 | # call tracehook_report_syscall_entry/tracehook_report_syscall_exit before |
| 375 | # and after the system call |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | # |
| 377 | sysc_tracesys: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 378 | la %r2,SP_PTREGS(%r15) # load pt_regs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | la %r3,0 |
| 380 | srl %r7,2 |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 381 | stg %r7,SP_R2(%r15) |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 382 | brasl %r14,do_syscall_trace_enter |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | lghi %r0,NR_syscalls |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 384 | clgr %r0,%r2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | jnh sysc_tracenogo |
Martin Schwidefsky | 59da213 | 2008-11-27 11:05:55 +0100 | [diff] [blame] | 386 | sllg %r7,%r2,2 # svc number *4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | lgf %r8,0(%r7,%r10) |
| 388 | sysc_tracego: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 389 | lmg %r3,%r6,SP_R3(%r15) |
| 390 | lg %r2,SP_ORIG_R2(%r15) |
| 391 | basr %r14,%r8 # call sys_xxx |
| 392 | stg %r2,SP_R2(%r15) # store return value |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | sysc_tracenogo: |
Heiko Carstens | bcf5cef | 2009-06-12 10:26:26 +0200 | [diff] [blame] | 394 | tm __TI_flags+6(%r9),_TIF_SYSCALL |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 395 | jz sysc_return |
| 396 | la %r2,SP_PTREGS(%r15) # load pt_regs |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 397 | larl %r14,sysc_return # return point is sysc_return |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 398 | jg do_syscall_trace_exit |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | |
| 400 | # |
| 401 | # a new process exits the kernel with ret_from_fork |
| 402 | # |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 403 | .globl ret_from_fork |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | ret_from_fork: |
| 405 | lg %r13,__LC_SVC_NEW_PSW+8 |
| 406 | lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct |
| 407 | tm SP_PSW+1(%r15),0x01 # forking a kernel thread ? |
| 408 | jo 0f |
| 409 | stg %r15,SP_R15(%r15) # store stack pointer for new kthread |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 410 | 0: brasl %r14,schedule_tail |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 411 | TRACE_IRQS_ON |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 412 | stosm 24(%r15),0x03 # reenable interrupts |
Al Viro | 8f2961c | 2008-12-25 13:37:58 +0100 | [diff] [blame] | 413 | j sysc_tracenogo |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | |
| 415 | # |
Martin Schwidefsky | 03ff9a2 | 2007-04-27 16:01:40 +0200 | [diff] [blame] | 416 | # kernel_execve function needs to deal with pt_regs that is not |
| 417 | # at the usual place |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | # |
Martin Schwidefsky | 03ff9a2 | 2007-04-27 16:01:40 +0200 | [diff] [blame] | 419 | .globl kernel_execve |
| 420 | kernel_execve: |
| 421 | stmg %r12,%r15,96(%r15) |
| 422 | lgr %r14,%r15 |
| 423 | aghi %r15,-SP_SIZE |
| 424 | stg %r14,__SF_BACKCHAIN(%r15) |
| 425 | la %r12,SP_PTREGS(%r15) |
| 426 | xc 0(__PT_SIZE,%r12),0(%r12) |
| 427 | lgr %r5,%r12 |
| 428 | brasl %r14,do_execve |
| 429 | ltgfr %r2,%r2 |
| 430 | je 0f |
| 431 | aghi %r15,SP_SIZE |
| 432 | lmg %r12,%r15,96(%r15) |
| 433 | br %r14 |
| 434 | # execve succeeded. |
| 435 | 0: stnsm __SF_EMPTY(%r15),0xfc # disable interrupts |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 436 | # TRACE_IRQS_OFF |
Martin Schwidefsky | 03ff9a2 | 2007-04-27 16:01:40 +0200 | [diff] [blame] | 437 | lg %r15,__LC_KERNEL_STACK # load ksp |
| 438 | aghi %r15,-SP_SIZE # make room for registers & psw |
| 439 | lg %r13,__LC_SVC_NEW_PSW+8 |
| 440 | lg %r9,__LC_THREAD_INFO |
| 441 | mvc SP_PTREGS(__PT_SIZE,%r15),0(%r12) # copy pt_regs |
| 442 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 443 | # TRACE_IRQS_ON |
Martin Schwidefsky | 03ff9a2 | 2007-04-27 16:01:40 +0200 | [diff] [blame] | 444 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts |
| 445 | brasl %r14,execve_tail |
| 446 | j sysc_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | |
| 448 | /* |
| 449 | * Program check handler routine |
| 450 | */ |
| 451 | |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 452 | .globl pgm_check_handler |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | pgm_check_handler: |
| 454 | /* |
| 455 | * First we need to check for a special case: |
| 456 | * Single stepping an instruction that disables the PER event mask will |
| 457 | * cause a PER event AFTER the mask has been set. Example: SVC or LPSW. |
| 458 | * For a single stepped SVC the program check handler gets control after |
| 459 | * the SVC new PSW has been loaded. But we want to execute the SVC first and |
| 460 | * then handle the PER event. Therefore we update the SVC old PSW to point |
| 461 | * to the pgm_check_handler and branch to the SVC handler after we checked |
| 462 | * if we have to load the kernel stack register. |
| 463 | * For every other possible cause for PER event without the PER mask set |
| 464 | * we just ignore the PER event (FIXME: is there anything we have to do |
| 465 | * for LPSW?). |
| 466 | */ |
Martin Schwidefsky | c185b78 | 2008-12-25 13:39:25 +0100 | [diff] [blame] | 467 | stpt __LC_SYNC_ENTER_TIMER |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | SAVE_ALL_BASE __LC_SAVE_AREA |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 469 | tm __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception |
| 470 | jnz pgm_per # got per exception -> special case |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 471 | SAVE_ALL_SYNC __LC_PGM_OLD_PSW,__LC_SAVE_AREA |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 472 | CREATE_STACK_FRAME __LC_PGM_OLD_PSW,__LC_SAVE_AREA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | tm SP_PSW+1(%r15),0x01 # interrupting from user ? |
| 474 | jz pgm_no_vtime |
| 475 | UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER |
| 476 | UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER |
| 477 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER |
| 478 | pgm_no_vtime: |
Carsten Otte | cd3b70f | 2010-05-17 10:00:04 +0200 | [diff] [blame^] | 479 | HANDLE_SIE_INTERCEPT |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 480 | TRACE_IRQS_CHECK_OFF |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct |
Christian Borntraeger | 9e74a6b8 | 2008-04-17 07:46:30 +0200 | [diff] [blame] | 482 | mvc SP_ARGS(8,%r15),__LC_LAST_BREAK |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 483 | lgf %r3,__LC_PGM_ILC # load program interruption code |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | lghi %r8,0x7f |
| 485 | ngr %r8,%r3 |
| 486 | pgm_do_call: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 487 | sll %r8,3 |
| 488 | larl %r1,pgm_check_table |
| 489 | lg %r1,0(%r8,%r1) # load address of handler routine |
| 490 | la %r2,SP_PTREGS(%r15) # address of register-save area |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 491 | basr %r14,%r1 # branch to interrupt-handler |
| 492 | pgm_exit: |
| 493 | TRACE_IRQS_CHECK_ON |
| 494 | j sysc_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | |
| 496 | # |
| 497 | # handle per exception |
| 498 | # |
| 499 | pgm_per: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 500 | tm __LC_PGM_OLD_PSW,0x40 # test if per event recording is on |
| 501 | jnz pgm_per_std # ok, normal per event from user space |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | # ok its one of the special cases, now we need to find out which one |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 503 | clc __LC_PGM_OLD_PSW(16),__LC_SVC_NEW_PSW |
| 504 | je pgm_svcper |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | # no interesting special case, ignore PER event |
| 506 | lmg %r12,%r15,__LC_SAVE_AREA |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 507 | lpswe __LC_PGM_OLD_PSW |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | |
| 509 | # |
| 510 | # Normal per exception |
| 511 | # |
| 512 | pgm_per_std: |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 513 | SAVE_ALL_SYNC __LC_PGM_OLD_PSW,__LC_SAVE_AREA |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 514 | CREATE_STACK_FRAME __LC_PGM_OLD_PSW,__LC_SAVE_AREA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 515 | tm SP_PSW+1(%r15),0x01 # interrupting from user ? |
| 516 | jz pgm_no_vtime2 |
| 517 | UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER |
| 518 | UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER |
| 519 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER |
| 520 | pgm_no_vtime2: |
Carsten Otte | cd3b70f | 2010-05-17 10:00:04 +0200 | [diff] [blame^] | 521 | HANDLE_SIE_INTERCEPT |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 522 | TRACE_IRQS_CHECK_OFF |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct |
| 524 | lg %r1,__TI_task(%r9) |
Michael Grundy | 4ba069b | 2006-09-20 15:58:39 +0200 | [diff] [blame] | 525 | tm SP_PSW+1(%r15),0x01 # kernel per event ? |
| 526 | jz kernel_per |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID |
| 528 | mvc __THREAD_per+__PER_address(8,%r1),__LC_PER_ADDRESS |
| 529 | mvc __THREAD_per+__PER_access_id(1,%r1),__LC_PER_ACCESS_ID |
| 530 | oi __TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 531 | lgf %r3,__LC_PGM_ILC # load program interruption code |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | lghi %r8,0x7f |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 533 | ngr %r8,%r3 # clear per-event-bit and ilc |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 534 | je pgm_exit |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | j pgm_do_call |
| 536 | |
| 537 | # |
| 538 | # it was a single stepped SVC that is causing all the trouble |
| 539 | # |
| 540 | pgm_svcper: |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 541 | SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 542 | CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 543 | UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER |
| 544 | UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER |
| 545 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 546 | llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 548 | TRACE_IRQS_OFF |
Christian Borntraeger | bcc6525 | 2009-11-13 15:43:54 +0100 | [diff] [blame] | 549 | lg %r8,__TI_task(%r9) |
| 550 | mvc __THREAD_per+__PER_atmid(2,%r8),__LC_PER_ATMID |
| 551 | mvc __THREAD_per+__PER_address(8,%r8),__LC_PER_ADDRESS |
| 552 | mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 553 | oi __TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 554 | TRACE_IRQS_ON |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 556 | lmg %r2,%r6,SP_R2(%r15) # load svc arguments |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | j sysc_do_svc |
| 558 | |
Michael Grundy | 4ba069b | 2006-09-20 15:58:39 +0200 | [diff] [blame] | 559 | # |
| 560 | # per was called from kernel, must be kprobes |
| 561 | # |
| 562 | kernel_per: |
Martin Schwidefsky | 59da213 | 2008-11-27 11:05:55 +0100 | [diff] [blame] | 563 | xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number |
Michael Grundy | 4ba069b | 2006-09-20 15:58:39 +0200 | [diff] [blame] | 564 | la %r2,SP_PTREGS(%r15) # address of register-save area |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 565 | brasl %r14,do_single_step |
| 566 | j pgm_exit |
Michael Grundy | 4ba069b | 2006-09-20 15:58:39 +0200 | [diff] [blame] | 567 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | /* |
| 569 | * IO interrupt handler routine |
| 570 | */ |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 571 | .globl io_int_handler |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | io_int_handler: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | stck __LC_INT_CLOCK |
Martin Schwidefsky | 9cfb9b3 | 2008-12-31 15:11:41 +0100 | [diff] [blame] | 574 | stpt __LC_ASYNC_ENTER_TIMER |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | SAVE_ALL_BASE __LC_SAVE_AREA+32 |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 576 | SAVE_ALL_ASYNC __LC_IO_OLD_PSW,__LC_SAVE_AREA+32 |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 577 | CREATE_STACK_FRAME __LC_IO_OLD_PSW,__LC_SAVE_AREA+32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 578 | tm SP_PSW+1(%r15),0x01 # interrupting from user ? |
| 579 | jz io_no_vtime |
| 580 | UPDATE_VTIME __LC_EXIT_TIMER,__LC_ASYNC_ENTER_TIMER,__LC_USER_TIMER |
| 581 | UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER |
| 582 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER |
| 583 | io_no_vtime: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct |
Carsten Otte | cd3b70f | 2010-05-17 10:00:04 +0200 | [diff] [blame^] | 585 | HANDLE_SIE_INTERCEPT |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 586 | TRACE_IRQS_OFF |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 587 | la %r2,SP_PTREGS(%r15) # address of register-save area |
| 588 | brasl %r14,do_IRQ # call standard irq handler |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 589 | io_return: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 590 | LOCKDEP_SYS_EXIT |
| 591 | TRACE_IRQS_ON |
| 592 | io_tif: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | tm __TI_flags+7(%r9),_TIF_WORK_INT |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 594 | jnz io_work # there is work to do (signals etc.) |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 595 | io_restore: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 596 | RESTORE_ALL __LC_RETURN_PSW,0 |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 597 | io_done: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 598 | |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 599 | # |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 600 | # There is work todo, find out in which context we have been interrupted: |
| 601 | # 1) if we return to user space we can do all _TIF_WORK_INT work |
| 602 | # 2) if we return to kernel code and kvm is enabled check if we need to |
| 603 | # modify the psw to leave SIE |
| 604 | # 3) if we return to kernel code and preemptive scheduling is enabled check |
| 605 | # the preemption counter and if it is zero call preempt_schedule_irq |
| 606 | # Before any work can be done, a switch to the kernel stack is required. |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 607 | # |
| 608 | io_work: |
| 609 | tm SP_PSW+1(%r15),0x01 # returning to user ? |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 610 | jo io_work_user # yes -> do resched & signal |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 611 | #ifdef CONFIG_PREEMPT |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 612 | # check for preemptive scheduling |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 613 | icm %r0,15,__TI_precount(%r9) |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 614 | jnz io_restore # preemption is disabled |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 615 | tm __TI_flags+7(%r12),_TIF_NEED_RESCHED |
| 616 | jno io_restore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 617 | # switch to kernel stack |
| 618 | lg %r1,SP_R15(%r15) |
| 619 | aghi %r1,-SP_SIZE |
| 620 | mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 621 | xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) # clear back chain |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 622 | lgr %r15,%r1 |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 623 | # TRACE_IRQS_ON already done at io_return, call |
| 624 | # TRACE_IRQS_OFF to keep things symmetrical |
| 625 | TRACE_IRQS_OFF |
| 626 | brasl %r14,preempt_schedule_irq |
| 627 | j io_return |
| 628 | #else |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 629 | j io_restore |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 630 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 631 | |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 632 | # |
| 633 | # Need to do work before returning to userspace, switch to kernel stack |
| 634 | # |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 635 | io_work_user: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 636 | lg %r1,__LC_KERNEL_STACK |
| 637 | aghi %r1,-SP_SIZE |
| 638 | mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 639 | xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) # clear back chain |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 640 | lgr %r15,%r1 |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 641 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 642 | # |
| 643 | # One of the work bits is on. Find out which one. |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 644 | # Checked are: _TIF_SIGPENDING, _TIF_NOTIFY_RESUME, _TIF_NEED_RESCHED |
Heiko Carstens | 54dfe5d | 2006-02-01 03:06:38 -0800 | [diff] [blame] | 645 | # and _TIF_MCCK_PENDING |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | # |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 647 | io_work_tif: |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 648 | tm __TI_flags+7(%r9),_TIF_MCCK_PENDING |
| 649 | jo io_mcck_pending |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 650 | tm __TI_flags+7(%r9),_TIF_NEED_RESCHED |
| 651 | jo io_reschedule |
Roland McGrath | 02a029b | 2008-04-30 00:53:08 -0700 | [diff] [blame] | 652 | tm __TI_flags+7(%r9),_TIF_SIGPENDING |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 653 | jo io_sigpending |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 654 | tm __TI_flags+7(%r9),_TIF_NOTIFY_RESUME |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 655 | jo io_notify_resume |
| 656 | j io_return # beware of critical section cleanup |
Christian Borntraeger | 0eaeafa | 2008-05-07 09:22:53 +0200 | [diff] [blame] | 657 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 658 | # |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 659 | # _TIF_MCCK_PENDING is set, call handler |
| 660 | # |
| 661 | io_mcck_pending: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 662 | # TRACE_IRQS_ON already done at io_return |
Heiko Carstens | b771aea | 2007-07-27 12:29:18 +0200 | [diff] [blame] | 663 | brasl %r14,s390_handle_mcck # TIF bit will be cleared by handler |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 664 | TRACE_IRQS_OFF |
| 665 | j io_return |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 666 | |
| 667 | # |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 668 | # _TIF_NEED_RESCHED is set, call schedule |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 669 | # |
| 670 | io_reschedule: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 671 | # TRACE_IRQS_ON already done at io_return |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 672 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts |
| 673 | brasl %r14,schedule # call scheduler |
| 674 | stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 675 | TRACE_IRQS_OFF |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 676 | j io_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | |
| 678 | # |
Roland McGrath | 02a029b | 2008-04-30 00:53:08 -0700 | [diff] [blame] | 679 | # _TIF_SIGPENDING or is set, call do_signal |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 680 | # |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 681 | io_sigpending: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 682 | # TRACE_IRQS_ON already done at io_return |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 683 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts |
| 684 | la %r2,SP_PTREGS(%r15) # load pt_regs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 685 | brasl %r14,do_signal # call do_signal |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 686 | stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 687 | TRACE_IRQS_OFF |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 688 | j io_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 689 | |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 690 | # |
| 691 | # _TIF_NOTIFY_RESUME or is set, call do_notify_resume |
| 692 | # |
| 693 | io_notify_resume: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 694 | # TRACE_IRQS_ON already done at io_return |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 695 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts |
| 696 | la %r2,SP_PTREGS(%r15) # load pt_regs |
| 697 | brasl %r14,do_notify_resume # call do_notify_resume |
| 698 | stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts |
| 699 | TRACE_IRQS_OFF |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 700 | j io_return |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 701 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 702 | /* |
| 703 | * External interrupt handler routine |
| 704 | */ |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 705 | .globl ext_int_handler |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 706 | ext_int_handler: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | stck __LC_INT_CLOCK |
Martin Schwidefsky | 9cfb9b3 | 2008-12-31 15:11:41 +0100 | [diff] [blame] | 708 | stpt __LC_ASYNC_ENTER_TIMER |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 709 | SAVE_ALL_BASE __LC_SAVE_AREA+32 |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 710 | SAVE_ALL_ASYNC __LC_EXT_OLD_PSW,__LC_SAVE_AREA+32 |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 711 | CREATE_STACK_FRAME __LC_EXT_OLD_PSW,__LC_SAVE_AREA+32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 712 | tm SP_PSW+1(%r15),0x01 # interrupting from user ? |
| 713 | jz ext_no_vtime |
| 714 | UPDATE_VTIME __LC_EXIT_TIMER,__LC_ASYNC_ENTER_TIMER,__LC_USER_TIMER |
| 715 | UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER |
| 716 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER |
| 717 | ext_no_vtime: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 718 | lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct |
Carsten Otte | cd3b70f | 2010-05-17 10:00:04 +0200 | [diff] [blame^] | 719 | HANDLE_SIE_INTERCEPT |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 720 | TRACE_IRQS_OFF |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 721 | la %r2,SP_PTREGS(%r15) # address of register-save area |
| 722 | llgh %r3,__LC_EXT_INT_CODE # get interruption code |
| 723 | brasl %r14,do_extint |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 724 | j io_return |
| 725 | |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 726 | __critical_end: |
| 727 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 728 | /* |
| 729 | * Machine check handler routines |
| 730 | */ |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 731 | .globl mcck_int_handler |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 732 | mcck_int_handler: |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 733 | stck __LC_MCCK_CLOCK |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 734 | la %r1,4095 # revalidate r1 |
| 735 | spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # revalidate cpu timer |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 736 | lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# revalidate gprs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 737 | SAVE_ALL_BASE __LC_SAVE_AREA+64 |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 738 | la %r12,__LC_MCK_OLD_PSW |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 739 | tm __LC_MCCK_CODE,0x80 # system damage? |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 740 | jo mcck_int_main # yes -> rest of mcck code invalid |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 741 | la %r14,4095 |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 742 | mvc __LC_MCCK_ENTER_TIMER(8),__LC_CPU_TIMER_SAVE_AREA-4095(%r14) |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 743 | tm __LC_MCCK_CODE+5,0x02 # stored cpu timer value valid? |
| 744 | jo 1f |
| 745 | la %r14,__LC_SYNC_ENTER_TIMER |
| 746 | clc 0(8,%r14),__LC_ASYNC_ENTER_TIMER |
| 747 | jl 0f |
| 748 | la %r14,__LC_ASYNC_ENTER_TIMER |
| 749 | 0: clc 0(8,%r14),__LC_EXIT_TIMER |
| 750 | jl 0f |
| 751 | la %r14,__LC_EXIT_TIMER |
| 752 | 0: clc 0(8,%r14),__LC_LAST_UPDATE_TIMER |
| 753 | jl 0f |
| 754 | la %r14,__LC_LAST_UPDATE_TIMER |
| 755 | 0: spt 0(%r14) |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 756 | mvc __LC_MCCK_ENTER_TIMER(8),0(%r14) |
Martin Schwidefsky | c185b78 | 2008-12-25 13:39:25 +0100 | [diff] [blame] | 757 | 1: tm __LC_MCCK_CODE+2,0x09 # mwp + ia of old psw valid? |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 758 | jno mcck_int_main # no -> skip cleanup critical |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 759 | tm __LC_MCK_OLD_PSW+1,0x01 # test problem state bit |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 760 | jnz mcck_int_main # from user -> load kernel stack |
| 761 | clc __LC_MCK_OLD_PSW+8(8),BASED(.Lcritical_end) |
| 762 | jhe mcck_int_main |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 763 | clc __LC_MCK_OLD_PSW+8(8),BASED(.Lcritical_start) |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 764 | jl mcck_int_main |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 765 | brasl %r14,cleanup_critical |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 766 | mcck_int_main: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 767 | lg %r14,__LC_PANIC_STACK # are we already on the panic stack? |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 768 | slgr %r14,%r15 |
| 769 | srag %r14,%r14,PAGE_SHIFT |
| 770 | jz 0f |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 771 | lg %r15,__LC_PANIC_STACK # load panic stack |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 772 | 0: CREATE_STACK_FRAME __LC_MCK_OLD_PSW,__LC_SAVE_AREA+64 |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 773 | tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid? |
| 774 | jno mcck_no_vtime # no -> no timer update |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 775 | tm SP_PSW+1(%r15),0x01 # interrupting from user ? |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 776 | jz mcck_no_vtime |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 777 | UPDATE_VTIME __LC_EXIT_TIMER,__LC_MCCK_ENTER_TIMER,__LC_USER_TIMER |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 778 | UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 779 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_MCCK_ENTER_TIMER |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 780 | mcck_no_vtime: |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 781 | lg %r9,__LC_THREAD_INFO # load pointer to thread_info struct |
| 782 | la %r2,SP_PTREGS(%r15) # load pt_regs |
| 783 | brasl %r14,s390_do_machine_check |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 784 | tm SP_PSW+1(%r15),0x01 # returning to user ? |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 785 | jno mcck_return |
| 786 | lg %r1,__LC_KERNEL_STACK # switch to kernel stack |
| 787 | aghi %r1,-SP_SIZE |
| 788 | mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) |
| 789 | xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) # clear back chain |
| 790 | lgr %r15,%r1 |
| 791 | stosm __SF_EMPTY(%r15),0x04 # turn dat on |
| 792 | tm __TI_flags+7(%r9),_TIF_MCCK_PENDING |
| 793 | jno mcck_return |
Carsten Otte | cd3b70f | 2010-05-17 10:00:04 +0200 | [diff] [blame^] | 794 | HANDLE_SIE_INTERCEPT |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 795 | TRACE_IRQS_OFF |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 796 | brasl %r14,s390_handle_mcck |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 797 | TRACE_IRQS_ON |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 798 | mcck_return: |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 799 | mvc __LC_RETURN_MCCK_PSW(16),SP_PSW(%r15) # move return PSW |
| 800 | ni __LC_RETURN_MCCK_PSW+1,0xfd # clear wait state bit |
| 801 | lmg %r0,%r15,SP_R0(%r15) # load gprs 0-15 |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 802 | tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ? |
| 803 | jno 0f |
| 804 | stpt __LC_EXIT_TIMER |
Martin Schwidefsky | c185b78 | 2008-12-25 13:39:25 +0100 | [diff] [blame] | 805 | 0: lpswe __LC_RETURN_MCCK_PSW # back to caller |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 806 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 807 | /* |
| 808 | * Restart interruption handler, kick starter for additional CPUs |
| 809 | */ |
Heiko Carstens | 84b36a8 | 2007-06-19 13:10:03 +0200 | [diff] [blame] | 810 | #ifdef CONFIG_SMP |
Heiko Carstens | 2bc89b5 | 2008-02-05 16:50:40 +0100 | [diff] [blame] | 811 | __CPUINIT |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 812 | .globl restart_int_handler |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 813 | restart_int_handler: |
Martin Schwidefsky | 5b409ed | 2009-04-14 15:36:27 +0200 | [diff] [blame] | 814 | basr %r1,0 |
| 815 | restart_base: |
| 816 | spt restart_vtime-restart_base(%r1) |
| 817 | stck __LC_LAST_UPDATE_CLOCK |
| 818 | mvc __LC_LAST_UPDATE_TIMER(8),restart_vtime-restart_base(%r1) |
| 819 | mvc __LC_EXIT_TIMER(8),restart_vtime-restart_base(%r1) |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 820 | lg %r15,__LC_SAVE_AREA+120 # load ksp |
| 821 | lghi %r10,__LC_CREGS_SAVE_AREA |
| 822 | lctlg %c0,%c15,0(%r10) # get new ctl regs |
| 823 | lghi %r10,__LC_AREGS_SAVE_AREA |
| 824 | lam %a0,%a15,0(%r10) |
| 825 | lmg %r6,%r15,__SF_GPRS(%r15) # load registers from clone |
Martin Schwidefsky | 5b409ed | 2009-04-14 15:36:27 +0200 | [diff] [blame] | 826 | lg %r1,__LC_THREAD_INFO |
| 827 | mvc __LC_USER_TIMER(8),__TI_user_timer(%r1) |
| 828 | mvc __LC_SYSTEM_TIMER(8),__TI_system_timer(%r1) |
| 829 | xc __LC_STEAL_TIMER(8),__LC_STEAL_TIMER |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 830 | stosm __SF_EMPTY(%r15),0x04 # now we can turn dat on |
| 831 | jg start_secondary |
Martin Schwidefsky | 5b409ed | 2009-04-14 15:36:27 +0200 | [diff] [blame] | 832 | .align 8 |
| 833 | restart_vtime: |
| 834 | .long 0x7fffffff,0xffffffff |
Heiko Carstens | 84b36a8 | 2007-06-19 13:10:03 +0200 | [diff] [blame] | 835 | .previous |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 836 | #else |
| 837 | /* |
| 838 | * If we do not run with SMP enabled, let the new CPU crash ... |
| 839 | */ |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 840 | .globl restart_int_handler |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 841 | restart_int_handler: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 842 | basr %r1,0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 843 | restart_base: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 844 | lpswe restart_crash-restart_base(%r1) |
| 845 | .align 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 846 | restart_crash: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 847 | .long 0x000a0000,0x00000000,0x00000000,0x00000000 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 848 | restart_go: |
| 849 | #endif |
| 850 | |
| 851 | #ifdef CONFIG_CHECK_STACK |
| 852 | /* |
| 853 | * The synchronous or the asynchronous stack overflowed. We are dead. |
| 854 | * No need to properly save the registers, we are going to panic anyway. |
| 855 | * Setup a pt_regs so that show_trace can provide a good call trace. |
| 856 | */ |
| 857 | stack_overflow: |
| 858 | lg %r15,__LC_PANIC_STACK # change to panic stack |
Heiko Carstens | 9514e23 | 2006-09-20 15:59:22 +0200 | [diff] [blame] | 859 | aghi %r15,-SP_SIZE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 860 | mvc SP_PSW(16,%r15),0(%r12) # move user PSW to stack |
| 861 | stmg %r0,%r11,SP_R0(%r15) # store gprs %r0-%r11 to kernel stack |
| 862 | la %r1,__LC_SAVE_AREA |
| 863 | chi %r12,__LC_SVC_OLD_PSW |
| 864 | je 0f |
| 865 | chi %r12,__LC_PGM_OLD_PSW |
| 866 | je 0f |
Heiko Carstens | 9514e23 | 2006-09-20 15:59:22 +0200 | [diff] [blame] | 867 | la %r1,__LC_SAVE_AREA+32 |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 868 | 0: mvc SP_R12(32,%r15),0(%r1) # move %r12-%r15 to stack |
Christian Borntraeger | 9e74a6b8 | 2008-04-17 07:46:30 +0200 | [diff] [blame] | 869 | mvc SP_ARGS(8,%r15),__LC_LAST_BREAK |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 870 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) # clear back chain |
| 871 | la %r2,SP_PTREGS(%r15) # load pt_regs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 872 | jg kernel_stack_overflow |
| 873 | #endif |
| 874 | |
| 875 | cleanup_table_system_call: |
| 876 | .quad system_call, sysc_do_svc |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 877 | cleanup_table_sysc_tif: |
| 878 | .quad sysc_tif, sysc_restore |
| 879 | cleanup_table_sysc_restore: |
| 880 | .quad sysc_restore, sysc_done |
| 881 | cleanup_table_io_tif: |
| 882 | .quad io_tif, io_restore |
| 883 | cleanup_table_io_restore: |
| 884 | .quad io_restore, io_done |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 885 | |
| 886 | cleanup_critical: |
| 887 | clc 8(8,%r12),BASED(cleanup_table_system_call) |
| 888 | jl 0f |
| 889 | clc 8(8,%r12),BASED(cleanup_table_system_call+8) |
| 890 | jl cleanup_system_call |
| 891 | 0: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 892 | clc 8(8,%r12),BASED(cleanup_table_sysc_tif) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 893 | jl 0f |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 894 | clc 8(8,%r12),BASED(cleanup_table_sysc_tif+8) |
| 895 | jl cleanup_sysc_tif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 896 | 0: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 897 | clc 8(8,%r12),BASED(cleanup_table_sysc_restore) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 898 | jl 0f |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 899 | clc 8(8,%r12),BASED(cleanup_table_sysc_restore+8) |
| 900 | jl cleanup_sysc_restore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 901 | 0: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 902 | clc 8(8,%r12),BASED(cleanup_table_io_tif) |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 903 | jl 0f |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 904 | clc 8(8,%r12),BASED(cleanup_table_io_tif+8) |
| 905 | jl cleanup_io_tif |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 906 | 0: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 907 | clc 8(8,%r12),BASED(cleanup_table_io_restore) |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 908 | jl 0f |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 909 | clc 8(8,%r12),BASED(cleanup_table_io_restore+8) |
| 910 | jl cleanup_io_restore |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 911 | 0: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 912 | br %r14 |
| 913 | |
| 914 | cleanup_system_call: |
| 915 | mvc __LC_RETURN_PSW(16),0(%r12) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 916 | clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+8) |
| 917 | jh 0f |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 918 | mvc __LC_SYNC_ENTER_TIMER(8),__LC_MCCK_ENTER_TIMER |
| 919 | cghi %r12,__LC_MCK_OLD_PSW |
| 920 | je 0f |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 921 | mvc __LC_SYNC_ENTER_TIMER(8),__LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 922 | 0: cghi %r12,__LC_MCK_OLD_PSW |
| 923 | la %r12,__LC_SAVE_AREA+64 |
| 924 | je 0f |
| 925 | la %r12,__LC_SAVE_AREA+32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 926 | 0: clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+16) |
| 927 | jhe cleanup_vtime |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 928 | clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn) |
| 929 | jh 0f |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 930 | mvc __LC_SAVE_AREA(32),0(%r12) |
| 931 | 0: stg %r13,8(%r12) |
| 932 | stg %r12,__LC_SAVE_AREA+96 # argh |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 933 | SAVE_ALL_SYNC __LC_SVC_OLD_PSW,__LC_SAVE_AREA |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 934 | CREATE_STACK_FRAME __LC_SVC_OLD_PSW,__LC_SAVE_AREA |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 935 | lg %r12,__LC_SAVE_AREA+96 # argh |
| 936 | stg %r15,24(%r12) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 937 | llgh %r7,__LC_SVC_INT_CODE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 938 | cleanup_vtime: |
| 939 | clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+24) |
| 940 | jhe cleanup_stime |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 941 | UPDATE_VTIME __LC_EXIT_TIMER,__LC_SYNC_ENTER_TIMER,__LC_USER_TIMER |
| 942 | cleanup_stime: |
| 943 | clc __LC_RETURN_PSW+8(8),BASED(cleanup_system_call_insn+32) |
| 944 | jh cleanup_update |
| 945 | UPDATE_VTIME __LC_LAST_UPDATE_TIMER,__LC_EXIT_TIMER,__LC_SYSTEM_TIMER |
| 946 | cleanup_update: |
| 947 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 948 | mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_system_call+8) |
| 949 | la %r12,__LC_RETURN_PSW |
| 950 | br %r14 |
| 951 | cleanup_system_call_insn: |
| 952 | .quad sysc_saveall |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 953 | .quad system_call |
| 954 | .quad sysc_vtime |
| 955 | .quad sysc_stime |
| 956 | .quad sysc_update |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 957 | |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 958 | cleanup_sysc_tif: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 959 | mvc __LC_RETURN_PSW(8),0(%r12) |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 960 | mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_sysc_tif) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 961 | la %r12,__LC_RETURN_PSW |
| 962 | br %r14 |
| 963 | |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 964 | cleanup_sysc_restore: |
| 965 | clc 8(8,%r12),BASED(cleanup_sysc_restore_insn) |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 966 | je 2f |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 967 | clc 8(8,%r12),BASED(cleanup_sysc_restore_insn+8) |
Martin Schwidefsky | c742b31 | 2008-12-31 15:11:42 +0100 | [diff] [blame] | 968 | jhe 0f |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 969 | mvc __LC_EXIT_TIMER(8),__LC_MCCK_ENTER_TIMER |
| 970 | cghi %r12,__LC_MCK_OLD_PSW |
| 971 | je 0f |
Martin Schwidefsky | c742b31 | 2008-12-31 15:11:42 +0100 | [diff] [blame] | 972 | mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER |
| 973 | 0: mvc __LC_RETURN_PSW(16),SP_PSW(%r15) |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 974 | cghi %r12,__LC_MCK_OLD_PSW |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 975 | la %r12,__LC_SAVE_AREA+64 |
| 976 | je 1f |
| 977 | la %r12,__LC_SAVE_AREA+32 |
| 978 | 1: mvc 0(32,%r12),SP_R12(%r15) |
| 979 | lmg %r0,%r11,SP_R0(%r15) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 980 | lg %r15,SP_R15(%r15) |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 981 | 2: la %r12,__LC_RETURN_PSW |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 982 | br %r14 |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 983 | cleanup_sysc_restore_insn: |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 984 | .quad sysc_done - 4 |
Martin Schwidefsky | c742b31 | 2008-12-31 15:11:42 +0100 | [diff] [blame] | 985 | .quad sysc_done - 16 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 986 | |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 987 | cleanup_io_tif: |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 988 | mvc __LC_RETURN_PSW(8),0(%r12) |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 989 | mvc __LC_RETURN_PSW+8(8),BASED(cleanup_table_io_tif) |
Martin Schwidefsky | 176b180 | 2010-04-09 13:43:00 +0200 | [diff] [blame] | 990 | la %r12,__LC_RETURN_PSW |
| 991 | br %r14 |
| 992 | |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 993 | cleanup_io_restore: |
| 994 | clc 8(8,%r12),BASED(cleanup_io_restore_insn) |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 995 | je 1f |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 996 | clc 8(8,%r12),BASED(cleanup_io_restore_insn+8) |
Martin Schwidefsky | c742b31 | 2008-12-31 15:11:42 +0100 | [diff] [blame] | 997 | jhe 0f |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 998 | mvc __LC_EXIT_TIMER(8),__LC_MCCK_ENTER_TIMER |
Martin Schwidefsky | c742b31 | 2008-12-31 15:11:42 +0100 | [diff] [blame] | 999 | 0: mvc __LC_RETURN_PSW(16),SP_PSW(%r15) |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 1000 | mvc __LC_SAVE_AREA+64(32),SP_R12(%r15) |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 1001 | lmg %r0,%r11,SP_R0(%r15) |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 1002 | lg %r15,SP_R15(%r15) |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 1003 | 1: la %r12,__LC_RETURN_PSW |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 1004 | br %r14 |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 1005 | cleanup_io_restore_insn: |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 1006 | .quad io_done - 4 |
Martin Schwidefsky | c742b31 | 2008-12-31 15:11:42 +0100 | [diff] [blame] | 1007 | .quad io_done - 16 |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 1008 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1009 | /* |
| 1010 | * Integer constants |
| 1011 | */ |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 1012 | .align 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1013 | .Lconst: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 1014 | .Lnr_syscalls: .long NR_syscalls |
| 1015 | .L0x0130: .short 0x130 |
| 1016 | .L0x0140: .short 0x140 |
| 1017 | .L0x0150: .short 0x150 |
| 1018 | .L0x0160: .short 0x160 |
| 1019 | .L0x0170: .short 0x170 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1020 | .Lcritical_start: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 1021 | .quad __critical_start |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1022 | .Lcritical_end: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 1023 | .quad __critical_end |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1024 | |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 1025 | .section .rodata, "a" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1026 | #define SYSCALL(esa,esame,emu) .long esame |
Heiko Carstens | 9bf1226 | 2009-06-12 10:26:47 +0200 | [diff] [blame] | 1027 | .globl sys_call_table |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1028 | sys_call_table: |
| 1029 | #include "syscalls.S" |
| 1030 | #undef SYSCALL |
| 1031 | |
Martin Schwidefsky | 347a8dc | 2006-01-06 00:19:28 -0800 | [diff] [blame] | 1032 | #ifdef CONFIG_COMPAT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1033 | |
| 1034 | #define SYSCALL(esa,esame,emu) .long emu |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1035 | sys_call_table_emu: |
| 1036 | #include "syscalls.S" |
| 1037 | #undef SYSCALL |
| 1038 | #endif |