1 /* $NetBSD: linux_machdep.h,v 1.13 2010/07/07 01:30:33 chs 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 rax; 74 u_int64_t rcx; 75 u_int64_t rsp; 76 u_int64_t rip; 77 u_int64_t eflags; 78 u_int16_t cs; 79 u_int16_t gs; 80 u_int16_t fs; 81 u_int16_t pad0; 82 u_int64_t err; 83 u_int64_t trapno; 84 u_int64_t oldmask; 85 u_int64_t cr2; 86 struct linux__fpstate *fpstate; 87 u_int64_t reserved1[8]; 88 }; 89 90 /* From <asm/ucontext.h> */ 91 struct linux_ucontext { 92 u_int64_t luc_flags; 93 struct linux_ucontext *luc_link; 94 linux_stack_t luc_stack; 95 struct linux_sigcontext luc_mcontext; 96 linux_sigset_t luc_sigmask; 97 }; 98 99 /* From linux/arch/x86_64/kernel/signal.c */ 100 struct linux_rt_sigframe { 101 char *pretcode; 102 struct linux_ucontext uc; 103 struct linux_siginfo info; 104 }; 105 106 #ifdef _KERNEL 107 __BEGIN_DECLS 108 void linux_syscall_intern(struct proc *); 109 __END_DECLS 110 #endif /* !_KERNEL */ 111 112 #define LINUX_VSYSCALL_START 0xffffffffff600000 113 #define LINUX_VSYSCALL_SIZE 1024 114 #define LINUX_VSYSCALL_MAXNR 3 115 116 #define LINUX_UNAME_ARCH MACHINE_ARCH 117 #define LINUX_LARGEFILE64 118 #define LINUX_IPC_FORCE64 119 120 #define LINUX_LWP_SETPRIVATE linux_lwp_setprivate 121 122 /* 123 * Used in ugly patch to fake device numbers. 124 */ 125 /* Major device numbers for new style ptys. */ 126 #define LINUX_PTC_MAJOR 2 127 #define LINUX_PTS_MAJOR 3 128 /* Major device numbers of VT device on both Linux and NetBSD. */ 129 #define LINUX_CONS_MAJOR 4 130 131 #endif /* _AMD64_LINUX_MACHDEP_H */ 132