xref: /netbsd-src/sys/compat/linux/arch/amd64/linux_machdep.h (revision aaf4ece63a859a04e37cf3a7229b5fab0157cc06)
1 /*	$NetBSD: linux_machdep.h,v 1.5 2005/11/23 16:14:57 manu Exp $ */
2 
3 /*-
4  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *	This product includes software developed by Emmanuel Dreyfus
17  * 4. The name of the author may not be used to endorse or promote
18  *    products derived from this software without specific prior written
19  *    permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS''
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _AMD64_LINUX_MACHDEP_H
35 #define _AMD64_LINUX_MACHDEP_H
36 
37 #include <compat/linux/common/linux_types.h>
38 #include <compat/linux/common/linux_signal.h>
39 #include <compat/linux/common/linux_siginfo.h>
40 
41 /* From <asm/sigcontext.h> */
42 struct linux__fpstate {
43 	u_int16_t cwd;
44 	u_int16_t swd;
45 	u_int16_t twd;
46 	u_int16_t fop;
47 	u_int64_t rip;
48 	u_int64_t rdp;
49 	u_int32_t mxcsr;
50 	u_int32_t mxcsr_mask;
51 	u_int32_t st_space[32];
52 	u_int32_t xmm_space[64];
53 	u_int32_t reserved2[24];
54 };
55 
56 /* From <asm/sigcontext.h> */
57 struct linux_sigcontext {
58 	u_int64_t r8;
59 	u_int64_t r9;
60 	u_int64_t r10;
61 	u_int64_t r11;
62 	u_int64_t r12;
63 	u_int64_t r13;
64 	u_int64_t r14;
65 	u_int64_t r15;
66 	u_int64_t rdi;
67 	u_int64_t rsi;
68 	u_int64_t rbp;
69 	u_int64_t rbx;
70 	u_int64_t rdx;
71 	u_int64_t rcx;
72 	u_int64_t rsp;
73 	u_int64_t rip;
74 	u_int64_t eflags;
75 	u_int16_t cs;
76 	u_int16_t gs;
77 	u_int16_t fs;
78 	u_int16_t pad0;
79 	u_int64_t err;
80 	u_int64_t trapno;
81 	u_int64_t oldmask;
82 	u_int64_t cr2;
83 	struct linux__fpstate *fpstate;
84 	u_int64_t reserved1[8];
85 };
86 
87 /* From <asm/ucontext.h> */
88 struct linux_ucontext {
89 	u_int64_t luc_flags;
90 	struct linux_ucontext *luc_link;
91 	linux_stack_t luc_stack;
92 	struct linux_sigcontext luc_mcontext;
93 	linux_sigset_t luc_sigmask;
94 };
95 
96 /* From linux/arch/x86_64/kernel/signal.c */
97 struct linux_rt_sigframe {
98 	char *pretcode;
99 	struct linux_ucontext uc;
100 	struct linux_siginfo info;
101 };
102 
103 #ifdef _KERNEL
104 __BEGIN_DECLS
105 void linux_syscall_intern __P((struct proc *));
106 __END_DECLS
107 #endif /* !_KERNEL */
108 
109 #define LINUX_VSYSCALL_START	0xffffffffff600000
110 #define LINUX_VSYSCALL_SIZE	1024
111 #define LINUX_VSYSCALL_MAXNR	3
112 
113 #define LINUX_UNAME_ARCH machine_arch
114 #define LINUX_NPTL
115 #define LINUX_LARGEFILE64
116 
117 #endif /* _AMD64_LINUX_MACHDEP_H */
118