From owner-svn-src-all@freebsd.org Sun Nov 22 05:34:52 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBEBC47D587; Sun, 22 Nov 2020 05:34:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CdzWJ5J6Vz4ZMb; Sun, 22 Nov 2020 05:34:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8B8515141; Sun, 22 Nov 2020 05:34:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AM5Yqsq071738; Sun, 22 Nov 2020 05:34:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AM5Yp4u071733; Sun, 22 Nov 2020 05:34:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011220534.0AM5Yp4u071733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 22 Nov 2020 05:34:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367928 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern sys X-SVN-Commit-Revision: 367928 X-SVN-Commit-Repository: base 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.34 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: Sun, 22 Nov 2020 05:34:52 -0000 Author: kevans Date: Sun Nov 22 05:34:51 2020 New Revision: 367928 URL: https://svnweb.freebsd.org/changeset/base/367928 Log: _umtx_op: move compat32 definitions back in These are reasonably compact, and a future commit will blur the compat32 lines by supporting 32-bit operations with the native _umtx_op. Modified: head/sys/compat/freebsd32/freebsd32.h head/sys/compat/freebsd32/freebsd32_misc.c head/sys/kern/kern_umtx.c head/sys/sys/syscallsubr.h head/sys/sys/umtx.h Modified: head/sys/compat/freebsd32/freebsd32.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32.h Sun Nov 22 05:00:28 2020 (r367927) +++ head/sys/compat/freebsd32/freebsd32.h Sun Nov 22 05:34:51 2020 (r367928) @@ -94,27 +94,6 @@ struct itimerval32 { struct timeval32 it_value; }; -struct umtx_time32 { - struct timespec32 _timeout; - uint32_t _flags; - uint32_t _clockid; -}; - -struct umtx_robust_lists_params_compat32 { - uint32_t robust_list_offset; - uint32_t robust_priv_list_offset; - uint32_t robust_inact_offset; -}; - -struct umutex32 { - volatile __lwpid_t m_owner; /* Owner of the mutex */ - __uint32_t m_flags; /* Flags of the mutex */ - __uint32_t m_ceilings[2]; /* Priority protect ceiling */ - __uint32_t m_rb_lnk; /* Robust linkage */ - __uint32_t m_pad; - __uint32_t m_spare[2]; -}; - #define FREEBSD4_MFSNAMELEN 16 #define FREEBSD4_MNAMELEN (88 - 2 * sizeof(int32_t)) Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Sun Nov 22 05:00:28 2020 (r367927) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sun Nov 22 05:34:51 2020 (r367928) @@ -3766,11 +3766,3 @@ freebsd32_sched_rr_get_interval(struct thread *td, } return (error); } - -int -freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) -{ - - return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, - uap->uaddr2, &umtx_native_ops32)); -} Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Sun Nov 22 05:00:28 2020 (r367927) +++ head/sys/kern/kern_umtx.c Sun Nov 22 05:34:51 2020 (r367928) @@ -219,7 +219,41 @@ struct abs_timeout { struct timespec end; }; +struct umtx_copyops { + int (*copyin_timeout)(const void *uaddr, struct timespec *tsp); + int (*copyin_umtx_time)(const void *uaddr, size_t size, + struct _umtx_time *tp); + int (*copyin_robust_lists)(const void *uaddr, size_t size, + struct umtx_robust_lists_params *rbp); + int (*copyout_timeout)(void *uaddr, size_t size, + struct timespec *tsp); + const size_t timespec_sz; + const size_t umtx_time_sz; + const bool compat32; +}; + #ifdef COMPAT_FREEBSD32 +struct umtx_time32 { + struct timespec32 _timeout; + uint32_t _flags; + uint32_t _clockid; +}; + +struct umtx_robust_lists_params_compat32 { + uint32_t robust_list_offset; + uint32_t robust_priv_list_offset; + uint32_t robust_inact_offset; +}; + +struct umutex32 { + volatile __lwpid_t m_owner; /* Owner of the mutex */ + __uint32_t m_flags; /* Flags of the mutex */ + __uint32_t m_ceilings[2]; /* Priority protect ceiling */ + __uint32_t m_rb_lnk; /* Robust linkage */ + __uint32_t m_pad; + __uint32_t m_spare[2]; +}; + _Static_assert(sizeof(struct umutex) == sizeof(struct umutex32), "umutex32"); _Static_assert(__offsetof(struct umutex, m_spare[0]) == __offsetof(struct umutex32, m_spare[0]), "m_spare32"); @@ -4291,7 +4325,7 @@ const struct umtx_copyops umtx_native_ops32 = { }; #endif -int +static int kern__umtx_op(struct thread *td, void *obj, int op, unsigned long val, void *uaddr1, void *uaddr2, const struct umtx_copyops *ops) { @@ -4315,6 +4349,16 @@ sys__umtx_op(struct thread *td, struct _umtx_op_args * return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr1, uap->uaddr2, &umtx_native_ops)); } + +#ifdef COMPAT_FREEBSD32 +int +freebsd32__umtx_op(struct thread *td, struct freebsd32__umtx_op_args *uap) +{ + + return (kern__umtx_op(td, uap->obj, uap->op, uap->val, uap->uaddr, + uap->uaddr2, &umtx_native_ops32)); +} +#endif void umtx_thread_init(struct thread *td) Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Sun Nov 22 05:00:28 2020 (r367927) +++ head/sys/sys/syscallsubr.h Sun Nov 22 05:34:51 2020 (r367928) @@ -62,7 +62,6 @@ struct sockaddr; struct stat; struct thr_param; struct uio; -struct umtx_copyops; struct vm_map; struct vmspace; @@ -80,8 +79,6 @@ struct mmap_req { int kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, size_t buflen, size_t path_max); -int kern__umtx_op(struct thread *td, void *obj, int op, unsigned long val, - void *uaddr1, void *uaddr2, const struct umtx_copyops *ops); int kern_accept(struct thread *td, int s, struct sockaddr **name, socklen_t *namelen, struct file **fp); int kern_accept4(struct thread *td, int s, struct sockaddr **name, Modified: head/sys/sys/umtx.h ============================================================================== --- head/sys/sys/umtx.h Sun Nov 22 05:00:28 2020 (r367927) +++ head/sys/sys/umtx.h Sun Nov 22 05:34:51 2020 (r367928) @@ -200,21 +200,5 @@ void umtx_thread_fini(struct thread *); void umtx_thread_alloc(struct thread *); void umtx_thread_exit(struct thread *); -struct umtx_copyops { - int (*copyin_timeout)(const void *uaddr, struct timespec *tsp); - int (*copyin_umtx_time)(const void *uaddr, size_t size, - struct _umtx_time *tp); - int (*copyin_robust_lists)(const void *uaddr, size_t size, - struct umtx_robust_lists_params *rbp); - int (*copyout_timeout)(void *uaddr, size_t size, - struct timespec *tsp); - const size_t timespec_sz; - const size_t umtx_time_sz; - const bool compat32; -}; - -#ifdef COMPAT_FREEBSD32 -extern const struct umtx_copyops umtx_native_ops32; -#endif #endif /* !_KERNEL */ #endif /* !_SYS_UMTX_H_ */