|
@@ -349,38 +349,12 @@ static int add_brk_on_nop(struct dyn_ftrace *rec)
|
|
return add_break(rec->ip, old);
|
|
return add_break(rec->ip, old);
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * If the record has the FTRACE_FL_REGS set, that means that it
|
|
|
|
- * wants to convert to a callback that saves all regs. If FTRACE_FL_REGS
|
|
|
|
- * is not not set, then it wants to convert to the normal callback.
|
|
|
|
- */
|
|
|
|
-static unsigned long get_ftrace_addr(struct dyn_ftrace *rec)
|
|
|
|
-{
|
|
|
|
- if (rec->flags & FTRACE_FL_REGS)
|
|
|
|
- return (unsigned long)FTRACE_REGS_ADDR;
|
|
|
|
- else
|
|
|
|
- return (unsigned long)FTRACE_ADDR;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/*
|
|
|
|
- * The FTRACE_FL_REGS_EN is set when the record already points to
|
|
|
|
- * a function that saves all the regs. Basically the '_EN' version
|
|
|
|
- * represents the current state of the function.
|
|
|
|
- */
|
|
|
|
-static unsigned long get_ftrace_old_addr(struct dyn_ftrace *rec)
|
|
|
|
-{
|
|
|
|
- if (rec->flags & FTRACE_FL_REGS_EN)
|
|
|
|
- return (unsigned long)FTRACE_REGS_ADDR;
|
|
|
|
- else
|
|
|
|
- return (unsigned long)FTRACE_ADDR;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static int add_breakpoints(struct dyn_ftrace *rec, int enable)
|
|
static int add_breakpoints(struct dyn_ftrace *rec, int enable)
|
|
{
|
|
{
|
|
unsigned long ftrace_addr;
|
|
unsigned long ftrace_addr;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- ftrace_addr = get_ftrace_old_addr(rec);
|
|
|
|
|
|
+ ftrace_addr = ftrace_get_addr_curr(rec);
|
|
|
|
|
|
ret = ftrace_test_record(rec, enable);
|
|
ret = ftrace_test_record(rec, enable);
|
|
|
|
|
|
@@ -438,14 +412,14 @@ static int remove_breakpoint(struct dyn_ftrace *rec)
|
|
* If not, don't touch the breakpoint, we make just create
|
|
* If not, don't touch the breakpoint, we make just create
|
|
* a disaster.
|
|
* a disaster.
|
|
*/
|
|
*/
|
|
- ftrace_addr = get_ftrace_addr(rec);
|
|
|
|
|
|
+ ftrace_addr = ftrace_get_addr_new(rec);
|
|
nop = ftrace_call_replace(ip, ftrace_addr);
|
|
nop = ftrace_call_replace(ip, ftrace_addr);
|
|
|
|
|
|
if (memcmp(&ins[1], &nop[1], MCOUNT_INSN_SIZE - 1) == 0)
|
|
if (memcmp(&ins[1], &nop[1], MCOUNT_INSN_SIZE - 1) == 0)
|
|
goto update;
|
|
goto update;
|
|
|
|
|
|
/* Check both ftrace_addr and ftrace_old_addr */
|
|
/* Check both ftrace_addr and ftrace_old_addr */
|
|
- ftrace_addr = get_ftrace_old_addr(rec);
|
|
|
|
|
|
+ ftrace_addr = ftrace_get_addr_curr(rec);
|
|
nop = ftrace_call_replace(ip, ftrace_addr);
|
|
nop = ftrace_call_replace(ip, ftrace_addr);
|
|
|
|
|
|
if (memcmp(&ins[1], &nop[1], MCOUNT_INSN_SIZE - 1) != 0)
|
|
if (memcmp(&ins[1], &nop[1], MCOUNT_INSN_SIZE - 1) != 0)
|
|
@@ -489,7 +463,7 @@ static int add_update(struct dyn_ftrace *rec, int enable)
|
|
|
|
|
|
ret = ftrace_test_record(rec, enable);
|
|
ret = ftrace_test_record(rec, enable);
|
|
|
|
|
|
- ftrace_addr = get_ftrace_addr(rec);
|
|
|
|
|
|
+ ftrace_addr = ftrace_get_addr_new(rec);
|
|
|
|
|
|
switch (ret) {
|
|
switch (ret) {
|
|
case FTRACE_UPDATE_IGNORE:
|
|
case FTRACE_UPDATE_IGNORE:
|
|
@@ -536,7 +510,7 @@ static int finish_update(struct dyn_ftrace *rec, int enable)
|
|
|
|
|
|
ret = ftrace_update_record(rec, enable);
|
|
ret = ftrace_update_record(rec, enable);
|
|
|
|
|
|
- ftrace_addr = get_ftrace_addr(rec);
|
|
|
|
|
|
+ ftrace_addr = ftrace_get_addr_new(rec);
|
|
|
|
|
|
switch (ret) {
|
|
switch (ret) {
|
|
case FTRACE_UPDATE_IGNORE:
|
|
case FTRACE_UPDATE_IGNORE:
|