Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/asm-m32r/ptrace.h |
| 3 | * |
| 4 | * This file is subject to the terms and conditions of the GNU General Public |
| 5 | * License. See the file "COPYING" in the main directory of this archive |
| 6 | * for more details. |
| 7 | * |
| 8 | * M32R version: |
| 9 | * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org> |
| 10 | */ |
David Howells | f7f4dc1 | 2012-12-19 16:07:18 +0000 | [diff] [blame] | 11 | #ifndef _ASM_M32R_PTRACE_H |
| 12 | #define _ASM_M32R_PTRACE_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
Christoph Hellwig | 481bed4 | 2005-11-07 00:59:47 -0800 | [diff] [blame] | 14 | |
David Woodhouse | 47dbec7 | 2006-09-17 08:39:39 +0100 | [diff] [blame] | 15 | #include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */ |
David Howells | f7f4dc1 | 2012-12-19 16:07:18 +0000 | [diff] [blame] | 16 | #include <uapi/asm/ptrace.h> |
David Woodhouse | 47dbec7 | 2006-09-17 08:39:39 +0100 | [diff] [blame] | 17 | |
Christoph Hellwig | e34112e | 2010-03-10 15:23:01 -0800 | [diff] [blame] | 18 | #define arch_has_single_step() (1) |
| 19 | |
Christoph Hellwig | 0ac1555 | 2007-10-16 01:26:37 -0700 | [diff] [blame] | 20 | struct task_struct; |
| 21 | extern void init_debug_traps(struct task_struct *); |
| 22 | #define arch_ptrace_attach(child) \ |
| 23 | init_debug_traps(child) |
Christoph Hellwig | 481bed4 | 2005-11-07 00:59:47 -0800 | [diff] [blame] | 24 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) |
| 26 | #define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0) |
| 27 | #elif defined(CONFIG_ISA_M32R) |
| 28 | #define user_mode(regs) ((M32R_PSW_BSM & (regs)->psw) != 0) |
| 29 | #else |
| 30 | #error unknown isa configuration |
| 31 | #endif |
| 32 | |
| 33 | #define instruction_pointer(regs) ((regs)->bpc) |
| 34 | #define profile_pc(regs) instruction_pointer(regs) |
Al Viro | 5208ba2 | 2012-12-14 01:50:19 -0500 | [diff] [blame] | 35 | #define user_stack_pointer(regs) ((regs)->spu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | extern void withdraw_debug_trap(struct pt_regs *regs); |
| 38 | |
Al Viro | 6c3559fc | 2006-01-12 01:05:52 -0800 | [diff] [blame] | 39 | #define task_pt_regs(task) \ |
| 40 | ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1) |
Al Viro | 8eae10e | 2012-10-15 16:37:12 -0400 | [diff] [blame] | 41 | #define current_pt_regs() ((struct pt_regs *) \ |
| 42 | ((unsigned long)current_thread_info() + THREAD_SIZE) - 1) |
Al Viro | 6c3559fc | 2006-01-12 01:05:52 -0800 | [diff] [blame] | 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #endif /* _ASM_M32R_PTRACE_H */ |