xref: /netbsd-src/sys/arch/sparc/include/reg.h (revision 1ea7c0386922613b140572fe180d78669b999708)
1*1ea7c038Smartin /*	$NetBSD: reg.h,v 1.11 2018/01/15 10:06:49 martin Exp $ */
2274a9076Sderaadt 
34588caefSderaadt /*
44588caefSderaadt  * Copyright (c) 1992, 1993
54588caefSderaadt  *	The Regents of the University of California.  All rights reserved.
64588caefSderaadt  *
74588caefSderaadt  * This software was developed by the Computer Systems Engineering group
84588caefSderaadt  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
94588caefSderaadt  * contributed to Berkeley.
104588caefSderaadt  *
114588caefSderaadt  * All advertising materials mentioning features or use of this software
124588caefSderaadt  * must display the following acknowledgement:
134588caefSderaadt  *	This product includes software developed by the University of
144588caefSderaadt  *	California, Lawrence Berkeley Laboratory.
154588caefSderaadt  *
164588caefSderaadt  * Redistribution and use in source and binary forms, with or without
174588caefSderaadt  * modification, are permitted provided that the following conditions
184588caefSderaadt  * are met:
194588caefSderaadt  * 1. Redistributions of source code must retain the above copyright
204588caefSderaadt  *    notice, this list of conditions and the following disclaimer.
214588caefSderaadt  * 2. Redistributions in binary form must reproduce the above copyright
224588caefSderaadt  *    notice, this list of conditions and the following disclaimer in the
234588caefSderaadt  *    documentation and/or other materials provided with the distribution.
24aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
254588caefSderaadt  *    may be used to endorse or promote products derived from this software
264588caefSderaadt  *    without specific prior written permission.
274588caefSderaadt  *
284588caefSderaadt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
294588caefSderaadt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
304588caefSderaadt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
314588caefSderaadt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
324588caefSderaadt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
334588caefSderaadt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
344588caefSderaadt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
354588caefSderaadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
364588caefSderaadt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
374588caefSderaadt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
384588caefSderaadt  * SUCH DAMAGE.
394588caefSderaadt  *
404588caefSderaadt  *	@(#)reg.h	8.1 (Berkeley) 6/11/93
414588caefSderaadt  */
424588caefSderaadt 
434588caefSderaadt #ifndef _MACHINE_REG_H_
444588caefSderaadt #define	_MACHINE_REG_H_
454588caefSderaadt 
464588caefSderaadt /*
474588caefSderaadt  * Registers passed to trap/syscall/etc.
484588caefSderaadt  * This structure is known to occupy exactly 80 bytes (see locore.s).
494588caefSderaadt  * Note, tf_global[0] is not actually written (since g0 is always 0).
504588caefSderaadt  * (The slot tf_global[0] is used to send a copy of %wim to kernel gdb.
514588caefSderaadt  * This is known as `cheating'.)
524588caefSderaadt  */
534588caefSderaadt struct trapframe {
544588caefSderaadt 	int	tf_psr;		/* psr */
554588caefSderaadt 	int	tf_pc;		/* return pc */
564588caefSderaadt 	int	tf_npc;		/* return npc */
574588caefSderaadt 	int	tf_y;		/* %y register */
584588caefSderaadt 	int	tf_global[8];	/* global registers in trap's caller */
594588caefSderaadt 	int	tf_out[8];	/* output registers in trap's caller */
604588caefSderaadt };
614588caefSderaadt 
624588caefSderaadt /*
634588caefSderaadt  * Register windows.  Each stack pointer (%o6 aka %sp) in each window
644588caefSderaadt  * must ALWAYS point to some place at which it is safe to scribble on
654588caefSderaadt  * 64 bytes.  (If not, your process gets mangled.)  Furthermore, each
664588caefSderaadt  * stack pointer should be aligned on an 8-byte boundary (the kernel
674588caefSderaadt  * as currently coded allows arbitrary alignment, but with a hefty
684588caefSderaadt  * performance penalty).
694588caefSderaadt  */
704588caefSderaadt struct rwindow {
714588caefSderaadt 	int	rw_local[8];		/* %l0..%l7 */
724588caefSderaadt 	int	rw_in[8];		/* %i0..%i7 */
734588caefSderaadt };
744588caefSderaadt 
7568f0489fSpk /*
7668f0489fSpk  * Clone trapframe for now; this seems to be the more useful
7768f0489fSpk  * than the old struct reg above.
7868f0489fSpk  */
79e9fee9d6Sderaadt struct reg {
8068f0489fSpk 	int	r_psr;		/* psr */
8168f0489fSpk 	int	r_pc;		/* return pc */
8268f0489fSpk 	int	r_npc;		/* return npc */
8368f0489fSpk 	int	r_y;		/* %y register */
8468f0489fSpk 	int	r_global[8];	/* global registers in trap's caller */
8568f0489fSpk 	int	r_out[8];	/* output registers in trap's caller */
86e9fee9d6Sderaadt };
87e9fee9d6Sderaadt 
884588caefSderaadt #include <machine/fsr.h>
894588caefSderaadt 
904588caefSderaadt /*
914588caefSderaadt  * FP coprocessor registers.
924588caefSderaadt  *
934588caefSderaadt  * FP_QSIZE is the maximum coprocessor instruction queue depth
944588caefSderaadt  * of any implementation on which the kernel will run.  David Hough:
954588caefSderaadt  * ``I'd suggest allowing 16 ... allowing an indeterminate variable
964588caefSderaadt  * size would be even better''.  Of course, we cannot do that; we
974588caefSderaadt  * need to malloc these.
984588caefSderaadt  */
994588caefSderaadt #define	FP_QSIZE	16
1004588caefSderaadt 
1014588caefSderaadt struct fp_qentry {
1024588caefSderaadt 	int	*fq_addr;		/* the instruction's address */
1034588caefSderaadt 	int	fq_instr;		/* the instruction itself */
1044588caefSderaadt };
10581784756Schristos 
10681784756Schristos struct fpreg {
10781784756Schristos 	u_int	fr_regs[32];		/* our view is 32 32-bit registers */
10881784756Schristos 	int	fr_fsr;			/* %fsr */
109*1ea7c038Smartin };
110*1ea7c038Smartin 
1114588caefSderaadt struct fpstate {
11281784756Schristos 	struct fpreg fs_reg;
11381784756Schristos #define fs_regs fs_reg.fr_regs
11481784756Schristos #define fs_fsr	fs_reg.fr_fsr
1154588caefSderaadt 	int	fs_qsize;		/* actual queue depth */
1164588caefSderaadt 	struct	fp_qentry fs_queue[FP_QSIZE];	/* queue contents */
117*1ea7c038Smartin }
118*1ea7c038Smartin #ifdef _KERNEL
119*1ea7c038Smartin  __aligned(8)				/* asm code uses std instructions */
120*1ea7c038Smartin #endif
121*1ea7c038Smartin ;
1224588caefSderaadt 
12368f0489fSpk /*
124f3f6c5b6Swiz  * The actual FP registers are made accessible (c.f. ptrace(2)) through
1254681e482Spk  * a `struct fpreg'; <arch/sparc/sparc/process_machdep.c> relies on the
1264681e482Spk  * fact that `fpreg' is a prefix of `fpstate'.
12768f0489fSpk  */
12868f0489fSpk 
1294588caefSderaadt #endif /* _MACHINE_REG_H_ */
130