[ALSA] Fix WM9705 AC97 patch build error
[linux-2.6/verdex.git] / arch / um / os-Linux / tls.c
blob9cb09a45546b8828bd105729897ad431f6c509c1
1 #include <errno.h>
2 #include <sys/ptrace.h>
3 #include <asm/ldt.h>
4 #include "sysdep/tls.h"
5 #include "uml-config.h"
7 /* TLS support - we basically rely on the host's one.*/
9 /* In TT mode, this should be called only by the tracing thread, and makes sense
10 * only for PTRACE_SET_THREAD_AREA. In SKAS mode, it's used normally.
14 #ifndef PTRACE_GET_THREAD_AREA
15 #define PTRACE_GET_THREAD_AREA 25
16 #endif
18 #ifndef PTRACE_SET_THREAD_AREA
19 #define PTRACE_SET_THREAD_AREA 26
20 #endif
22 int os_set_thread_area(user_desc_t *info, int pid)
24 int ret;
26 ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number,
27 (unsigned long) info);
28 if (ret < 0)
29 ret = -errno;
30 return ret;
33 #ifdef UML_CONFIG_MODE_SKAS
35 int os_get_thread_area(user_desc_t *info, int pid)
37 int ret;
39 ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number,
40 (unsigned long) info);
41 if (ret < 0)
42 ret = -errno;
43 return ret;
46 #endif
48 #ifdef UML_CONFIG_MODE_TT
49 #include "linux/unistd.h"
51 static _syscall1(int, get_thread_area, user_desc_t *, u_info);
52 static _syscall1(int, set_thread_area, user_desc_t *, u_info);
54 int do_set_thread_area_tt(user_desc_t *info)
56 int ret;
58 ret = set_thread_area(info);
59 if (ret < 0) {
60 ret = -errno;
62 return ret;
65 int do_get_thread_area_tt(user_desc_t *info)
67 int ret;
69 ret = get_thread_area(info);
70 if (ret < 0) {
71 ret = -errno;
73 return ret;
76 #endif /* UML_CONFIG_MODE_TT */