2 * arch/s390/kernel/entry.S
3 * S390 low-level entry points.
6 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
8 * Hartmut Penner (hp@de.ibm.com),
9 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
12 #include <linux/sys.h>
13 #include <linux/linkage.h>
14 #include <linux/config.h>
15 #include <asm/cache.h>
16 #include <asm/lowcore.h>
17 #include <asm/errno.h>
18 #include <asm/ptrace.h>
19 #include <asm/thread_info.h>
20 #include <asm/offsets.h>
21 #include <asm/unistd.h>
24 * Stack layout for the system_call stack entry.
25 * The first few entries are identical to the user_regs_struct.
27 SP_PTREGS = STACK_FRAME_OVERHEAD
28 SP_PSW = STACK_FRAME_OVERHEAD + __PT_PSW
29 SP_R0 = STACK_FRAME_OVERHEAD + __PT_GPRS
30 SP_R1 = STACK_FRAME_OVERHEAD + __PT_GPRS + 4
31 SP_R2 = STACK_FRAME_OVERHEAD + __PT_GPRS + 8
32 SP_R3 = STACK_FRAME_OVERHEAD + __PT_GPRS + 12
33 SP_R4 = STACK_FRAME_OVERHEAD + __PT_GPRS + 16
34 SP_R5 = STACK_FRAME_OVERHEAD + __PT_GPRS + 20
35 SP_R6 = STACK_FRAME_OVERHEAD + __PT_GPRS + 24
36 SP_R7 = STACK_FRAME_OVERHEAD + __PT_GPRS + 28
37 SP_R8 = STACK_FRAME_OVERHEAD + __PT_GPRS + 32
38 SP_R9 = STACK_FRAME_OVERHEAD + __PT_GPRS + 36
39 SP_R10 = STACK_FRAME_OVERHEAD + __PT_GPRS + 40
40 SP_R11 = STACK_FRAME_OVERHEAD + __PT_GPRS + 44
41 SP_R12 = STACK_FRAME_OVERHEAD + __PT_GPRS + 48
42 SP_R13 = STACK_FRAME_OVERHEAD + __PT_GPRS + 52
43 SP_R14 = STACK_FRAME_OVERHEAD + __PT_GPRS + 56
44 SP_R15 = STACK_FRAME_OVERHEAD + __PT_GPRS + 60
45 SP_ORIG_R2 = STACK_FRAME_OVERHEAD + __PT_ORIG_GPR2
46 SP_ILC = STACK_FRAME_OVERHEAD + __PT_ILC
47 SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP
48 SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE
50 _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_RESTART_SVC)
51 _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED)
53 #define BASED(name) name-system_call(%r13)
56 * Register usage in interrupt handlers:
57 * R9 - pointer to current task structure
58 * R13 - pointer to literal pool
59 * R14 - return register for function calls
60 * R15 - kernel stack pointer
63 .macro SAVE_ALL_BASE psworg,savearea,sync
64 stm %r12,%r15,\savearea
65 l %r13,__LC_SVC_NEW_PSW+4 # load &system_call to %r13
68 .macro CLEANUP_SAVE_ALL_BASE psworg,savearea,sync
72 mvc \savearea(16),SP_R12(%r15)
73 0: st %r13,SP_R13(%r15)
76 .macro SAVE_ALL psworg,savearea,sync
78 tm \psworg+1,0x01 # test problem state bit
79 bz BASED(1f) # skip stack setup save
80 l %r15,__LC_KERNEL_STACK # problem state -> load ksp
82 tm \psworg+1,0x01 # test problem state bit
83 bnz BASED(0f) # from user -> load async stack
84 l %r14,__LC_ASYNC_STACK # are we already on the async stack ?
88 0: l %r15,__LC_ASYNC_STACK
90 1: s %r15,BASED(.Lc_spsize) # make room for registers & psw
91 l %r14,BASED(.L\psworg)
93 icm %r14,12,__LC_SVC_ILC
94 stm %r0,%r11,SP_R0(%r15) # store gprs 0-12 to kernel stack
95 st %r2,SP_ORIG_R2(%r15) # store original content of gpr 2
96 mvc SP_R12(16,%r15),\savearea # move R13-R15 to stack
97 mvc SP_PSW(8,%r15),\psworg # move user PSW to stack
99 st %r12,0(%r15) # clear back chain
102 .macro CLEANUP_SAVE_ALL psworg,savearea,sync
107 l %r1,__LC_KERNEL_STACK
111 l %r0,__LC_ASYNC_STACK
115 0: l %r1,__LC_ASYNC_STACK
117 1: s %r1,BASED(.Lc_spsize)
119 l %r0,BASED(.L\psworg)
120 xc SP_R12(4,%r15),SP_R12(%r15)
121 icm %r0,12,__LC_SVC_ILC
123 mvc SP_R0(48,%r1),SP_R0(%r15)
124 mvc SP_ORIG_R2(4,%r1),SP_R2(%r15)
125 mvc SP_R12(16,%r1),\savearea
126 mvc SP_PSW(8,%r1),\psworg
131 .macro RESTORE_ALL # system exit macro
132 mvc __LC_RETURN_PSW(8),SP_PSW(%r15) # move user PSW to lowcore
133 ni __LC_RETURN_PSW+1,0xfd # clear wait state bit
134 lm %r0,%r15,SP_R0(%r15) # load gprs 0-15 of user
135 lpsw __LC_RETURN_PSW # back to caller
138 .macro CLEANUP_RESTORE_ALL
142 mvc SP_PSW(8,%r15),__LC_RETURN_PSW
144 0: l %r1,SP_R15(%r15)
145 mvc SP_PSW(8,%r15),SP_PSW(%r1)
146 mvc SP_R0(64,%r15),SP_R0(%r1)
150 .macro GET_THREAD_INFO
151 l %r9,__LC_THREAD_INFO
154 .macro CHECK_CRITICAL
155 tm SP_PSW+1(%r15),0x01 # test problem state bit
156 bnz BASED(0f) # from user -> not critical
157 clc SP_PSW+4(4,%r15),BASED(.Lcritical_end)
159 clc SP_PSW+4(4,%r15),BASED(.Lcritical_start)
161 l %r1,BASED(.Lcleanup_critical)
167 * Scheduler resume function, called by switch_to
168 * gpr2 = (task_struct *) prev
169 * gpr3 = (task_struct *) next
177 tm __THREAD_per(%r3),0xe8 # new process is using per ?
178 bz __switch_to_noper-__switch_to_base(%r1) # if not we're fine
179 stctl %c9,%c11,24(%r15) # We are using per stuff
180 clc __THREAD_per(12,%r3),24(%r15)
181 be __switch_to_noper-__switch_to_base(%r1) # we got away w/o bashing TLB's
182 lctl %c9,%c11,__THREAD_per(%r3) # Nope we didn't
184 stm %r6,%r15,24(%r15) # store __switch_to registers of prev task
185 st %r15,__THREAD_ksp(%r2) # store kernel stack to prev->tss.ksp
186 l %r15,__THREAD_ksp(%r3) # load kernel stack from next->tss.ksp
187 lm %r6,%r15,24(%r15) # load __switch_to registers of next task
188 st %r3,__LC_CURRENT # __LC_CURRENT = current task struct
189 l %r3,__THREAD_info(%r3) # load thread_info from task struct
190 st %r3,__LC_THREAD_INFO
192 st %r3,__LC_KERNEL_STACK # __LC_KERNEL_STACK = new kernel stack
196 * do_softirq calling function. We want to run the softirq functions on the
197 * asynchronous interrupt stack.
199 .global do_call_softirq
202 stm %r12,%r15,28(%r15)
206 l %r0,__LC_ASYNC_STACK
209 be 0f-do_call_base(%r13)
210 l %r15,__LC_ASYNC_STACK
211 0: sl %r15,.Lc_overhead-do_call_base(%r13)
212 st %r12,0(%r15) # store backchain
213 l %r1,.Ldo_softirq-do_call_base(%r13)
215 lm %r12,%r15,28(%r12)
221 * SVC interrupt handler routine. System calls are synchronous events and
222 * are executed with interrupts enabled.
227 SAVE_ALL_BASE __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
228 SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
229 lh %r7,0x8a # get svc number from lowcore
231 GET_THREAD_INFO # load pointer to task_struct to R9
232 sla %r7,2 # *4 and test for svc 0
233 bnz BASED(sysc_do_restart) # svc number > 0
234 # svc 0: system call number in %r1
235 cl %r1,BASED(.Lnr_syscalls)
236 bnl BASED(sysc_do_restart)
237 lr %r7,%r1 # copy svc number to %r7
240 tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
241 l %r8,sys_call_table-system_call(%r7,%r13) # get system call addr.
242 bo BASED(sysc_tracesys)
243 basr %r14,%r8 # call sys_xxxx
244 st %r2,SP_R2(%r15) # store return value (change R2 on stack)
245 # ATTENTION: check sys_execve_glue before
246 # changing anything here !!
249 tm SP_PSW+1(%r15),0x01 # returning to user ?
250 bno BASED(sysc_leave)
251 tm __TI_flags+3(%r9),_TIF_WORK_SVC
252 bnz BASED(sysc_work) # there is work to do (signals etc.)
257 # recheck if there is more work to do
260 GET_THREAD_INFO # load pointer to task_struct to R9
261 tm __TI_flags+3(%r9),_TIF_WORK_SVC
262 bz BASED(sysc_leave) # there is no work to do
264 # One of the work bits is on. Find out which one.
265 # Checked are: _TIF_SIGPENDING and _TIF_NEED_RESCHED
268 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
269 bo BASED(sysc_reschedule)
270 tm __TI_flags+3(%r9),_TIF_SIGPENDING
271 bo BASED(sysc_sigpending)
272 tm __TI_flags+3(%r9),_TIF_RESTART_SVC
273 bo BASED(sysc_restart)
277 # _TIF_NEED_RESCHED is set, call schedule
280 l %r1,BASED(.Lschedule)
281 la %r14,BASED(sysc_work_loop)
282 br %r1 # call scheduler
285 # _TIF_SIGPENDING is set, call do_signal
288 la %r2,SP_PTREGS(%r15) # load pt_regs
289 sr %r3,%r3 # clear *oldset
290 l %r1,BASED(.Ldo_signal)
291 basr %r14,%r1 # call do_signal
292 tm __TI_flags+3(%r9),_TIF_RESTART_SVC
293 bo BASED(sysc_restart)
294 b BASED(sysc_leave) # out of here, do NOT recheck
297 # _TIF_RESTART_SVC is set, set up registers and restart svc
300 ni __TI_flags+3(%r9),255-_TIF_RESTART_SVC # clear TIF_RESTART_SVC
301 l %r7,SP_R2(%r15) # load new svc number
303 mvc SP_R2(4,%r15),SP_ORIG_R2(%r15) # restore first argument
304 lm %r2,%r6,SP_R2(%r15) # load svc arguments
305 b BASED(sysc_do_restart) # restart svc
310 # call trace before and after sys_call
314 la %r2,SP_PTREGS(%r15) # load pt_regs
319 clc SP_R2(4,%r15),BASED(.Lnr_syscalls)
320 bnl BASED(sysc_tracenogo)
321 l %r7,SP_R2(%r15) # strace might have changed the
322 sll %r7,2 # system call
323 l %r8,sys_call_table-system_call(%r7,%r13)
325 lm %r3,%r6,SP_R3(%r15)
326 l %r2,SP_ORIG_R2(%r15)
327 basr %r14,%r8 # call sys_xxx
328 st %r2,SP_R2(%r15) # store return value
330 tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
331 bno BASED(sysc_return)
333 la %r2,SP_PTREGS(%r15) # load pt_regs
335 la %r14,BASED(sysc_return)
339 # a new process exits the kernel with ret_from_fork
343 l %r13,__LC_SVC_NEW_PSW+4
344 GET_THREAD_INFO # load pointer to task_struct to R9
345 l %r1,BASED(.Lschedtail)
347 stosm 24(%r15),0x03 # reenable interrupts
351 # clone, fork, vfork, exec and sigreturn need glue,
352 # because they all expect pt_regs as parameter,
353 # but are called with different parameter.
354 # return-address is set up above
357 la %r2,SP_PTREGS(%r15) # load pt_regs
359 br %r1 # branch to sys_clone
362 la %r2,SP_PTREGS(%r15) # load pt_regs
364 br %r1 # branch to sys_fork
367 la %r2,SP_PTREGS(%r15) # load pt_regs
369 br %r1 # branch to sys_vfork
372 la %r2,SP_PTREGS(%r15) # load pt_regs
373 l %r1,BASED(.Lexecve)
374 lr %r12,%r14 # save return address
375 basr %r14,%r1 # call sys_execve
376 ltr %r2,%r2 # check if execve failed
377 bnz 0(%r12) # it did fail -> store result in gpr2
378 b 4(%r12) # SKIP ST 2,SP_R2(15) after BASR 14,8
379 # in system_call/sysc_tracesys
382 la %r2,SP_PTREGS(%r15) # load pt_regs as parameter
383 l %r1,BASED(.Lsigreturn)
384 br %r1 # branch to sys_sigreturn
386 sys_rt_sigreturn_glue:
387 la %r2,SP_PTREGS(%r15) # load pt_regs as parameter
388 l %r1,BASED(.Lrt_sigreturn)
389 br %r1 # branch to sys_sigreturn
392 # sigsuspend and rt_sigsuspend need pt_regs as an additional
393 # parameter and they have to skip the store of %r2 into the
394 # user register %r2 because the return value was set in
395 # sigsuspend and rt_sigsuspend already and must not be overwritten!
399 lr %r5,%r4 # move mask back
400 lr %r4,%r3 # move history1 parameter
401 lr %r3,%r2 # move history0 parameter
402 la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter
403 l %r1,BASED(.Lsigsuspend)
404 la %r14,4(%r14) # skip store of return value
405 br %r1 # branch to sys_sigsuspend
407 sys_rt_sigsuspend_glue:
408 lr %r4,%r3 # move sigsetsize parameter
409 lr %r3,%r2 # move unewset parameter
410 la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter
411 l %r1,BASED(.Lrt_sigsuspend)
412 la %r14,4(%r14) # skip store of return value
413 br %r1 # branch to sys_rt_sigsuspend
415 sys_sigaltstack_glue:
416 la %r4,SP_PTREGS(%r15) # load pt_regs as parameter
417 l %r1,BASED(.Lsigaltstack)
418 br %r1 # branch to sys_sigreturn
422 * Program check handler routine
425 .globl pgm_check_handler
428 * First we need to check for a special case:
429 * Single stepping an instruction that disables the PER event mask will
430 * cause a PER event AFTER the mask has been set. Example: SVC or LPSW.
431 * For a single stepped SVC the program check handler gets control after
432 * the SVC new PSW has been loaded. But we want to execute the SVC first and
433 * then handle the PER event. Therefore we update the SVC old PSW to point
434 * to the pgm_check_handler and branch to the SVC handler after we checked
435 * if we have to load the kernel stack register.
436 * For every other possible cause for PER event without the PER mask set
437 * we just ignore the PER event (FIXME: is there anything we have to do
440 SAVE_ALL_BASE __LC_PGM_OLD_PSW,__LC_SAVE_AREA,1
441 tm __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception
442 bnz BASED(pgm_per) # got per exception -> special case
443 SAVE_ALL __LC_PGM_OLD_PSW,__LC_SAVE_AREA,1
444 l %r3,__LC_PGM_ILC # load program interruption code
446 l %r7,BASED(.Ljump_table)
450 l %r7,0(%r8,%r7) # load address of handler routine
451 la %r2,SP_PTREGS(%r15) # address of register-save area
452 la %r14,BASED(sysc_return)
453 br %r7 # branch to interrupt-handler
456 # handle per exception
459 tm __LC_PGM_OLD_PSW,0x40 # test if per event recording is on
460 bnz BASED(pgm_per_std) # ok, normal per event from user space
461 # ok its one of the special cases, now we need to find out which one
462 clc __LC_PGM_OLD_PSW(8),__LC_SVC_NEW_PSW
464 # no interesting special case, ignore PER event
465 lm %r13,%r15,__LC_SAVE_AREA
469 # Normal per exception
472 SAVE_ALL __LC_PGM_OLD_PSW,__LC_SAVE_AREA,1
474 mvc __THREAD_per+__PER_atmid(2,%r9),__LC_PER_ATMID
475 mvc __THREAD_per+__PER_address(4,%r9),__LC_PER_ADDRESS
476 mvc __THREAD_per+__PER_access_id(1,%r9),__LC_PER_ACCESS_ID
478 l %r3,__LC_PGM_ILC # load program interruption code
479 nr %r4,%r3 # clear per-event-bit and ilc
480 be BASED(pgm_per_only) # only per or per+check ?
481 l %r1,BASED(.Ljump_table)
483 l %r1,0(%r4,%r1) # load address of handler routine
484 la %r2,SP_PTREGS(%r15) # address of register-save area
485 basr %r14,%r1 # branch to interrupt-handler
487 la %r2,SP_PTREGS(15) # address of register-save area
488 l %r1,BASED(.Lhandle_per) # load adr. of per handler
489 la %r14,BASED(sysc_return) # load adr. of system return
490 br %r1 # branch to do_debugger_trap
493 # it was a single stepped SVC that is causing all the trouble
496 SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
497 lh %r7,0x8a # get svc number from lowcore
498 stosm 24(%r15),0x03 # reenable interrupts
499 GET_THREAD_INFO # load pointer to task_struct to R9
500 mvc __THREAD_per+__PER_atmid(2,%r9),__LC_PER_ATMID
501 mvc __THREAD_per+__PER_address(4,%r9),__LC_PER_ADDRESS
502 mvc __THREAD_per+__PER_access_id(1,%r9),__LC_PER_ACCESS_ID
503 sla %r7,2 # *4 and test for svc 0
504 bnz BASED(pgm_svcstd) # svc number > 0 ?
505 # svc 0: system call number in %r1
506 cl %r1,BASED(.Lnr_syscalls)
507 bnl BASED(pgm_svcstd)
508 lr %r7,%r1 # copy svc number to %r7
511 tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
512 l %r8,sys_call_table-system_call(%r7,%r13) # get system call addr.
513 bo BASED(pgm_tracesys)
514 basr %r14,%r8 # call sys_xxxx
515 st %r2,SP_R2(%r15) # store return value (change R2 on stack)
516 # ATTENTION: check sys_execve_glue before
517 # changing anything here !!
520 tm __TI_flags+3(%r9),_TIF_SIGPENDING
521 bno BASED(pgm_svcper_nosig)
522 la %r2,SP_PTREGS(%r15) # load pt_regs
523 sr %r3,%r3 # clear *oldset
524 l %r1,BASED(.Ldo_signal)
525 basr %r14,%r1 # call do_signal
528 mvi SP_TRAP+3(%r15),0x28 # set trap indication to pgm check
529 la %r2,SP_PTREGS(15) # address of register-save area
530 l %r1,BASED(.Lhandle_per) # load adr. of per handler
531 la %r14,BASED(sysc_return) # load adr. of system return
532 br %r1 # branch to do_debugger_trap
534 # call trace before and after sys_call
538 la %r2,SP_PTREGS(%r15) # load pt_regs
543 clc SP_R2(4,%r15),BASED(.Lnr_syscalls)
544 bnl BASED(pgm_svc_nogo)
545 l %r7,SP_R2(%r15) # strace changed the syscall
547 l %r8,sys_call_table-system_call(%r7,%r13)
549 lm %r3,%r6,SP_R3(%r15)
550 l %r2,SP_ORIG_R2(%r15)
551 basr %r14,%r8 # call sys_xxx
552 st %r2,SP_R2(%r15) # store return value
554 tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
555 bno BASED(pgm_svcret)
557 la %r2,SP_PTREGS(%r15) # load pt_regs
559 la %r14,BASED(pgm_svcret)
563 * IO interrupt handler routine
566 .globl io_int_handler
568 SAVE_ALL_BASE __LC_IO_OLD_PSW,__LC_SAVE_AREA+16,0
569 SAVE_ALL __LC_IO_OLD_PSW,__LC_SAVE_AREA+16,0
572 GET_THREAD_INFO # load pointer to task_struct to R9
573 l %r1,BASED(.Ldo_IRQ) # load address of do_IRQ
574 la %r2,SP_PTREGS(%r15) # address of register-save area
575 basr %r14,%r1 # branch to standard irq handler
578 tm SP_PSW+1(%r15),0x01 # returning to user ?
579 #ifdef CONFIG_PREEMPT
580 bno BASED(io_preempt) # no -> check for preemptive scheduling
582 bno BASED(io_leave) # no-> skip resched & signal
584 tm __TI_flags+3(%r9),_TIF_WORK_INT
585 bnz BASED(io_work) # there is work to do (signals etc.)
589 #ifdef CONFIG_PREEMPT
591 icm %r0,15,__TI_precount(%r9)
594 s %r1,BASED(.Lc_spsize)
595 mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15)
596 xc 0(4,%r1),0(%r1) # clear back chain
599 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
601 mvc __TI_precount(4,%r9),BASED(.Lc_pactive)
602 stosm 24(%r15),0x03 # reenable interrupts
603 l %r1,BASED(.Lschedule)
604 basr %r14,%r1 # call schedule
605 stnsm 24(%r15),0xfc # disable I/O and ext. interrupts
606 GET_THREAD_INFO # load pointer to task_struct to R9
607 xc __TI_precount(4,%r9),__TI_precount(%r9)
608 b BASED(io_resume_loop)
612 # switch to kernel stack, then check the TIF bits
615 l %r1,__LC_KERNEL_STACK
616 s %r1,BASED(.Lc_spsize)
617 mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15)
618 xc 0(4,%r1),0(%r1) # clear back chain
621 # One of the work bits is on. Find out which one.
622 # Checked are: _TIF_SIGPENDING and _TIF_NEED_RESCHED
625 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
626 bo BASED(io_reschedule)
627 tm __TI_flags+3(%r9),_TIF_SIGPENDING
628 bo BASED(io_sigpending)
632 # _TIF_NEED_RESCHED is set, call schedule
635 l %r1,BASED(.Lschedule)
636 stosm 24(%r15),0x03 # reenable interrupts
637 basr %r14,%r1 # call scheduler
638 stnsm 24(%r15),0xfc # disable I/O and ext. interrupts
639 GET_THREAD_INFO # load pointer to task_struct to R9
640 tm __TI_flags+3(%r9),_TIF_WORK_INT
641 bz BASED(io_leave) # there is no work to do
642 b BASED(io_work_loop)
645 # _TIF_SIGPENDING is set, call do_signal
648 stosm 24(%r15),0x03 # reenable interrupts
649 la %r2,SP_PTREGS(%r15) # load pt_regs
650 sr %r3,%r3 # clear *oldset
651 l %r1,BASED(.Ldo_signal)
652 basr %r14,%r1 # call do_signal
653 stnsm 24(%r15),0xfc # disable I/O and ext. interrupts
654 b BASED(io_leave) # out of here, do NOT recheck
657 * External interrupt handler routine
660 .globl ext_int_handler
662 SAVE_ALL_BASE __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16,0
663 SAVE_ALL __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16,0
666 GET_THREAD_INFO # load pointer to task_struct to R9
667 la %r2,SP_PTREGS(%r15) # address of register-save area
668 lh %r3,__LC_EXT_INT_CODE # get interruption code
669 l %r1,BASED(.Ldo_extint)
674 * Machine check handler routines
677 .globl mcck_int_handler
679 SAVE_ALL_BASE __LC_MCK_OLD_PSW,__LC_SAVE_AREA+32,0
680 SAVE_ALL __LC_MCK_OLD_PSW,__LC_SAVE_AREA+32,0
681 l %r1,BASED(.Ls390_mcck)
682 basr %r14,%r1 # call machine check handler
688 * Restart interruption handler, kick starter for additional CPUs
690 .globl restart_int_handler
692 l %r15,__LC_SAVE_AREA+60 # load ksp
693 lctl %c0,%c15,__LC_CREGS_SAVE_AREA # get new ctl regs
694 lam %a0,%a15,__LC_AREGS_SAVE_AREA
695 stosm 0(%r15),0x04 # now we can turn dat on
696 lm %r6,%r15,24(%r15) # load registers from clone
698 l %r14,restart_addr-.(%r14)
699 br %r14 # branch to start_secondary
701 .long start_secondary
704 * If we do not run with SMP enabled, let the new CPU crash ...
706 .globl restart_int_handler
710 lpsw restart_crash-restart_base(%r1)
713 .long 0x000a0000,0x00000000
718 .long system_call, sysc_enter, cleanup_sysc_enter
719 .long sysc_return, sysc_leave, cleanup_sysc_return
720 .long sysc_leave, sysc_work_loop, cleanup_sysc_leave
721 .long sysc_work_loop, sysc_reschedule, cleanup_sysc_return
722 cleanup_table_entries=(.-cleanup_table) / 12
725 lhi %r0,cleanup_table_entries
726 la %r1,BASED(cleanup_table)
731 bl BASED(cleanup_cont)
733 bl BASED(cleanup_found)
736 bct %r0,BASED(cleanup_loop)
743 CLEANUP_SAVE_ALL_BASE __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
744 CLEANUP_SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
747 la %r1,BASED(sysc_enter)
749 st %r1,SP_PSW+4(%r15)
753 la %r1,BASED(sysc_return)
755 st %r1,SP_PSW+4(%r15)
766 .Lc_spsize: .long SP_SIZE
767 .Lc_overhead: .long STACK_FRAME_OVERHEAD
768 .Lc_pactive: .long PREEMPT_ACTIVE
769 .Lnr_syscalls: .long NR_syscalls
775 .Lamode: .long 0x80000000
780 .Ls390_mcck: .long s390_do_machine_check
781 .Ldo_IRQ: .long do_IRQ
782 .Ldo_extint: .long do_extint
783 .Ldo_signal: .long do_signal
784 .Ldo_softirq: .long do_softirq
785 .Lhandle_per: .long do_debugger_trap
786 .Ljump_table: .long pgm_check_table
787 .Lschedule: .long schedule
788 .Lclone: .long sys_clone
789 .Lexecve: .long sys_execve
790 .Lfork: .long sys_fork
791 .Lrt_sigreturn:.long sys_rt_sigreturn
793 .long sys_rt_sigsuspend
794 .Lsigreturn: .long sys_sigreturn
795 .Lsigsuspend: .long sys_sigsuspend
796 .Lsigaltstack: .long sys_sigaltstack
797 .Ltrace: .long syscall_trace
798 .Lvfork: .long sys_vfork
799 .Lschedtail: .long schedule_tail
802 .long __critical_start + 0x80000000
804 .long __critical_end + 0x80000000
806 .long cleanup_critical
808 #define SYSCALL(esa,esame,emu) .long esa
809 .globl sys_call_table
811 #include "syscalls.S"