diff options
Diffstat (limited to 'arch/tile')
-rw-r--r-- | arch/tile/include/asm/ptrace.h | 3 | ||||
-rw-r--r-- | arch/tile/kernel/process.c | 4 | ||||
-rw-r--r-- | arch/tile/kernel/single_step.c | 21 |
3 files changed, 26 insertions, 2 deletions
diff --git a/arch/tile/include/asm/ptrace.h b/arch/tile/include/asm/ptrace.h index ac6d343129d3..6be2246e015c 100644 --- a/arch/tile/include/asm/ptrace.h +++ b/arch/tile/include/asm/ptrace.h | |||
@@ -141,6 +141,9 @@ struct single_step_state { | |||
141 | /* Single-step the instruction at regs->pc */ | 141 | /* Single-step the instruction at regs->pc */ |
142 | extern void single_step_once(struct pt_regs *regs); | 142 | extern void single_step_once(struct pt_regs *regs); |
143 | 143 | ||
144 | /* Clean up after execve(). */ | ||
145 | extern void single_step_execve(void); | ||
146 | |||
144 | struct task_struct; | 147 | struct task_struct; |
145 | 148 | ||
146 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, | 149 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, |
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index e90eb53173b0..5db8b5b63cea 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
@@ -574,6 +574,8 @@ SYSCALL_DEFINE4(execve, const char __user *, path, | |||
574 | goto out; | 574 | goto out; |
575 | error = do_execve(filename, argv, envp, regs); | 575 | error = do_execve(filename, argv, envp, regs); |
576 | putname(filename); | 576 | putname(filename); |
577 | if (error == 0) | ||
578 | single_step_execve(); | ||
577 | out: | 579 | out: |
578 | return error; | 580 | return error; |
579 | } | 581 | } |
@@ -593,6 +595,8 @@ long compat_sys_execve(const char __user *path, | |||
593 | goto out; | 595 | goto out; |
594 | error = compat_do_execve(filename, argv, envp, regs); | 596 | error = compat_do_execve(filename, argv, envp, regs); |
595 | putname(filename); | 597 | putname(filename); |
598 | if (error == 0) | ||
599 | single_step_execve(); | ||
596 | out: | 600 | out: |
597 | return error; | 601 | return error; |
598 | } | 602 | } |
diff --git a/arch/tile/kernel/single_step.c b/arch/tile/kernel/single_step.c index 1eb3b39e36c7..84a729e06ec4 100644 --- a/arch/tile/kernel/single_step.c +++ b/arch/tile/kernel/single_step.c | |||
@@ -56,7 +56,7 @@ enum mem_op { | |||
56 | MEMOP_STORE_POSTINCR | 56 | MEMOP_STORE_POSTINCR |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static inline tile_bundle_bits set_BrOff_X1(tile_bundle_bits n, int32_t offset) | 59 | static inline tile_bundle_bits set_BrOff_X1(tile_bundle_bits n, s32 offset) |
60 | { | 60 | { |
61 | tile_bundle_bits result; | 61 | tile_bundle_bits result; |
62 | 62 | ||
@@ -254,6 +254,18 @@ P("\n"); | |||
254 | return bundle; | 254 | return bundle; |
255 | } | 255 | } |
256 | 256 | ||
257 | /* | ||
258 | * Called after execve() has started the new image. This allows us | ||
259 | * to reset the info state. Note that the the mmap'ed memory, if there | ||
260 | * was any, has already been unmapped by the exec. | ||
261 | */ | ||
262 | void single_step_execve(void) | ||
263 | { | ||
264 | struct thread_info *ti = current_thread_info(); | ||
265 | kfree(ti->step_state); | ||
266 | ti->step_state = NULL; | ||
267 | } | ||
268 | |||
257 | /** | 269 | /** |
258 | * single_step_once() - entry point when single stepping has been triggered. | 270 | * single_step_once() - entry point when single stepping has been triggered. |
259 | * @regs: The machine register state | 271 | * @regs: The machine register state |
@@ -373,7 +385,7 @@ void single_step_once(struct pt_regs *regs) | |||
373 | /* branches */ | 385 | /* branches */ |
374 | case BRANCH_OPCODE_X1: | 386 | case BRANCH_OPCODE_X1: |
375 | { | 387 | { |
376 | int32_t offset = signExtend17(get_BrOff_X1(bundle)); | 388 | s32 offset = signExtend17(get_BrOff_X1(bundle)); |
377 | 389 | ||
378 | /* | 390 | /* |
379 | * For branches, we use a rewriting trick to let the | 391 | * For branches, we use a rewriting trick to let the |
@@ -731,4 +743,9 @@ void single_step_once(struct pt_regs *regs) | |||
731 | __insn_mtspr(SPR_SINGLE_STEP_EN_K_K, 1 << USER_PL); | 743 | __insn_mtspr(SPR_SINGLE_STEP_EN_K_K, 1 << USER_PL); |
732 | } | 744 | } |
733 | 745 | ||
746 | void single_step_execve(void) | ||
747 | { | ||
748 | /* Nothing */ | ||
749 | } | ||
750 | |||
734 | #endif /* !__tilegx__ */ | 751 | #endif /* !__tilegx__ */ |