.. | .. |
---|
37 | 37 | ftrace_modify_all_code(command); |
---|
38 | 38 | } |
---|
39 | 39 | |
---|
40 | | -#endif |
---|
41 | | - |
---|
42 | | -#ifdef CONFIG_DYNAMIC_FTRACE |
---|
43 | | - |
---|
44 | 40 | #define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */ |
---|
45 | 41 | #define ADDR_MASK 0x03ffffff /* op_code|addr : 31...26|25 ....0 */ |
---|
46 | 42 | #define JUMP_RANGE_MASK ((1UL << 28) - 1) |
---|
.. | .. |
---|
86 | 82 | return -EFAULT; |
---|
87 | 83 | |
---|
88 | 84 | old_fs = get_fs(); |
---|
89 | | - set_fs(get_ds()); |
---|
| 85 | + set_fs(KERNEL_DS); |
---|
90 | 86 | flush_icache_range(ip, ip + 8); |
---|
91 | 87 | set_fs(old_fs); |
---|
92 | 88 | |
---|
.. | .. |
---|
111 | 107 | |
---|
112 | 108 | ip -= 4; |
---|
113 | 109 | old_fs = get_fs(); |
---|
114 | | - set_fs(get_ds()); |
---|
| 110 | + set_fs(KERNEL_DS); |
---|
115 | 111 | flush_icache_range(ip, ip + 8); |
---|
116 | 112 | set_fs(old_fs); |
---|
117 | 113 | |
---|
.. | .. |
---|
135 | 131 | return -EFAULT; |
---|
136 | 132 | |
---|
137 | 133 | old_fs = get_fs(); |
---|
138 | | - set_fs(get_ds()); |
---|
| 134 | + set_fs(KERNEL_DS); |
---|
139 | 135 | flush_icache_range(ip, ip + 8); |
---|
140 | 136 | set_fs(old_fs); |
---|
141 | 137 | |
---|
.. | .. |
---|
333 | 329 | return; |
---|
334 | 330 | |
---|
335 | 331 | /* |
---|
336 | | - * "parent_ra_addr" is the stack address saved the return address of |
---|
337 | | - * the caller of _mcount. |
---|
| 332 | + * "parent_ra_addr" is the stack address where the return address of |
---|
| 333 | + * the caller of _mcount is saved. |
---|
338 | 334 | * |
---|
339 | | - * if the gcc < 4.5, a leaf function does not save the return address |
---|
340 | | - * in the stack address, so, we "emulate" one in _mcount's stack space, |
---|
341 | | - * and hijack it directly, but for a non-leaf function, it save the |
---|
342 | | - * return address to the its own stack space, we can not hijack it |
---|
343 | | - * directly, but need to find the real stack address, |
---|
344 | | - * ftrace_get_parent_addr() does it! |
---|
| 335 | + * If gcc < 4.5, a leaf function does not save the return address |
---|
| 336 | + * in the stack address, so we "emulate" one in _mcount's stack space, |
---|
| 337 | + * and hijack it directly. |
---|
| 338 | + * For a non-leaf function, it does save the return address to its own |
---|
| 339 | + * stack space, so we can not hijack it directly, but need to find the |
---|
| 340 | + * real stack address, which is done by ftrace_get_parent_addr(). |
---|
345 | 341 | * |
---|
346 | | - * if gcc>= 4.5, with the new -mmcount-ra-address option, for a |
---|
| 342 | + * If gcc >= 4.5, with the new -mmcount-ra-address option, for a |
---|
347 | 343 | * non-leaf function, the location of the return address will be saved |
---|
348 | | - * to $12 for us, and for a leaf function, only put a zero into $12. we |
---|
349 | | - * do it in ftrace_graph_caller of mcount.S. |
---|
| 344 | + * to $12 for us. |
---|
| 345 | + * For a leaf function, it just puts a zero into $12, so we handle |
---|
| 346 | + * it in ftrace_graph_caller() of mcount.S. |
---|
350 | 347 | */ |
---|
351 | 348 | |
---|
352 | 349 | /* old_parent_ra = *parent_ra_addr; */ |
---|
.. | .. |
---|
400 | 397 | unsigned long __init arch_syscall_addr(int nr) |
---|
401 | 398 | { |
---|
402 | 399 | #ifdef CONFIG_MIPS32_N32 |
---|
403 | | - if (nr >= __NR_N32_Linux && nr <= __NR_N32_Linux + __NR_N32_Linux_syscalls) |
---|
| 400 | + if (nr >= __NR_N32_Linux && nr < __NR_N32_Linux + __NR_N32_Linux_syscalls) |
---|
404 | 401 | return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux]; |
---|
405 | 402 | #endif |
---|
406 | | - if (nr >= __NR_64_Linux && nr <= __NR_64_Linux + __NR_64_Linux_syscalls) |
---|
| 403 | + if (nr >= __NR_64_Linux && nr < __NR_64_Linux + __NR_64_Linux_syscalls) |
---|
407 | 404 | return (unsigned long)sys_call_table[nr - __NR_64_Linux]; |
---|
408 | 405 | #ifdef CONFIG_MIPS32_O32 |
---|
409 | | - if (nr >= __NR_O32_Linux && nr <= __NR_O32_Linux + __NR_O32_Linux_syscalls) |
---|
| 406 | + if (nr >= __NR_O32_Linux && nr < __NR_O32_Linux + __NR_O32_Linux_syscalls) |
---|
410 | 407 | return (unsigned long)sys32_call_table[nr - __NR_O32_Linux]; |
---|
411 | 408 | #endif |
---|
412 | 409 | |
---|