blob: 4c475350dcf02a545102042493508d9aa70686ba [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_PTRACE_X86_64_H
8#define __UM_PTRACE_X86_64_H
9
10#include "linux/compiler.h"
Paolo 'Blaisorblade' Giarrussoaa6758d2006-03-31 02:30:22 -080011#include "asm/errno.h"
12#include "asm/host_ldt.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#define __FRAME_OFFSETS /* Needed to get the R* macros */
15#include "asm/ptrace-generic.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Jeff Dike79d20b12005-05-03 07:54:51 +010017#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
18
Jeff Dikea8b4fc42006-09-27 01:50:35 -070019/* Also defined in sysdep/ptrace.h, so may already be defined. */
20#ifndef FS_BASE
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#define FS_BASE (21 * sizeof(unsigned long))
22#define GS_BASE (22 * sizeof(unsigned long))
23#define DS (23 * sizeof(unsigned long))
24#define ES (24 * sizeof(unsigned long))
25#define FS (25 * sizeof(unsigned long))
26#define GS (26 * sizeof(unsigned long))
Jeff Dikea8b4fc42006-09-27 01:50:35 -070027#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
29#define PT_REGS_RBX(r) UPT_RBX(&(r)->regs)
30#define PT_REGS_RCX(r) UPT_RCX(&(r)->regs)
31#define PT_REGS_RDX(r) UPT_RDX(&(r)->regs)
32#define PT_REGS_RSI(r) UPT_RSI(&(r)->regs)
33#define PT_REGS_RDI(r) UPT_RDI(&(r)->regs)
34#define PT_REGS_RBP(r) UPT_RBP(&(r)->regs)
35#define PT_REGS_RAX(r) UPT_RAX(&(r)->regs)
36#define PT_REGS_R8(r) UPT_R8(&(r)->regs)
37#define PT_REGS_R9(r) UPT_R9(&(r)->regs)
38#define PT_REGS_R10(r) UPT_R10(&(r)->regs)
39#define PT_REGS_R11(r) UPT_R11(&(r)->regs)
40#define PT_REGS_R12(r) UPT_R12(&(r)->regs)
41#define PT_REGS_R13(r) UPT_R13(&(r)->regs)
42#define PT_REGS_R14(r) UPT_R14(&(r)->regs)
43#define PT_REGS_R15(r) UPT_R15(&(r)->regs)
44
45#define PT_REGS_FS(r) UPT_FS(&(r)->regs)
46#define PT_REGS_GS(r) UPT_GS(&(r)->regs)
47#define PT_REGS_DS(r) UPT_DS(&(r)->regs)
48#define PT_REGS_ES(r) UPT_ES(&(r)->regs)
49#define PT_REGS_SS(r) UPT_SS(&(r)->regs)
50#define PT_REGS_CS(r) UPT_CS(&(r)->regs)
51
52#define PT_REGS_ORIG_RAX(r) UPT_ORIG_RAX(&(r)->regs)
53#define PT_REGS_RIP(r) UPT_IP(&(r)->regs)
54#define PT_REGS_RSP(r) UPT_SP(&(r)->regs)
55
56#define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs)
57
58/* XXX */
59#define user_mode(r) UPT_IS_USER(&(r)->regs)
60#define PT_REGS_ORIG_SYSCALL(r) PT_REGS_RAX(r)
61#define PT_REGS_SYSCALL_RET(r) PT_REGS_RAX(r)
62
63#define PT_FIX_EXEC_STACK(sp) do ; while(0)
64
65#define profile_pc(regs) PT_REGS_IP(regs)
66
Paolo 'Blaisorblade' Giarrussoaa6758d2006-03-31 02:30:22 -080067static inline int ptrace_get_thread_area(struct task_struct *child, int idx,
68 struct user_desc __user *user_desc)
69{
70 return -ENOSYS;
71}
Linus Torvalds1da177e2005-04-16 15:20:36 -070072
Paolo 'Blaisorblade' Giarrussoaa6758d2006-03-31 02:30:22 -080073static inline int ptrace_set_thread_area(struct task_struct *child, int idx,
74 struct user_desc __user *user_desc)
75{
76 return -ENOSYS;
77}
78
Jeff Dike77bf4402007-10-16 01:26:58 -070079extern long arch_prctl(struct task_struct *task, int code,
80 unsigned long __user *addr);
Paolo 'Blaisorblade' Giarrussoaa6758d2006-03-31 02:30:22 -080081#endif