um/x86: merge 32 and 64 bit variants of ptrace.h

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Al Viro 2012-10-08 03:26:17 +01:00 committed by Richard Weinberger
parent 4301785c7c
commit 8813f67439
3 changed files with 54 additions and 78 deletions

View File

@ -1,11 +1,13 @@
#ifndef __UM_X86_PTRACE_H
#define __UM_X86_PTRACE_H
#ifdef CONFIG_X86_32
# include "ptrace_32.h"
#else
# include "ptrace_64.h"
#include <linux/compiler.h>
#ifndef CONFIG_X86_32
#define __FRAME_OFFSETS /* Needed to get the R* macros */
#endif
#include <asm/ptrace-generic.h>
#define user_mode(r) UPT_IS_USER(&(r)->regs)
#define PT_REGS_AX(r) UPT_AX(&(r)->regs)
#define PT_REGS_BX(r) UPT_BX(&(r)->regs)
@ -36,4 +38,52 @@ static inline long regs_return_value(struct pt_regs *regs)
{
return PT_REGS_AX(regs);
}
/*
* Forward declaration to avoid including sysdep/tls.h, which causes a
* circular include, and compilation failures.
*/
struct user_desc;
#ifdef CONFIG_X86_32
#define HOST_AUDIT_ARCH AUDIT_ARCH_I386
extern int ptrace_get_thread_area(struct task_struct *child, int idx,
struct user_desc __user *user_desc);
extern int ptrace_set_thread_area(struct task_struct *child, int idx,
struct user_desc __user *user_desc);
#else
#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
#define PT_REGS_R8(r) UPT_R8(&(r)->regs)
#define PT_REGS_R9(r) UPT_R9(&(r)->regs)
#define PT_REGS_R10(r) UPT_R10(&(r)->regs)
#define PT_REGS_R11(r) UPT_R11(&(r)->regs)
#define PT_REGS_R12(r) UPT_R12(&(r)->regs)
#define PT_REGS_R13(r) UPT_R13(&(r)->regs)
#define PT_REGS_R14(r) UPT_R14(&(r)->regs)
#define PT_REGS_R15(r) UPT_R15(&(r)->regs)
#include <asm/errno.h>
static inline int ptrace_get_thread_area(struct task_struct *child, int idx,
struct user_desc __user *user_desc)
{
return -ENOSYS;
}
static inline int ptrace_set_thread_area(struct task_struct *child, int idx,
struct user_desc __user *user_desc)
{
return -ENOSYS;
}
extern long arch_prctl(struct task_struct *task, int code,
unsigned long __user *addr);
#endif
#endif /* __UM_X86_PTRACE_H */

View File

@ -1,28 +0,0 @@
/*
* Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL
*/
#ifndef __UM_PTRACE_I386_H
#define __UM_PTRACE_I386_H
#define HOST_AUDIT_ARCH AUDIT_ARCH_I386
#include "linux/compiler.h"
#include "asm/ptrace-generic.h"
#define user_mode(r) UPT_IS_USER(&(r)->regs)
/*
* Forward declaration to avoid including sysdep/tls.h, which causes a
* circular include, and compilation failures.
*/
struct user_desc;
extern int ptrace_get_thread_area(struct task_struct *child, int idx,
struct user_desc __user *user_desc);
extern int ptrace_set_thread_area(struct task_struct *child, int idx,
struct user_desc __user *user_desc);
#endif

View File

@ -1,46 +0,0 @@
/*
* Copyright 2003 PathScale, Inc.
*
* Licensed under the GPL
*/
#ifndef __UM_PTRACE_X86_64_H
#define __UM_PTRACE_X86_64_H
#include "linux/compiler.h"
#include "asm/errno.h"
#define __FRAME_OFFSETS /* Needed to get the R* macros */
#include "asm/ptrace-generic.h"
#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
#define PT_REGS_R8(r) UPT_R8(&(r)->regs)
#define PT_REGS_R9(r) UPT_R9(&(r)->regs)
#define PT_REGS_R10(r) UPT_R10(&(r)->regs)
#define PT_REGS_R11(r) UPT_R11(&(r)->regs)
#define PT_REGS_R12(r) UPT_R12(&(r)->regs)
#define PT_REGS_R13(r) UPT_R13(&(r)->regs)
#define PT_REGS_R14(r) UPT_R14(&(r)->regs)
#define PT_REGS_R15(r) UPT_R15(&(r)->regs)
/* XXX */
#define user_mode(r) UPT_IS_USER(&(r)->regs)
struct user_desc;
static inline int ptrace_get_thread_area(struct task_struct *child, int idx,
struct user_desc __user *user_desc)
{
return -ENOSYS;
}
static inline int ptrace_set_thread_area(struct task_struct *child, int idx,
struct user_desc __user *user_desc)
{
return -ENOSYS;
}
extern long arch_prctl(struct task_struct *task, int code,
unsigned long __user *addr);
#endif