aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2011-08-18 15:03:49 -0400
committerRichard Weinberger <richard@nod.at>2011-11-02 09:14:53 -0400
commit51d34749051a6369093e5067ef67c17f17694921 (patch)
tree765e499c73e2797cc5d525f1b4cf590f17aa4132 /arch/um/os-Linux
parent7eb122555c8583e1601b7a620c5a88c1e06c3eac (diff)
um: merge arch/um/os-Linux/sys-{i386,x86_64}
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/os-Linux')
-rw-r--r--arch/um/os-Linux/Makefile2
-rw-r--r--arch/um/os-Linux/sys-x86/Makefile (renamed from arch/um/os-Linux/sys-i386/Makefile)5
-rw-r--r--arch/um/os-Linux/sys-x86/prctl.c (renamed from arch/um/os-Linux/sys-x86_64/prctl.c)0
-rw-r--r--arch/um/os-Linux/sys-x86/registers.c (renamed from arch/um/os-Linux/sys-i386/registers.c)58
-rw-r--r--arch/um/os-Linux/sys-x86/task_size.c (renamed from arch/um/os-Linux/sys-i386/task_size.c)12
-rw-r--r--arch/um/os-Linux/sys-x86/tls.c (renamed from arch/um/os-Linux/sys-i386/tls.c)0
-rw-r--r--arch/um/os-Linux/sys-x86_64/Makefile10
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c50
-rw-r--r--arch/um/os-Linux/sys-x86_64/task_size.c5
9 files changed, 57 insertions, 85 deletions
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index 7aec5bfea331..7879e76e998f 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -5,7 +5,7 @@
5 5
6obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ 6obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \
7 registers.o sigio.o signal.o start_up.o time.o tty.o \ 7 registers.o sigio.o signal.o start_up.o time.o tty.o \
8 umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/ 8 umid.o tls.o user_syms.o util.o drivers/ sys-$(HEADER_ARCH)/ skas/
9 9
10obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o 10obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o
11 11
diff --git a/arch/um/os-Linux/sys-i386/Makefile b/arch/um/os-Linux/sys-x86/Makefile
index d491754bf701..22cc5073c020 100644
--- a/arch/um/os-Linux/sys-i386/Makefile
+++ b/arch/um/os-Linux/sys-x86/Makefile
@@ -3,7 +3,10 @@
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-y = registers.o task_size.o tls.o 6obj-y = registers.o task_size.o
7
8obj-$(CONFIG_X86_32) += tls.o
9obj-$(CONFIG_64BIT) += prctl.o
7 10
8USER_OBJS := $(obj-y) 11USER_OBJS := $(obj-y)
9 12
diff --git a/arch/um/os-Linux/sys-x86_64/prctl.c b/arch/um/os-Linux/sys-x86/prctl.c
index 9d34eddb517f..9d34eddb517f 100644
--- a/arch/um/os-Linux/sys-x86_64/prctl.c
+++ b/arch/um/os-Linux/sys-x86/prctl.c
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-x86/registers.c
index 913d811b38db..3a9b6247bbbc 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-x86/registers.c
@@ -24,6 +24,8 @@ int restore_fp_registers(int pid, unsigned long *fp_regs)
24 return 0; 24 return 0;
25} 25}
26 26
27#ifdef __i386__
28int have_fpx_regs = 1;
27int save_fpx_registers(int pid, unsigned long *fp_regs) 29int save_fpx_registers(int pid, unsigned long *fp_regs)
28{ 30{
29 if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0) 31 if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0)
@@ -38,24 +40,6 @@ int restore_fpx_registers(int pid, unsigned long *fp_regs)
38 return 0; 40 return 0;
39} 41}
40 42
41unsigned long get_thread_reg(int reg, jmp_buf *buf)
42{
43 switch (reg) {
44 case EIP:
45 return buf[0]->__eip;
46 case UESP:
47 return buf[0]->__esp;
48 case EBP:
49 return buf[0]->__ebp;
50 default:
51 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
52 reg);
53 return 0;
54 }
55}
56
57int have_fpx_regs = 1;
58
59int get_fp_registers(int pid, unsigned long *regs) 43int get_fp_registers(int pid, unsigned long *regs)
60{ 44{
61 if (have_fpx_regs) 45 if (have_fpx_regs)
@@ -87,3 +71,41 @@ void arch_init_registers(int pid)
87 71
88 have_fpx_regs = 0; 72 have_fpx_regs = 0;
89} 73}
74#else
75
76int get_fp_registers(int pid, unsigned long *regs)
77{
78 return save_fp_registers(pid, regs);
79}
80
81int put_fp_registers(int pid, unsigned long *regs)
82{
83 return restore_fp_registers(pid, regs);
84}
85
86#endif
87
88unsigned long get_thread_reg(int reg, jmp_buf *buf)
89{
90 switch (reg) {
91#ifdef __i386__
92 case EIP:
93 return buf[0]->__eip;
94 case UESP:
95 return buf[0]->__esp;
96 case EBP:
97 return buf[0]->__ebp;
98#else
99 case RIP:
100 return buf[0]->__rip;
101 case RSP:
102 return buf[0]->__rsp;
103 case RBP:
104 return buf[0]->__rbp;
105#endif
106 default:
107 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
108 reg);
109 return 0;
110 }
111}
diff --git a/arch/um/os-Linux/sys-i386/task_size.c b/arch/um/os-Linux/sys-x86/task_size.c
index 4ce09b8e99c9..efb16c5c9bcf 100644
--- a/arch/um/os-Linux/sys-i386/task_size.c
+++ b/arch/um/os-Linux/sys-x86/task_size.c
@@ -4,6 +4,8 @@
4#include <sys/mman.h> 4#include <sys/mman.h>
5#include "longjmp.h" 5#include "longjmp.h"
6 6
7#ifdef __i386__
8
7static jmp_buf buf; 9static jmp_buf buf;
8 10
9static void segfault(int sig) 11static void segfault(int sig)
@@ -136,3 +138,13 @@ out:
136 138
137 return top; 139 return top;
138} 140}
141
142#else
143
144unsigned long os_get_top_address(void)
145{
146 /* The old value of CONFIG_TOP_ADDR */
147 return 0x7fc0000000;
148}
149
150#endif
diff --git a/arch/um/os-Linux/sys-i386/tls.c b/arch/um/os-Linux/sys-x86/tls.c
index 281e83ecce3d..281e83ecce3d 100644
--- a/arch/um/os-Linux/sys-i386/tls.c
+++ b/arch/um/os-Linux/sys-x86/tls.c
diff --git a/arch/um/os-Linux/sys-x86_64/Makefile b/arch/um/os-Linux/sys-x86_64/Makefile
deleted file mode 100644
index 58f6e0a38598..000000000000
--- a/arch/um/os-Linux/sys-x86_64/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL
4#
5
6obj-y = registers.o prctl.o task_size.o
7
8USER_OBJS := $(obj-y)
9
10include arch/um/scripts/Makefile.rules
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
deleted file mode 100644
index 0594d550c034..000000000000
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Copyright (C) 2006 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include <errno.h>
7#include <sys/ptrace.h>
8#define __FRAME_OFFSETS
9#include <asm/ptrace.h>
10#include "longjmp.h"
11
12int save_fp_registers(int pid, unsigned long *fp_regs)
13{
14 if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
15 return -errno;
16 return 0;
17}
18
19int restore_fp_registers(int pid, unsigned long *fp_regs)
20{
21 if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
22 return -errno;
23 return 0;
24}
25
26unsigned long get_thread_reg(int reg, jmp_buf *buf)
27{
28 switch (reg) {
29 case RIP:
30 return buf[0]->__rip;
31 case RSP:
32 return buf[0]->__rsp;
33 case RBP:
34 return buf[0]->__rbp;
35 default:
36 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
37 reg);
38 return 0;
39 }
40}
41
42int get_fp_registers(int pid, unsigned long *regs)
43{
44 return save_fp_registers(pid, regs);
45}
46
47int put_fp_registers(int pid, unsigned long *regs)
48{
49 return restore_fp_registers(pid, regs);
50}
diff --git a/arch/um/os-Linux/sys-x86_64/task_size.c b/arch/um/os-Linux/sys-x86_64/task_size.c
deleted file mode 100644
index 26a0dd1f349c..000000000000
--- a/arch/um/os-Linux/sys-x86_64/task_size.c
+++ /dev/null
@@ -1,5 +0,0 @@
1unsigned long os_get_top_address(unsigned long shift)
2{
3 /* The old value of CONFIG_TOP_ADDR */
4 return 0x7fc0000000;
5}