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