aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/um
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2011-08-18 15:12:19 -0400
committerRichard Weinberger <richard@nod.at>2011-11-02 09:15:27 -0400
commit966e803ab12538faf2b236dbe83f7fb796a031d6 (patch)
tree508ab798c9ce5cc0f6f53a2fd9f0b0942a4b32b0 /arch/x86/um
parenta10c95d84c2d04a4bfb02104644bbf2811b99690 (diff)
um: unify ptrace_user.h
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/x86/um')
-rw-r--r--arch/x86/um/ptrace_64.c2
-rw-r--r--arch/x86/um/shared/sysdep/ptrace_64.h2
-rw-r--r--arch/x86/um/shared/sysdep/ptrace_user.h26
-rw-r--r--arch/x86/um/shared/sysdep/ptrace_user_32.h26
-rw-r--r--arch/x86/um/shared/sysdep/ptrace_user_64.h38
-rw-r--r--arch/x86/um/user-offsets.c3
6 files changed, 28 insertions, 69 deletions
diff --git a/arch/x86/um/ptrace_64.c b/arch/x86/um/ptrace_64.c
index 6e6343e73296..3b52bf0b418a 100644
--- a/arch/x86/um/ptrace_64.c
+++ b/arch/x86/um/ptrace_64.c
@@ -46,7 +46,7 @@ static const int reg_offsets[] =
46 [FS >> 3] = HOST_FS, 46 [FS >> 3] = HOST_FS,
47 [GS >> 3] = HOST_GS, 47 [GS >> 3] = HOST_GS,
48 [EFLAGS >> 3] = HOST_EFLAGS, 48 [EFLAGS >> 3] = HOST_EFLAGS,
49 [ORIG_RAX >> 3] = HOST_ORIG_RAX, 49 [ORIG_RAX >> 3] = HOST_ORIG_AX,
50}; 50};
51 51
52int putreg(struct task_struct *child, int regno, unsigned long value) 52int putreg(struct task_struct *child, int regno, unsigned long value)
diff --git a/arch/x86/um/shared/sysdep/ptrace_64.h b/arch/x86/um/shared/sysdep/ptrace_64.h
index 430dedc2505e..031edc53ac57 100644
--- a/arch/x86/um/shared/sysdep/ptrace_64.h
+++ b/arch/x86/um/shared/sysdep/ptrace_64.h
@@ -65,7 +65,7 @@
65#define REGS_FS(r) ((r)[HOST_FS]) 65#define REGS_FS(r) ((r)[HOST_FS])
66#define REGS_GS(r) ((r)[HOST_GS]) 66#define REGS_GS(r) ((r)[HOST_GS])
67 67
68#define REGS_ORIG_RAX(r) ((r)[HOST_ORIG_RAX]) 68#define REGS_ORIG_RAX(r) ((r)[HOST_ORIG_AX])
69 69
70#define REGS_SET_SYSCALL_RETURN(r, res) REGS_RAX(r) = (res) 70#define REGS_SET_SYSCALL_RETURN(r, res) REGS_RAX(r) = (res)
71 71
diff --git a/arch/x86/um/shared/sysdep/ptrace_user.h b/arch/x86/um/shared/sysdep/ptrace_user.h
index a92f883264ed..16cd6b5e71f7 100644
--- a/arch/x86/um/shared/sysdep/ptrace_user.h
+++ b/arch/x86/um/shared/sysdep/ptrace_user.h
@@ -1,5 +1,27 @@
1#include <generated/user_constants.h>
2
3#define PT_OFFSET(r) ((r) * sizeof(long))
4
5#define PT_SYSCALL_NR(regs) ((regs)[HOST_ORIG_AX])
6#define PT_SYSCALL_NR_OFFSET PT_OFFSET(HOST_ORIG_AX)
7
8#define PT_SYSCALL_RET_OFFSET PT_OFFSET(HOST_AX)
9
10#define REGS_IP_INDEX HOST_IP
11#define REGS_SP_INDEX HOST_SP
12
1#ifdef __i386__ 13#ifdef __i386__
2#include "ptrace_user_32.h" 14#define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE)
3#else 15#else
4#include "ptrace_user_64.h" 16#define FP_SIZE HOST_FP_SIZE
17
18/*
19 * x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though
20 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the
21 * 2.4 name and value for 2.4 host compatibility.
22 */
23#ifndef PTRACE_OLDSETOPTIONS
24#define PTRACE_OLDSETOPTIONS 21
25#endif
26
5#endif 27#endif
diff --git a/arch/x86/um/shared/sysdep/ptrace_user_32.h b/arch/x86/um/shared/sysdep/ptrace_user_32.h
deleted file mode 100644
index 9d88a79a138b..000000000000
--- a/arch/x86/um/shared/sysdep/ptrace_user_32.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_I386_PTRACE_USER_H__
7#define __SYSDEP_I386_PTRACE_USER_H__
8
9#include <sys/ptrace.h>
10#include <linux/ptrace.h>
11#include <asm/ptrace.h>
12#include <generated/user_constants.h>
13
14#define PT_OFFSET(r) ((r) * sizeof(long))
15
16#define PT_SYSCALL_NR(regs) ((regs)[ORIG_EAX])
17#define PT_SYSCALL_NR_OFFSET PT_OFFSET(ORIG_EAX)
18
19#define PT_SYSCALL_RET_OFFSET PT_OFFSET(EAX)
20
21#define REGS_IP_INDEX EIP
22#define REGS_SP_INDEX UESP
23
24#define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE)
25
26#endif
diff --git a/arch/x86/um/shared/sysdep/ptrace_user_64.h b/arch/x86/um/shared/sysdep/ptrace_user_64.h
deleted file mode 100644
index 2f1b6e33d590..000000000000
--- a/arch/x86/um/shared/sysdep/ptrace_user_64.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __SYSDEP_X86_64_PTRACE_USER_H__
8#define __SYSDEP_X86_64_PTRACE_USER_H__
9
10#define __FRAME_OFFSETS
11#include <sys/ptrace.h>
12#include <linux/ptrace.h>
13#include <asm/ptrace.h>
14#undef __FRAME_OFFSETS
15#include <generated/user_constants.h>
16
17#define PT_INDEX(off) ((off) / sizeof(unsigned long))
18
19#define PT_SYSCALL_NR(regs) ((regs)[PT_INDEX(ORIG_RAX)])
20#define PT_SYSCALL_NR_OFFSET (ORIG_RAX)
21
22#define PT_SYSCALL_RET_OFFSET (RAX)
23
24/*
25 * x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though
26 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the
27 * 2.4 name and value for 2.4 host compatibility.
28 */
29#ifndef PTRACE_OLDSETOPTIONS
30#define PTRACE_OLDSETOPTIONS 21
31#endif
32
33#define REGS_IP_INDEX PT_INDEX(RIP)
34#define REGS_SP_INDEX PT_INDEX(RSP)
35
36#define FP_SIZE (HOST_FP_SIZE)
37
38#endif
diff --git a/arch/x86/um/user-offsets.c b/arch/x86/um/user-offsets.c
index 88d125516ee4..ca49be8ddd0c 100644
--- a/arch/x86/um/user-offsets.c
+++ b/arch/x86/um/user-offsets.c
@@ -36,6 +36,7 @@ void foo(void)
36 DEFINE(HOST_FS, FS); 36 DEFINE(HOST_FS, FS);
37 DEFINE(HOST_ES, ES); 37 DEFINE(HOST_ES, ES);
38 DEFINE(HOST_GS, GS); 38 DEFINE(HOST_GS, GS);
39 DEFINE(HOST_ORIG_AX, ORIG_EAX);
39#else 40#else
40 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); 41 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
41 DEFINE_LONGS(HOST_BX, RBX); 42 DEFINE_LONGS(HOST_BX, RBX);
@@ -53,7 +54,7 @@ void foo(void)
53 DEFINE_LONGS(HOST_R13, R13); 54 DEFINE_LONGS(HOST_R13, R13);
54 DEFINE_LONGS(HOST_R14, R14); 55 DEFINE_LONGS(HOST_R14, R14);
55 DEFINE_LONGS(HOST_R15, R15); 56 DEFINE_LONGS(HOST_R15, R15);
56 DEFINE_LONGS(HOST_ORIG_RAX, ORIG_RAX); 57 DEFINE_LONGS(HOST_ORIG_AX, ORIG_RAX);
57 DEFINE_LONGS(HOST_CS, CS); 58 DEFINE_LONGS(HOST_CS, CS);
58 DEFINE_LONGS(HOST_SS, SS); 59 DEFINE_LONGS(HOST_SS, SS);
59 DEFINE_LONGS(HOST_EFLAGS, EFLAGS); 60 DEFINE_LONGS(HOST_EFLAGS, EFLAGS);