Date: Tue, 14 Jul 2015 15:11:50 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285540 - in head/sys/compat: cloudabi cloudabi64 Message-ID: <201507141511.t6EFBoNg056572@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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(); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507141511.t6EFBoNg056572>