File tree Expand file tree Collapse file tree 10 files changed +937
-4
lines changed Expand file tree Collapse file tree 10 files changed +937
-4
lines changed Original file line number Diff line number Diff line change @@ -487,8 +487,22 @@ source "drivers/net/Kconfig"
487
487
488
488
source "fs/Kconfig"
489
489
490
+ menu "Instrumentation Support"
491
+
490
492
source "arch/s390/oprofile/Kconfig"
491
493
494
+ config KPROBES
495
+ bool "Kprobes (EXPERIMENTAL)"
496
+ depends on EXPERIMENTAL && MODULES
497
+ help
498
+ Kprobes allows you to trap at almost any kernel address and
499
+ execute a callback function. register_kprobe() establishes
500
+ a probepoint and specifies the callback. Kprobes is useful
501
+ for kernel debugging, non-intrusive instrumentation and testing.
502
+ If in doubt, say "N".
503
+
504
+ endmenu
505
+
492
506
source "arch/s390/Kconfig.debug"
493
507
494
508
source "security/Kconfig"
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \
24
24
25
25
obj-$(CONFIG_VIRT_TIMER) += vtime.o
26
26
obj-$(CONFIG_STACKTRACE) += stacktrace.o
27
+ obj-$(CONFIG_KPROBES) += kprobes.o
27
28
28
29
# Kexec part
29
30
S390_KEXEC_OBJS := machine_kexec.o crash.o
Original file line number Diff line number Diff line change @@ -505,6 +505,8 @@ pgm_no_vtime2:
505
505
mvc __THREAD_per+__PER_address(4 ,%r1),__LC_PER_ADDRESS
506
506
mvc __THREAD_per+__PER_access_id(1 ,%r1),__LC_PER_ACCESS_ID
507
507
oi __TI_flags+3 (%r9 ),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
508
+ tm SP_PSW+1 (%r15 ),0x01 # kernel per event ?
509
+ bz BASED(kernel_per)
508
510
l %r3,__LC_PGM_ILC # load program interruption code
509
511
la %r8 ,0x7f
510
512
nr %r8 ,%r3 # clear per-event-bit and ilc
@@ -536,6 +538,16 @@ pgm_no_vtime3:
536
538
stosm __SF_EMPTY(%r15 ),0x03 # reenable interrupts
537
539
b BASED(sysc_do_svc)
538
540
541
+ #
542
+ # per was called from kernel, must be kprobes
543
+ #
544
+ kernel_per:
545
+ mvi SP_TRAP+1 (%r15 ),0x28 # set trap indication to pgm check
546
+ la %r2,SP_PTREGS(%r15 ) # address of register-save area
547
+ l %r1,BASED(.Lhandle_per) # load adr. of per handler
548
+ la %r14 ,BASED(sysc_leave) # load adr. of system return
549
+ br %r1 # branch to do_single_step
550
+
539
551
/*
540
552
* IO interrupt handler routine
541
553
*/
Original file line number Diff line number Diff line change @@ -518,6 +518,8 @@ pgm_no_vtime2:
518
518
#endif
519
519
lg %r9 ,__LC_THREAD_INFO # load pointer to thread_info struct
520
520
lg %r1,__TI_task(%r9 )
521
+ tm SP_PSW+1 (%r15 ),0x01 # kernel per event ?
522
+ jz kernel_per
521
523
mvc __THREAD_per+__PER_atmid(2 ,%r1),__LC_PER_ATMID
522
524
mvc __THREAD_per+__PER_address(8 ,%r1),__LC_PER_ADDRESS
523
525
mvc __THREAD_per+__PER_access_id(1 ,%r1),__LC_PER_ACCESS_ID
@@ -553,6 +555,16 @@ pgm_no_vtime3:
553
555
stosm __SF_EMPTY(%r15 ),0x03 # reenable interrupts
554
556
j sysc_do_svc
555
557
558
+ #
559
+ # per was called from kernel, must be kprobes
560
+ #
561
+ kernel_per:
562
+ lhi %r0,__LC_PGM_OLD_PSW
563
+ sth %r0,SP_TRAP(%r15 ) # set trap indication to pgm check
564
+ la %r2,SP_PTREGS(%r15 ) # address of register-save area
565
+ larl %r14 ,sysc_leave # load adr. of system ret, no work
566
+ jg do_single_step # branch to do_single_step
567
+
556
568
/*
557
569
* IO interrupt handler routine
558
570
*/
You can’t perform that action at this time.
0 commit comments