diff --git a/include/syscall-codes.h b/include/syscall-codes.h index 999f32d80..84bc7b58b 100644 --- a/include/syscall-codes.h +++ b/include/syscall-codes.h @@ -22,6 +22,9 @@ #define __NR_exit 60 #define __NR_unlink 87 +#define __NR_set_thread_area 205 +#define __NR_get_thread_area 211 + #else /* CONFIG_X86_64 */ # error x86-32 bit mode not yet implemented #endif /* CONFIG_X86_64 */ diff --git a/include/syscall.h b/include/syscall.h index 7deeb1039..b4e9fb875 100644 --- a/include/syscall.h +++ b/include/syscall.h @@ -3,6 +3,7 @@ #include +#include "types.h" #include "compiler.h" #include "syscall-codes.h" @@ -210,6 +211,17 @@ static always_inline long sys_rt_sigreturn(void) return syscall0(__NR_rt_sigreturn); } +static always_inline long sys_set_thread_area(user_desc_t *info) +{ + return syscall1(__NR_set_thread_area, (long)info); +} + +static always_inline long sys_get_thread_area(user_desc_t *info) +{ + return syscall1(__NR_get_thread_area, (long)info); +} + + #else /* CONFIG_X86_64 */ # error x86-32 bit mode not yet implemented #endif /* CONFIG_X86_64 */ diff --git a/include/types.h b/include/types.h index 5e636df30..3dc2a13e0 100644 --- a/include/types.h +++ b/include/types.h @@ -56,6 +56,19 @@ typedef signed char s8; #ifdef CONFIG_X86_64 +typedef struct { + unsigned int entry_number; + unsigned int base_addr; + unsigned int limit; + unsigned int seg_32bit:1; + unsigned int contents:2; + unsigned int read_exec_only:1; + unsigned int limit_in_pages:1; + unsigned int seg_not_present:1; + unsigned int useable:1; + unsigned int lm:1; +} user_desc_t; + typedef struct { unsigned long r15; unsigned long r14;