1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

Implement thread_tcb_set() and thread_yield().

The first system call is used to set the user TLS address. Right now
this system call is invoked by the C library for both the initial thread
and additional threads unconditionally, but in the future we'll only
call this if the architecture does not support this. On recent x86-64
CPUs we could use the WRFSBASE instruction.

This system call was erroneously placed in sys/compat/cloudabi64, even
though it does not depend on any pointer size dependent datastructure.
Move it to the right place.

Obtained from:	https://github.com/NuxiNL/freebsd
This commit is contained in:
Ed Schouten 2015-07-14 15:11:50 +00:00
parent 03744d7c8d
commit 1eb7c7cae3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285540
3 changed files with 15 additions and 13 deletions

View File

@ -26,6 +26,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/sched.h>
#include <compat/cloudabi/cloudabi_proto.h>
int
@ -37,11 +41,19 @@ cloudabi_sys_thread_exit(struct thread *td,
return (ENOSYS);
}
int
cloudabi_sys_thread_tcb_set(struct thread *td,
struct cloudabi_sys_thread_tcb_set_args *uap)
{
return (cpu_set_user_tls(td, uap->tcb));
}
int
cloudabi_sys_thread_yield(struct thread *td,
struct cloudabi_sys_thread_yield_args *uap)
{
/* Not implemented. */
return (ENOSYS);
sched_relinquish(td);
return (0);
}

View File

@ -37,12 +37,3 @@ cloudabi64_sys_thread_create(struct thread *td,
/* Not implemented. */
return (ENOSYS);
}
int
cloudabi64_sys_thread_tcb_set(struct thread *td,
struct cloudabi64_sys_thread_tcb_set_args *uap)
{
/* Not implemented. */
return (ENOSYS);
}

View File

@ -207,6 +207,5 @@
cloudabi64_threadattr_t *attr); }
54 AUE_NULL STD { void cloudabi_sys_thread_exit( \
cloudabi_lock_t *lock); }
55 AUE_NULL STD { void cloudabi64_sys_thread_tcb_set( \
void *tcb); }
55 AUE_NULL STD { void cloudabi_sys_thread_tcb_set(void *tcb); }
56 AUE_NULL STD { void cloudabi_sys_thread_yield(); }