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