Thread (28 messages) flat view 28 messages, 6 authors, 2009-02-13

Re: [PATCH 3/7][RFC] powerpc64, tracing: add function graph tracer with dynamic tracing

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2009-02-13 04:16:00
Also in: lkml

quoted hunk ↗ jump to hunk
@@ -55,8 +56,9 @@ static unsigned char *ftrace_call_replace(unsigned
long ip, unsigned long addr)
 	 */
 	addr = GET_ADDR(addr);
 
-	/* Set to "bl addr" */
-	op = 0x48000001 | (ftrace_calc_offset(ip, addr) & 0x03fffffc);
+	/* if (link) set op to 'bl' else 'b' */
+	op = 0x48000000 | (link ? 1 : 0);
+	op |= (ftrace_calc_offset(ip, addr) & 0x03fffffc);
Any reason why you aren't using the code in
arch/powerpc/lib/code-patching.c here ?
	new = ftrace_call_replace(ip, stub, 0);
+	memcpy(old, new, MCOUNT_INSN_SIZE);
+	new = ftrace_call_replace(ip, addr, 0);
+
+	return ftrace_modify_code(ip, old, new);
+}
Heh, memcpy of 4 bytes :-) I hope gcc is smart enough to turn that into
a simple load/store ..

Cheers,
Ben.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help