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