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 * 4. Neither the name of the University nor the names of its contributors
1784194Sjake *    may be used to endorse or promote products derived from this software
1884194Sjake *    without specific prior written permission.
1980708Sjake *
2084194Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2180708Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2280708Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2384194Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2480708Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2580708Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2680708Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2780708Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2880708Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2980708Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3080708Sjake * SUCH DAMAGE.
3180708Sjake *
3284194Sjake *	from: @(#)reg.h	5.5 (Berkeley) 1/18/91
3384194Sjake *	from: FreeBSD: src/sys/i386/include/reg.h,v 1.23 2000/09/21
3480708Sjake * $FreeBSD: releng/11.0/sys/sparc64/include/reg.h 281266 2015-04-08 16:30:45Z jhb $
3580708Sjake */
3680708Sjake
3780708Sjake#ifndef	_MACHINE_REG_H_
3880708Sjake#define	_MACHINE_REG_H_
3980708Sjake
4084194Sjake/*
4184194Sjake * Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS.
42105733Sjake *
43105733Sjake * NOTE: DO NOT CHANGE THESE STRUCTURES.  The offsets of the fields are
44105733Sjake * hardcoded in gdb.  Changing them and recompiling doesn't help, the
45105733Sjake * constants in nm-fbsd.h must also be updated.
4684194Sjake */
47105733Sjake
48105733Sjakestruct reg32 {
49105733Sjake	uint32_t r_global[8];
50105733Sjake	uint32_t r_out[8];
51105733Sjake	uint32_t r_npc;
52105733Sjake	uint32_t r_pc;
53105733Sjake	uint32_t r_psr;
54105733Sjake	uint32_t r_wim;
55105733Sjake	uint32_t r_pad[4];
56105733Sjake};
57105733Sjake
5883053Sobrienstruct reg {
59105733Sjake	uint64_t r_global[8];
60105733Sjake	uint64_t r_out[8];
61105733Sjake	uint64_t r_fprs;
62105733Sjake	uint64_t r_fsr;
63105733Sjake	uint64_t r_gsr;
64105733Sjake	uint64_t r_level;
65105733Sjake	uint64_t r_pil;
66105733Sjake	uint64_t r_sfar;
67105733Sjake	uint64_t r_sfsr;
68105733Sjake	uint64_t r_tar;
69105733Sjake	uint64_t r_tnpc;
70105733Sjake	uint64_t r_tpc;
71105733Sjake	uint64_t r_tstate;
72105733Sjake	uint64_t r_type;
73105733Sjake	uint64_t r_y;
74105733Sjake	uint64_t r_wstate;
75105733Sjake	uint64_t r_pad[2];
7680708Sjake};
7780708Sjake
7884194Sjake/*
7984194Sjake * Register set accessible via /proc/$pid/fpregs.
8084194Sjake */
81105733Sjake
82105733Sjakestruct fpreg32 {
83105733Sjake	uint32_t fr_regs[32];
84105733Sjake	uint32_t fr_fsr;
85105733Sjake};
86105733Sjake
8783053Sobrienstruct fpreg {
88105733Sjake	uint32_t fr_regs[64];	/* our view is 64 32-bit registers */
89105733Sjake	int64_t	fr_fsr;		/* %fsr */
90105733Sjake	int32_t	fr_gsr;		/* %gsr */
91105733Sjake	int32_t fr_pad[1];
9280708Sjake};
9380708Sjake
9484194Sjake/*
9584194Sjake * Register set accessible via /proc/$pid/dbregs.
9684194Sjake */
9783053Sobrienstruct dbreg {
98105733Sjake	int dummy;
9980708Sjake};
10080708Sjake
101281266Sjhb/*
102281266Sjhb * NB: sparcv8 binaries are not supported even though this header
103281266Sjhb * defines the relevant structures.
104281266Sjhb */
105281266Sjhb#define	__HAVE_REG32
106281266Sjhb
10780708Sjake#ifdef _KERNEL
10884194Sjake/*
10984194Sjake * XXX these interfaces are MI, so they should be declared in a MI place.
11084194Sjake */
11192844Salfredint	fill_regs(struct thread *, struct reg *);
11292844Salfredint	set_regs(struct thread *, struct reg *);
11392844Salfredint	fill_fpregs(struct thread *, struct fpreg *);
11492844Salfredint	set_fpregs(struct thread *, struct fpreg *);
11592844Salfredint	fill_dbregs(struct thread *, struct dbreg *);
11692844Salfredint	set_dbregs(struct thread *, struct dbreg *);
11780708Sjake#endif
11880708Sjake
11980708Sjake#endif /* !_MACHINE_REG_H_ */
120