Commit d6e7afe3 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

syscalls: Add sys_set/get_thread_area helpers

They are actually banned in kernel for now, but
we might end up needing them, so better to have
them in-place.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent cb7a9a52
......@@ -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 */
......
......@@ -3,6 +3,7 @@
#include <sys/types.h>
#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 */
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment