Home | History | Annotate | Line # | Download | only in m68k
linux_machdep.h revision 1.6
      1  1.6    dsl /*	$NetBSD: linux_machdep.h,v 1.6 2007/12/04 18:40:14 dsl 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.5    chs #include <compat/linux/common/linux_types.h>
     44  1.1  itohy #include <compat/linux/common/linux_signal.h>
     45  1.5    chs #include <compat/linux/common/linux_siginfo.h>
     46  1.1  itohy 
     47  1.1  itohy /*
     48  1.1  itohy  * Signal stack definitions for old signal interface.
     49  1.1  itohy  */
     50  1.1  itohy 
     51  1.1  itohy struct linux_sigcontext {
     52  1.1  itohy 	linux_old_sigset_t	sc_mask;	/* signal mask to restore */
     53  1.1  itohy 	u_int			sc_sp;		/* usp to restore */
     54  1.1  itohy 	u_int			sc_d0;
     55  1.1  itohy 	u_int			sc_d1;
     56  1.1  itohy 	u_int			sc_a0;
     57  1.1  itohy 	u_int			sc_a1;
     58  1.1  itohy 	u_short			sc_ps;		/* processor status (sr reg) */
     59  1.1  itohy 	u_int			sc_pc;
     60  1.1  itohy 
     61  1.1  itohy 	/*
     62  1.1  itohy 	 * The Linux sigstate (state of hardware).
     63  1.1  itohy 	 */
     64  1.1  itohy 	struct linux_sigstate {
     65  1.1  itohy 		u_short		ss_format:4,	/* frame # */
     66  1.1  itohy 				ss_vector:12;	/* vector offset */
     67  1.1  itohy 		struct linux_fpframe {
     68  1.1  itohy 			u_int		fpf_regs[2][3];	/* only fp0 and fp1 */
     69  1.1  itohy 			u_int		fpf_fpcr;
     70  1.1  itohy 			u_int		fpf_fpsr;
     71  1.1  itohy 			u_int		fpf_fpiar;
     72  1.1  itohy 			union FPF_u1	FPF_u1;
     73  1.1  itohy 			union FPF_u2	FPF_u2;
     74  1.1  itohy 		} ss_fpstate;			/* 68881/68882 state info */
     75  1.1  itohy 		union F_u	ss_frame;	/* original exception frame */
     76  1.1  itohy 	} sc_ss;
     77  1.1  itohy };
     78  1.1  itohy 
     79  1.1  itohy /*
     80  1.1  itohy  * The Linux compatible signal frame
     81  1.1  itohy  * On Linux, the sigtramp code is on the frame structure.
     82  1.1  itohy  */
     83  1.1  itohy struct linux_sigframe {
     84  1.1  itohy 	void		*sf_psigtramp;
     85  1.1  itohy 	int		sf_signum;	/* signo for handler */
     86  1.1  itohy 	int		sf_code;	/* Linux stores vector offset here */
     87  1.1  itohy 	struct linux_sigcontext	*sf_scp; /* context ptr for handler */
     88  1.1  itohy 	int		sf_sigtramp[2];
     89  1.1  itohy 	struct linux_sigc2 {
     90  1.1  itohy #if LINUX__NSIG_WORDS > 1
     91  1.1  itohy 		/* This breaks backward compatibility, but Linux 2.1 has.... */
     92  1.1  itohy 		u_long	c_extrasigmask[LINUX__NSIG_WORDS - 1];
     93  1.1  itohy #endif
     94  1.1  itohy 		struct	linux_sigcontext c_sc;	/* actual context */
     95  1.1  itohy 	} sf_c;
     96  1.1  itohy };
     97  1.1  itohy 
     98  1.1  itohy #define LINUX_SF_SIGTRAMP0 0xDEFC0014	/* addaw #20,sp */
     99  1.1  itohy #define LINUX_SF_SIGTRAMP1 (0x70004E40 | (LINUX_SYS_sigreturn << 16))
    100  1.1  itohy 				/* moveq #LINUX_SYS_sigreturn,d0; trap #0 */
    101  1.1  itohy 
    102  1.1  itohy /*
    103  1.1  itohy  * Signal stack definitions for new RT signal interface.
    104  1.1  itohy  */
    105  1.1  itohy 
    106  1.1  itohy typedef struct linux_gregset {
    107  1.1  itohy 	u_int	gr_regs[16];		/* d0-d7/a0-a6/usp */
    108  1.1  itohy 	u_int	gr_pc;
    109  1.1  itohy 	u_int	gr_sr;
    110  1.1  itohy } linux_gregset_t;
    111  1.1  itohy 
    112  1.1  itohy typedef struct linux_fpregset {
    113  1.1  itohy 	u_int	fpr_fpcr;
    114  1.1  itohy 	u_int	fpr_fpsr;
    115  1.1  itohy 	u_int	fpr_fpiar;
    116  1.1  itohy 	u_int	fpr_regs[8][3];		/* fp0-fp7 */
    117  1.1  itohy } linux_fpregset_t;
    118  1.1  itohy 
    119  1.1  itohy struct linux_mcontext {
    120  1.1  itohy 	int			mc_version;
    121  1.1  itohy 	linux_gregset_t		mc_gregs;
    122  1.1  itohy 	linux_fpregset_t	mc_fpregs;
    123  1.1  itohy };
    124  1.1  itohy 
    125  1.1  itohy #define LINUX_MCONTEXT_VERSION	2
    126  1.1  itohy 
    127  1.1  itohy struct linux_ucontext {
    128  1.1  itohy 	u_long			uc_flags;	/* 0 */
    129  1.1  itohy 	struct linux_ucontext	*uc_link;	/* 0 */
    130  1.1  itohy 	linux_stack_t		uc_stack;
    131  1.1  itohy 	struct linux_mcontext	uc_mc;
    132  1.1  itohy 	struct linux_rt_sigstate {
    133  1.1  itohy 		struct linux_rt_fpframe {
    134  1.1  itohy 			union FPF_u1	FPF_u1;
    135  1.1  itohy 			union FPF_u2	FPF_u2;
    136  1.1  itohy 		} ss_fpstate;
    137  1.1  itohy 		unsigned int	ss_unused1:16,
    138  1.1  itohy 				ss_format:4,
    139  1.1  itohy 				ss_vector:12;
    140  1.1  itohy 		union F_u	ss_frame;	/* original exception frame */
    141  1.1  itohy 		int		ss_unused2[4];
    142  1.1  itohy 	} uc_ss;
    143  1.1  itohy 	linux_sigset_t		uc_sigmask;
    144  1.1  itohy };
    145  1.1  itohy 
    146  1.1  itohy /*
    147  1.1  itohy  * The Linux compatible RT signal frame
    148  1.1  itohy  * On Linux, the sigtramp code is on the frame structure.
    149  1.1  itohy  */
    150  1.1  itohy struct linux_rt_sigframe {
    151  1.1  itohy 	void			*sf_psigtramp;
    152  1.1  itohy 	int			sf_signum;
    153  1.1  itohy 	struct linux_siginfo	*sf_pinfo;
    154  1.1  itohy 	void			*sf_puc;
    155  1.1  itohy 	struct linux_siginfo	sf_info;
    156  1.1  itohy 	struct linux_ucontext	sf_uc;
    157  1.1  itohy 	int			sf_sigtramp[2];
    158  1.1  itohy };
    159  1.1  itohy 
    160  1.1  itohy #define LINUX_RT_SF_SIGTRAMP0 (0x203C0000 | (LINUX_SYS_rt_sigreturn >> 16))
    161  1.1  itohy #define LINUX_RT_SF_SIGTRAMP1 (0x00004E40 | (LINUX_SYS_rt_sigreturn << 16))
    162  1.1  itohy 			/* movel #LINUX_SYS_rt_sigreturn,#d0; trap #0 */
    163  1.4    scw 
    164  1.4    scw #ifdef _KERNEL
    165  1.4    scw __BEGIN_DECLS
    166  1.6    dsl void linux_syscall_intern(struct proc *);
    167  1.4    scw __END_DECLS
    168  1.4    scw #endif /* !_KERNEL */
    169  1.1  itohy 
    170  1.1  itohy #endif /* _M68K_LINUX_MACHDEP_H */
    171