Home | History | Annotate | Line # | Download | only in m68k
linux_machdep.h revision 1.1.4.1
      1  1.1.4.1  thorpej /*	$NetBSD: linux_machdep.h,v 1.1.4.1 1999/06/21 01:07:36 thorpej Exp $	*/
      2      1.1    itohy 
      3      1.1    itohy /*-
      4      1.1    itohy  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5      1.1    itohy  * All rights reserved.
      6      1.1    itohy  *
      7      1.1    itohy  * This code is derived from software contributed to The NetBSD Foundation
      8      1.1    itohy  * by ITOH Yasufumi.
      9      1.1    itohy  *
     10      1.1    itohy  * Redistribution and use in source and binary forms, with or without
     11      1.1    itohy  * modification, are permitted provided that the following conditions
     12      1.1    itohy  * are met:
     13      1.1    itohy  * 1. Redistributions of source code must retain the above copyright
     14      1.1    itohy  *    notice, this list of conditions and the following disclaimer.
     15      1.1    itohy  * 2. Redistributions in binary form must reproduce the above copyright
     16      1.1    itohy  *    notice, this list of conditions and the following disclaimer in the
     17      1.1    itohy  *    documentation and/or other materials provided with the distribution.
     18      1.1    itohy  * 3. All advertising materials mentioning features or use of this software
     19      1.1    itohy  *    must display the following acknowledgement:
     20      1.1    itohy  *	This product includes software developed by the NetBSD
     21      1.1    itohy  *	Foundation, Inc. and its contributors.
     22      1.1    itohy  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23      1.1    itohy  *    contributors may be used to endorse or promote products derived
     24      1.1    itohy  *    from this software without specific prior written permission.
     25      1.1    itohy  *
     26      1.1    itohy  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27      1.1    itohy  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28      1.1    itohy  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29      1.1    itohy  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30      1.1    itohy  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31      1.1    itohy  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32      1.1    itohy  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33      1.1    itohy  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34      1.1    itohy  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35      1.1    itohy  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36      1.1    itohy  * POSSIBILITY OF SUCH DAMAGE.
     37      1.1    itohy  */
     38      1.1    itohy 
     39      1.1    itohy #ifndef _M68K_LINUX_MACHDEP_H
     40      1.1    itohy #define _M68K_LINUX_MACHDEP_H
     41      1.1    itohy 
     42      1.1    itohy #include <m68k/frame.h>
     43      1.1    itohy #include <compat/linux/common/linux_signal.h>
     44      1.1    itohy 
     45      1.1    itohy /*
     46      1.1    itohy  * Signal stack definitions for old signal interface.
     47      1.1    itohy  */
     48      1.1    itohy 
     49      1.1    itohy struct linux_sigcontext {
     50      1.1    itohy 	linux_old_sigset_t	sc_mask;	/* signal mask to restore */
     51      1.1    itohy 	u_int			sc_sp;		/* usp to restore */
     52      1.1    itohy 	u_int			sc_d0;
     53      1.1    itohy 	u_int			sc_d1;
     54      1.1    itohy 	u_int			sc_a0;
     55      1.1    itohy 	u_int			sc_a1;
     56      1.1    itohy 	u_short			sc_ps;		/* processor status (sr reg) */
     57      1.1    itohy 	u_int			sc_pc;
     58      1.1    itohy 
     59      1.1    itohy 	/*
     60      1.1    itohy 	 * The Linux sigstate (state of hardware).
     61      1.1    itohy 	 */
     62      1.1    itohy 	struct linux_sigstate {
     63      1.1    itohy 		u_short		ss_format:4,	/* frame # */
     64      1.1    itohy 				ss_vector:12;	/* vector offset */
     65      1.1    itohy 		struct linux_fpframe {
     66      1.1    itohy 			u_int		fpf_regs[2][3];	/* only fp0 and fp1 */
     67      1.1    itohy 			u_int		fpf_fpcr;
     68      1.1    itohy 			u_int		fpf_fpsr;
     69      1.1    itohy 			u_int		fpf_fpiar;
     70      1.1    itohy 			union FPF_u1	FPF_u1;
     71      1.1    itohy 			union FPF_u2	FPF_u2;
     72      1.1    itohy 		} ss_fpstate;			/* 68881/68882 state info */
     73      1.1    itohy 		union F_u	ss_frame;	/* original exception frame */
     74      1.1    itohy 	} sc_ss;
     75      1.1    itohy };
     76      1.1    itohy 
     77      1.1    itohy /*
     78      1.1    itohy  * The Linux compatible signal frame
     79      1.1    itohy  * On Linux, the sigtramp code is on the frame structure.
     80      1.1    itohy  */
     81      1.1    itohy struct linux_sigframe {
     82      1.1    itohy 	void		*sf_psigtramp;
     83      1.1    itohy 	int		sf_signum;	/* signo for handler */
     84      1.1    itohy 	int		sf_code;	/* Linux stores vector offset here */
     85      1.1    itohy 	struct linux_sigcontext	*sf_scp; /* context ptr for handler */
     86      1.1    itohy 	int		sf_sigtramp[2];
     87      1.1    itohy 	struct linux_sigc2 {
     88      1.1    itohy #if LINUX__NSIG_WORDS > 1
     89      1.1    itohy 		/* This breaks backward compatibility, but Linux 2.1 has.... */
     90      1.1    itohy 		u_long	c_extrasigmask[LINUX__NSIG_WORDS - 1];
     91      1.1    itohy #endif
     92      1.1    itohy 		struct	linux_sigcontext c_sc;	/* actual context */
     93      1.1    itohy 	} sf_c;
     94      1.1    itohy };
     95      1.1    itohy 
     96      1.1    itohy #define LINUX_SF_SIGTRAMP0 0xDEFC0014	/* addaw #20,sp */
     97      1.1    itohy #define LINUX_SF_SIGTRAMP1 (0x70004E40 | (LINUX_SYS_sigreturn << 16))
     98      1.1    itohy 				/* moveq #LINUX_SYS_sigreturn,d0; trap #0 */
     99      1.1    itohy 
    100      1.1    itohy /*
    101      1.1    itohy  * Signal stack definitions for new RT signal interface.
    102      1.1    itohy  */
    103      1.1    itohy 
    104      1.1    itohy typedef struct linux_gregset {
    105      1.1    itohy 	u_int	gr_regs[16];		/* d0-d7/a0-a6/usp */
    106      1.1    itohy 	u_int	gr_pc;
    107      1.1    itohy 	u_int	gr_sr;
    108      1.1    itohy } linux_gregset_t;
    109      1.1    itohy 
    110      1.1    itohy typedef struct linux_fpregset {
    111      1.1    itohy 	u_int	fpr_fpcr;
    112      1.1    itohy 	u_int	fpr_fpsr;
    113      1.1    itohy 	u_int	fpr_fpiar;
    114      1.1    itohy 	u_int	fpr_regs[8][3];		/* fp0-fp7 */
    115      1.1    itohy } linux_fpregset_t;
    116      1.1    itohy 
    117      1.1    itohy struct linux_mcontext {
    118      1.1    itohy 	int			mc_version;
    119      1.1    itohy 	linux_gregset_t		mc_gregs;
    120      1.1    itohy 	linux_fpregset_t	mc_fpregs;
    121      1.1    itohy };
    122      1.1    itohy 
    123      1.1    itohy #define LINUX_MCONTEXT_VERSION	2
    124      1.1    itohy 
    125      1.1    itohy struct linux_ucontext {
    126      1.1    itohy 	u_long			uc_flags;	/* 0 */
    127      1.1    itohy 	struct linux_ucontext	*uc_link;	/* 0 */
    128      1.1    itohy 	linux_stack_t		uc_stack;
    129      1.1    itohy 	struct linux_mcontext	uc_mc;
    130      1.1    itohy 	struct linux_rt_sigstate {
    131      1.1    itohy 		struct linux_rt_fpframe {
    132      1.1    itohy 			union FPF_u1	FPF_u1;
    133      1.1    itohy 			union FPF_u2	FPF_u2;
    134      1.1    itohy 		} ss_fpstate;
    135      1.1    itohy 		unsigned int	ss_unused1:16,
    136      1.1    itohy 				ss_format:4,
    137      1.1    itohy 				ss_vector:12;
    138      1.1    itohy 		union F_u	ss_frame;	/* original exception frame */
    139      1.1    itohy 		int		ss_unused2[4];
    140      1.1    itohy 	} uc_ss;
    141      1.1    itohy 	linux_sigset_t		uc_sigmask;
    142      1.1    itohy };
    143      1.1    itohy 
    144      1.1    itohy /*
    145      1.1    itohy  * The Linux compatible RT signal frame
    146      1.1    itohy  * On Linux, the sigtramp code is on the frame structure.
    147      1.1    itohy  */
    148      1.1    itohy struct linux_rt_sigframe {
    149      1.1    itohy 	void			*sf_psigtramp;
    150      1.1    itohy 	int			sf_signum;
    151      1.1    itohy 	struct linux_siginfo	*sf_pinfo;
    152      1.1    itohy 	void			*sf_puc;
    153      1.1    itohy 	struct linux_siginfo	sf_info;
    154      1.1    itohy 	struct linux_ucontext	sf_uc;
    155      1.1    itohy 	int			sf_sigtramp[2];
    156      1.1    itohy };
    157      1.1    itohy 
    158      1.1    itohy #define LINUX_RT_SF_SIGTRAMP0 (0x203C0000 | (LINUX_SYS_rt_sigreturn >> 16))
    159      1.1    itohy #define LINUX_RT_SF_SIGTRAMP1 (0x00004E40 | (LINUX_SYS_rt_sigreturn << 16))
    160      1.1    itohy 			/* movel #LINUX_SYS_rt_sigreturn,#d0; trap #0 */
    161      1.1    itohy 
    162      1.1    itohy #ifdef _KERNEL
    163      1.1    itohy 
    164      1.1    itohy /* linux_machdep.c */
    165      1.1    itohy void linux_sendsig __P((sig_t, int, sigset_t *, u_long));
    166      1.1    itohy dev_t linux_fakedev __P((dev_t));
    167      1.1    itohy 
    168      1.1    itohy #endif /* _KERNEL */
    169      1.1    itohy 
    170      1.1    itohy #endif /* _M68K_LINUX_MACHDEP_H */
    171