Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * S390 low-level entry points. |
| 3 | * |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 4 | * Copyright IBM Corp. 1999, 2012 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 6 | * Hartmut Penner (hp@de.ibm.com), |
| 7 | * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 8 | * Heiko Carstens <heiko.carstens@de.ibm.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | */ |
| 10 | |
Heiko Carstens | 2bc89b5 | 2008-02-05 16:50:40 +0100 | [diff] [blame] | 11 | #include <linux/init.h> |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 12 | #include <linux/linkage.h> |
Heiko Carstens | eb608fb | 2012-09-05 13:26:11 +0200 | [diff] [blame] | 13 | #include <asm/processor.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> |
Heiko Carstens | eb54619 | 2012-06-04 15:05:43 +0200 | [diff] [blame] | 21 | #include <asm/sigp.h> |
Martin Schwidefsky | 1f44a225 | 2013-06-27 09:01:09 +0200 | [diff] [blame^] | 22 | #include <asm/irq.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 24 | __PT_R0 = __PT_GPRS |
| 25 | __PT_R1 = __PT_GPRS + 8 |
| 26 | __PT_R2 = __PT_GPRS + 16 |
| 27 | __PT_R3 = __PT_GPRS + 24 |
| 28 | __PT_R4 = __PT_GPRS + 32 |
| 29 | __PT_R5 = __PT_GPRS + 40 |
| 30 | __PT_R6 = __PT_GPRS + 48 |
| 31 | __PT_R7 = __PT_GPRS + 56 |
| 32 | __PT_R8 = __PT_GPRS + 64 |
| 33 | __PT_R9 = __PT_GPRS + 72 |
| 34 | __PT_R10 = __PT_GPRS + 80 |
| 35 | __PT_R11 = __PT_GPRS + 88 |
| 36 | __PT_R12 = __PT_GPRS + 96 |
| 37 | __PT_R13 = __PT_GPRS + 104 |
| 38 | __PT_R14 = __PT_GPRS + 112 |
| 39 | __PT_R15 = __PT_GPRS + 120 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
| 41 | STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER |
| 42 | STACK_SIZE = 1 << STACK_SHIFT |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 43 | STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 45 | _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ |
Martin Schwidefsky | b6ef5bb | 2011-10-30 15:16:49 +0100 | [diff] [blame] | 46 | _TIF_MCCK_PENDING | _TIF_PER_TRAP ) |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 47 | _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ |
Heiko Carstens | 54dfe5d | 2006-02-01 03:06:38 -0800 | [diff] [blame] | 48 | _TIF_MCCK_PENDING) |
Martin Schwidefsky | b6ef5bb | 2011-10-30 15:16:49 +0100 | [diff] [blame] | 49 | _TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ |
| 50 | _TIF_SYSCALL_TRACEPOINT) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
| 52 | #define BASED(name) name-system_call(%r13) |
| 53 | |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 54 | .macro TRACE_IRQS_ON |
| 55 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 56 | basr %r2,%r0 |
| 57 | brasl %r14,trace_hardirqs_on_caller |
| 58 | #endif |
| 59 | .endm |
| 60 | |
| 61 | .macro TRACE_IRQS_OFF |
| 62 | #ifdef CONFIG_TRACE_IRQFLAGS |
| 63 | basr %r2,%r0 |
| 64 | brasl %r14,trace_hardirqs_off_caller |
| 65 | #endif |
| 66 | .endm |
| 67 | |
| 68 | .macro LOCKDEP_SYS_EXIT |
| 69 | #ifdef CONFIG_LOCKDEP |
| 70 | tm __PT_PSW+1(%r11),0x01 # returning to user ? |
| 71 | jz .+10 |
| 72 | brasl %r14,lockdep_sys_exit |
| 73 | #endif |
| 74 | .endm |
| 75 | |
Hendrik Brueckner | 23d18e8 | 2013-02-11 18:11:09 +0100 | [diff] [blame] | 76 | .macro LPP newpp |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 77 | #if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) |
Hendrik Brueckner | 23d18e8 | 2013-02-11 18:11:09 +0100 | [diff] [blame] | 78 | tm __LC_MACHINE_FLAGS+6,0x20 # MACHINE_FLAG_LPP |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 79 | jz .+8 |
| 80 | .insn s,0xb2800000,\newpp |
| 81 | #endif |
| 82 | .endm |
| 83 | |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 84 | .macro HANDLE_SIE_INTERCEPT scratch,reason |
Carsten Otte | cd3b70f | 2010-05-17 10:00:04 +0200 | [diff] [blame] | 85 | #if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) |
Martin Schwidefsky | 6022afc | 2012-05-09 16:27:36 +0200 | [diff] [blame] | 86 | tmhh %r8,0x0001 # interrupting from user ? |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 87 | jnz .+62 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 88 | lgr \scratch,%r9 |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 89 | slg \scratch,BASED(.Lsie_critical) |
| 90 | clg \scratch,BASED(.Lsie_critical_length) |
| 91 | .if \reason==1 |
Christian Borntraeger | ce6a04a | 2012-11-15 09:35:16 +0100 | [diff] [blame] | 92 | # Some program interrupts are suppressing (e.g. protection). |
| 93 | # We must also check the instruction after SIE in that case. |
| 94 | # do_protection_exception will rewind to rewind_pad |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 95 | jh .+42 |
Christian Borntraeger | ce6a04a | 2012-11-15 09:35:16 +0100 | [diff] [blame] | 96 | .else |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 97 | jhe .+42 |
Christian Borntraeger | ce6a04a | 2012-11-15 09:35:16 +0100 | [diff] [blame] | 98 | .endif |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 99 | lg %r14,__SF_EMPTY(%r15) # get control block pointer |
| 100 | LPP __SF_EMPTY+16(%r15) # set host id |
Christian Borntraeger | 95d38fd | 2013-05-17 14:41:34 +0200 | [diff] [blame] | 101 | ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 102 | lctlg %c1,%c1,__LC_USER_ASCE # load primary asce |
| 103 | larl %r9,sie_exit # skip forward to sie_exit |
| 104 | mvi __SF_EMPTY+31(%r15),\reason # set exit reason |
Carsten Otte | cd3b70f | 2010-05-17 10:00:04 +0200 | [diff] [blame] | 105 | #endif |
| 106 | .endm |
| 107 | |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 108 | .macro CHECK_STACK stacksize,savearea |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 109 | #ifdef CONFIG_CHECK_STACK |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 110 | tml %r15,\stacksize - CONFIG_STACK_GUARD |
| 111 | lghi %r14,\savearea |
| 112 | jz stack_overflow |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 113 | #endif |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 114 | .endm |
| 115 | |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 116 | .macro SWITCH_ASYNC savearea,stack,shift |
| 117 | tmhh %r8,0x0001 # interrupting from user ? |
| 118 | jnz 1f |
| 119 | lgr %r14,%r9 |
| 120 | slg %r14,BASED(.Lcritical_start) |
| 121 | clg %r14,BASED(.Lcritical_length) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | jhe 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 123 | lghi %r11,\savearea # inside critical section, do cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | brasl %r14,cleanup_critical |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 125 | tmhh %r8,0x0001 # retest problem state after cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | jnz 1f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 127 | 0: lg %r14,\stack # are we already on the target stack? |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | slgr %r14,%r15 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 129 | srag %r14,%r14,\shift |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 130 | jnz 1f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 131 | CHECK_STACK 1<<\shift,\savearea |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 132 | aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 133 | j 2f |
| 134 | 1: lg %r15,\stack # load target stack |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 135 | 2: la %r11,STACK_FRAME_OVERHEAD(%r15) |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 136 | .endm |
| 137 | |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 138 | .macro UPDATE_VTIME scratch,enter_timer |
| 139 | lg \scratch,__LC_EXIT_TIMER |
| 140 | slg \scratch,\enter_timer |
| 141 | alg \scratch,__LC_USER_TIMER |
| 142 | stg \scratch,__LC_USER_TIMER |
| 143 | lg \scratch,__LC_LAST_UPDATE_TIMER |
| 144 | slg \scratch,__LC_EXIT_TIMER |
| 145 | alg \scratch,__LC_SYSTEM_TIMER |
| 146 | stg \scratch,__LC_SYSTEM_TIMER |
| 147 | mvc __LC_LAST_UPDATE_TIMER(8),\enter_timer |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 148 | .endm |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 150 | .macro LAST_BREAK scratch |
| 151 | srag \scratch,%r10,23 |
| 152 | jz .+10 |
| 153 | stg %r10,__TI_last_break(%r12) |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 154 | .endm |
| 155 | |
Martin Schwidefsky | 1e54622 | 2010-10-25 16:10:37 +0200 | [diff] [blame] | 156 | .macro REENABLE_IRQS |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 157 | stg %r8,__LC_RETURN_PSW |
| 158 | ni __LC_RETURN_PSW,0xbf |
| 159 | ssm __LC_RETURN_PSW |
Martin Schwidefsky | 1e54622 | 2010-10-25 16:10:37 +0200 | [diff] [blame] | 160 | .endm |
| 161 | |
Heiko Carstens | 473e66b | 2012-05-09 16:27:39 +0200 | [diff] [blame] | 162 | .macro STCK savearea |
Heiko Carstens | d652d59 | 2012-05-14 10:35:22 +0200 | [diff] [blame] | 163 | #ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES |
Heiko Carstens | 473e66b | 2012-05-09 16:27:39 +0200 | [diff] [blame] | 164 | .insn s,0xb27c0000,\savearea # store clock fast |
| 165 | #else |
| 166 | .insn s,0xb2050000,\savearea # store clock |
| 167 | #endif |
| 168 | .endm |
| 169 | |
Martin Schwidefsky | 860dba4 | 2011-01-05 12:47:25 +0100 | [diff] [blame] | 170 | .section .kprobes.text, "ax" |
| 171 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | /* |
| 173 | * Scheduler resume function, called by switch_to |
| 174 | * gpr2 = (task_struct *) prev |
| 175 | * gpr3 = (task_struct *) next |
| 176 | * Returns: |
| 177 | * gpr2 = prev |
| 178 | */ |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 179 | ENTRY(__switch_to) |
Martin Schwidefsky | eda0c6d | 2012-05-15 09:20:06 +0200 | [diff] [blame] | 180 | stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task |
| 181 | stg %r15,__THREAD_ksp(%r2) # store kernel stack of prev |
Martin Schwidefsky | 5e9a269 | 2011-01-05 12:48:10 +0100 | [diff] [blame] | 182 | lg %r4,__THREAD_info(%r2) # get thread_info of prev |
| 183 | lg %r5,__THREAD_info(%r3) # get thread_info of next |
Martin Schwidefsky | eda0c6d | 2012-05-15 09:20:06 +0200 | [diff] [blame] | 184 | lgr %r15,%r5 |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 185 | aghi %r15,STACK_INIT # end of kernel stack of next |
Martin Schwidefsky | eda0c6d | 2012-05-15 09:20:06 +0200 | [diff] [blame] | 186 | stg %r3,__LC_CURRENT # store task struct of next |
| 187 | stg %r5,__LC_THREAD_INFO # store thread info of next |
| 188 | stg %r15,__LC_KERNEL_STACK # store end of kernel stack |
| 189 | lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4 |
| 190 | mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next |
| 191 | lg %r15,__THREAD_ksp(%r3) # load kernel stack of next |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 192 | tm __TI_flags+7(%r4),_TIF_MCCK_PENDING # machine check pending? |
Martin Schwidefsky | 5e9a269 | 2011-01-05 12:48:10 +0100 | [diff] [blame] | 193 | jz 0f |
| 194 | ni __TI_flags+7(%r4),255-_TIF_MCCK_PENDING # clear flag in prev |
| 195 | oi __TI_flags+7(%r5),_TIF_MCCK_PENDING # set it in next |
Martin Schwidefsky | eda0c6d | 2012-05-15 09:20:06 +0200 | [diff] [blame] | 196 | 0: lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | br %r14 |
| 198 | |
| 199 | __critical_start: |
| 200 | /* |
| 201 | * SVC interrupt handler routine. System calls are synchronous events and |
| 202 | * are executed with interrupts enabled. |
| 203 | */ |
| 204 | |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 205 | ENTRY(system_call) |
Martin Schwidefsky | c185b78 | 2008-12-25 13:39:25 +0100 | [diff] [blame] | 206 | stpt __LC_SYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 207 | sysc_stmg: |
| 208 | stmg %r8,%r15,__LC_SAVE_AREA_SYNC |
| 209 | lg %r10,__LC_LAST_BREAK |
| 210 | lg %r12,__LC_THREAD_INFO |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 211 | sysc_per: |
| 212 | lg %r15,__LC_KERNEL_STACK |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 213 | la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | sysc_vtime: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 215 | UPDATE_VTIME %r13,__LC_SYNC_ENTER_TIMER |
| 216 | LAST_BREAK %r13 |
| 217 | stmg %r0,%r7,__PT_R0(%r11) |
| 218 | mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC |
| 219 | mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 220 | mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | sysc_do_svc: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 222 | oi __TI_flags+7(%r12),_TIF_SYSCALL |
Martin Schwidefsky | 6164988 | 2013-04-24 12:58:39 +0200 | [diff] [blame] | 223 | lg %r10,__TI_sysc_table(%r12) # address of system call table |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 224 | llgh %r8,__PT_INT_CODE+2(%r11) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 225 | slag %r8,%r8,2 # shift and test for svc 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | jnz sysc_nr_ok |
| 227 | # svc 0: system call number in %r1 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 228 | llgfr %r1,%r1 # clear high word in r1 |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 229 | cghi %r1,NR_syscalls |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | jnl sysc_nr_ok |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 231 | sth %r1,__PT_INT_CODE+2(%r11) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 232 | slag %r8,%r1,2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | sysc_nr_ok: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 234 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
| 235 | stg %r2,__PT_ORIG_GPR2(%r11) |
| 236 | stg %r7,STACK_FRAME_OVERHEAD(%r15) |
| 237 | lgf %r9,0(%r8,%r10) # get system call add. |
Martin Schwidefsky | b6ef5bb | 2011-10-30 15:16:49 +0100 | [diff] [blame] | 238 | tm __TI_flags+6(%r12),_TIF_TRACE >> 8 |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 239 | jnz sysc_tracesys |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 240 | basr %r14,%r9 # call sys_xxxx |
| 241 | stg %r2,__PT_R2(%r11) # store return value |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | |
| 243 | sysc_return: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 244 | LOCKDEP_SYS_EXIT |
| 245 | sysc_tif: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 246 | tm __PT_PSW+1(%r11),0x01 # returning to user ? |
Martin Schwidefsky | b6ef5bb | 2011-10-30 15:16:49 +0100 | [diff] [blame] | 247 | jno sysc_restore |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 248 | tm __TI_flags+7(%r12),_TIF_WORK_SVC |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 249 | jnz sysc_work # check for work |
Martin Schwidefsky | b6ef5bb | 2011-10-30 15:16:49 +0100 | [diff] [blame] | 250 | ni __TI_flags+7(%r12),255-_TIF_SYSCALL |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 251 | sysc_restore: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 252 | lg %r14,__LC_VDSO_PER_CPU |
| 253 | lmg %r0,%r10,__PT_R0(%r11) |
| 254 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) |
| 255 | stpt __LC_EXIT_TIMER |
| 256 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER |
| 257 | lmg %r11,%r15,__PT_R11(%r11) |
| 258 | lpswe __LC_RETURN_PSW |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 259 | sysc_done: |
| 260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | # |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 262 | # One of the work bits is on. Find out which one. |
| 263 | # |
Martin Schwidefsky | b6ef5bb | 2011-10-30 15:16:49 +0100 | [diff] [blame] | 264 | sysc_work: |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 265 | tm __TI_flags+7(%r12),_TIF_MCCK_PENDING |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 266 | jo sysc_mcck_pending |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 267 | tm __TI_flags+7(%r12),_TIF_NEED_RESCHED |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | jo sysc_reschedule |
Martin Schwidefsky | 39efd4e | 2012-11-21 16:36:27 +0100 | [diff] [blame] | 269 | tm __TI_flags+7(%r12),_TIF_PER_TRAP |
| 270 | jo sysc_singlestep |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 271 | tm __TI_flags+7(%r12),_TIF_SIGPENDING |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 272 | jo sysc_sigpending |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 273 | tm __TI_flags+7(%r12),_TIF_NOTIFY_RESUME |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 274 | jo sysc_notify_resume |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 275 | j sysc_return # beware of critical section cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | |
| 277 | # |
| 278 | # _TIF_NEED_RESCHED is set, call schedule |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 279 | # |
| 280 | sysc_reschedule: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 281 | larl %r14,sysc_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 282 | jg schedule |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
| 284 | # |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 285 | # _TIF_MCCK_PENDING is set, call handler |
| 286 | # |
| 287 | sysc_mcck_pending: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 288 | larl %r14,sysc_return |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 289 | jg s390_handle_mcck # TIF bit will be cleared by handler |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 290 | |
| 291 | # |
Roland McGrath | 02a029b | 2008-04-30 00:53:08 -0700 | [diff] [blame] | 292 | # _TIF_SIGPENDING is set, call do_signal |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | # |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 294 | sysc_sigpending: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 295 | lgr %r2,%r11 # pass pointer to pt_regs |
| 296 | brasl %r14,do_signal |
Martin Schwidefsky | b6ef5bb | 2011-10-30 15:16:49 +0100 | [diff] [blame] | 297 | tm __TI_flags+7(%r12),_TIF_SYSCALL |
| 298 | jno sysc_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 299 | lmg %r2,%r7,__PT_R2(%r11) # load svc arguments |
| 300 | lghi %r8,0 # svc 0 returns -ENOSYS |
Martin Schwidefsky | 450e47d | 2012-10-09 13:33:53 +0200 | [diff] [blame] | 301 | llgh %r1,__PT_INT_CODE+2(%r11) # load new svc number |
Martin Schwidefsky | b6ef5bb | 2011-10-30 15:16:49 +0100 | [diff] [blame] | 302 | cghi %r1,NR_syscalls |
| 303 | jnl sysc_nr_ok # invalid svc number -> do svc 0 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 304 | slag %r8,%r1,2 |
Martin Schwidefsky | b6ef5bb | 2011-10-30 15:16:49 +0100 | [diff] [blame] | 305 | j sysc_nr_ok # restart svc |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | |
| 307 | # |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 308 | # _TIF_NOTIFY_RESUME is set, call do_notify_resume |
| 309 | # |
| 310 | sysc_notify_resume: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 311 | lgr %r2,%r11 # pass pointer to pt_regs |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 312 | larl %r14,sysc_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 313 | jg do_notify_resume |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 314 | |
| 315 | # |
Martin Schwidefsky | 5e9a269 | 2011-01-05 12:48:10 +0100 | [diff] [blame] | 316 | # _TIF_PER_TRAP is set, call do_per_trap |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | # |
| 318 | sysc_singlestep: |
Martin Schwidefsky | 39efd4e | 2012-11-21 16:36:27 +0100 | [diff] [blame] | 319 | ni __TI_flags+7(%r12),255-_TIF_PER_TRAP |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 320 | lgr %r2,%r11 # pass pointer to pt_regs |
| 321 | larl %r14,sysc_return |
Martin Schwidefsky | 5e9a269 | 2011-01-05 12:48:10 +0100 | [diff] [blame] | 322 | jg do_per_trap |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | # |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 325 | # call tracehook_report_syscall_entry/tracehook_report_syscall_exit before |
| 326 | # and after the system call |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | # |
| 328 | sysc_tracesys: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 329 | lgr %r2,%r11 # pass pointer to pt_regs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | la %r3,0 |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 331 | llgh %r0,__PT_INT_CODE+2(%r11) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 332 | stg %r0,__PT_R2(%r11) |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 333 | brasl %r14,do_syscall_trace_enter |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | lghi %r0,NR_syscalls |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 335 | clgr %r0,%r2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | jnh sysc_tracenogo |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 337 | sllg %r8,%r2,2 |
| 338 | lgf %r9,0(%r8,%r10) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | sysc_tracego: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 340 | lmg %r3,%r7,__PT_R3(%r11) |
| 341 | stg %r7,STACK_FRAME_OVERHEAD(%r15) |
| 342 | lg %r2,__PT_ORIG_GPR2(%r11) |
| 343 | basr %r14,%r9 # call sys_xxx |
| 344 | stg %r2,__PT_R2(%r11) # store return value |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | sysc_tracenogo: |
Martin Schwidefsky | b6ef5bb | 2011-10-30 15:16:49 +0100 | [diff] [blame] | 346 | tm __TI_flags+6(%r12),_TIF_TRACE >> 8 |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 347 | jz sysc_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 348 | lgr %r2,%r11 # pass pointer to pt_regs |
| 349 | larl %r14,sysc_return |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 350 | jg do_syscall_trace_exit |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | |
| 352 | # |
| 353 | # a new process exits the kernel with ret_from_fork |
| 354 | # |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 355 | ENTRY(ret_from_fork) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 356 | la %r11,STACK_FRAME_OVERHEAD(%r15) |
| 357 | lg %r12,__LC_THREAD_INFO |
Al Viro | 30dcb09 | 2012-10-11 15:30:14 -0400 | [diff] [blame] | 358 | brasl %r14,schedule_tail |
| 359 | TRACE_IRQS_ON |
| 360 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 361 | tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ? |
Al Viro | 30dcb09 | 2012-10-11 15:30:14 -0400 | [diff] [blame] | 362 | jne sysc_tracenogo |
| 363 | # it's a kernel thread |
| 364 | lmg %r9,%r10,__PT_R9(%r11) # load gprs |
Al Viro | 37fe5d4 | 2012-09-10 18:03:41 -0400 | [diff] [blame] | 365 | ENTRY(kernel_thread_starter) |
| 366 | la %r2,0(%r10) |
| 367 | basr %r14,%r9 |
Al Viro | 30dcb09 | 2012-10-11 15:30:14 -0400 | [diff] [blame] | 368 | j sysc_tracenogo |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | |
| 370 | /* |
| 371 | * Program check handler routine |
| 372 | */ |
| 373 | |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 374 | ENTRY(pgm_check_handler) |
Martin Schwidefsky | c185b78 | 2008-12-25 13:39:25 +0100 | [diff] [blame] | 375 | stpt __LC_SYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 376 | stmg %r8,%r15,__LC_SAVE_AREA_SYNC |
| 377 | lg %r10,__LC_LAST_BREAK |
| 378 | lg %r12,__LC_THREAD_INFO |
| 379 | larl %r13,system_call |
| 380 | lmg %r8,%r9,__LC_PGM_OLD_PSW |
Christian Borntraeger | ce6a04a | 2012-11-15 09:35:16 +0100 | [diff] [blame] | 381 | HANDLE_SIE_INTERCEPT %r14,1 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 382 | tmhh %r8,0x0001 # test problem state bit |
| 383 | jnz 1f # -> fault in user space |
| 384 | tmhh %r8,0x4000 # PER bit set in old PSW ? |
| 385 | jnz 0f # -> enabled, can't be a double fault |
| 386 | tm __LC_PGM_ILC+3,0x80 # check for per exception |
| 387 | jnz pgm_svcper # -> single stepped svc |
| 388 | 0: CHECK_STACK STACK_SIZE,__LC_SAVE_AREA_SYNC |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 389 | aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 390 | j 2f |
| 391 | 1: UPDATE_VTIME %r14,__LC_SYNC_ENTER_TIMER |
| 392 | LAST_BREAK %r14 |
| 393 | lg %r15,__LC_KERNEL_STACK |
Martin Schwidefsky | d35339a | 2012-07-31 11:03:04 +0200 | [diff] [blame] | 394 | lg %r14,__TI_task(%r12) |
| 395 | lghi %r13,__LC_PGM_TDB |
| 396 | tm __LC_PGM_ILC+2,0x02 # check for transaction abort |
| 397 | jz 2f |
| 398 | mvc __THREAD_trap_tdb(256,%r14),0(%r13) |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 399 | 2: la %r11,STACK_FRAME_OVERHEAD(%r15) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 400 | stmg %r0,%r7,__PT_R0(%r11) |
| 401 | mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC |
| 402 | stmg %r8,%r9,__PT_PSW(%r11) |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 403 | mvc __PT_INT_CODE(4,%r11),__LC_PGM_ILC |
| 404 | mvc __PT_INT_PARM_LONG(8,%r11),__LC_TRANS_EXC_CODE |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 405 | stg %r10,__PT_ARGS(%r11) |
| 406 | tm __LC_PGM_ILC+3,0x80 # check for per exception |
| 407 | jz 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 408 | tmhh %r8,0x0001 # kernel per event ? |
| 409 | jz pgm_kprobe |
| 410 | oi __TI_flags+7(%r12),_TIF_PER_TRAP |
Martin Schwidefsky | d35339a | 2012-07-31 11:03:04 +0200 | [diff] [blame] | 411 | mvc __THREAD_per_address(8,%r14),__LC_PER_ADDRESS |
| 412 | mvc __THREAD_per_cause(2,%r14),__LC_PER_CAUSE |
| 413 | mvc __THREAD_per_paid(1,%r14),__LC_PER_PAID |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 414 | 0: REENABLE_IRQS |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 415 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
Heiko Carstens | f5cdac2 | 2010-07-27 19:29:37 +0200 | [diff] [blame] | 416 | larl %r1,pgm_check_table |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 417 | llgh %r10,__PT_INT_CODE+2(%r11) |
| 418 | nill %r10,0x007f |
Heiko Carstens | b01a37a | 2012-10-18 18:10:06 +0200 | [diff] [blame] | 419 | sll %r10,2 |
Martin Schwidefsky | aa33c8c | 2011-12-27 11:27:18 +0100 | [diff] [blame] | 420 | je sysc_return |
Heiko Carstens | b01a37a | 2012-10-18 18:10:06 +0200 | [diff] [blame] | 421 | lgf %r1,0(%r10,%r1) # load address of handler routine |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 422 | lgr %r2,%r11 # pass pointer to pt_regs |
Heiko Carstens | f5cdac2 | 2010-07-27 19:29:37 +0200 | [diff] [blame] | 423 | basr %r14,%r1 # branch to interrupt-handler |
Heiko Carstens | f5cdac2 | 2010-07-27 19:29:37 +0200 | [diff] [blame] | 424 | j sysc_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | |
| 426 | # |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 427 | # PER event in supervisor state, must be kprobes |
| 428 | # |
| 429 | pgm_kprobe: |
| 430 | REENABLE_IRQS |
| 431 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
| 432 | lgr %r2,%r11 # pass pointer to pt_regs |
| 433 | brasl %r14,do_per_trap |
| 434 | j sysc_return |
| 435 | |
| 436 | # |
| 437 | # single stepped system call |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | # |
| 439 | pgm_svcper: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 440 | oi __TI_flags+7(%r12),_TIF_PER_TRAP |
| 441 | mvc __LC_RETURN_PSW(8),__LC_SVC_NEW_PSW |
| 442 | larl %r14,sysc_per |
| 443 | stg %r14,__LC_RETURN_PSW+8 |
| 444 | lpswe __LC_RETURN_PSW # branch to sysc_per and enable irqs |
Michael Grundy | 4ba069b | 2006-09-20 15:58:39 +0200 | [diff] [blame] | 445 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | /* |
| 447 | * IO interrupt handler routine |
| 448 | */ |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 449 | ENTRY(io_int_handler) |
Heiko Carstens | 473e66b | 2012-05-09 16:27:39 +0200 | [diff] [blame] | 450 | STCK __LC_INT_CLOCK |
Martin Schwidefsky | 9cfb9b3 | 2008-12-31 15:11:41 +0100 | [diff] [blame] | 451 | stpt __LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 452 | stmg %r8,%r15,__LC_SAVE_AREA_ASYNC |
| 453 | lg %r10,__LC_LAST_BREAK |
| 454 | lg %r12,__LC_THREAD_INFO |
| 455 | larl %r13,system_call |
| 456 | lmg %r8,%r9,__LC_IO_OLD_PSW |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 457 | HANDLE_SIE_INTERCEPT %r14,2 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 458 | SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_STACK,STACK_SHIFT |
| 459 | tmhh %r8,0x0001 # interrupting from user? |
| 460 | jz io_skip |
| 461 | UPDATE_VTIME %r14,__LC_ASYNC_ENTER_TIMER |
| 462 | LAST_BREAK %r14 |
| 463 | io_skip: |
| 464 | stmg %r0,%r7,__PT_R0(%r11) |
| 465 | mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC |
| 466 | stmg %r8,%r9,__PT_PSW(%r11) |
Martin Schwidefsky | 48f6b00 | 2013-06-17 14:54:02 +0200 | [diff] [blame] | 467 | mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 468 | TRACE_IRQS_OFF |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 469 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
Martin Schwidefsky | 48f6b00 | 2013-06-17 14:54:02 +0200 | [diff] [blame] | 470 | io_loop: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 471 | lgr %r2,%r11 # pass pointer to pt_regs |
Martin Schwidefsky | 1f44a225 | 2013-06-27 09:01:09 +0200 | [diff] [blame^] | 472 | lghi %r3,IO_INTERRUPT |
| 473 | tm __PT_INT_CODE+8(%r11),0x80 # adapter interrupt ? |
| 474 | jz io_call |
| 475 | lghi %r3,THIN_INTERRUPT |
| 476 | io_call: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 477 | brasl %r14,do_IRQ |
Martin Schwidefsky | 48f6b00 | 2013-06-17 14:54:02 +0200 | [diff] [blame] | 478 | tm __LC_MACHINE_FLAGS+6,0x10 # MACHINE_FLAG_LPAR |
| 479 | jz io_return |
| 480 | tpi 0 |
| 481 | jz io_return |
| 482 | mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID |
| 483 | j io_loop |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | io_return: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 485 | LOCKDEP_SYS_EXIT |
| 486 | TRACE_IRQS_ON |
| 487 | io_tif: |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 488 | tm __TI_flags+7(%r12),_TIF_WORK_INT |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 489 | jnz io_work # there is work to do (signals etc.) |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 490 | io_restore: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 491 | lg %r14,__LC_VDSO_PER_CPU |
| 492 | lmg %r0,%r10,__PT_R0(%r11) |
| 493 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 494 | stpt __LC_EXIT_TIMER |
| 495 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER |
| 496 | lmg %r11,%r15,__PT_R11(%r11) |
| 497 | lpswe __LC_RETURN_PSW |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 498 | io_done: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 499 | |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 500 | # |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 501 | # There is work todo, find out in which context we have been interrupted: |
| 502 | # 1) if we return to user space we can do all _TIF_WORK_INT work |
| 503 | # 2) if we return to kernel code and kvm is enabled check if we need to |
| 504 | # modify the psw to leave SIE |
| 505 | # 3) if we return to kernel code and preemptive scheduling is enabled check |
| 506 | # the preemption counter and if it is zero call preempt_schedule_irq |
| 507 | # 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] | 508 | # |
| 509 | io_work: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 510 | tm __PT_PSW+1(%r11),0x01 # returning to user ? |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 511 | jo io_work_user # yes -> do resched & signal |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 512 | #ifdef CONFIG_PREEMPT |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 513 | # check for preemptive scheduling |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 514 | icm %r0,15,__TI_precount(%r12) |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 515 | jnz io_restore # preemption is disabled |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 516 | tm __TI_flags+7(%r12),_TIF_NEED_RESCHED |
| 517 | jno io_restore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | # switch to kernel stack |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 519 | lg %r1,__PT_R15(%r11) |
| 520 | aghi %r1,-(STACK_FRAME_OVERHEAD + __PT_SIZE) |
| 521 | mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) |
| 522 | xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) |
| 523 | la %r11,STACK_FRAME_OVERHEAD(%r1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 524 | lgr %r15,%r1 |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 525 | # TRACE_IRQS_ON already done at io_return, call |
| 526 | # TRACE_IRQS_OFF to keep things symmetrical |
| 527 | TRACE_IRQS_OFF |
| 528 | brasl %r14,preempt_schedule_irq |
| 529 | j io_return |
| 530 | #else |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 531 | j io_restore |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 532 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 534 | # |
| 535 | # Need to do work before returning to userspace, switch to kernel stack |
| 536 | # |
Martin Schwidefsky | 2688905 | 2008-05-07 09:22:52 +0200 | [diff] [blame] | 537 | io_work_user: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | lg %r1,__LC_KERNEL_STACK |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 539 | mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) |
| 540 | xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) |
| 541 | la %r11,STACK_FRAME_OVERHEAD(%r1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 | lgr %r15,%r1 |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 543 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | # |
| 545 | # One of the work bits is on. Find out which one. |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 546 | # Checked are: _TIF_SIGPENDING, _TIF_NOTIFY_RESUME, _TIF_NEED_RESCHED |
Heiko Carstens | 54dfe5d | 2006-02-01 03:06:38 -0800 | [diff] [blame] | 547 | # and _TIF_MCCK_PENDING |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | # |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 549 | io_work_tif: |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 550 | tm __TI_flags+7(%r12),_TIF_MCCK_PENDING |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 551 | jo io_mcck_pending |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 552 | tm __TI_flags+7(%r12),_TIF_NEED_RESCHED |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 553 | jo io_reschedule |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 554 | tm __TI_flags+7(%r12),_TIF_SIGPENDING |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 555 | jo io_sigpending |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 556 | tm __TI_flags+7(%r12),_TIF_NOTIFY_RESUME |
Martin Schwidefsky | 43d399d | 2010-05-17 10:00:01 +0200 | [diff] [blame] | 557 | jo io_notify_resume |
| 558 | j io_return # beware of critical section cleanup |
Christian Borntraeger | 0eaeafa | 2008-05-07 09:22:53 +0200 | [diff] [blame] | 559 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | # |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 561 | # _TIF_MCCK_PENDING is set, call handler |
| 562 | # |
| 563 | io_mcck_pending: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 564 | # TRACE_IRQS_ON already done at io_return |
Heiko Carstens | b771aea | 2007-07-27 12:29:18 +0200 | [diff] [blame] | 565 | brasl %r14,s390_handle_mcck # TIF bit will be cleared by handler |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 566 | TRACE_IRQS_OFF |
| 567 | j io_return |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 568 | |
| 569 | # |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 570 | # _TIF_NEED_RESCHED is set, call schedule |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 571 | # |
| 572 | io_reschedule: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 573 | # TRACE_IRQS_ON already done at io_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 574 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 575 | brasl %r14,schedule # call scheduler |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 576 | ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 577 | TRACE_IRQS_OFF |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 578 | j io_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 579 | |
| 580 | # |
Roland McGrath | 02a029b | 2008-04-30 00:53:08 -0700 | [diff] [blame] | 581 | # _TIF_SIGPENDING or is set, call do_signal |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 582 | # |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 583 | io_sigpending: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 584 | # TRACE_IRQS_ON already done at io_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 585 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
| 586 | lgr %r2,%r11 # pass pointer to pt_regs |
| 587 | brasl %r14,do_signal |
| 588 | ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 589 | TRACE_IRQS_OFF |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 590 | j io_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 591 | |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 592 | # |
| 593 | # _TIF_NOTIFY_RESUME or is set, call do_notify_resume |
| 594 | # |
| 595 | io_notify_resume: |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 596 | # TRACE_IRQS_ON already done at io_return |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 597 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
| 598 | lgr %r2,%r11 # pass pointer to pt_regs |
| 599 | brasl %r14,do_notify_resume |
| 600 | ssm __LC_PGM_NEW_PSW # disable I/O and ext. interrupts |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 601 | TRACE_IRQS_OFF |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 602 | j io_return |
Martin Schwidefsky | 753c4dd | 2008-10-10 21:33:20 +0200 | [diff] [blame] | 603 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 604 | /* |
| 605 | * External interrupt handler routine |
| 606 | */ |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 607 | ENTRY(ext_int_handler) |
Heiko Carstens | 473e66b | 2012-05-09 16:27:39 +0200 | [diff] [blame] | 608 | STCK __LC_INT_CLOCK |
Martin Schwidefsky | 9cfb9b3 | 2008-12-31 15:11:41 +0100 | [diff] [blame] | 609 | stpt __LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 610 | stmg %r8,%r15,__LC_SAVE_AREA_ASYNC |
| 611 | lg %r10,__LC_LAST_BREAK |
| 612 | lg %r12,__LC_THREAD_INFO |
| 613 | larl %r13,system_call |
| 614 | lmg %r8,%r9,__LC_EXT_OLD_PSW |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 615 | HANDLE_SIE_INTERCEPT %r14,3 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 616 | SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_STACK,STACK_SHIFT |
| 617 | tmhh %r8,0x0001 # interrupting from user ? |
| 618 | jz ext_skip |
| 619 | UPDATE_VTIME %r14,__LC_ASYNC_ENTER_TIMER |
| 620 | LAST_BREAK %r14 |
| 621 | ext_skip: |
| 622 | stmg %r0,%r7,__PT_R0(%r11) |
| 623 | mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC |
| 624 | stmg %r8,%r9,__PT_PSW(%r11) |
Martin Schwidefsky | 48f6b00 | 2013-06-17 14:54:02 +0200 | [diff] [blame] | 625 | lghi %r1,__LC_EXT_PARAMS2 |
| 626 | mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR |
| 627 | mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS |
| 628 | mvc __PT_INT_PARM_LONG(8,%r11),0(%r1) |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 629 | TRACE_IRQS_OFF |
Michael Holzheu | 0de9db3 | 2012-05-09 16:27:35 +0200 | [diff] [blame] | 630 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 631 | lgr %r2,%r11 # pass pointer to pt_regs |
Martin Schwidefsky | 1f44a225 | 2013-06-27 09:01:09 +0200 | [diff] [blame^] | 632 | lghi %r3,EXT_INTERRUPT |
| 633 | brasl %r14,do_IRQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | j io_return |
| 635 | |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 636 | /* |
| 637 | * Load idle PSW. The second "half" of this function is in cleanup_idle. |
| 638 | */ |
| 639 | ENTRY(psw_idle) |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 640 | stg %r3,__SF_EMPTY(%r15) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 641 | larl %r1,psw_idle_lpsw+4 |
| 642 | stg %r1,__SF_EMPTY+8(%r15) |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 643 | STCK __CLOCK_IDLE_ENTER(%r2) |
| 644 | stpt __TIMER_IDLE_ENTER(%r2) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 645 | psw_idle_lpsw: |
| 646 | lpswe __SF_EMPTY(%r15) |
| 647 | br %r14 |
| 648 | psw_idle_end: |
| 649 | |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 650 | __critical_end: |
| 651 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 652 | /* |
| 653 | * Machine check handler routines |
| 654 | */ |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 655 | ENTRY(mcck_int_handler) |
Heiko Carstens | 473e66b | 2012-05-09 16:27:39 +0200 | [diff] [blame] | 656 | STCK __LC_MCCK_CLOCK |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 657 | la %r1,4095 # revalidate r1 |
| 658 | spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # revalidate cpu timer |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 659 | lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# revalidate gprs |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 660 | lg %r10,__LC_LAST_BREAK |
| 661 | lg %r12,__LC_THREAD_INFO |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 662 | larl %r13,system_call |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 663 | lmg %r8,%r9,__LC_MCK_OLD_PSW |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 664 | HANDLE_SIE_INTERCEPT %r14,4 |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 665 | tm __LC_MCCK_CODE,0x80 # system damage? |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 666 | jo mcck_panic # yes -> rest of mcck code invalid |
| 667 | lghi %r14,__LC_CPU_TIMER_SAVE_AREA |
| 668 | mvc __LC_MCCK_ENTER_TIMER(8),0(%r14) |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 669 | tm __LC_MCCK_CODE+5,0x02 # stored cpu timer value valid? |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 670 | jo 3f |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 671 | la %r14,__LC_SYNC_ENTER_TIMER |
| 672 | clc 0(8,%r14),__LC_ASYNC_ENTER_TIMER |
| 673 | jl 0f |
| 674 | la %r14,__LC_ASYNC_ENTER_TIMER |
| 675 | 0: clc 0(8,%r14),__LC_EXIT_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 676 | jl 1f |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 677 | la %r14,__LC_EXIT_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 678 | 1: clc 0(8,%r14),__LC_LAST_UPDATE_TIMER |
| 679 | jl 2f |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 680 | la %r14,__LC_LAST_UPDATE_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 681 | 2: spt 0(%r14) |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 682 | mvc __LC_MCCK_ENTER_TIMER(8),0(%r14) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 683 | 3: tm __LC_MCCK_CODE+2,0x09 # mwp + ia of old psw valid? |
| 684 | jno mcck_panic # no -> skip cleanup critical |
| 685 | SWITCH_ASYNC __LC_GPREGS_SAVE_AREA+64,__LC_PANIC_STACK,PAGE_SHIFT |
| 686 | tm %r8,0x0001 # interrupting from user ? |
| 687 | jz mcck_skip |
| 688 | UPDATE_VTIME %r14,__LC_MCCK_ENTER_TIMER |
| 689 | LAST_BREAK %r14 |
| 690 | mcck_skip: |
Martin Schwidefsky | 6551fbd | 2013-02-28 16:28:41 +0100 | [diff] [blame] | 691 | lghi %r14,__LC_GPREGS_SAVE_AREA+64 |
| 692 | stmg %r0,%r7,__PT_R0(%r11) |
| 693 | mvc __PT_R8(64,%r11),0(%r14) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 694 | stmg %r8,%r9,__PT_PSW(%r11) |
| 695 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
| 696 | lgr %r2,%r11 # pass pointer to pt_regs |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 697 | brasl %r14,s390_do_machine_check |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 698 | tm __PT_PSW+1(%r11),0x01 # returning to user ? |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 699 | jno mcck_return |
| 700 | lg %r1,__LC_KERNEL_STACK # switch to kernel stack |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 701 | mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) |
| 702 | xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) |
| 703 | la %r11,STACK_FRAME_OVERHEAD(%r1) |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 704 | lgr %r15,%r1 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 705 | ssm __LC_PGM_NEW_PSW # turn dat on, keep irqs off |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 706 | tm __TI_flags+7(%r12),_TIF_MCCK_PENDING |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 707 | jno mcck_return |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 708 | TRACE_IRQS_OFF |
Heiko Carstens | 77fa224 | 2005-06-25 14:55:30 -0700 | [diff] [blame] | 709 | brasl %r14,s390_handle_mcck |
Heiko Carstens | 1f194a4 | 2006-07-03 00:24:46 -0700 | [diff] [blame] | 710 | TRACE_IRQS_ON |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 711 | mcck_return: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 712 | lg %r14,__LC_VDSO_PER_CPU |
| 713 | lmg %r0,%r10,__PT_R0(%r11) |
| 714 | mvc __LC_RETURN_MCCK_PSW(16),__PT_PSW(%r11) # move return PSW |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 715 | tm __LC_RETURN_MCCK_PSW+1,0x01 # returning to user ? |
| 716 | jno 0f |
| 717 | stpt __LC_EXIT_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 718 | mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER |
| 719 | 0: lmg %r11,%r15,__PT_R11(%r11) |
| 720 | lpswe __LC_RETURN_MCCK_PSW |
| 721 | |
| 722 | mcck_panic: |
| 723 | lg %r14,__LC_PANIC_STACK |
| 724 | slgr %r14,%r15 |
| 725 | srag %r14,%r14,PAGE_SHIFT |
| 726 | jz 0f |
| 727 | lg %r15,__LC_PANIC_STACK |
| 728 | 0: aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) |
| 729 | j mcck_skip |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 730 | |
Michael Holzheu | 7dd6b33 | 2011-08-03 16:44:19 +0200 | [diff] [blame] | 731 | # |
| 732 | # PSW restart interrupt handler |
| 733 | # |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 734 | ENTRY(restart_int_handler) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 735 | stg %r15,__LC_SAVE_AREA_RESTART |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 736 | lg %r15,__LC_RESTART_STACK |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 737 | aghi %r15,-__PT_SIZE # create pt_regs on stack |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 738 | xc 0(__PT_SIZE,%r15),0(%r15) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 739 | stmg %r0,%r14,__PT_R0(%r15) |
| 740 | mvc __PT_R15(8,%r15),__LC_SAVE_AREA_RESTART |
| 741 | mvc __PT_PSW(16,%r15),__LC_RST_OLD_PSW # store restart old psw |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 742 | aghi %r15,-STACK_FRAME_OVERHEAD # create stack frame on stack |
| 743 | xc 0(STACK_FRAME_OVERHEAD,%r15),0(%r15) |
Heiko Carstens | fbe7656 | 2012-06-05 09:59:52 +0200 | [diff] [blame] | 744 | lg %r1,__LC_RESTART_FN # load fn, parm & source cpu |
| 745 | lg %r2,__LC_RESTART_DATA |
| 746 | lg %r3,__LC_RESTART_SOURCE |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 747 | ltgr %r3,%r3 # test source cpu address |
| 748 | jm 1f # negative -> skip source stop |
Heiko Carstens | eb54619 | 2012-06-04 15:05:43 +0200 | [diff] [blame] | 749 | 0: sigp %r4,%r3,SIGP_SENSE # sigp sense to source cpu |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 750 | brc 10,0b # wait for status stored |
| 751 | 1: basr %r14,%r1 # call function |
| 752 | stap __SF_EMPTY(%r15) # store cpu address |
| 753 | llgh %r3,__SF_EMPTY(%r15) |
Heiko Carstens | eb54619 | 2012-06-04 15:05:43 +0200 | [diff] [blame] | 754 | 2: sigp %r4,%r3,SIGP_STOP # sigp stop to current cpu |
Martin Schwidefsky | 8b646bd | 2012-03-11 11:59:26 -0400 | [diff] [blame] | 755 | brc 2,2b |
| 756 | 3: j 3b |
Michael Holzheu | 7dd6b33 | 2011-08-03 16:44:19 +0200 | [diff] [blame] | 757 | |
Martin Schwidefsky | 860dba4 | 2011-01-05 12:47:25 +0100 | [diff] [blame] | 758 | .section .kprobes.text, "ax" |
| 759 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 760 | #ifdef CONFIG_CHECK_STACK |
| 761 | /* |
| 762 | * The synchronous or the asynchronous stack overflowed. We are dead. |
| 763 | * No need to properly save the registers, we are going to panic anyway. |
| 764 | * Setup a pt_regs so that show_trace can provide a good call trace. |
| 765 | */ |
| 766 | stack_overflow: |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 767 | lg %r15,__LC_PANIC_STACK # change to panic stack |
| 768 | la %r11,STACK_FRAME_OVERHEAD(%r15) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 769 | stmg %r0,%r7,__PT_R0(%r11) |
| 770 | stmg %r8,%r9,__PT_PSW(%r11) |
| 771 | mvc __PT_R8(64,%r11),0(%r14) |
| 772 | stg %r10,__PT_ORIG_GPR2(%r11) # store last break to orig_gpr2 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 773 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
| 774 | lgr %r2,%r11 # pass pointer to pt_regs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 775 | jg kernel_stack_overflow |
| 776 | #endif |
| 777 | |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 778 | .align 8 |
| 779 | cleanup_table: |
| 780 | .quad system_call |
| 781 | .quad sysc_do_svc |
| 782 | .quad sysc_tif |
| 783 | .quad sysc_restore |
| 784 | .quad sysc_done |
| 785 | .quad io_tif |
| 786 | .quad io_restore |
| 787 | .quad io_done |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 788 | .quad psw_idle |
| 789 | .quad psw_idle_end |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 790 | |
| 791 | cleanup_critical: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 792 | clg %r9,BASED(cleanup_table) # system_call |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 793 | jl 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 794 | clg %r9,BASED(cleanup_table+8) # sysc_do_svc |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 795 | jl cleanup_system_call |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 796 | clg %r9,BASED(cleanup_table+16) # sysc_tif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 797 | jl 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 798 | clg %r9,BASED(cleanup_table+24) # sysc_restore |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 799 | jl cleanup_sysc_tif |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 800 | clg %r9,BASED(cleanup_table+32) # sysc_done |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 801 | jl cleanup_sysc_restore |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 802 | clg %r9,BASED(cleanup_table+40) # io_tif |
Martin Schwidefsky | 63b1224 | 2006-06-29 14:58:05 +0200 | [diff] [blame] | 803 | jl 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 804 | clg %r9,BASED(cleanup_table+48) # io_restore |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 805 | jl cleanup_io_tif |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 806 | clg %r9,BASED(cleanup_table+56) # io_done |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 807 | jl cleanup_io_restore |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 808 | clg %r9,BASED(cleanup_table+64) # psw_idle |
| 809 | jl 0f |
| 810 | clg %r9,BASED(cleanup_table+72) # psw_idle_end |
| 811 | jl cleanup_idle |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 812 | 0: br %r14 |
| 813 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 814 | |
| 815 | cleanup_system_call: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 816 | # check if stpt has been executed |
| 817 | clg %r9,BASED(cleanup_system_call_insn) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 818 | jh 0f |
| 819 | mvc __LC_SYNC_ENTER_TIMER(8),__LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 820 | cghi %r11,__LC_SAVE_AREA_ASYNC |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 821 | je 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 822 | mvc __LC_SYNC_ENTER_TIMER(8),__LC_MCCK_ENTER_TIMER |
| 823 | 0: # check if stmg has been executed |
| 824 | clg %r9,BASED(cleanup_system_call_insn+8) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 825 | jh 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 826 | mvc __LC_SAVE_AREA_SYNC(64),0(%r11) |
| 827 | 0: # check if base register setup + TIF bit load has been done |
| 828 | clg %r9,BASED(cleanup_system_call_insn+16) |
| 829 | jhe 0f |
| 830 | # set up saved registers r10 and r12 |
| 831 | stg %r10,16(%r11) # r10 last break |
| 832 | stg %r12,32(%r11) # r12 thread-info pointer |
| 833 | 0: # check if the user time update has been done |
| 834 | clg %r9,BASED(cleanup_system_call_insn+24) |
| 835 | jh 0f |
| 836 | lg %r15,__LC_EXIT_TIMER |
| 837 | slg %r15,__LC_SYNC_ENTER_TIMER |
| 838 | alg %r15,__LC_USER_TIMER |
| 839 | stg %r15,__LC_USER_TIMER |
| 840 | 0: # check if the system time update has been done |
| 841 | clg %r9,BASED(cleanup_system_call_insn+32) |
| 842 | jh 0f |
| 843 | lg %r15,__LC_LAST_UPDATE_TIMER |
| 844 | slg %r15,__LC_EXIT_TIMER |
| 845 | alg %r15,__LC_SYSTEM_TIMER |
| 846 | stg %r15,__LC_SYSTEM_TIMER |
| 847 | 0: # update accounting time stamp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 848 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 849 | # do LAST_BREAK |
| 850 | lg %r9,16(%r11) |
| 851 | srag %r9,%r9,23 |
Martin Schwidefsky | 86f2552 | 2010-05-17 10:00:05 +0200 | [diff] [blame] | 852 | jz 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 853 | mvc __TI_last_break(8,%r12),16(%r11) |
| 854 | 0: # set up saved register r11 |
| 855 | lg %r15,__LC_KERNEL_STACK |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 856 | la %r9,STACK_FRAME_OVERHEAD(%r15) |
| 857 | stg %r9,24(%r11) # r11 pt_regs pointer |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 858 | # fill pt_regs |
Martin Schwidefsky | dc7ee00 | 2013-04-24 10:20:43 +0200 | [diff] [blame] | 859 | mvc __PT_R8(64,%r9),__LC_SAVE_AREA_SYNC |
| 860 | stmg %r0,%r7,__PT_R0(%r9) |
| 861 | mvc __PT_PSW(16,%r9),__LC_SVC_OLD_PSW |
| 862 | mvc __PT_INT_CODE(4,%r9),__LC_SVC_ILC |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 863 | # setup saved register r15 |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 864 | stg %r15,56(%r11) # r15 stack pointer |
| 865 | # set new psw address and exit |
| 866 | larl %r9,sysc_do_svc |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 867 | br %r14 |
| 868 | cleanup_system_call_insn: |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 869 | .quad system_call |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 870 | .quad sysc_stmg |
| 871 | .quad sysc_per |
| 872 | .quad sysc_vtime+18 |
| 873 | .quad sysc_vtime+42 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 874 | |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 875 | cleanup_sysc_tif: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 876 | larl %r9,sysc_tif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 877 | br %r14 |
| 878 | |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 879 | cleanup_sysc_restore: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 880 | clg %r9,BASED(cleanup_sysc_restore_insn) |
Martin Schwidefsky | 6377981 | 2010-05-17 10:00:03 +0200 | [diff] [blame] | 881 | je 0f |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 882 | lg %r9,24(%r11) # get saved pointer to pt_regs |
| 883 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) |
| 884 | mvc 0(64,%r11),__PT_R8(%r9) |
| 885 | lmg %r0,%r7,__PT_R0(%r9) |
| 886 | 0: lmg %r8,%r9,__LC_RETURN_PSW |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 887 | br %r14 |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 888 | cleanup_sysc_restore_insn: |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 889 | .quad sysc_done - 4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 890 | |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 891 | cleanup_io_tif: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 892 | larl %r9,io_tif |
Martin Schwidefsky | 176b180 | 2010-04-09 13:43:00 +0200 | [diff] [blame] | 893 | br %r14 |
| 894 | |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 895 | cleanup_io_restore: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 896 | clg %r9,BASED(cleanup_io_restore_insn) |
| 897 | je 0f |
| 898 | lg %r9,24(%r11) # get saved r11 pointer to pt_regs |
| 899 | mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 900 | mvc 0(64,%r11),__PT_R8(%r9) |
| 901 | lmg %r0,%r7,__PT_R0(%r9) |
| 902 | 0: lmg %r8,%r9,__LC_RETURN_PSW |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 903 | br %r14 |
Martin Schwidefsky | 6a2df3a | 2010-05-17 10:00:02 +0200 | [diff] [blame] | 904 | cleanup_io_restore_insn: |
Heiko Carstens | 411788e | 2007-11-20 11:13:32 +0100 | [diff] [blame] | 905 | .quad io_done - 4 |
Martin Schwidefsky | ae6aa2e | 2005-09-03 15:57:56 -0700 | [diff] [blame] | 906 | |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 907 | cleanup_idle: |
| 908 | # copy interrupt clock & cpu timer |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 909 | mvc __CLOCK_IDLE_EXIT(8,%r2),__LC_INT_CLOCK |
| 910 | mvc __TIMER_IDLE_EXIT(8,%r2),__LC_ASYNC_ENTER_TIMER |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 911 | cghi %r11,__LC_SAVE_AREA_ASYNC |
| 912 | je 0f |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 913 | mvc __CLOCK_IDLE_EXIT(8,%r2),__LC_MCCK_CLOCK |
| 914 | mvc __TIMER_IDLE_EXIT(8,%r2),__LC_MCCK_ENTER_TIMER |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 915 | 0: # check if stck & stpt have been executed |
| 916 | clg %r9,BASED(cleanup_idle_insn) |
| 917 | jhe 1f |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 918 | mvc __CLOCK_IDLE_ENTER(8,%r2),__CLOCK_IDLE_EXIT(%r2) |
| 919 | mvc __TIMER_IDLE_ENTER(8,%r2),__TIMER_IDLE_EXIT(%r2) |
| 920 | 1: # account system time going idle |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 921 | lg %r9,__LC_STEAL_TIMER |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 922 | alg %r9,__CLOCK_IDLE_ENTER(%r2) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 923 | slg %r9,__LC_LAST_UPDATE_CLOCK |
| 924 | stg %r9,__LC_STEAL_TIMER |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 925 | mvc __LC_LAST_UPDATE_CLOCK(8),__CLOCK_IDLE_EXIT(%r2) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 926 | lg %r9,__LC_SYSTEM_TIMER |
| 927 | alg %r9,__LC_LAST_UPDATE_TIMER |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 928 | slg %r9,__TIMER_IDLE_ENTER(%r2) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 929 | stg %r9,__LC_SYSTEM_TIMER |
Martin Schwidefsky | 27f6b41 | 2012-07-20 11:15:08 +0200 | [diff] [blame] | 930 | mvc __LC_LAST_UPDATE_TIMER(8),__TIMER_IDLE_EXIT(%r2) |
Martin Schwidefsky | 4c1051e | 2012-03-11 11:59:27 -0400 | [diff] [blame] | 931 | # prepare return psw |
| 932 | nihh %r8,0xfffd # clear wait state bit |
| 933 | lg %r9,48(%r11) # return from psw_idle |
| 934 | br %r14 |
| 935 | cleanup_idle_insn: |
| 936 | .quad psw_idle_lpsw |
| 937 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 938 | /* |
| 939 | * Integer constants |
| 940 | */ |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 941 | .align 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 942 | .Lcritical_start: |
Martin Schwidefsky | c532890 | 2011-12-27 11:27:15 +0100 | [diff] [blame] | 943 | .quad __critical_start |
| 944 | .Lcritical_length: |
| 945 | .quad __critical_end - __critical_start |
| 946 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 947 | |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 948 | #if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) |
| 949 | /* |
| 950 | * sie64a calling convention: |
| 951 | * %r2 pointer to sie control block |
| 952 | * %r3 guest register save area |
| 953 | */ |
Jan Glauber | 144d634 | 2011-07-24 10:48:19 +0200 | [diff] [blame] | 954 | ENTRY(sie64a) |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 955 | stmg %r6,%r14,__SF_GPRS(%r15) # save kernel registers |
| 956 | stg %r2,__SF_EMPTY(%r15) # save control block pointer |
| 957 | stg %r3,__SF_EMPTY+8(%r15) # save guest register save area |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 958 | xc __SF_EMPTY+16(16,%r15),__SF_EMPTY+16(%r15) # host id & reason |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 959 | lmg %r0,%r13,0(%r3) # load guest gprs 0-13 |
Christian Borntraeger | 480e592 | 2011-09-20 17:07:28 +0200 | [diff] [blame] | 960 | lg %r14,__LC_GMAP # get gmap pointer |
| 961 | ltgr %r14,%r14 |
| 962 | jz sie_gmap |
| 963 | lctlg %c1,%c1,__GMAP_ASCE(%r14) # load primary asce |
| 964 | sie_gmap: |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 965 | lg %r14,__SF_EMPTY(%r15) # get control block pointer |
Christian Borntraeger | 49b99e1 | 2013-05-17 14:41:35 +0200 | [diff] [blame] | 966 | oi __SIE_PROG0C+3(%r14),1 # we are going into SIE now |
| 967 | tm __SIE_PROG20+3(%r14),1 # last exit... |
| 968 | jnz sie_done |
Hendrik Brueckner | 23d18e8 | 2013-02-11 18:11:09 +0100 | [diff] [blame] | 969 | LPP __SF_EMPTY(%r15) # set guest id |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 970 | sie 0(%r14) |
| 971 | sie_done: |
Hendrik Brueckner | 23d18e8 | 2013-02-11 18:11:09 +0100 | [diff] [blame] | 972 | LPP __SF_EMPTY+16(%r15) # set host id |
Christian Borntraeger | 95d38fd | 2013-05-17 14:41:34 +0200 | [diff] [blame] | 973 | ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE |
Christian Borntraeger | 480e592 | 2011-09-20 17:07:28 +0200 | [diff] [blame] | 974 | lctlg %c1,%c1,__LC_USER_ASCE # load primary asce |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 975 | # some program checks are suppressing. C code (e.g. do_protection_exception) |
| 976 | # will rewind the PSW by the ILC, which is 4 bytes in case of SIE. Other |
| 977 | # instructions beween sie64a and sie_done should not cause program |
| 978 | # interrupts. So lets use a nop (47 00 00 00) as a landing pad. |
| 979 | # See also HANDLE_SIE_INTERCEPT |
| 980 | rewind_pad: |
| 981 | nop 0 |
Heinz Graalfs | b764bb1 | 2013-06-12 13:54:56 +0200 | [diff] [blame] | 982 | .globl sie_exit |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 983 | sie_exit: |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 984 | lg %r14,__SF_EMPTY+8(%r15) # load guest register save area |
| 985 | stmg %r0,%r13,0(%r14) # save guest gprs 0-13 |
| 986 | lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 987 | lg %r2,__SF_EMPTY+24(%r15) # return exit reason code |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 988 | br %r14 |
| 989 | sie_fault: |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 990 | lghi %r14,-EFAULT |
| 991 | stg %r14,__SF_EMPTY+24(%r15) # set exit reason code |
| 992 | j sie_exit |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 993 | |
| 994 | .align 8 |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 995 | .Lsie_critical: |
| 996 | .quad sie_gmap |
| 997 | .Lsie_critical_length: |
| 998 | .quad sie_done - sie_gmap |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 999 | |
Christian Borntraeger | ce6a04a | 2012-11-15 09:35:16 +0100 | [diff] [blame] | 1000 | EX_TABLE(rewind_pad,sie_fault) |
Martin Schwidefsky | 7c47053 | 2013-05-17 14:41:37 +0200 | [diff] [blame] | 1001 | EX_TABLE(sie_exit,sie_fault) |
Martin Schwidefsky | 603d1a5 | 2011-07-24 10:48:18 +0200 | [diff] [blame] | 1002 | #endif |
| 1003 | |
Heiko Carstens | 25d83cb | 2006-09-28 16:56:37 +0200 | [diff] [blame] | 1004 | .section .rodata, "a" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1005 | #define SYSCALL(esa,esame,emu) .long esame |
Heiko Carstens | 9bf1226 | 2009-06-12 10:26:47 +0200 | [diff] [blame] | 1006 | .globl sys_call_table |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1007 | sys_call_table: |
| 1008 | #include "syscalls.S" |
| 1009 | #undef SYSCALL |
| 1010 | |
Martin Schwidefsky | 347a8dc | 2006-01-06 00:19:28 -0800 | [diff] [blame] | 1011 | #ifdef CONFIG_COMPAT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1012 | |
| 1013 | #define SYSCALL(esa,esame,emu) .long emu |
Martin Schwidefsky | 6164988 | 2013-04-24 12:58:39 +0200 | [diff] [blame] | 1014 | .globl sys_call_table_emu |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1015 | sys_call_table_emu: |
| 1016 | #include "syscalls.S" |
| 1017 | #undef SYSCALL |
| 1018 | #endif |