1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1990 The Regents of the University of California.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * William Jolitz.
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. Neither the name of the University nor the names of its contributors
19 *    may be used to endorse or promote products derived from this software
20 *    without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 *	from: @(#)reg.h	5.5 (Berkeley) 1/18/91
35 *	from: FreeBSD: src/sys/i386/include/reg.h,v 1.23 2000/09/21
36 * $FreeBSD$
37 */
38
39#ifndef	_MACHINE_REG_H_
40#define	_MACHINE_REG_H_
41
42/*
43 * Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS.
44 *
45 * NOTE: DO NOT CHANGE THESE STRUCTURES.  The offsets of the fields are
46 * hardcoded in gdb.  Changing them and recompiling doesn't help, the
47 * constants in nm-fbsd.h must also be updated.
48 */
49
50struct reg32 {
51	uint32_t r_global[8];
52	uint32_t r_out[8];
53	uint32_t r_npc;
54	uint32_t r_pc;
55	uint32_t r_psr;
56	uint32_t r_wim;
57	uint32_t r_pad[4];
58};
59
60struct reg {
61	uint64_t r_global[8];
62	uint64_t r_out[8];
63	uint64_t r_fprs;
64	uint64_t r_fsr;
65	uint64_t r_gsr;
66	uint64_t r_level;
67	uint64_t r_pil;
68	uint64_t r_sfar;
69	uint64_t r_sfsr;
70	uint64_t r_tar;
71	uint64_t r_tnpc;
72	uint64_t r_tpc;
73	uint64_t r_tstate;
74	uint64_t r_type;
75	uint64_t r_y;
76	uint64_t r_wstate;
77	uint64_t r_pad[2];
78};
79
80/*
81 * Register set accessible via /proc/$pid/fpregs.
82 */
83
84struct fpreg32 {
85	uint32_t fr_regs[32];
86	uint32_t fr_fsr;
87};
88
89struct fpreg {
90	uint32_t fr_regs[64];	/* our view is 64 32-bit registers */
91	int64_t	fr_fsr;		/* %fsr */
92	int32_t	fr_gsr;		/* %gsr */
93	int32_t fr_pad[1];
94};
95
96/*
97 * Register set accessible via /proc/$pid/dbregs.
98 */
99struct dbreg {
100	int dummy;
101};
102
103/*
104 * NB: sparcv8 binaries are not supported even though this header
105 * defines the relevant structures.
106 */
107#define	__HAVE_REG32
108
109#ifdef _KERNEL
110/*
111 * XXX these interfaces are MI, so they should be declared in a MI place.
112 */
113int	fill_regs(struct thread *, struct reg *);
114int	set_regs(struct thread *, struct reg *);
115int	fill_fpregs(struct thread *, struct fpreg *);
116int	set_fpregs(struct thread *, struct fpreg *);
117int	fill_dbregs(struct thread *, struct dbreg *);
118int	set_dbregs(struct thread *, struct dbreg *);
119#endif
120
121#endif /* !_MACHINE_REG_H_ */
122