Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2004-2008 Analog Devices Inc. |
| 3 | * |
| 4 | * Licensed under the GPL-2 or later. |
| 5 | */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 6 | #ifndef _BFIN_PTRACE_H |
| 7 | #define _BFIN_PTRACE_H |
| 8 | |
David Howells | 2ba3645 | 2012-10-09 09:46:39 +0100 | [diff] [blame] | 9 | #include <uapi/asm/ptrace.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 10 | |
| 11 | #ifndef __ASSEMBLY__ |
| 12 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 13 | /* user_mode returns true if only one bit is set in IPEND, other than the |
| 14 | master interrupt enable. */ |
| 15 | #define user_mode(regs) (!(((regs)->ipend & ~0x10) & (((regs)->ipend & ~0x10) - 1))) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 16 | |
Mike Frysinger | e8f263d | 2010-01-26 07:33:53 +0000 | [diff] [blame] | 17 | #define arch_has_single_step() (1) |
Mike Frysinger | e8f263d | 2010-01-26 07:33:53 +0000 | [diff] [blame] | 18 | /* common code demands this function */ |
| 19 | #define ptrace_disable(child) user_disable_single_step(child) |
Al Viro | 1ca97bb | 2012-11-18 12:50:10 -0500 | [diff] [blame] | 20 | #define current_user_stack_pointer() rdusp() |
Mike Frysinger | e8f263d | 2010-01-26 07:33:53 +0000 | [diff] [blame] | 21 | |
Sonic Zhang | 99a5b28 | 2010-09-06 10:16:04 +0000 | [diff] [blame] | 22 | extern int is_user_addr_valid(struct task_struct *child, |
| 23 | unsigned long start, unsigned long len); |
| 24 | |
Mike Frysinger | e8f263d | 2010-01-26 07:33:53 +0000 | [diff] [blame] | 25 | /* |
| 26 | * Get the address of the live pt_regs for the specified task. |
| 27 | * These are saved onto the top kernel stack when the process |
| 28 | * is not running. |
| 29 | * |
| 30 | * Note: if a user thread is execve'd from kernel space, the |
| 31 | * kernel stack will not be empty on entry to the kernel, so |
| 32 | * ptracing these tasks will fail. |
| 33 | */ |
| 34 | #define task_pt_regs(task) \ |
| 35 | (struct pt_regs *) \ |
| 36 | ((unsigned long)task_stack_page(task) + \ |
| 37 | (THREAD_SIZE - sizeof(struct pt_regs))) |
| 38 | |
Mike Frysinger | 82258c6 | 2011-05-26 16:25:42 -0700 | [diff] [blame] | 39 | #include <asm-generic/ptrace.h> |
| 40 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 41 | #endif /* __ASSEMBLY__ */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 42 | #endif /* _BFIN_PTRACE_H */ |