diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-01-05 06:48:10 -0500 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2011-01-05 06:47:31 -0500 |
commit | 5e9a26928f550157563cfc06ce12c4ae121a02ec (patch) | |
tree | fc58668f8c6151a5f58c0430f92a0691d727af42 /arch/s390/kernel/entry64.S | |
parent | da7f51c11d5fedca9ba779ee220063ccb4f0a27e (diff) |
[S390] ptrace cleanup
Overhaul program event recording and the code dealing with the ptrace
user space interface.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/entry64.S')
-rw-r--r-- | arch/s390/kernel/entry64.S | 69 |
1 files changed, 30 insertions, 39 deletions
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index 1c0dce58933a..9d3603d6c511 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S | |||
@@ -51,7 +51,7 @@ STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER | |||
51 | STACK_SIZE = 1 << STACK_SHIFT | 51 | STACK_SIZE = 1 << STACK_SHIFT |
52 | 52 | ||
53 | _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ | 53 | _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ |
54 | _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) | 54 | _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_PER_TRAP ) |
55 | _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ | 55 | _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ |
56 | _TIF_MCCK_PENDING) | 56 | _TIF_MCCK_PENDING) |
57 | _TIF_SYSCALL = (_TIF_SYSCALL_TRACE>>8 | _TIF_SYSCALL_AUDIT>>8 | \ | 57 | _TIF_SYSCALL = (_TIF_SYSCALL_TRACE>>8 | _TIF_SYSCALL_AUDIT>>8 | \ |
@@ -208,30 +208,21 @@ _TIF_SYSCALL = (_TIF_SYSCALL_TRACE>>8 | _TIF_SYSCALL_AUDIT>>8 | \ | |||
208 | */ | 208 | */ |
209 | .globl __switch_to | 209 | .globl __switch_to |
210 | __switch_to: | 210 | __switch_to: |
211 | tm __THREAD_per+4(%r3),0xe8 # is the new process using per ? | 211 | lg %r4,__THREAD_info(%r2) # get thread_info of prev |
212 | jz __switch_to_noper # if not we're fine | 212 | lg %r5,__THREAD_info(%r3) # get thread_info of next |
213 | stctg %c9,%c11,__SF_EMPTY(%r15)# We are using per stuff | ||
214 | clc __THREAD_per(24,%r3),__SF_EMPTY(%r15) | ||
215 | je __switch_to_noper # we got away without bashing TLB's | ||
216 | lctlg %c9,%c11,__THREAD_per(%r3) # Nope we didn't | ||
217 | __switch_to_noper: | ||
218 | lg %r4,__THREAD_info(%r2) # get thread_info of prev | ||
219 | tm __TI_flags+7(%r4),_TIF_MCCK_PENDING # machine check pending? | 213 | tm __TI_flags+7(%r4),_TIF_MCCK_PENDING # machine check pending? |
220 | jz __switch_to_no_mcck | 214 | jz 0f |
221 | ni __TI_flags+7(%r4),255-_TIF_MCCK_PENDING # clear flag in prev | 215 | ni __TI_flags+7(%r4),255-_TIF_MCCK_PENDING # clear flag in prev |
222 | lg %r4,__THREAD_info(%r3) # get thread_info of next | 216 | oi __TI_flags+7(%r5),_TIF_MCCK_PENDING # set it in next |
223 | oi __TI_flags+7(%r4),_TIF_MCCK_PENDING # set it in next | 217 | 0: stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task |
224 | __switch_to_no_mcck: | 218 | stg %r15,__THREAD_ksp(%r2) # store kernel stack of prev |
225 | stmg %r6,%r15,__SF_GPRS(%r15)# store __switch_to registers of prev task | 219 | lg %r15,__THREAD_ksp(%r3) # load kernel stack of next |
226 | stg %r15,__THREAD_ksp(%r2) # store kernel stack to prev->tss.ksp | 220 | lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4 |
227 | lg %r15,__THREAD_ksp(%r3) # load kernel stack from next->tss.ksp | 221 | lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task |
228 | lmg %r6,%r15,__SF_GPRS(%r15)# load __switch_to registers of next task | 222 | stg %r3,__LC_CURRENT # store task struct of next |
229 | stg %r3,__LC_CURRENT # __LC_CURRENT = current task struct | 223 | stg %r5,__LC_THREAD_INFO # store thread info of next |
230 | lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4 | 224 | aghi %r5,STACK_SIZE # end of kernel stack of next |
231 | lg %r3,__THREAD_info(%r3) # load thread_info from task struct | 225 | stg %r5,__LC_KERNEL_STACK # store end of kernel stack |
232 | stg %r3,__LC_THREAD_INFO | ||
233 | aghi %r3,STACK_SIZE | ||
234 | stg %r3,__LC_KERNEL_STACK # __LC_KERNEL_STACK = new kernel stack | ||
235 | br %r14 | 226 | br %r14 |
236 | 227 | ||
237 | __critical_start: | 228 | __critical_start: |
@@ -311,7 +302,7 @@ sysc_work_tif: | |||
311 | jo sysc_notify_resume | 302 | jo sysc_notify_resume |
312 | tm __TI_flags+7(%r12),_TIF_RESTART_SVC | 303 | tm __TI_flags+7(%r12),_TIF_RESTART_SVC |
313 | jo sysc_restart | 304 | jo sysc_restart |
314 | tm __TI_flags+7(%r12),_TIF_SINGLE_STEP | 305 | tm __TI_flags+7(%r12),_TIF_PER_TRAP |
315 | jo sysc_singlestep | 306 | jo sysc_singlestep |
316 | j sysc_return # beware of critical section cleanup | 307 | j sysc_return # beware of critical section cleanup |
317 | 308 | ||
@@ -333,12 +324,12 @@ sysc_mcck_pending: | |||
333 | # _TIF_SIGPENDING is set, call do_signal | 324 | # _TIF_SIGPENDING is set, call do_signal |
334 | # | 325 | # |
335 | sysc_sigpending: | 326 | sysc_sigpending: |
336 | ni __TI_flags+7(%r12),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP | 327 | ni __TI_flags+7(%r12),255-_TIF_PER_TRAP # clear TIF_PER_TRAP |
337 | la %r2,SP_PTREGS(%r15) # load pt_regs | 328 | la %r2,SP_PTREGS(%r15) # load pt_regs |
338 | brasl %r14,do_signal # call do_signal | 329 | brasl %r14,do_signal # call do_signal |
339 | tm __TI_flags+7(%r12),_TIF_RESTART_SVC | 330 | tm __TI_flags+7(%r12),_TIF_RESTART_SVC |
340 | jo sysc_restart | 331 | jo sysc_restart |
341 | tm __TI_flags+7(%r12),_TIF_SINGLE_STEP | 332 | tm __TI_flags+7(%r12),_TIF_PER_TRAP |
342 | jo sysc_singlestep | 333 | jo sysc_singlestep |
343 | j sysc_return | 334 | j sysc_return |
344 | 335 | ||
@@ -363,14 +354,14 @@ sysc_restart: | |||
363 | j sysc_nr_ok # restart svc | 354 | j sysc_nr_ok # restart svc |
364 | 355 | ||
365 | # | 356 | # |
366 | # _TIF_SINGLE_STEP is set, call do_single_step | 357 | # _TIF_PER_TRAP is set, call do_per_trap |
367 | # | 358 | # |
368 | sysc_singlestep: | 359 | sysc_singlestep: |
369 | ni __TI_flags+7(%r12),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP | 360 | ni __TI_flags+7(%r12),255-_TIF_PER_TRAP # clear TIF_PER_TRAP |
370 | xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number | 361 | xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number |
371 | la %r2,SP_PTREGS(%r15) # address of register-save area | 362 | la %r2,SP_PTREGS(%r15) # address of register-save area |
372 | larl %r14,sysc_return # load adr. of system return | 363 | larl %r14,sysc_return # load adr. of system return |
373 | jg do_single_step # branch to do_sigtrap | 364 | jg do_per_trap |
374 | 365 | ||
375 | # | 366 | # |
376 | # call tracehook_report_syscall_entry/tracehook_report_syscall_exit before | 367 | # call tracehook_report_syscall_entry/tracehook_report_syscall_exit before |
@@ -526,10 +517,10 @@ pgm_no_vtime2: | |||
526 | lg %r1,__TI_task(%r12) | 517 | lg %r1,__TI_task(%r12) |
527 | tm SP_PSW+1(%r15),0x01 # kernel per event ? | 518 | tm SP_PSW+1(%r15),0x01 # kernel per event ? |
528 | jz kernel_per | 519 | jz kernel_per |
529 | mvc __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID | 520 | mvc __THREAD_per_cause(2,%r1),__LC_PER_CAUSE |
530 | mvc __THREAD_per+__PER_address(8,%r1),__LC_PER_ADDRESS | 521 | mvc __THREAD_per_address(8,%r1),__LC_PER_ADDRESS |
531 | mvc __THREAD_per+__PER_access_id(1,%r1),__LC_PER_ACCESS_ID | 522 | mvc __THREAD_per_paid(1,%r1),__LC_PER_PAID |
532 | oi __TI_flags+7(%r12),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP | 523 | oi __TI_flags+7(%r12),_TIF_PER_TRAP # set TIF_PER_TRAP |
533 | lgf %r3,__LC_PGM_ILC # load program interruption code | 524 | lgf %r3,__LC_PGM_ILC # load program interruption code |
534 | lg %r4,__LC_TRANS_EXC_CODE | 525 | lg %r4,__LC_TRANS_EXC_CODE |
535 | REENABLE_IRQS | 526 | REENABLE_IRQS |
@@ -558,10 +549,10 @@ pgm_svcper: | |||
558 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER | 549 | mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER |
559 | LAST_BREAK | 550 | LAST_BREAK |
560 | lg %r8,__TI_task(%r12) | 551 | lg %r8,__TI_task(%r12) |
561 | mvc __THREAD_per+__PER_atmid(2,%r8),__LC_PER_ATMID | 552 | mvc __THREAD_per_cause(2,%r8),__LC_PER_CAUSE |
562 | mvc __THREAD_per+__PER_address(8,%r8),__LC_PER_ADDRESS | 553 | mvc __THREAD_per_address(8,%r8),__LC_PER_ADDRESS |
563 | mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID | 554 | mvc __THREAD_per_paid(1,%r8),__LC_PER_PAID |
564 | oi __TI_flags+7(%r12),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP | 555 | oi __TI_flags+7(%r12),_TIF_PER_TRAP # set TIF_PER_TRAP |
565 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts | 556 | stosm __SF_EMPTY(%r15),0x03 # reenable interrupts |
566 | lmg %r2,%r6,SP_R2(%r15) # load svc arguments | 557 | lmg %r2,%r6,SP_R2(%r15) # load svc arguments |
567 | j sysc_do_svc | 558 | j sysc_do_svc |
@@ -573,7 +564,7 @@ kernel_per: | |||
573 | REENABLE_IRQS | 564 | REENABLE_IRQS |
574 | xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number | 565 | xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number |
575 | la %r2,SP_PTREGS(%r15) # address of register-save area | 566 | la %r2,SP_PTREGS(%r15) # address of register-save area |
576 | brasl %r14,do_single_step | 567 | brasl %r14,do_per_trap |
577 | j pgm_exit | 568 | j pgm_exit |
578 | 569 | ||
579 | /* | 570 | /* |