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