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