Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* ptrace.h: ptrace() relevant definitions |
| 2 | * |
| 3 | * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ |
| 11 | #ifndef _ASM_PTRACE_H |
| 12 | #define _ASM_PTRACE_H |
| 13 | |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 14 | #include <asm/irq_regs.h> |
David Howells | aa2c47e | 2012-10-10 12:09:42 +0100 | [diff] [blame] | 15 | #include <uapi/asm/ptrace.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
| 17 | #define in_syscall(regs) (((regs)->tbr & TBR_TT) == TBR_TT_TRAP0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #ifndef __ASSEMBLY__ |
| 19 | |
David Howells | 4a3b989 | 2009-06-11 13:05:24 +0100 | [diff] [blame] | 20 | struct task_struct; |
| 21 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | /* |
David Howells | 84e8cd6 | 2006-07-10 04:44:55 -0700 | [diff] [blame] | 23 | * we dedicate GR28 to keeping a pointer to the current exception frame |
| 24 | * - gr28 is destroyed on entry to the kernel from userspace |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | */ |
| 26 | register struct pt_regs *__frame asm("gr28"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
| 28 | #define user_mode(regs) (!((regs)->psr & PSR_S)) |
| 29 | #define instruction_pointer(regs) ((regs)->pc) |
David Howells | 4a3b989 | 2009-06-11 13:05:24 +0100 | [diff] [blame] | 30 | #define user_stack_pointer(regs) ((regs)->sp) |
Al Viro | 460daba | 2012-09-18 22:25:02 -0400 | [diff] [blame] | 31 | #define current_pt_regs() (__frame) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
| 33 | extern unsigned long user_stack(const struct pt_regs *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #define profile_pc(regs) ((regs)->pc) |
David Howells | 4a3b989 | 2009-06-11 13:05:24 +0100 | [diff] [blame] | 35 | |
| 36 | #define task_pt_regs(task) ((task)->thread.frame0) |
| 37 | |
| 38 | #define arch_has_single_step() (1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | #endif /* !__ASSEMBLY__ */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | #endif /* _ASM_PTRACE_H */ |