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