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