Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
243412be
Commit
243412be
authored
May 20, 2012
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
um/x86: merge (and trim) 32- and 64-bit variants of ptrace.h
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
c6802f43
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
150 additions
and
279 deletions
+150
-279
arch/um/kernel/process.c
arch/um/kernel/process.c
+1
-1
arch/um/kernel/skas/syscall.c
arch/um/kernel/skas/syscall.c
+1
-1
arch/x86/um/asm/elf.h
arch/x86/um/asm/elf.h
+21
-21
arch/x86/um/asm/ptrace.h
arch/x86/um/asm/ptrace.h
+34
-0
arch/x86/um/asm/ptrace_32.h
arch/x86/um/asm/ptrace_32.h
+0
-23
arch/x86/um/asm/ptrace_64.h
arch/x86/um/asm/ptrace_64.h
+0
-26
arch/x86/um/shared/sysdep/ptrace.h
arch/x86/um/shared/sysdep/ptrace.h
+63
-4
arch/x86/um/shared/sysdep/ptrace_32.h
arch/x86/um/shared/sysdep/ptrace_32.h
+7
-85
arch/x86/um/shared/sysdep/ptrace_64.h
arch/x86/um/shared/sysdep/ptrace_64.h
+4
-97
arch/x86/um/signal.c
arch/x86/um/signal.c
+11
-11
arch/x86/um/sysrq_32.c
arch/x86/um/sysrq_32.c
+3
-5
arch/x86/um/sysrq_64.c
arch/x86/um/sysrq_64.c
+4
-4
arch/x86/um/tls_32.c
arch/x86/um/tls_32.c
+1
-1
No files found.
arch/um/kernel/process.c
View file @
243412be
...
@@ -196,7 +196,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
...
@@ -196,7 +196,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
if
(
current
->
thread
.
forking
)
{
if
(
current
->
thread
.
forking
)
{
memcpy
(
&
p
->
thread
.
regs
.
regs
,
&
regs
->
regs
,
memcpy
(
&
p
->
thread
.
regs
.
regs
,
&
regs
->
regs
,
sizeof
(
p
->
thread
.
regs
.
regs
));
sizeof
(
p
->
thread
.
regs
.
regs
));
REGS_SET_SYSCALL_RETURN
(
p
->
thread
.
regs
.
regs
.
gp
,
0
);
UPT_SET_SYSCALL_RETURN
(
&
p
->
thread
.
regs
.
regs
,
0
);
if
(
sp
!=
0
)
if
(
sp
!=
0
)
REGS_SP
(
p
->
thread
.
regs
.
regs
.
gp
)
=
sp
;
REGS_SP
(
p
->
thread
.
regs
.
regs
.
gp
)
=
sp
;
...
...
arch/um/kernel/skas/syscall.c
View file @
243412be
...
@@ -34,7 +34,7 @@ void handle_syscall(struct uml_pt_regs *r)
...
@@ -34,7 +34,7 @@ void handle_syscall(struct uml_pt_regs *r)
result
=
-
ENOSYS
;
result
=
-
ENOSYS
;
else
result
=
EXECUTE_SYSCALL
(
syscall
,
regs
);
else
result
=
EXECUTE_SYSCALL
(
syscall
,
regs
);
REGS_SET_SYSCALL_RETURN
(
r
->
gp
,
result
);
UPT_SET_SYSCALL_RETURN
(
r
,
result
);
syscall_trace
(
r
,
1
);
syscall_trace
(
r
,
1
);
}
}
arch/x86/um/asm/elf.h
View file @
243412be
...
@@ -34,25 +34,25 @@
...
@@ -34,25 +34,25 @@
#define ELF_ARCH EM_386
#define ELF_ARCH EM_386
#define ELF_PLAT_INIT(regs, load_addr) do { \
#define ELF_PLAT_INIT(regs, load_addr) do { \
PT_REGS_
E
BX(regs) = 0; \
PT_REGS_BX(regs) = 0; \
PT_REGS_
E
CX(regs) = 0; \
PT_REGS_CX(regs) = 0; \
PT_REGS_
E
DX(regs) = 0; \
PT_REGS_DX(regs) = 0; \
PT_REGS_
E
SI(regs) = 0; \
PT_REGS_SI(regs) = 0; \
PT_REGS_
E
DI(regs) = 0; \
PT_REGS_DI(regs) = 0; \
PT_REGS_
E
BP(regs) = 0; \
PT_REGS_BP(regs) = 0; \
PT_REGS_
E
AX(regs) = 0; \
PT_REGS_AX(regs) = 0; \
} while (0)
} while (0)
/* Shamelessly stolen from include/asm-i386/elf.h */
/* Shamelessly stolen from include/asm-i386/elf.h */
#define ELF_CORE_COPY_REGS(pr_reg, regs) do { \
#define ELF_CORE_COPY_REGS(pr_reg, regs) do { \
pr_reg[0] = PT_REGS_
E
BX(regs); \
pr_reg[0] = PT_REGS_BX(regs); \
pr_reg[1] = PT_REGS_
E
CX(regs); \
pr_reg[1] = PT_REGS_CX(regs); \
pr_reg[2] = PT_REGS_
E
DX(regs); \
pr_reg[2] = PT_REGS_DX(regs); \
pr_reg[3] = PT_REGS_
E
SI(regs); \
pr_reg[3] = PT_REGS_SI(regs); \
pr_reg[4] = PT_REGS_
E
DI(regs); \
pr_reg[4] = PT_REGS_DI(regs); \
pr_reg[5] = PT_REGS_
E
BP(regs); \
pr_reg[5] = PT_REGS_BP(regs); \
pr_reg[6] = PT_REGS_
E
AX(regs); \
pr_reg[6] = PT_REGS_AX(regs); \
pr_reg[7] = PT_REGS_DS(regs); \
pr_reg[7] = PT_REGS_DS(regs); \
pr_reg[8] = PT_REGS_ES(regs); \
pr_reg[8] = PT_REGS_ES(regs); \
/* fake once used fs and gs selectors? */
\
/* fake once used fs and gs selectors? */
\
...
@@ -130,13 +130,13 @@ do { \
...
@@ -130,13 +130,13 @@ do { \
#define ELF_ARCH EM_X86_64
#define ELF_ARCH EM_X86_64
#define ELF_PLAT_INIT(regs, load_addr) do { \
#define ELF_PLAT_INIT(regs, load_addr) do { \
PT_REGS_
R
BX(regs) = 0; \
PT_REGS_BX(regs) = 0; \
PT_REGS_
R
CX(regs) = 0; \
PT_REGS_CX(regs) = 0; \
PT_REGS_
R
DX(regs) = 0; \
PT_REGS_DX(regs) = 0; \
PT_REGS_
R
SI(regs) = 0; \
PT_REGS_SI(regs) = 0; \
PT_REGS_
R
DI(regs) = 0; \
PT_REGS_DI(regs) = 0; \
PT_REGS_
R
BP(regs) = 0; \
PT_REGS_BP(regs) = 0; \
PT_REGS_
R
AX(regs) = 0; \
PT_REGS_AX(regs) = 0; \
PT_REGS_R8(regs) = 0; \
PT_REGS_R8(regs) = 0; \
PT_REGS_R9(regs) = 0; \
PT_REGS_R9(regs) = 0; \
PT_REGS_R10(regs) = 0; \
PT_REGS_R10(regs) = 0; \
...
...
arch/x86/um/asm/ptrace.h
View file @
243412be
#ifndef __UM_X86_PTRACE_H
#define __UM_X86_PTRACE_H
#ifdef CONFIG_X86_32
#ifdef CONFIG_X86_32
# include "ptrace_32.h"
# include "ptrace_32.h"
#else
#else
# include "ptrace_64.h"
# include "ptrace_64.h"
#endif
#endif
#define PT_REGS_AX(r) UPT_AX(&(r)->regs)
#define PT_REGS_BX(r) UPT_BX(&(r)->regs)
#define PT_REGS_CX(r) UPT_CX(&(r)->regs)
#define PT_REGS_DX(r) UPT_DX(&(r)->regs)
#define PT_REGS_SI(r) UPT_SI(&(r)->regs)
#define PT_REGS_DI(r) UPT_DI(&(r)->regs)
#define PT_REGS_BP(r) UPT_BP(&(r)->regs)
#define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs)
#define PT_REGS_CS(r) UPT_CS(&(r)->regs)
#define PT_REGS_SS(r) UPT_SS(&(r)->regs)
#define PT_REGS_DS(r) UPT_DS(&(r)->regs)
#define PT_REGS_ES(r) UPT_ES(&(r)->regs)
#define PT_REGS_ORIG_SYSCALL(r) PT_REGS_AX(r)
#define PT_REGS_SYSCALL_RET(r) PT_REGS_AX(r)
#define PT_FIX_EXEC_STACK(sp) do ; while(0)
#define profile_pc(regs) PT_REGS_IP(regs)
#define UPT_RESTART_SYSCALL(r) (UPT_IP(r) -= 2)
#define UPT_SET_SYSCALL_RETURN(r, res) (UPT_AX(r) = (res))
static
inline
long
regs_return_value
(
struct
uml_pt_regs
*
regs
)
{
return
UPT_AX
(
regs
);
}
#endif
/* __UM_X86_PTRACE_H */
arch/x86/um/asm/ptrace_32.h
View file @
243412be
...
@@ -11,29 +11,6 @@
...
@@ -11,29 +11,6 @@
#include "linux/compiler.h"
#include "linux/compiler.h"
#include "asm/ptrace-generic.h"
#include "asm/ptrace-generic.h"
#define PT_REGS_EAX(r) UPT_EAX(&(r)->regs)
#define PT_REGS_EBX(r) UPT_EBX(&(r)->regs)
#define PT_REGS_ECX(r) UPT_ECX(&(r)->regs)
#define PT_REGS_EDX(r) UPT_EDX(&(r)->regs)
#define PT_REGS_ESI(r) UPT_ESI(&(r)->regs)
#define PT_REGS_EDI(r) UPT_EDI(&(r)->regs)
#define PT_REGS_EBP(r) UPT_EBP(&(r)->regs)
#define PT_REGS_CS(r) UPT_CS(&(r)->regs)
#define PT_REGS_SS(r) UPT_SS(&(r)->regs)
#define PT_REGS_DS(r) UPT_DS(&(r)->regs)
#define PT_REGS_ES(r) UPT_ES(&(r)->regs)
#define PT_REGS_FS(r) UPT_FS(&(r)->regs)
#define PT_REGS_GS(r) UPT_GS(&(r)->regs)
#define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs)
#define PT_REGS_ORIG_SYSCALL(r) PT_REGS_EAX(r)
#define PT_REGS_SYSCALL_RET(r) PT_REGS_EAX(r)
#define PT_FIX_EXEC_STACK(sp) do ; while(0)
#define profile_pc(regs) PT_REGS_IP(regs)
#define user_mode(r) UPT_IS_USER(&(r)->regs)
#define user_mode(r) UPT_IS_USER(&(r)->regs)
/*
/*
...
...
arch/x86/um/asm/ptrace_64.h
View file @
243412be
...
@@ -15,13 +15,6 @@
...
@@ -15,13 +15,6 @@
#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
#define PT_REGS_RBX(r) UPT_RBX(&(r)->regs)
#define PT_REGS_RCX(r) UPT_RCX(&(r)->regs)
#define PT_REGS_RDX(r) UPT_RDX(&(r)->regs)
#define PT_REGS_RSI(r) UPT_RSI(&(r)->regs)
#define PT_REGS_RDI(r) UPT_RDI(&(r)->regs)
#define PT_REGS_RBP(r) UPT_RBP(&(r)->regs)
#define PT_REGS_RAX(r) UPT_RAX(&(r)->regs)
#define PT_REGS_R8(r) UPT_R8(&(r)->regs)
#define PT_REGS_R8(r) UPT_R8(&(r)->regs)
#define PT_REGS_R9(r) UPT_R9(&(r)->regs)
#define PT_REGS_R9(r) UPT_R9(&(r)->regs)
#define PT_REGS_R10(r) UPT_R10(&(r)->regs)
#define PT_REGS_R10(r) UPT_R10(&(r)->regs)
...
@@ -31,27 +24,8 @@
...
@@ -31,27 +24,8 @@
#define PT_REGS_R14(r) UPT_R14(&(r)->regs)
#define PT_REGS_R14(r) UPT_R14(&(r)->regs)
#define PT_REGS_R15(r) UPT_R15(&(r)->regs)
#define PT_REGS_R15(r) UPT_R15(&(r)->regs)
#define PT_REGS_FS(r) UPT_FS(&(r)->regs)
#define PT_REGS_GS(r) UPT_GS(&(r)->regs)
#define PT_REGS_DS(r) UPT_DS(&(r)->regs)
#define PT_REGS_ES(r) UPT_ES(&(r)->regs)
#define PT_REGS_SS(r) UPT_SS(&(r)->regs)
#define PT_REGS_CS(r) UPT_CS(&(r)->regs)
#define PT_REGS_ORIG_RAX(r) UPT_ORIG_RAX(&(r)->regs)
#define PT_REGS_RIP(r) UPT_IP(&(r)->regs)
#define PT_REGS_SP(r) UPT_SP(&(r)->regs)
#define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs)
/* XXX */
/* XXX */
#define user_mode(r) UPT_IS_USER(&(r)->regs)
#define user_mode(r) UPT_IS_USER(&(r)->regs)
#define PT_REGS_ORIG_SYSCALL(r) PT_REGS_RAX(r)
#define PT_REGS_SYSCALL_RET(r) PT_REGS_RAX(r)
#define PT_FIX_EXEC_STACK(sp) do ; while(0)
#define profile_pc(regs) PT_REGS_IP(regs)
struct
user_desc
;
struct
user_desc
;
...
...
arch/x86/um/shared/sysdep/ptrace.h
View file @
243412be
#ifndef __SYSDEP_X86_PTRACE_H
#ifndef __SYSDEP_X86_PTRACE_H
#define __SYSDEP_X86_PTRACE_H
#define __SYSDEP_X86_PTRACE_H
#include <generated/user_constants.h>
#include "sysdep/faultinfo.h"
#define MAX_REG_OFFSET (UM_FRAME_SIZE)
#define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long))
#define REGS_IP(r) ((r)[HOST_IP])
#define REGS_SP(r) ((r)[HOST_SP])
#define REGS_EFLAGS(r) ((r)[HOST_EFLAGS])
#define REGS_AX(r) ((r)[HOST_AX])
#define REGS_BX(r) ((r)[HOST_BX])
#define REGS_CX(r) ((r)[HOST_CX])
#define REGS_DX(r) ((r)[HOST_DX])
#define REGS_SI(r) ((r)[HOST_SI])
#define REGS_DI(r) ((r)[HOST_DI])
#define REGS_BP(r) ((r)[HOST_BP])
#define REGS_CS(r) ((r)[HOST_CS])
#define REGS_SS(r) ((r)[HOST_SS])
#define REGS_DS(r) ((r)[HOST_DS])
#define REGS_ES(r) ((r)[HOST_ES])
#define UPT_IP(r) REGS_IP((r)->gp)
#define UPT_SP(r) REGS_SP((r)->gp)
#define UPT_EFLAGS(r) REGS_EFLAGS((r)->gp)
#define UPT_AX(r) REGS_AX((r)->gp)
#define UPT_BX(r) REGS_BX((r)->gp)
#define UPT_CX(r) REGS_CX((r)->gp)
#define UPT_DX(r) REGS_DX((r)->gp)
#define UPT_SI(r) REGS_SI((r)->gp)
#define UPT_DI(r) REGS_DI((r)->gp)
#define UPT_BP(r) REGS_BP((r)->gp)
#define UPT_CS(r) REGS_CS((r)->gp)
#define UPT_SS(r) REGS_SS((r)->gp)
#define UPT_DS(r) REGS_DS((r)->gp)
#define UPT_ES(r) REGS_ES((r)->gp)
#ifdef __i386__
#ifdef __i386__
#include "ptrace_32.h"
#include "ptrace_32.h"
#else
#else
#include "ptrace_64.h"
#include "ptrace_64.h"
#endif
#endif
static
inline
long
regs_return_value
(
struct
uml_pt_regs
*
regs
)
struct
syscall_args
{
{
unsigned
long
args
[
6
];
return
UPT_SYSCALL_RET
(
regs
);
};
}
#define SYSCALL_ARGS(r) ((struct syscall_args) \
{ .args = { UPT_SYSCALL_ARG1(r), \
UPT_SYSCALL_ARG2(r), \
UPT_SYSCALL_ARG3(r), \
UPT_SYSCALL_ARG4(r), \
UPT_SYSCALL_ARG5(r), \
UPT_SYSCALL_ARG6(r) } } )
struct
uml_pt_regs
{
unsigned
long
gp
[
MAX_REG_NR
];
unsigned
long
fp
[
MAX_FP_NR
];
struct
faultinfo
faultinfo
;
long
syscall
;
int
is_user
;
};
#define EMPTY_UML_PT_REGS { }
#define UPT_SYSCALL_NR(r) ((r)->syscall)
#define UPT_FAULTINFO(r) (&(r)->faultinfo)
#define UPT_IS_USER(r) ((r)->is_user)
extern
int
user_context
(
unsigned
long
sp
);
#endif
/* __SYSDEP_X86_PTRACE_H */
#endif
/* __SYSDEP_X86_PTRACE_H */
arch/x86/um/shared/sysdep/ptrace_32.h
View file @
243412be
...
@@ -6,11 +6,7 @@
...
@@ -6,11 +6,7 @@
#ifndef __SYSDEP_I386_PTRACE_H
#ifndef __SYSDEP_I386_PTRACE_H
#define __SYSDEP_I386_PTRACE_H
#define __SYSDEP_I386_PTRACE_H
#include <generated/user_constants.h>
#define MAX_FP_NR HOST_FPX_SIZE
#include "sysdep/faultinfo.h"
#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long))
#define MAX_REG_OFFSET (UM_FRAME_SIZE)
static
inline
void
update_debugregs
(
int
seq
)
{}
static
inline
void
update_debugregs
(
int
seq
)
{}
...
@@ -24,90 +20,16 @@ void set_using_sysemu(int value);
...
@@ -24,90 +20,16 @@ void set_using_sysemu(int value);
int
get_using_sysemu
(
void
);
int
get_using_sysemu
(
void
);
extern
int
sysemu_supported
;
extern
int
sysemu_supported
;
#define REGS_IP(r) ((r)[HOST_IP])
#define REGS_SP(r) ((r)[HOST_SP])
#define REGS_EFLAGS(r) ((r)[HOST_EFLAGS])
#define REGS_EAX(r) ((r)[HOST_AX])
#define REGS_EBX(r) ((r)[HOST_BX])
#define REGS_ECX(r) ((r)[HOST_CX])
#define REGS_EDX(r) ((r)[HOST_DX])
#define REGS_ESI(r) ((r)[HOST_SI])
#define REGS_EDI(r) ((r)[HOST_DI])
#define REGS_EBP(r) ((r)[HOST_BP])
#define REGS_CS(r) ((r)[HOST_CS])
#define REGS_SS(r) ((r)[HOST_SS])
#define REGS_DS(r) ((r)[HOST_DS])
#define REGS_ES(r) ((r)[HOST_ES])
#define REGS_FS(r) ((r)[HOST_FS])
#define REGS_GS(r) ((r)[HOST_GS])
#define REGS_SET_SYSCALL_RETURN(r, res) REGS_EAX(r) = (res)
#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
#ifndef PTRACE_SYSEMU_SINGLESTEP
#ifndef PTRACE_SYSEMU_SINGLESTEP
#define PTRACE_SYSEMU_SINGLESTEP 32
#define PTRACE_SYSEMU_SINGLESTEP 32
#endif
#endif
struct
uml_pt_regs
{
#define UPT_SYSCALL_ARG1(r) UPT_BX(r)
unsigned
long
gp
[
MAX_REG_NR
];
#define UPT_SYSCALL_ARG2(r) UPT_CX(r)
unsigned
long
fp
[
HOST_FPX_SIZE
];
#define UPT_SYSCALL_ARG3(r) UPT_DX(r)
struct
faultinfo
faultinfo
;
#define UPT_SYSCALL_ARG4(r) UPT_SI(r)
long
syscall
;
#define UPT_SYSCALL_ARG5(r) UPT_DI(r)
int
is_user
;
#define UPT_SYSCALL_ARG6(r) UPT_BP(r)
};
#define EMPTY_UML_PT_REGS { }
#define UPT_IP(r) REGS_IP((r)->gp)
#define UPT_SP(r) REGS_SP((r)->gp)
#define UPT_EFLAGS(r) REGS_EFLAGS((r)->gp)
#define UPT_EAX(r) REGS_EAX((r)->gp)
#define UPT_EBX(r) REGS_EBX((r)->gp)
#define UPT_ECX(r) REGS_ECX((r)->gp)
#define UPT_EDX(r) REGS_EDX((r)->gp)
#define UPT_ESI(r) REGS_ESI((r)->gp)
#define UPT_EDI(r) REGS_EDI((r)->gp)
#define UPT_EBP(r) REGS_EBP((r)->gp)
#define UPT_ORIG_EAX(r) ((r)->syscall)
#define UPT_CS(r) REGS_CS((r)->gp)
#define UPT_SS(r) REGS_SS((r)->gp)
#define UPT_DS(r) REGS_DS((r)->gp)
#define UPT_ES(r) REGS_ES((r)->gp)
#define UPT_FS(r) REGS_FS((r)->gp)
#define UPT_GS(r) REGS_GS((r)->gp)
#define UPT_SYSCALL_ARG1(r) UPT_EBX(r)
#define UPT_SYSCALL_ARG2(r) UPT_ECX(r)
#define UPT_SYSCALL_ARG3(r) UPT_EDX(r)
#define UPT_SYSCALL_ARG4(r) UPT_ESI(r)
#define UPT_SYSCALL_ARG5(r) UPT_EDI(r)
#define UPT_SYSCALL_ARG6(r) UPT_EBP(r)
extern
int
user_context
(
unsigned
long
sp
);
#define UPT_IS_USER(r) ((r)->is_user)
struct
syscall_args
{
unsigned
long
args
[
6
];
};
#define SYSCALL_ARGS(r) ((struct syscall_args) \
{ .args = { UPT_SYSCALL_ARG1(r), \
UPT_SYSCALL_ARG2(r), \
UPT_SYSCALL_ARG3(r), \
UPT_SYSCALL_ARG4(r), \
UPT_SYSCALL_ARG5(r), \
UPT_SYSCALL_ARG6(r) } } )
#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp)
#define UPT_ORIG_SYSCALL(r) UPT_EAX(r)
#define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r)
#define UPT_SYSCALL_RET(r) UPT_EAX(r)
#define UPT_FAULTINFO(r) (&(r)->faultinfo)
extern
void
arch_init_registers
(
int
pid
);
extern
void
arch_init_registers
(
int
pid
);
...
...
arch/x86/um/shared/sysdep/ptrace_64.h
View file @
243412be
...
@@ -8,22 +8,8 @@
...
@@ -8,22 +8,8 @@
#ifndef __SYSDEP_X86_64_PTRACE_H
#ifndef __SYSDEP_X86_64_PTRACE_H
#define __SYSDEP_X86_64_PTRACE_H
#define __SYSDEP_X86_64_PTRACE_H
#include <generated/user_constants.h>
#define MAX_FP_NR HOST_FP_SIZE
#include "sysdep/faultinfo.h"
#define MAX_REG_OFFSET (UM_FRAME_SIZE)
#define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long))
#define REGS_IP(r) ((r)[HOST_IP])
#define REGS_SP(r) ((r)[HOST_SP])
#define REGS_RBX(r) ((r)[HOST_BX])
#define REGS_RCX(r) ((r)[HOST_CX])
#define REGS_RDX(r) ((r)[HOST_DX])
#define REGS_RSI(r) ((r)[HOST_SI])
#define REGS_RDI(r) ((r)[HOST_DI])
#define REGS_RBP(r) ((r)[HOST_BP])
#define REGS_RAX(r) ((r)[HOST_AX])
#define REGS_R8(r) ((r)[HOST_R8])
#define REGS_R8(r) ((r)[HOST_R8])
#define REGS_R9(r) ((r)[HOST_R9])
#define REGS_R9(r) ((r)[HOST_R9])
#define REGS_R10(r) ((r)[HOST_R10])
#define REGS_R10(r) ((r)[HOST_R10])
...
@@ -32,9 +18,6 @@
...
@@ -32,9 +18,6 @@
#define REGS_R13(r) ((r)[HOST_R13])
#define REGS_R13(r) ((r)[HOST_R13])
#define REGS_R14(r) ((r)[HOST_R14])
#define REGS_R14(r) ((r)[HOST_R14])
#define REGS_R15(r) ((r)[HOST_R15])
#define REGS_R15(r) ((r)[HOST_R15])
#define REGS_CS(r) ((r)[HOST_CS])
#define REGS_EFLAGS(r) ((r)[HOST_EFLAGS])
#define REGS_SS(r) ((r)[HOST_SS])
#define HOST_FS_BASE 21
#define HOST_FS_BASE 21
#define HOST_GS_BASE 22
#define HOST_GS_BASE 22
...
@@ -58,45 +41,6 @@
...
@@ -58,45 +41,6 @@
#define GS (HOST_GS * sizeof(long))
#define GS (HOST_GS * sizeof(long))
#endif
#endif
#define REGS_FS_BASE(r) ((r)[HOST_FS_BASE])
#define REGS_GS_BASE(r) ((r)[HOST_GS_BASE])
#define REGS_DS(r) ((r)[HOST_DS])
#define REGS_ES(r) ((r)[HOST_ES])
#define REGS_FS(r) ((r)[HOST_FS])
#define REGS_GS(r) ((r)[HOST_GS])
#define REGS_ORIG_RAX(r) ((r)[HOST_ORIG_AX])
#define REGS_SET_SYSCALL_RETURN(r, res) REGS_RAX(r) = (res)
#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
#define REGS_FAULT_ADDR(r) ((r)->fault_addr)
#define REGS_FAULT_WRITE(r) FAULT_WRITE((r)->fault_type)
#define REGS_TRAP(r) ((r)->trap_type)
#define REGS_ERR(r) ((r)->fault_type)
struct
uml_pt_regs
{
unsigned
long
gp
[
MAX_REG_NR
];
unsigned
long
fp
[
HOST_FP_SIZE
];
struct
faultinfo
faultinfo
;
long
syscall
;
int
is_user
;
};
#define EMPTY_UML_PT_REGS { }
#define UPT_RBX(r) REGS_RBX((r)->gp)
#define UPT_RCX(r) REGS_RCX((r)->gp)
#define UPT_RDX(r) REGS_RDX((r)->gp)
#define UPT_RSI(r) REGS_RSI((r)->gp)
#define UPT_RDI(r) REGS_RDI((r)->gp)
#define UPT_RBP(r) REGS_RBP((r)->gp)
#define UPT_RAX(r) REGS_RAX((r)->gp)
#define UPT_R8(r) REGS_R8((r)->gp)
#define UPT_R8(r) REGS_R8((r)->gp)
#define UPT_R9(r) REGS_R9((r)->gp)
#define UPT_R9(r) REGS_R9((r)->gp)
#define UPT_R10(r) REGS_R10((r)->gp)
#define UPT_R10(r) REGS_R10((r)->gp)
...
@@ -105,51 +49,14 @@ struct uml_pt_regs {
...
@@ -105,51 +49,14 @@ struct uml_pt_regs {
#define UPT_R13(r) REGS_R13((r)->gp)
#define UPT_R13(r) REGS_R13((r)->gp)
#define UPT_R14(r) REGS_R14((r)->gp)
#define UPT_R14(r) REGS_R14((r)->gp)
#define UPT_R15(r) REGS_R15((r)->gp)
#define UPT_R15(r) REGS_R15((r)->gp)
#define UPT_CS(r) REGS_CS((r)->gp)
#define UPT_FS_BASE(r) REGS_FS_BASE((r)->gp)
#define UPT_FS(r) REGS_FS((r)->gp)
#define UPT_GS_BASE(r) REGS_GS_BASE((r)->gp)
#define UPT_GS(r) REGS_GS((r)->gp)
#define UPT_DS(r) REGS_DS((r)->gp)
#define UPT_ES(r) REGS_ES((r)->gp)
#define UPT_CS(r) REGS_CS((r)->gp)
#define UPT_SS(r) REGS_SS((r)->gp)
#define UPT_ORIG_RAX(r) REGS_ORIG_RAX((r)->gp)
#define UPT_IP(r) REGS_IP((r)->gp)
#define UPT_SP(r) REGS_SP((r)->gp)
#define UPT_EFLAGS(r) REGS_EFLAGS((r)->gp)
#define UPT_SYSCALL_NR(r) ((r)->syscall)
#define UPT_SYSCALL_RET(r) UPT_RAX(r)
extern
int
user_context
(
unsigned
long
sp
);
#define UPT_IS_USER(r) ((r)->is_user)
#define UPT_SYSCALL_ARG1(r) UPT_DI(r)
#define UPT_SYSCALL_ARG2(r) UPT_SI(r)
#define UPT_SYSCALL_ARG1(r) UPT_RDI(r)
#define UPT_SYSCALL_ARG3(r) UPT_DX(r)
#define UPT_SYSCALL_ARG2(r) UPT_RSI(r)
#define UPT_SYSCALL_ARG3(r) UPT_RDX(r)
#define UPT_SYSCALL_ARG4(r) UPT_R10(r)
#define UPT_SYSCALL_ARG4(r) UPT_R10(r)
#define UPT_SYSCALL_ARG5(r) UPT_R8(r)
#define UPT_SYSCALL_ARG5(r) UPT_R8(r)
#define UPT_SYSCALL_ARG6(r) UPT_R9(r)
#define UPT_SYSCALL_ARG6(r) UPT_R9(r)
struct
syscall_args
{
unsigned
long
args
[
6
];
};
#define SYSCALL_ARGS(r) ((struct syscall_args) \
{ .args = { UPT_SYSCALL_ARG1(r), \
UPT_SYSCALL_ARG2(r), \
UPT_SYSCALL_ARG3(r), \
UPT_SYSCALL_ARG4(r), \
UPT_SYSCALL_ARG5(r), \
UPT_SYSCALL_ARG6(r) } } )
#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp)
#define UPT_FAULTINFO(r) (&(r)->faultinfo)
static
inline
void
arch_init_registers
(
int
pid
)
static
inline
void
arch_init_registers
(
int
pid
)
{
{
}
}
...
...
arch/x86/um/signal.c
View file @
243412be
...
@@ -413,9 +413,9 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
...
@@ -413,9 +413,9 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
PT_REGS_SP
(
regs
)
=
(
unsigned
long
)
frame
;
PT_REGS_SP
(
regs
)
=
(
unsigned
long
)
frame
;
PT_REGS_IP
(
regs
)
=
(
unsigned
long
)
ka
->
sa
.
sa_handler
;
PT_REGS_IP
(
regs
)
=
(
unsigned
long
)
ka
->
sa
.
sa_handler
;
PT_REGS_
E
AX
(
regs
)
=
(
unsigned
long
)
sig
;
PT_REGS_AX
(
regs
)
=
(
unsigned
long
)
sig
;
PT_REGS_
E
DX
(
regs
)
=
(
unsigned
long
)
0
;
PT_REGS_DX
(
regs
)
=
(
unsigned
long
)
0
;
PT_REGS_
E
CX
(
regs
)
=
(
unsigned
long
)
0
;
PT_REGS_CX
(
regs
)
=
(
unsigned
long
)
0
;
if
((
current
->
ptrace
&
PT_DTRACE
)
&&
(
current
->
ptrace
&
PT_PTRACED
))
if
((
current
->
ptrace
&
PT_DTRACE
)
&&
(
current
->
ptrace
&
PT_PTRACED
))
ptrace_notify
(
SIGTRAP
);
ptrace_notify
(
SIGTRAP
);
...
@@ -463,9 +463,9 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
...
@@ -463,9 +463,9 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
PT_REGS_SP
(
regs
)
=
(
unsigned
long
)
frame
;
PT_REGS_SP
(
regs
)
=
(
unsigned
long
)
frame
;
PT_REGS_IP
(
regs
)
=
(
unsigned
long
)
ka
->
sa
.
sa_handler
;
PT_REGS_IP
(
regs
)
=
(
unsigned
long
)
ka
->
sa
.
sa_handler
;
PT_REGS_
E
AX
(
regs
)
=
(
unsigned
long
)
sig
;
PT_REGS_AX
(
regs
)
=
(
unsigned
long
)
sig
;
PT_REGS_
E
DX
(
regs
)
=
(
unsigned
long
)
&
frame
->
info
;
PT_REGS_DX
(
regs
)
=
(
unsigned
long
)
&
frame
->
info
;
PT_REGS_
E
CX
(
regs
)
=
(
unsigned
long
)
&
frame
->
uc
;
PT_REGS_CX
(
regs
)
=
(
unsigned
long
)
&
frame
->
uc
;
if
((
current
->
ptrace
&
PT_DTRACE
)
&&
(
current
->
ptrace
&
PT_PTRACED
))
if
((
current
->
ptrace
&
PT_DTRACE
)
&&
(
current
->
ptrace
&
PT_PTRACED
))
ptrace_notify
(
SIGTRAP
);
ptrace_notify
(
SIGTRAP
);
...
@@ -573,17 +573,17 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
...
@@ -573,17 +573,17 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
}
}
PT_REGS_SP
(
regs
)
=
(
unsigned
long
)
frame
;
PT_REGS_SP
(
regs
)
=
(
unsigned
long
)
frame
;
PT_REGS_
R
DI
(
regs
)
=
sig
;
PT_REGS_DI
(
regs
)
=
sig
;
/* In case the signal handler was declared without prototypes */
/* In case the signal handler was declared without prototypes */
PT_REGS_
R
AX
(
regs
)
=
0
;
PT_REGS_AX
(
regs
)
=
0
;
/*
/*
* This also works for non SA_SIGINFO handlers because they expect the
* This also works for non SA_SIGINFO handlers because they expect the
* next argument after the signal number on the stack.
* next argument after the signal number on the stack.
*/
*/
PT_REGS_
R
SI
(
regs
)
=
(
unsigned
long
)
&
frame
->
info
;
PT_REGS_SI
(
regs
)
=
(
unsigned
long
)
&
frame
->
info
;
PT_REGS_
R
DX
(
regs
)
=
(
unsigned
long
)
&
frame
->
uc
;
PT_REGS_DX
(
regs
)
=
(
unsigned
long
)
&
frame
->
uc
;
PT_REGS_
R
IP
(
regs
)
=
(
unsigned
long
)
ka
->
sa
.
sa_handler
;
PT_REGS_IP
(
regs
)
=
(
unsigned
long
)
ka
->
sa
.
sa_handler
;
out:
out:
return
err
;
return
err
;
}
}
...
...
arch/x86/um/sysrq_32.c
View file @
243412be
...
@@ -23,12 +23,10 @@ void show_regs(struct pt_regs *regs)
...
@@ -23,12 +23,10 @@ void show_regs(struct pt_regs *regs)
printk
(
" EFLAGS: %08lx
\n
%s
\n
"
,
PT_REGS_EFLAGS
(
regs
),
printk
(
" EFLAGS: %08lx
\n
%s
\n
"
,
PT_REGS_EFLAGS
(
regs
),
print_tainted
());
print_tainted
());
printk
(
"EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx
\n
"
,
printk
(
"EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx
\n
"
,
PT_REGS_EAX
(
regs
),
PT_REGS_EBX
(
regs
),
PT_REGS_AX
(
regs
),
PT_REGS_BX
(
regs
),
PT_REGS_ECX
(
regs
),
PT_REGS_CX
(
regs
),
PT_REGS_DX
(
regs
));
PT_REGS_EDX
(
regs
));
printk
(
"ESI: %08lx EDI: %08lx EBP: %08lx"
,
printk
(
"ESI: %08lx EDI: %08lx EBP: %08lx"
,
PT_REGS_ESI
(
regs
),
PT_REGS_EDI
(
regs
),
PT_REGS_SI
(
regs
),
PT_REGS_DI
(
regs
),
PT_REGS_BP
(
regs
));
PT_REGS_EBP
(
regs
));
printk
(
" DS: %04lx ES: %04lx
\n
"
,
printk
(
" DS: %04lx ES: %04lx
\n
"
,
0xffff
&
PT_REGS_DS
(
regs
),
0xffff
&
PT_REGS_DS
(
regs
),
0xffff
&
PT_REGS_ES
(
regs
));
0xffff
&
PT_REGS_ES
(
regs
));
...
...
arch/x86/um/sysrq_64.c
View file @
243412be
...
@@ -19,15 +19,15 @@ void __show_regs(struct pt_regs *regs)
...
@@ -19,15 +19,15 @@ void __show_regs(struct pt_regs *regs)
printk
(
KERN_INFO
"Pid: %d, comm: %.20s %s %s
\n
"
,
task_pid_nr
(
current
),
printk
(
KERN_INFO
"Pid: %d, comm: %.20s %s %s
\n
"
,
task_pid_nr
(
current
),
current
->
comm
,
print_tainted
(),
init_utsname
()
->
release
);
current
->
comm
,
print_tainted
(),
init_utsname
()
->
release
);
printk
(
KERN_INFO
"RIP: %04lx:[<%016lx>]
\n
"
,
PT_REGS_CS
(
regs
)
&
0xffff
,
printk
(
KERN_INFO
"RIP: %04lx:[<%016lx>]
\n
"
,
PT_REGS_CS
(
regs
)
&
0xffff
,
PT_REGS_
R
IP
(
regs
));
PT_REGS_IP
(
regs
));
printk
(
KERN_INFO
"RSP: %016lx EFLAGS: %08lx
\n
"
,
PT_REGS_SP
(
regs
),
printk
(
KERN_INFO
"RSP: %016lx EFLAGS: %08lx
\n
"
,
PT_REGS_SP
(
regs
),
PT_REGS_EFLAGS
(
regs
));
PT_REGS_EFLAGS
(
regs
));
printk
(
KERN_INFO
"RAX: %016lx RBX: %016lx RCX: %016lx
\n
"
,
printk
(
KERN_INFO
"RAX: %016lx RBX: %016lx RCX: %016lx
\n
"
,
PT_REGS_
RAX
(
regs
),
PT_REGS_RBX
(
regs
),
PT_REGS_R
CX
(
regs
));
PT_REGS_
AX
(
regs
),
PT_REGS_BX
(
regs
),
PT_REGS_
CX
(
regs
));
printk
(
KERN_INFO
"RDX: %016lx RSI: %016lx RDI: %016lx
\n
"
,
printk
(
KERN_INFO
"RDX: %016lx RSI: %016lx RDI: %016lx
\n
"
,
PT_REGS_
RDX
(
regs
),
PT_REGS_RSI
(
regs
),
PT_REGS_R
DI
(
regs
));
PT_REGS_
DX
(
regs
),
PT_REGS_SI
(
regs
),
PT_REGS_
DI
(
regs
));
printk
(
KERN_INFO
"RBP: %016lx R08: %016lx R09: %016lx
\n
"
,
printk
(
KERN_INFO
"RBP: %016lx R08: %016lx R09: %016lx
\n
"
,
PT_REGS_
R
BP
(
regs
),
PT_REGS_R8
(
regs
),
PT_REGS_R9
(
regs
));
PT_REGS_BP
(
regs
),
PT_REGS_R8
(
regs
),
PT_REGS_R9
(
regs
));
printk
(
KERN_INFO
"R10: %016lx R11: %016lx R12: %016lx
\n
"
,
printk
(
KERN_INFO
"R10: %016lx R11: %016lx R12: %016lx
\n
"
,
PT_REGS_R10
(
regs
),
PT_REGS_R11
(
regs
),
PT_REGS_R12
(
regs
));
PT_REGS_R10
(
regs
),
PT_REGS_R11
(
regs
),
PT_REGS_R12
(
regs
));
printk
(
KERN_INFO
"R13: %016lx R14: %016lx R15: %016lx
\n
"
,
printk
(
KERN_INFO
"R13: %016lx R14: %016lx R15: %016lx
\n
"
,
...
...
arch/x86/um/tls_32.c
View file @
243412be
...
@@ -219,7 +219,7 @@ int arch_copy_tls(struct task_struct *new)
...
@@ -219,7 +219,7 @@ int arch_copy_tls(struct task_struct *new)
int
idx
,
ret
=
-
EFAULT
;
int
idx
,
ret
=
-
EFAULT
;
if
(
copy_from_user
(
&
info
,
if
(
copy_from_user
(
&
info
,
(
void
__user
*
)
UPT_
E
SI
(
&
new
->
thread
.
regs
.
regs
),
(
void
__user
*
)
UPT_SI
(
&
new
->
thread
.
regs
.
regs
),
sizeof
(
info
)))
sizeof
(
info
)))
goto
out
;
goto
out
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment