Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: merge os-Linux/tls.c into arch/x86/um/os-Linux/tls.c

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 <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>

authored by

Al Viro and committed by
Richard Weinberger
1bbd5f21 c5cc32fe

+38 -43
-5
arch/um/include/shared/os.h
··· 10 10 #include "irq_user.h" 11 11 #include "longjmp.h" 12 12 #include "mm_id.h" 13 - #include "sysdep/tls.h" 14 13 15 14 #define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR)) 16 15 ··· 210 211 unsigned int flags, unsigned long *stack_out); 211 212 extern int helper_wait(int pid); 212 213 213 - 214 - /* tls.c */ 215 - extern int os_set_thread_area(user_desc_t *info, int pid); 216 - extern int os_get_thread_area(user_desc_t *info, int pid); 217 214 218 215 /* umid.c */ 219 216 extern int umid_file_name(char *name, char *buf, int len);
+2 -2
arch/um/os-Linux/Makefile
··· 5 5 6 6 obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ 7 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/ skas/ 8 + umid.o user_syms.o util.o drivers/ skas/ 9 9 10 10 obj-$(CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA) += elf_aux.o 11 11 12 12 USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ 13 13 main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \ 14 - tty.o tls.o umid.o util.o 14 + tty.o umid.o util.o 15 15 16 16 CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) 17 17
-35
arch/um/os-Linux/tls.c
··· 1 - #include <errno.h> 2 - #include <sys/ptrace.h> 3 - #include "sysdep/tls.h" 4 - 5 - /* TLS support - we basically rely on the host's one.*/ 6 - 7 - #ifndef PTRACE_GET_THREAD_AREA 8 - #define PTRACE_GET_THREAD_AREA 25 9 - #endif 10 - 11 - #ifndef PTRACE_SET_THREAD_AREA 12 - #define PTRACE_SET_THREAD_AREA 26 13 - #endif 14 - 15 - int os_set_thread_area(user_desc_t *info, int pid) 16 - { 17 - int ret; 18 - 19 - ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number, 20 - (unsigned long) info); 21 - if (ret < 0) 22 - ret = -errno; 23 - return ret; 24 - } 25 - 26 - int os_get_thread_area(user_desc_t *info, int pid) 27 - { 28 - int ret; 29 - 30 - ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number, 31 - (unsigned long) info); 32 - if (ret < 0) 33 - ret = -errno; 34 - return ret; 35 - }
+33 -1
arch/x86/um/os-Linux/tls.c
··· 1 1 #include <errno.h> 2 2 #include <linux/unistd.h> 3 3 4 + #include <sys/ptrace.h> 4 5 #include <sys/syscall.h> 5 6 #include <unistd.h> 6 7 7 8 #include "sysdep/tls.h" 8 9 10 + #ifndef PTRACE_GET_THREAD_AREA 11 + #define PTRACE_GET_THREAD_AREA 25 12 + #endif 13 + 14 + #ifndef PTRACE_SET_THREAD_AREA 15 + #define PTRACE_SET_THREAD_AREA 26 16 + #endif 17 + 9 18 /* Checks whether host supports TLS, and sets *tls_min according to the value 10 19 * valid on the host. 11 20 * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */ 12 - void check_host_supports_tls(int *supports_tls, int *tls_min) { 21 + void check_host_supports_tls(int *supports_tls, int *tls_min) 22 + { 13 23 /* Values for x86 and x86_64.*/ 14 24 int val[] = {GDT_ENTRY_TLS_MIN_I386, GDT_ENTRY_TLS_MIN_X86_64}; 15 25 int i; ··· 42 32 } 43 33 44 34 *supports_tls = 0; 35 + } 36 + 37 + int os_set_thread_area(user_desc_t *info, int pid) 38 + { 39 + int ret; 40 + 41 + ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number, 42 + (unsigned long) info); 43 + if (ret < 0) 44 + ret = -errno; 45 + return ret; 46 + } 47 + 48 + int os_get_thread_area(user_desc_t *info, int pid) 49 + { 50 + int ret; 51 + 52 + ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number, 53 + (unsigned long) info); 54 + if (ret < 0) 55 + ret = -errno; 56 + return ret; 45 57 }
+3
arch/x86/um/shared/sysdep/tls.h
··· 29 29 30 30 # endif /* __KERNEL__ */ 31 31 32 + extern int os_set_thread_area(user_desc_t *info, int pid); 33 + extern int os_get_thread_area(user_desc_t *info, int pid); 34 + 32 35 #ifdef __i386__ 33 36 #define GDT_ENTRY_TLS_MIN_I386 6 34 37 #define GDT_ENTRY_TLS_MIN_X86_64 12