Home | History | Annotate | Line # | Download | only in i386
linux_machdep.h revision 1.32.32.1
      1  1.32.32.1      yamt /*	$NetBSD: linux_machdep.h,v 1.32.32.1 2008/05/16 02:23:39 yamt Exp $	*/
      2        1.1      fvdl 
      3        1.9      fvdl /*-
      4       1.16   mycroft  * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
      5        1.1      fvdl  * All rights reserved.
      6        1.1      fvdl  *
      7        1.9      fvdl  * This code is derived from software contributed to The NetBSD Foundation
      8        1.9      fvdl  * by Frank van der Linden.
      9        1.9      fvdl  *
     10        1.1      fvdl  * Redistribution and use in source and binary forms, with or without
     11        1.1      fvdl  * modification, are permitted provided that the following conditions
     12        1.1      fvdl  * are met:
     13        1.1      fvdl  * 1. Redistributions of source code must retain the above copyright
     14        1.1      fvdl  *    notice, this list of conditions and the following disclaimer.
     15        1.1      fvdl  * 2. Redistributions in binary form must reproduce the above copyright
     16        1.1      fvdl  *    notice, this list of conditions and the following disclaimer in the
     17        1.1      fvdl  *    documentation and/or other materials provided with the distribution.
     18        1.1      fvdl  *
     19        1.9      fvdl  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20        1.9      fvdl  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21        1.9      fvdl  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22        1.9      fvdl  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23        1.9      fvdl  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24        1.9      fvdl  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25        1.9      fvdl  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26        1.9      fvdl  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27        1.9      fvdl  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28        1.9      fvdl  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29        1.9      fvdl  * POSSIBILITY OF SUCH DAMAGE.
     30        1.1      fvdl  */
     31        1.1      fvdl 
     32        1.8       erh #ifndef _I386_LINUX_MACHDEP_H
     33        1.8       erh #define _I386_LINUX_MACHDEP_H
     34        1.1      fvdl 
     35       1.24  christos #include <compat/linux/common/linux_types.h>
     36       1.21  christos #include <compat/linux/common/linux_signal.h>
     37       1.24  christos #include <compat/linux/common/linux_siginfo.h>
     38       1.21  christos 
     39        1.1      fvdl /*
     40        1.1      fvdl  * The Linux sigcontext, pretty much a standard 386 trapframe.
     41        1.1      fvdl  */
     42       1.25  christos struct linux_fpreg {
     43       1.25  christos 	uint16_t	mant[4];
     44       1.25  christos 	uint16_t	expo;
     45       1.25  christos };
     46       1.25  christos 
     47       1.25  christos struct linux_fpxreg {
     48       1.25  christos 	uint16_t	mant[4];
     49       1.25  christos 	uint16_t	expo;
     50       1.25  christos 	uint16_t	pad[3];
     51       1.25  christos };
     52       1.25  christos 
     53       1.25  christos struct linux_xmmreg {
     54       1.25  christos 	uint32_t	reg[4];
     55       1.25  christos };
     56       1.25  christos 
     57       1.25  christos struct linux_fpstate {
     58       1.25  christos 	uint32_t	cw;
     59       1.25  christos 	uint32_t	sw;
     60       1.25  christos 	uint32_t	tag;
     61       1.25  christos 	uint32_t	ipoff;
     62       1.25  christos 	uint32_t	cssel;
     63       1.25  christos 	uint32_t	dataoff;
     64       1.25  christos 	uint32_t	datasel;
     65       1.25  christos 	struct linux_fpreg	st[8];
     66       1.25  christos 	uint16_t	status;
     67       1.25  christos 	uint16_t	magic;
     68       1.25  christos 	uint32_t	fxsr_env[6];
     69       1.25  christos 	uint32_t	mxcsr;
     70       1.25  christos 	uint32_t	reserved;
     71       1.25  christos 	struct linux_fpxreg	fxsr_st[8];
     72       1.25  christos 	struct linux_xmmreg	xmm[8];
     73       1.25  christos 	uint32_t	padding[56];
     74       1.25  christos };
     75       1.25  christos 
     76        1.1      fvdl 
     77        1.1      fvdl struct linux_sigcontext {
     78        1.3   mycroft 	int	sc_gs;
     79        1.3   mycroft 	int	sc_fs;
     80        1.7   mycroft 	int	sc_es;
     81        1.7   mycroft 	int	sc_ds;
     82        1.7   mycroft 	int	sc_edi;
     83        1.7   mycroft 	int	sc_esi;
     84        1.7   mycroft 	int	sc_ebp;
     85        1.3   mycroft 	int	sc_esp;
     86        1.7   mycroft 	int	sc_ebx;
     87        1.7   mycroft 	int	sc_edx;
     88        1.7   mycroft 	int	sc_ecx;
     89        1.7   mycroft 	int	sc_eax;
     90        1.7   mycroft 	int	sc_trapno;
     91        1.7   mycroft 	int	sc_err;
     92        1.7   mycroft 	int	sc_eip;
     93        1.7   mycroft 	int	sc_cs;
     94        1.7   mycroft 	int	sc_eflags;
     95        1.7   mycroft 	int	sc_esp_at_signal;
     96        1.7   mycroft 	int	sc_ss;
     97       1.25  christos 	struct linux_fpstate *sc_387;
     98       1.10      fvdl 	/* XXX check this */
     99       1.10      fvdl 	linux_old_sigset_t sc_mask;
    100        1.3   mycroft 	int	sc_cr2;
    101        1.1      fvdl };
    102        1.1      fvdl 
    103       1.26  christos struct linux_libc_fpreg {
    104       1.26  christos 	unsigned short  significand[4];
    105       1.26  christos 	unsigned short  exponent;
    106       1.26  christos };
    107       1.26  christos 
    108       1.26  christos struct linux_libc_fpstate {
    109       1.26  christos 	unsigned long cw;
    110       1.26  christos 	unsigned long sw;
    111       1.26  christos 	unsigned long tag;
    112       1.26  christos 	unsigned long ipoff;
    113       1.26  christos 	unsigned long cssel;
    114       1.26  christos 	unsigned long dataoff;
    115       1.26  christos 	unsigned long datasel;
    116       1.26  christos 	struct linux_libc_fpreg _st[8];
    117       1.26  christos 	unsigned long status;
    118       1.26  christos };
    119       1.26  christos 
    120       1.26  christos struct linux_ucontext {
    121       1.26  christos 	unsigned long	uc_flags;
    122       1.26  christos 	struct ucontext	*uc_link;
    123       1.26  christos 	struct linux_sigaltstack uc_stack;
    124       1.26  christos 	struct linux_sigcontext uc_mcontext;
    125       1.26  christos 	linux_sigset_t uc_sigmask;
    126       1.26  christos 	struct linux_libc_fpstate uc_fpregs_mem;
    127       1.26  christos };
    128       1.26  christos 
    129        1.1      fvdl /*
    130        1.1      fvdl  * We make the stack look like Linux expects it when calling a signal
    131        1.1      fvdl  * handler, but use the BSD way of calling the handler and sigreturn().
    132        1.1      fvdl  * This means that we need to pass the pointer to the handler too.
    133        1.1      fvdl  * It is appended to the frame to not interfere with the rest of it.
    134        1.1      fvdl  */
    135       1.25  christos struct linux_rt_sigframe {
    136        1.3   mycroft 	int	sf_sig;
    137       1.24  christos 	struct	linux_siginfo  *sf_sip;
    138       1.26  christos 	struct	linux_ucontext *sf_ucp;
    139       1.25  christos 	struct	linux_siginfo  sf_si;
    140       1.26  christos 	struct	linux_ucontext sf_uc;
    141       1.24  christos 	sig_t	sf_handler;
    142       1.25  christos };
    143       1.25  christos 
    144       1.25  christos struct linux_sigframe {
    145       1.25  christos 	int	sf_sig;
    146        1.3   mycroft 	struct	linux_sigcontext sf_sc;
    147       1.25  christos 	sig_t	sf_handler;
    148        1.1      fvdl };
    149        1.4      fvdl 
    150        1.4      fvdl /*
    151       1.28  christos  * Used in ugly patch to fake device numbers.
    152        1.4      fvdl  */
    153       1.28  christos /* Major device numbers for new style ptys. */
    154       1.28  christos #define LINUX_PTC_MAJOR		2
    155       1.28  christos #define LINUX_PTS_MAJOR		3
    156       1.28  christos /* Major device numbers of VT device on both Linux and NetBSD. */
    157       1.28  christos #define LINUX_CONS_MAJOR   	4
    158        1.4      fvdl 
    159        1.4      fvdl /*
    160        1.4      fvdl  * Linux ioctl calls for the keyboard.
    161        1.4      fvdl  */
    162        1.4      fvdl #define LINUX_KDGKBMODE   0x4b44
    163        1.4      fvdl #define LINUX_KDSKBMODE   0x4b45
    164        1.4      fvdl #define LINUX_KDMKTONE    0x4b30
    165        1.4      fvdl #define LINUX_KDSETMODE   0x4b3a
    166       1.19      fvdl #define LINUX_KDGETMODE   0x4b3b
    167        1.4      fvdl #define LINUX_KDENABIO    0x4b36
    168        1.4      fvdl #define LINUX_KDDISABIO   0x4b37
    169        1.4      fvdl #define LINUX_KDGETLED    0x4b31
    170        1.4      fvdl #define LINUX_KDSETLED    0x4b32
    171       1.20      fvdl #define LINUX_KDGKBTYPE   0x4b33
    172       1.20      fvdl #define LINUX_KDGKBENT    0x4b46
    173       1.20      fvdl #define LINUX_KIOCSOUND   0x4b2f
    174        1.6  drochner 
    175        1.4      fvdl /*
    176        1.4      fvdl  * Mode for KDSKBMODE which we don't have (we just use plain mode for this)
    177        1.4      fvdl  */
    178        1.4      fvdl #define LINUX_K_MEDIUMRAW 2
    179        1.4      fvdl 
    180        1.4      fvdl /*
    181       1.12     veego  * VT ioctl calls in Linux (the ones that the pcvt emulation in wscons can handle)
    182        1.4      fvdl  */
    183        1.4      fvdl #define LINUX_VT_OPENQRY    0x5600
    184        1.4      fvdl #define LINUX_VT_GETMODE    0x5601
    185        1.4      fvdl #define LINUX_VT_SETMODE    0x5602
    186        1.6  drochner #define LINUX_VT_GETSTATE   0x5603
    187        1.4      fvdl #define LINUX_VT_RELDISP    0x5605
    188        1.4      fvdl #define LINUX_VT_ACTIVATE   0x5606
    189        1.4      fvdl #define LINUX_VT_WAITACTIVE 0x5607
    190       1.15      fvdl #define LINUX_VT_DISALLOCATE	0x5608
    191       1.17      fvdl 
    192       1.17      fvdl /*
    193       1.17      fvdl  * This range used by VMWare (XXX)
    194       1.17      fvdl  */
    195       1.17      fvdl #define LINUX_VMWARE_NONE 200
    196       1.17      fvdl #define LINUX_VMWARE_LAST 237
    197       1.17      fvdl 
    198       1.17      fvdl /*
    199       1.17      fvdl  * Range of ioctls to just pass on, so that LKMs (like VMWare) can
    200       1.17      fvdl  * handle them.
    201       1.17      fvdl  */
    202       1.17      fvdl #define LINUX_IOCTL_MIN_PASS	LINUX_VMWARE_NONE
    203       1.17      fvdl #define LINUX_IOCTL_MAX_PASS	(LINUX_VMWARE_LAST+8)
    204       1.13  jdolecek 
    205       1.30  christos #define LINUX_UNAME_ARCH	linux_get_uname_arch()
    206       1.32  christos #ifdef notyet
    207       1.32  christos /* We need to implement GDT based TLS first */
    208       1.31  christos #define LINUX_NPTL
    209       1.32  christos #endif
    210       1.30  christos 
    211       1.18   mycroft #ifdef _KERNEL
    212       1.18   mycroft __BEGIN_DECLS
    213       1.30  christos void linux_syscall_intern(struct proc *);
    214       1.30  christos const char *linux_get_uname_arch(void);
    215       1.18   mycroft __END_DECLS
    216       1.18   mycroft #endif /* !_KERNEL */
    217        1.1      fvdl 
    218        1.8       erh #endif /* _I386_LINUX_MACHDEP_H */
    219