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