xref: /freebsd/sys/compat/linux/linux_emul.h (revision 81338031c4839351c7f27c04c1e4924751319a88)
1ad2056f2SAlexander Leidinger /*-
2ad2056f2SAlexander Leidinger  * Copyright (c) 2006 Roman Divacky
3*81338031SDmitry Chagin  * Copyright (c) 2013 Dmitry Chagin
4ad2056f2SAlexander Leidinger  * All rights reserved.
5ad2056f2SAlexander Leidinger  *
6ad2056f2SAlexander Leidinger  * Redistribution and use in source and binary forms, with or without
7ad2056f2SAlexander Leidinger  * modification, are permitted provided that the following conditions
8ad2056f2SAlexander Leidinger  * are met:
9ad2056f2SAlexander Leidinger  * 1. Redistributions of source code must retain the above copyright
10ad2056f2SAlexander Leidinger  *    notice, this list of conditions and the following disclaimer
11ad2056f2SAlexander Leidinger  *    in this position and unchanged.
12ad2056f2SAlexander Leidinger  * 2. Redistributions in binary form must reproduce the above copyright
13ad2056f2SAlexander Leidinger  *    notice, this list of conditions and the following disclaimer in the
14ad2056f2SAlexander Leidinger  *    documentation and/or other materials provided with the distribution.
15ad2056f2SAlexander Leidinger  * 3. The name of the author may not be used to endorse or promote products
16ad2056f2SAlexander Leidinger  *    derived from this software without specific prior written permission
17ad2056f2SAlexander Leidinger  *
18ad2056f2SAlexander Leidinger  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19ad2056f2SAlexander Leidinger  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20ad2056f2SAlexander Leidinger  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21ad2056f2SAlexander Leidinger  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22ad2056f2SAlexander Leidinger  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23ad2056f2SAlexander Leidinger  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24ad2056f2SAlexander Leidinger  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25ad2056f2SAlexander Leidinger  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26ad2056f2SAlexander Leidinger  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27ad2056f2SAlexander Leidinger  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28ad2056f2SAlexander Leidinger  *
29ad2056f2SAlexander Leidinger  * $FreeBSD$
30ad2056f2SAlexander Leidinger  */
31ad2056f2SAlexander Leidinger 
32ad2056f2SAlexander Leidinger #ifndef _LINUX_EMUL_H_
33ad2056f2SAlexander Leidinger #define	_LINUX_EMUL_H_
34ad2056f2SAlexander Leidinger 
350eef2f8aSAlexander Leidinger /*
360eef2f8aSAlexander Leidinger  * modeled after similar structure in NetBSD
37ad2056f2SAlexander Leidinger  * this will be extended as we need more functionality
38ad2056f2SAlexander Leidinger  */
39ad2056f2SAlexander Leidinger struct linux_emuldata {
40ad2056f2SAlexander Leidinger 	int    *child_set_tid;	/* in clone(): Child's TID to set on clone */
41ad2056f2SAlexander Leidinger 	int    *child_clear_tid;/* in clone(): Child's TID to clear on exit */
42ad2056f2SAlexander Leidinger 
43955d762aSAlexander Leidinger 	int	pdeath_signal;		/* parent death signal */
44d14cc07dSDmitry Chagin 	int	flags;			/* different emuldata flags */
45*81338031SDmitry Chagin 	int	em_tid;			/* thread id */
46955d762aSAlexander Leidinger 
474732e446SRoman Divacky 	struct	linux_robust_list_head	*robust_futexes;
48ad2056f2SAlexander Leidinger };
49ad2056f2SAlexander Leidinger 
50*81338031SDmitry Chagin struct linux_emuldata	*em_find(struct thread *);
51ad2056f2SAlexander Leidinger 
52d14cc07dSDmitry Chagin /* emuldata flags */
53d14cc07dSDmitry Chagin #define	LINUX_XDEPR_REQUEUEOP	0x00000001	/* uses deprecated
54d14cc07dSDmitry Chagin 						   futex REQUEUE op*/
55d14cc07dSDmitry Chagin 
56*81338031SDmitry Chagin void	linux_proc_init(struct thread *, struct thread *, int);
57ad2056f2SAlexander Leidinger void	linux_proc_exit(void *, struct proc *);
58e5d81ef1SDmitry Chagin void	linux_schedtail(struct thread *);
59ad2056f2SAlexander Leidinger void	linux_proc_exec(void *, struct proc *, struct image_params *);
60*81338031SDmitry Chagin void	linux_thread_dtor(void *arg __unused, struct thread *);
61*81338031SDmitry Chagin void	linux_thread_detach(struct thread *);
62*81338031SDmitry Chagin int	linux_common_execve(struct thread *, struct image_args *);
6394cb2ecfSAlexander Leidinger 
64ad2056f2SAlexander Leidinger #endif	/* !_LINUX_EMUL_H_ */
65