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