blob: fa58ccfff865eb5e07527d0dd55a72d8927b542b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Howellsf7f4dc12012-12-19 16:07:18 +000011#ifndef _ASM_M32R_PTRACE_H
12#define _ASM_M32R_PTRACE_H
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Christoph Hellwig481bed42005-11-07 00:59:47 -080014
David Woodhouse47dbec72006-09-17 08:39:39 +010015#include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */
David Howellsf7f4dc12012-12-19 16:07:18 +000016#include <uapi/asm/ptrace.h>
David Woodhouse47dbec72006-09-17 08:39:39 +010017
Christoph Hellwige34112e2010-03-10 15:23:01 -080018#define arch_has_single_step() (1)
19
Christoph Hellwig0ac15552007-10-16 01:26:37 -070020struct task_struct;
21extern void init_debug_traps(struct task_struct *);
22#define arch_ptrace_attach(child) \
23 init_debug_traps(child)
Christoph Hellwig481bed42005-11-07 00:59:47 -080024
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#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 Viro5208ba22012-12-14 01:50:19 -050035#define user_stack_pointer(regs) ((regs)->spu)
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Linus Torvalds1da177e2005-04-16 15:20:36 -070037extern void withdraw_debug_trap(struct pt_regs *regs);
38
Al Viro6c3559fc2006-01-12 01:05:52 -080039#define task_pt_regs(task) \
40 ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1)
Al Viro8eae10e2012-10-15 16:37:12 -040041#define current_pt_regs() ((struct pt_regs *) \
42 ((unsigned long)current_thread_info() + THREAD_SIZE) - 1)
Al Viro6c3559fc2006-01-12 01:05:52 -080043
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#endif /* _ASM_M32R_PTRACE_H */