Subject: [PATCH 65/91] um: merge os-Linux/tls.c into arch/x86/um/os-Linux/tls.c
Subsystems (2)
it's i386-specific; moreover, analogs on other targets have incompatible interface - PTRACE_GET_THREAD_AREA does exist elsewhere, but struct user_desc does *not*
Signed-off-by Al Viro <[email protected]>
--- arch/um/include/shared/os.h | 5 ----- arch/um/os-Linux/Makefile | 4 ++-- arch/um/os-Linux/tls.c | 35 ----------------------------------- arch/x86/um/os-Linux/tls.c | 34 +++++++++++++++++++++++++++++++++- arch/x86/um/shared/sysdep/tls.h | 3 +++ 5 files changed, 38 insertions(+), 43 deletions(-) delete mode 100644 arch/um/os-Linux/tls.c
arch/um/include/shared/os.h +0 -5
@@ -10,7 +10,6 @@#include "irq_user.h" #include "longjmp.h" #include "mm_id.h" -#include "sysdep/tls.h" #define CATCH_EINTR (expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR))
@@ -212,10 +211,6 @@ extern int run_helper_thread(int (*proc)(void *), void *arg,extern int helper_wait (int pid); -/* tls.c */ -extern int os_set_thread_area (user_desc_t *info,int pid); -extern int os_get_thread_area (user_desc_t *info,int pid); -/* umid.c */ extern int umid_file_name (char *name,char *buf,int len);extern int set_umid (char *name);
arch/um/os-Linux/Makefile +2 -2
@@ -5,13 +5,13 @@ obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ registers.o sigio.o signal.o start_up.o time.o tty.o \ - umid.o tls.o user_syms.o util.o drivers/ skas/ + umid.o user_syms.o util.o drivers/ skas/ obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \ - tty.o tls.o umid.o util.o + tty.o umid.o util.o CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
arch/um/os-Linux/tls.c deleted +0 -35
@@ -1,35 +0,0 @@ -#include <errno.h> -#include <sys/ptrace.h> -#include "sysdep/tls.h" - -/* TLS support - we basically rely on the host's one.*/ - -#ifndef PTRACE_GET_THREAD_AREA -#define PTRACE_GET_THREAD_AREA 25 -#endif - -#ifndef PTRACE_SET_THREAD_AREA -#define PTRACE_SET_THREAD_AREA 26 -#endif - -int os_set_thread_area (user_desc_t *info,int pid) -{ -int ret; - - ret =ptrace (PTRACE_SET_THREAD_AREA , pid, info->entry_number, - (unsigned long ) info); -if (ret <0 ) - ret = -errno; -return ret; -} - -int os_get_thread_area (user_desc_t *info,int pid) -{ -int ret; - - ret =ptrace (PTRACE_GET_THREAD_AREA , pid, info->entry_number, - (unsigned long ) info); -if (ret <0 ) - ret = -errno; -return ret; -}
arch/x86/um/os-Linux/tls.c +33 -1
@@ -1,15 +1,25 @@#include <errno.h> #include <linux/unistd.h> +#include <sys/ptrace.h> #include <sys/syscall.h> #include <unistd.h> #include "sysdep/tls.h" +#ifndef PTRACE_GET_THREAD_AREA +#define PTRACE_GET_THREAD_AREA 25 +#endif + +#ifndef PTRACE_SET_THREAD_AREA +#define PTRACE_SET_THREAD_AREA 26 +#endif +/* Checks whether host supports TLS, and sets *tls_min according to the value * valid on the host. * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */ -void check_host_supports_tls (int *supports_tls,int *tls_min) { +void check_host_supports_tls (int *supports_tls,int *tls_min) +{/* Values for x86 and x86_64.*/ int val[] = {GDT_ENTRY_TLS_MIN_I386 ,GDT_ENTRY_TLS_MIN_X86_64 };int i;
@@ -33,3 +43,25 @@ void check_host_supports_tls(int *supports_tls, int *tls_min) { *supports_tls =0 ; } + +int os_set_thread_area (user_desc_t *info,int pid) +{ +int ret; + + ret =ptrace (PTRACE_SET_THREAD_AREA , pid, info->entry_number, + (unsigned long ) info); +if (ret <0 ) + ret = -errno; +return ret; +} + +int os_get_thread_area (user_desc_t *info,int pid) +{ +int ret; + + ret =ptrace (PTRACE_GET_THREAD_AREA , pid, info->entry_number, + (unsigned long ) info); +if (ret <0 ) + ret = -errno; +return ret; +}
arch/x86/um/shared/sysdep/tls.h +3 -0
@@ -29,6 +29,9 @@ typedef struct user_desc user_desc_t;# endif /* __KERNEL__ */ +extern int os_set_thread_area (user_desc_t *info,int pid); +extern int os_get_thread_area (user_desc_t *info,int pid); +#ifdef __i386__#define GDT_ENTRY_TLS_MIN_I386 6#define GDT_ENTRY_TLS_MIN_X86_64 12
Signature · 1 line
1.7.2.5