netbsd32_machdep.h revision 1.22
11.22Sdsl/*	$NetBSD: netbsd32_machdep.h,v 1.22 2007/03/16 22:24:49 dsl Exp $	*/
21.1Smrg
31.1Smrg/*
41.7Smrg * Copyright (c) 1998, 2001 Matthew R. Green
51.1Smrg * All rights reserved.
61.1Smrg *
71.1Smrg * Redistribution and use in source and binary forms, with or without
81.1Smrg * modification, are permitted provided that the following conditions
91.1Smrg * are met:
101.1Smrg * 1. Redistributions of source code must retain the above copyright
111.1Smrg *    notice, this list of conditions and the following disclaimer.
121.1Smrg * 2. Redistributions in binary form must reproduce the above copyright
131.1Smrg *    notice, this list of conditions and the following disclaimer in the
141.1Smrg *    documentation and/or other materials provided with the distribution.
151.1Smrg * 3. The name of the author may not be used to endorse or promote products
161.1Smrg *    derived from this software without specific prior written permission.
171.1Smrg *
181.1Smrg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
191.1Smrg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
201.1Smrg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
211.1Smrg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
221.1Smrg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
231.1Smrg * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
241.1Smrg * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
251.1Smrg * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
261.1Smrg * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
271.1Smrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
281.1Smrg * SUCH DAMAGE.
291.1Smrg */
301.1Smrg
311.1Smrg#ifndef _MACHINE_NETBSD32_H_
321.1Smrg#define _MACHINE_NETBSD32_H_
331.8Smrg
341.8Smrg#include <sys/types.h>
351.18Schs
361.18Schsstruct proc;
371.10Sscw
381.22Sdsl/* sparc64 uses an unsigned 32bit integer for 32bit pointers */
391.22Sdsl#define NETBSD32_POINTER_TYPE uint32_t
401.22Sdsltypedef struct { NETBSD32_POINTER_TYPE i32; } netbsd32_pointer_t;
411.10Sscw
421.1Smrg/* from <arch/sparc/include/signal.h> */
431.20Scditypedef uint32_t netbsd32_sigcontextp_t;
441.1Smrg
451.2Smrgstruct netbsd32_sigcontext {
461.5Seeh	int		sc_onstack;	/* sigstack state to restore */
471.5Seeh	int		__sc_mask13;	/* signal mask to restore (old style) */
481.5Seeh	/* begin machine dependent portion */
491.5Seeh	int		sc_sp;		/* %sp to restore */
501.5Seeh	int		sc_pc;		/* pc to restore */
511.5Seeh	int		sc_npc;		/* npc to restore */
521.6Skleink	int		sc_psr;		/* pstate to restore */
531.5Seeh	int		sc_g1;		/* %g1 to restore */
541.5Seeh	int		sc_o0;		/* %o0 to restore */
551.5Seeh	sigset_t	sc_mask;	/* signal mask to restore (new style) */
561.5Seeh};
571.5Seeh
581.5Seehstruct netbsd32_sigcontext13 {
591.1Smrg	int	sc_onstack;		/* sigstack state to restore */
601.5Seeh	int	sc_mask;		/* signal mask to restore (old style) */
611.1Smrg	/* begin machine dependent portion */
621.1Smrg	int	sc_sp;			/* %sp to restore */
631.1Smrg	int	sc_pc;			/* pc to restore */
641.1Smrg	int	sc_npc;			/* npc to restore */
651.5Seeh	int	sc_psr;			/* pstate to restore */
661.1Smrg	int	sc_g1;			/* %g1 to restore */
671.1Smrg	int	sc_o0;			/* %o0 to restore */
681.1Smrg};
691.3Seeh
701.7Smrg/*
711.7Smrg * Need to plug into get sparc specific ioctl's.
721.7Smrg */
731.7Smrg#define	NETBSD32_MD_IOCTL	/* enable netbsd32_md_ioctl() */
741.19Schristosint netbsd32_md_ioctl(struct file *, netbsd32_u_long, void *, struct lwp *);
751.1Smrg
761.16Sdrochner#define NETBSD32_MID_MACHINE MID_SPARC
771.16Sdrochner
781.17Smartin/*
791.17Smartin * When returning an off_t to userland, we need to modify the syscall
801.17Smartin * retval array. We return a 64 bit value in %o0 (high) and %o1 (low)
811.17Smartin * for 32bit userland.
821.17Smartin */
831.17Smartin#define NETBSD32_OFF_T_RETURN(RV)	\
841.17Smartin	do {				\
851.17Smartin		(RV)[1] = (RV)[0];	\
861.17Smartin		(RV)[0] >>= 32;		\
871.17Smartin	} while (0)
881.17Smartin
891.21Scubeint netbsd32_process_read_regs(struct lwp *, struct reg32 *);
901.21Scubeint netbsd32_process_read_fpregs(struct lwp *, struct fpreg32 *);
911.21Scube
921.1Smrg#endif /* _MACHINE_NETBSD32_H_ */
93