1 | /* $NetBSD: linux_machdep.h,v 1.14 2014/02/07 22:40:22 dsl 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 | #define LINUX_STATFS_64BIT /* Needed for full 64bit struct statfs */ |
38 | |
39 | #include <compat/linux/common/linux_types.h> |
40 | #include <compat/linux/common/linux_signal.h> |
41 | #include <compat/linux/common/linux_siginfo.h> |
42 | |
43 | /* From <asm/sigcontext.h> */ |
44 | /* Matches the cpu's fxsave format */ |
45 | struct linux__fpstate { |
46 | u_int16_t cwd; |
47 | u_int16_t swd; |
48 | u_int16_t twd; |
49 | u_int16_t fop; |
50 | u_int64_t rip; |
51 | u_int64_t rdp; |
52 | u_int32_t mxcsr; |
53 | u_int32_t mxcsr_mask; |
54 | u_int32_t st_space[32]; |
55 | u_int32_t xmm_space[64]; |
56 | u_int32_t reserved2[24]; |
57 | }; |
58 | __CTASSERT(sizeof (struct linux__fpstate) == 512); |
59 | |
60 | /* From <asm/sigcontext.h> */ |
61 | struct linux_sigcontext { |
62 | u_int64_t r8; |
63 | u_int64_t r9; |
64 | u_int64_t r10; |
65 | u_int64_t r11; |
66 | u_int64_t r12; |
67 | u_int64_t r13; |
68 | u_int64_t r14; |
69 | u_int64_t r15; |
70 | u_int64_t rdi; |
71 | u_int64_t rsi; |
72 | u_int64_t rbp; |
73 | u_int64_t rbx; |
74 | u_int64_t rdx; |
75 | u_int64_t rax; |
76 | u_int64_t rcx; |
77 | u_int64_t rsp; |
78 | u_int64_t rip; |
79 | u_int64_t eflags; |
80 | u_int16_t cs; |
81 | u_int16_t gs; |
82 | u_int16_t fs; |
83 | u_int16_t pad0; |
84 | u_int64_t err; |
85 | u_int64_t trapno; |
86 | u_int64_t oldmask; |
87 | u_int64_t cr2; |
88 | struct linux__fpstate *fpstate; |
89 | u_int64_t reserved1[8]; |
90 | }; |
91 | |
92 | /* From <asm/ucontext.h> */ |
93 | struct linux_ucontext { |
94 | u_int64_t luc_flags; |
95 | struct linux_ucontext *luc_link; |
96 | linux_stack_t luc_stack; |
97 | struct linux_sigcontext luc_mcontext; |
98 | linux_sigset_t luc_sigmask; |
99 | }; |
100 | |
101 | /* From linux/arch/x86_64/kernel/signal.c */ |
102 | struct linux_rt_sigframe { |
103 | char *pretcode; |
104 | struct linux_ucontext uc; |
105 | struct linux_siginfo info; |
106 | }; |
107 | |
108 | #ifdef _KERNEL |
109 | __BEGIN_DECLS |
110 | void linux_syscall_intern(struct proc *); |
111 | __END_DECLS |
112 | #endif /* !_KERNEL */ |
113 | |
114 | #define LINUX_VSYSCALL_START 0xffffffffff600000 |
115 | #define LINUX_VSYSCALL_SIZE 1024 |
116 | #define LINUX_VSYSCALL_MAXNR 3 |
117 | |
118 | #define LINUX_UNAME_ARCH MACHINE_ARCH |
119 | #define LINUX_LARGEFILE64 |
120 | #define LINUX_IPC_FORCE64 |
121 | |
122 | #define LINUX_LWP_SETPRIVATE linux_lwp_setprivate |
123 | |
124 | /* |
125 | * Used in ugly patch to fake device numbers. |
126 | */ |
127 | /* Major device numbers for new style ptys. */ |
128 | #define LINUX_PTC_MAJOR 2 |
129 | #define LINUX_PTS_MAJOR 3 |
130 | /* Major device numbers of VT device on both Linux and NetBSD. */ |
131 | #define LINUX_CONS_MAJOR 4 |
132 | |
133 | #endif /* _AMD64_LINUX_MACHDEP_H */ |
134 | |