From owner-svn-src-all@freebsd.org Tue Jul 14 15:11:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 372BA9A1895; Tue, 14 Jul 2015 15:11:52 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13A6EC5; Tue, 14 Jul 2015 15:11:52 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6EFBp0T056577; Tue, 14 Jul 2015 15:11:51 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6EFBoNg056572; Tue, 14 Jul 2015 15:11:50 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507141511.t6EFBoNg056572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Tue, 14 Jul 2015 15:11:50 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jul 2015 15:11:52 -0000 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 __FBSDID("$FreeBSD$"); +#include +#include +#include + #include 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(); }