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