aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/ptrace.c')
-rw-r--r--arch/x86/kernel/ptrace.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 16433a59b396..2d96aab82a48 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -141,30 +141,6 @@ static const int arg_offs_table[] = {
141#endif 141#endif
142}; 142};
143 143
144/**
145 * regs_get_argument_nth() - get Nth argument at function call
146 * @regs: pt_regs which contains registers at function entry.
147 * @n: argument number.
148 *
149 * regs_get_argument_nth() returns @n th argument of a function call.
150 * Since usually the kernel stack will be changed right after function entry,
151 * you must use this at function entry. If the @n th entry is NOT in the
152 * kernel stack or pt_regs, this returns 0.
153 */
154unsigned long regs_get_argument_nth(struct pt_regs *regs, unsigned int n)
155{
156 if (n < ARRAY_SIZE(arg_offs_table))
157 return *(unsigned long *)((char *)regs + arg_offs_table[n]);
158 else {
159 /*
160 * The typical case: arg n is on the stack.
161 * (Note: stack[0] = return address, so skip it)
162 */
163 n -= ARRAY_SIZE(arg_offs_table);
164 return regs_get_kernel_stack_nth(regs, 1 + n);
165 }
166}
167
168/* 144/*
169 * does not yet catch signals sent when the child dies. 145 * does not yet catch signals sent when the child dies.
170 * in exit.c or in signal.c. 146 * in exit.c or in signal.c.
@@ -703,7 +679,7 @@ static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n)
703 } else if (n == 6) { 679 } else if (n == 6) {
704 val = thread->debugreg6; 680 val = thread->debugreg6;
705 } else if (n == 7) { 681 } else if (n == 7) {
706 val = ptrace_get_dr7(thread->ptrace_bps); 682 val = thread->ptrace_dr7;
707 } 683 }
708 return val; 684 return val;
709} 685}
@@ -779,8 +755,11 @@ int ptrace_set_debugreg(struct task_struct *tsk, int n, unsigned long val)
779 return rc; 755 return rc;
780 } 756 }
781 /* All that's left is DR7 */ 757 /* All that's left is DR7 */
782 if (n == 7) 758 if (n == 7) {
783 rc = ptrace_write_dr7(tsk, val); 759 rc = ptrace_write_dr7(tsk, val);
760 if (!rc)
761 thread->ptrace_dr7 = val;
762 }
784 763
785ret_path: 764ret_path:
786 return rc; 765 return rc;