blob: 034f17934192d825463bc1a8c5fa12499ec0aa27 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* 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 Howells7d12e782006-10-05 14:55:46 +010014#include <asm/irq_regs.h>
David Howellsaa2c47e2012-10-10 12:09:42 +010015#include <uapi/asm/ptrace.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
17#define in_syscall(regs) (((regs)->tbr & TBR_TT) == TBR_TT_TRAP0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#ifndef __ASSEMBLY__
19
David Howells4a3b9892009-06-11 13:05:24 +010020struct task_struct;
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022/*
David Howells84e8cd62006-07-10 04:44:55 -070023 * we dedicate GR28 to keeping a pointer to the current exception frame
24 * - gr28 is destroyed on entry to the kernel from userspace
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 */
26register struct pt_regs *__frame asm("gr28");
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
28#define user_mode(regs) (!((regs)->psr & PSR_S))
29#define instruction_pointer(regs) ((regs)->pc)
David Howells4a3b9892009-06-11 13:05:24 +010030#define user_stack_pointer(regs) ((regs)->sp)
Al Viro460daba2012-09-18 22:25:02 -040031#define current_pt_regs() (__frame)
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
33extern unsigned long user_stack(const struct pt_regs *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#define profile_pc(regs) ((regs)->pc)
David Howells4a3b9892009-06-11 13:05:24 +010035
36#define task_pt_regs(task) ((task)->thread.frame0)
37
38#define arch_has_single_step() (1)
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
40#endif /* !__ASSEMBLY__ */
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#endif /* _ASM_PTRACE_H */