svn commit: r285540 - in head/sys/compat: cloudabi cloudabi64
Ed Schouten
ed at FreeBSD.org
Tue Jul 14 15:11:52 UTC 2015
Author: ed
Date: Tue Jul 14 15:11:50 2015
New Revision: 285540
URL: https://svnweb.freebsd.org/changeset/base/285540
Log:
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
Modified:
head/sys/compat/cloudabi/cloudabi_thread.c
head/sys/compat/cloudabi64/cloudabi64_thread.c
head/sys/compat/cloudabi64/syscalls.master
Modified: head/sys/compat/cloudabi/cloudabi_thread.c
==============================================================================
--- head/sys/compat/cloudabi/cloudabi_thread.c Tue Jul 14 14:33:21 2015 (r285539)
+++ head/sys/compat/cloudabi/cloudabi_thread.c Tue Jul 14 15:11:50 2015 (r285540)
@@ -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
@@ -38,10 +42,18 @@ cloudabi_sys_thread_exit(struct thread *
}
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);
}
Modified: head/sys/compat/cloudabi64/cloudabi64_thread.c
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_thread.c Tue Jul 14 14:33:21 2015 (r285539)
+++ head/sys/compat/cloudabi64/cloudabi64_thread.c Tue Jul 14 15:11:50 2015 (r285540)
@@ -37,12 +37,3 @@ cloudabi64_sys_thread_create(struct thre
/* 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);
-}
Modified: head/sys/compat/cloudabi64/syscalls.master
==============================================================================
--- head/sys/compat/cloudabi64/syscalls.master Tue Jul 14 14:33:21 2015 (r285539)
+++ head/sys/compat/cloudabi64/syscalls.master Tue Jul 14 15:11:50 2015 (r285540)
@@ -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(); }
More information about the svn-src-all
mailing list