reg.h revision 105733
180708Sjake/*-
284194Sjake * Copyright (c) 1990 The Regents of the University of California.
380708Sjake * All rights reserved.
480708Sjake *
584194Sjake * This code is derived from software contributed to Berkeley by
684194Sjake * William Jolitz.
784194Sjake *
880708Sjake * Redistribution and use in source and binary forms, with or without
980708Sjake * modification, are permitted provided that the following conditions
1080708Sjake * are met:
1180708Sjake * 1. Redistributions of source code must retain the above copyright
1280708Sjake *    notice, this list of conditions and the following disclaimer.
1380708Sjake * 2. Redistributions in binary form must reproduce the above copyright
1480708Sjake *    notice, this list of conditions and the following disclaimer in the
1580708Sjake *    documentation and/or other materials provided with the distribution.
1684194Sjake * 3. All advertising materials mentioning features or use of this software
1784194Sjake *    must display the following acknowledgement:
1884194Sjake *	This product includes software developed by the University of
1984194Sjake *	California, Berkeley and its contributors.
2084194Sjake * 4. Neither the name of the University nor the names of its contributors
2184194Sjake *    may be used to endorse or promote products derived from this software
2284194Sjake *    without specific prior written permission.
2380708Sjake *
2484194Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2580708Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2680708Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2784194Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2880708Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2980708Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3080708Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3180708Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3280708Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3380708Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3480708Sjake * SUCH DAMAGE.
3580708Sjake *
3684194Sjake *	from: @(#)reg.h	5.5 (Berkeley) 1/18/91
3784194Sjake *	from: FreeBSD: src/sys/i386/include/reg.h,v 1.23 2000/09/21
3880708Sjake * $FreeBSD: head/sys/sparc64/include/reg.h 105733 2002-10-22 18:03:15Z jake $
3980708Sjake */
4080708Sjake
4180708Sjake#ifndef	_MACHINE_REG_H_
4280708Sjake#define	_MACHINE_REG_H_
4380708Sjake
4484194Sjake/*
4584194Sjake * Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS.
46105733Sjake *
47105733Sjake * NOTE: DO NOT CHANGE THESE STRUCTURES.  The offsets of the fields are
48105733Sjake * hardcoded in gdb.  Changing them and recompiling doesn't help, the
49105733Sjake * constants in nm-fbsd.h must also be updated.
5084194Sjake */
51105733Sjake
52105733Sjakestruct reg32 {
53105733Sjake	uint32_t r_global[8];
54105733Sjake	uint32_t r_out[8];
55105733Sjake	uint32_t r_npc;
56105733Sjake	uint32_t r_pc;
57105733Sjake	uint32_t r_psr;
58105733Sjake	uint32_t r_wim;
59105733Sjake	uint32_t r_pad[4];
60105733Sjake};
61105733Sjake
6283053Sobrienstruct reg {
63105733Sjake	uint64_t r_global[8];
64105733Sjake	uint64_t r_out[8];
65105733Sjake	uint64_t r_fprs;
66105733Sjake	uint64_t r_fsr;
67105733Sjake	uint64_t r_gsr;
68105733Sjake	uint64_t r_level;
69105733Sjake	uint64_t r_pil;
70105733Sjake	uint64_t r_sfar;
71105733Sjake	uint64_t r_sfsr;
72105733Sjake	uint64_t r_tar;
73105733Sjake	uint64_t r_tnpc;
74105733Sjake	uint64_t r_tpc;
75105733Sjake	uint64_t r_tstate;
76105733Sjake	uint64_t r_type;
77105733Sjake	uint64_t r_y;
78105733Sjake	uint64_t r_wstate;
79105733Sjake	uint64_t r_pad[2];
8080708Sjake};
8180708Sjake
8284194Sjake/*
8384194Sjake * Register set accessible via /proc/$pid/fpregs.
8484194Sjake */
85105733Sjake
86105733Sjakestruct fpreg32 {
87105733Sjake	uint32_t fr_regs[32];
88105733Sjake	uint32_t fr_fsr;
89105733Sjake};
90105733Sjake
9183053Sobrienstruct fpreg {
92105733Sjake	uint32_t fr_regs[64];	/* our view is 64 32-bit registers */
93105733Sjake	int64_t	fr_fsr;		/* %fsr */
94105733Sjake	int32_t	fr_gsr;		/* %gsr */
95105733Sjake	int32_t fr_pad[1];
9680708Sjake};
9780708Sjake
9884194Sjake/*
9984194Sjake * Register set accessible via /proc/$pid/dbregs.
10084194Sjake */
10183053Sobrienstruct dbreg {
102105733Sjake	int dummy;
10380708Sjake};
10480708Sjake
10580708Sjake#ifdef _KERNEL
10684194Sjake/*
10784194Sjake * XXX these interfaces are MI, so they should be declared in a MI place.
10884194Sjake */
10992844Salfredint	fill_regs(struct thread *, struct reg *);
11092844Salfredint	set_regs(struct thread *, struct reg *);
11192844Salfredint	fill_fpregs(struct thread *, struct fpreg *);
11292844Salfredint	set_fpregs(struct thread *, struct fpreg *);
11392844Salfredint	fill_dbregs(struct thread *, struct dbreg *);
11492844Salfredint	set_dbregs(struct thread *, struct dbreg *);
11580708Sjake#endif
11680708Sjake
11780708Sjake#endif /* !_MACHINE_REG_H_ */
118