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