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 bnz 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 bz 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
475 mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
476 mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS
477 mvc __THREAD_per+__PER_access_id(1,%r1),__LC_PER_ACCESS_ID
479 l %r3,__LC_PGM_ILC # load program interruption code
480 nr %r4,%r3 # clear per-event-bit and ilc
481 be BASED(pgm_per_only) # only per or per+check ?
482 l %r1,BASED(.Ljump_table)
484 l %r1,0(%r4,%r1) # load address of handler routine
485 la %r2,SP_PTREGS(%r15) # address of register-save area
486 basr %r14,%r1 # branch to interrupt-handler
488 la %r2,SP_PTREGS(15) # address of register-save area
489 l %r1,BASED(.Lhandle_per) # load adr. of per handler
490 la %r14,BASED(sysc_return) # load adr. of system return
491 br %r1 # branch to do_debugger_trap
494 # it was a single stepped SVC that is causing all the trouble
497 SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
498 lh %r7,0x8a # get svc number from lowcore
499 GET_THREAD_INFO # load pointer to task_struct to R9
501 mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
502 mvc __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS
503 mvc __THREAD_per+__PER_access_id(1,%r1),__LC_PER_ACCESS_ID
504 stosm 24(%r15),0x03 # reenable interrupts
505 sla %r7,2 # *4 and test for svc 0
506 bnz BASED(pgm_svcstd) # svc number > 0 ?
507 # svc 0: system call number in %r1
508 cl %r1,BASED(.Lnr_syscalls)
509 bnl BASED(pgm_svcstd)
510 lr %r7,%r1 # copy svc number to %r7
513 tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
514 l %r8,sys_call_table-system_call(%r7,%r13) # get system call addr.
515 bnz BASED(pgm_tracesys)
516 basr %r14,%r8 # call sys_xxxx
517 st %r2,SP_R2(%r15) # store return value (change R2 on stack)
518 # ATTENTION: check sys_execve_glue before
519 # changing anything here !!
522 tm __TI_flags+3(%r9),_TIF_SIGPENDING
523 bno BASED(pgm_svcper_nosig)
524 la %r2,SP_PTREGS(%r15) # load pt_regs
525 sr %r3,%r3 # clear *oldset
526 l %r1,BASED(.Ldo_signal)
527 basr %r14,%r1 # call do_signal
530 mvi SP_TRAP+3(%r15),0x28 # set trap indication to pgm check
531 la %r2,SP_PTREGS(15) # address of register-save area
532 l %r1,BASED(.Lhandle_per) # load adr. of per handler
533 la %r14,BASED(sysc_return) # load adr. of system return
534 br %r1 # branch to do_debugger_trap
536 # call trace before and after sys_call
540 la %r2,SP_PTREGS(%r15) # load pt_regs
545 clc SP_R2(4,%r15),BASED(.Lnr_syscalls)
546 bnl BASED(pgm_svc_nogo)
547 l %r7,SP_R2(%r15) # strace changed the syscall
549 l %r8,sys_call_table-system_call(%r7,%r13)
551 lm %r3,%r6,SP_R3(%r15)
552 l %r2,SP_ORIG_R2(%r15)
553 basr %r14,%r8 # call sys_xxx
554 st %r2,SP_R2(%r15) # store return value
556 tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
559 la %r2,SP_PTREGS(%r15) # load pt_regs
561 la %r14,BASED(pgm_svcret)
565 * IO interrupt handler routine
568 .globl io_int_handler
570 SAVE_ALL_BASE __LC_IO_OLD_PSW,__LC_SAVE_AREA+16,0
571 SAVE_ALL __LC_IO_OLD_PSW,__LC_SAVE_AREA+16,0
574 GET_THREAD_INFO # load pointer to task_struct to R9
575 l %r1,BASED(.Ldo_IRQ) # load address of do_IRQ
576 la %r2,SP_PTREGS(%r15) # address of register-save area
577 basr %r14,%r1 # branch to standard irq handler
580 tm SP_PSW+1(%r15),0x01 # returning to user ?
581 #ifdef CONFIG_PREEMPT
582 bno BASED(io_preempt) # no -> check for preemptive scheduling
584 bno BASED(io_leave) # no-> skip resched & signal
586 tm __TI_flags+3(%r9),_TIF_WORK_INT
587 bnz BASED(io_work) # there is work to do (signals etc.)
591 #ifdef CONFIG_PREEMPT
593 icm %r0,15,__TI_precount(%r9)
596 s %r1,BASED(.Lc_spsize)
597 mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15)
598 xc 0(4,%r1),0(%r1) # clear back chain
601 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
603 mvc __TI_precount(4,%r9),BASED(.Lc_pactive)
604 stosm 24(%r15),0x03 # reenable interrupts
605 l %r1,BASED(.Lschedule)
606 basr %r14,%r1 # call schedule
607 stnsm 24(%r15),0xfc # disable I/O and ext. interrupts
608 GET_THREAD_INFO # load pointer to task_struct to R9
609 xc __TI_precount(4,%r9),__TI_precount(%r9)
610 b BASED(io_resume_loop)
614 # switch to kernel stack, then check the TIF bits
617 l %r1,__LC_KERNEL_STACK
618 s %r1,BASED(.Lc_spsize)
619 mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15)
620 xc 0(4,%r1),0(%r1) # clear back chain
623 # One of the work bits is on. Find out which one.
624 # Checked are: _TIF_SIGPENDING and _TIF_NEED_RESCHED
627 tm __TI_flags+3(%r9),_TIF_NEED_RESCHED
628 bo BASED(io_reschedule)
629 tm __TI_flags+3(%r9),_TIF_SIGPENDING
630 bo BASED(io_sigpending)
634 # _TIF_NEED_RESCHED is set, call schedule
637 l %r1,BASED(.Lschedule)
638 stosm 24(%r15),0x03 # reenable interrupts
639 basr %r14,%r1 # call scheduler
640 stnsm 24(%r15),0xfc # disable I/O and ext. interrupts
641 GET_THREAD_INFO # load pointer to task_struct to R9
642 tm __TI_flags+3(%r9),_TIF_WORK_INT
643 bz BASED(io_leave) # there is no work to do
644 b BASED(io_work_loop)
647 # _TIF_SIGPENDING is set, call do_signal
650 stosm 24(%r15),0x03 # reenable interrupts
651 la %r2,SP_PTREGS(%r15) # load pt_regs
652 sr %r3,%r3 # clear *oldset
653 l %r1,BASED(.Ldo_signal)
654 basr %r14,%r1 # call do_signal
655 stnsm 24(%r15),0xfc # disable I/O and ext. interrupts
656 b BASED(io_leave) # out of here, do NOT recheck
659 * External interrupt handler routine
662 .globl ext_int_handler
664 SAVE_ALL_BASE __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16,0
665 SAVE_ALL __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16,0
668 GET_THREAD_INFO # load pointer to task_struct to R9
669 la %r2,SP_PTREGS(%r15) # address of register-save area
670 lh %r3,__LC_EXT_INT_CODE # get interruption code
671 l %r1,BASED(.Ldo_extint)
676 * Machine check handler routines
679 .globl mcck_int_handler
681 SAVE_ALL_BASE __LC_MCK_OLD_PSW,__LC_SAVE_AREA+32,0
682 SAVE_ALL __LC_MCK_OLD_PSW,__LC_SAVE_AREA+32,0
683 l %r1,BASED(.Ls390_mcck)
684 basr %r14,%r1 # call machine check handler
690 * Restart interruption handler, kick starter for additional CPUs
692 .globl restart_int_handler
694 l %r15,__LC_SAVE_AREA+60 # load ksp
695 lctl %c0,%c15,__LC_CREGS_SAVE_AREA # get new ctl regs
696 lam %a0,%a15,__LC_AREGS_SAVE_AREA
697 stosm 0(%r15),0x04 # now we can turn dat on
698 lm %r6,%r15,24(%r15) # load registers from clone
700 l %r14,restart_addr-.(%r14)
701 br %r14 # branch to start_secondary
703 .long start_secondary
706 * If we do not run with SMP enabled, let the new CPU crash ...
708 .globl restart_int_handler
712 lpsw restart_crash-restart_base(%r1)
715 .long 0x000a0000,0x00000000
720 .long system_call, sysc_enter, cleanup_sysc_enter
721 .long sysc_return, sysc_leave, cleanup_sysc_return
722 .long sysc_leave, sysc_work_loop, cleanup_sysc_leave
723 .long sysc_work_loop, sysc_reschedule, cleanup_sysc_return
724 cleanup_table_entries=(.-cleanup_table) / 12
727 lhi %r0,cleanup_table_entries
728 la %r1,BASED(cleanup_table)
733 bl BASED(cleanup_cont)
735 bl BASED(cleanup_found)
738 bct %r0,BASED(cleanup_loop)
745 CLEANUP_SAVE_ALL_BASE __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
746 CLEANUP_SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
749 la %r1,BASED(sysc_enter)
751 st %r1,SP_PSW+4(%r15)
755 la %r1,BASED(sysc_return)
757 st %r1,SP_PSW+4(%r15)
768 .Lc_spsize: .long SP_SIZE
769 .Lc_overhead: .long STACK_FRAME_OVERHEAD
770 .Lc_pactive: .long PREEMPT_ACTIVE
771 .Lnr_syscalls: .long NR_syscalls
777 .Lamode: .long 0x80000000
782 .Ls390_mcck: .long s390_do_machine_check
783 .Ldo_IRQ: .long do_IRQ
784 .Ldo_extint: .long do_extint
785 .Ldo_signal: .long do_signal
786 .Ldo_softirq: .long do_softirq
787 .Lhandle_per: .long do_debugger_trap
788 .Ljump_table: .long pgm_check_table
789 .Lschedule: .long schedule
790 .Lclone: .long sys_clone
791 .Lexecve: .long sys_execve
792 .Lfork: .long sys_fork
793 .Lrt_sigreturn:.long sys_rt_sigreturn
795 .long sys_rt_sigsuspend
796 .Lsigreturn: .long sys_sigreturn
797 .Lsigsuspend: .long sys_sigsuspend
798 .Lsigaltstack: .long sys_sigaltstack
799 .Ltrace: .long syscall_trace
800 .Lvfork: .long sys_vfork
801 .Lschedtail: .long schedule_tail
804 .long __critical_start + 0x80000000
806 .long __critical_end + 0x80000000
808 .long cleanup_critical
810 #define SYSCALL(esa,esame,emu) .long esa
811 .globl sys_call_table
813 #include "syscalls.S"