Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 1 | #include <errno.h> |
| 2 | #include <sys/ptrace.h> |
Paolo 'Blaisorblade' Giarrusso | dd77aec | 2006-03-31 02:30:23 -0800 | [diff] [blame] | 3 | #include "sysdep/tls.h" |
Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 4 | |
| 5 | /* TLS support - we basically rely on the host's one.*/ |
| 6 | |
Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 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 | |
Paolo 'Blaisorblade' Giarrusso | dd77aec | 2006-03-31 02:30:23 -0800 | [diff] [blame] | 15 | int os_set_thread_area(user_desc_t *info, int pid) |
Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 16 | { |
Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 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 | |
Paolo 'Blaisorblade' Giarrusso | dd77aec | 2006-03-31 02:30:23 -0800 | [diff] [blame] | 26 | int os_get_thread_area(user_desc_t *info, int pid) |
Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 27 | { |
Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 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 | } |