2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-26 21:55:17 +02:00
|
|
|
|
2013-06-29 13:31:24 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-05-28 20:27:35 +02:00
|
|
|
|
2012-06-05 13:54:09 +09:00
|
|
|
|
2017-08-20 10:52:22 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-30 22:48:38 +02:00
|
|
|
|
2013-05-11 19:04:09 +00:00
|
|
|
|
2017-08-20 10:52:22 +02:00
|
|
|
|
2007-10-18 13:54:51 -07:00
|
|
|
|
2013-05-11 19:04:09 +00:00
|
|
|
|
2017-08-20 10:52:22 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-08-20 10:52:22 +02:00
|
|
|
|
|
|
|
|
|
2013-05-11 19:04:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-18 13:54:51 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
parisc: add dynamic ftrace
This patch implements dynamic ftrace for PA-RISC. The required mcount
call sequences can get pretty long, so instead of patching the
whole call sequence out of the functions, we are using
-fpatchable-function-entry from gcc. This puts a configurable amount of
NOPS before/at the start of the function. Taking do_sys_open() as example,
which would look like this when the call is patched out:
1036b248: 08 00 02 40 nop
1036b24c: 08 00 02 40 nop
1036b250: 08 00 02 40 nop
1036b254: 08 00 02 40 nop
1036b258 <do_sys_open>:
1036b258: 08 00 02 40 nop
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
When ftrace gets enabled for this function the kernel will patch these
NOPs to:
1036b248: 10 19 57 20 <address of ftrace>
1036b24c: 6f c1 00 80 stw,ma r1,40(sp)
1036b250: 48 21 3f d1 ldw -18(r1),r1
1036b254: e8 20 c0 02 bv,n r0(r1)
1036b258 <do_sys_open>:
1036b258: e8 3f 1f df b,l,n .-c,r1
1036b25c: 08 03 02 41 copy r3,r1
1036b260: 6b c2 3f d9 stw rp,-14(sp)
1036b264: 08 1e 02 43 copy sp,r3
1036b268: 6f c1 01 00 stw,ma r1,80(sp)
So the first NOP in do_sys_open() will be patched to jump backwards into
some minimal trampoline code which pushes a stackframe, saves r1 which
holds the return address, loads the address of the real ftrace function,
and branches to that location. For 64 Bit things are getting a bit more
complicated (and longer) because we must make sure that the address of
ftrace location is 8 byte aligned, and the offset passed to ldd for
fetching the address is 8 byte aligned as well.
Note that gcc has a bug which misplaces the function label, and needs a
patch to make dynamic ftrace work. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90751 for details.
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Helge Deller <deller@gmx.de>
2019-06-05 22:32:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-22 20:54:50 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-10-21 22:48:34 -04:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-01-31 21:44:28 +00:00
|
|
|
|
2013-04-23 21:29:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-31 21:44:28 +00:00
|
|
|
|
2018-11-29 17:05:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-05-29 09:56:58 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-14 22:21:35 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-05-07 11:28:13 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-06-05 13:54:09 +09:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-20 10:52:22 +02:00
|
|
|
|
|
|
|
|
|
2008-12-08 09:43:08 +00:00
|
|
|
|
2007-10-18 15:09:59 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-07-06 12:07:11 +09:00
|
|
|
|
|
|
|
|
|
2007-10-20 09:31:33 -07:00
|
|
|
|
|
|
|
|
|
2013-10-18 21:18:46 +02:00
|
|
|
|
2007-10-20 09:31:33 -07:00
|
|
|
|
2007-10-18 15:09:59 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-20 09:31:33 -07:00
|
|
|
|
2019-07-06 12:07:11 +09:00
|
|
|
|
|
|
|
|
|
2007-10-18 15:09:59 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-20 09:31:33 -07:00
|
|
|
|
2007-10-18 15:09:59 -07:00
|
|
|
|
2013-10-18 21:18:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-18 07:49:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-20 10:52:22 +02:00
|
|
|
|
2013-06-29 13:31:24 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-08-20 10:52:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-22 22:24:02 +02:00
|
|
|
|
2017-08-20 10:52:22 +02:00
|
|
|
|
|
|
|
|
|
2017-09-22 22:24:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-29 13:31:24 +02:00
|
|
|
|
2013-10-18 21:18:46 +02:00
|
|
|
|
2019-07-06 12:07:11 +09:00
|
|
|
|
2013-10-18 21:18:46 +02:00
|
|
|
|
|
|
|
|
|
2019-07-06 12:07:11 +09:00
|
|
|
|
2013-10-18 21:18:46 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2005-09-09 20:57:26 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-29 13:31:24 +02:00
|
|
|
|
2007-10-18 15:09:59 -07:00
|
|
|
|
2013-10-18 21:18:46 +02:00
|
|
|
|
2009-07-20 21:37:11 +02:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-10-18 21:18:46 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2018-11-19 12:04:36 +05:30
|
|
|
|
2019-08-01 13:47:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-19 12:04:36 +05:30
|
|
|
|
|
|
|
|
|