1/*	$OpenBSD: reg.h,v 1.7 2014/09/08 01:47:05 guenther Exp $	*/
2/*	$NetBSD: reg.h,v 1.2 1995/03/28 18:14:07 jtc Exp $	*/
3
4/*
5 * Copyright (c) 1994, 1995 Carnegie-Mellon University.
6 * All rights reserved.
7 *
8 * Author: Chris G. Demetriou
9 *
10 * Permission to use, copy, modify and distribute this software and
11 * its documentation is hereby granted, provided that both the copyright
12 * notice and this permission notice appear in all copies of the
13 * software, derivative works or modified versions, and any portions
14 * thereof, and that both notices appear in supporting documentation.
15 *
16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 *
20 * Carnegie Mellon requests users of this software to return to
21 *
22 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23 *  School of Computer Science
24 *  Carnegie Mellon University
25 *  Pittsburgh PA 15213-3890
26 *
27 * any improvements or extensions that they make and grant Carnegie the
28 * rights to redistribute these changes.
29 */
30
31#ifndef _MACHINE_REG_H_
32#define	_MACHINE_REG_H_
33
34/*
35 * XXX where did this info come from?
36 */
37
38/*
39 * Struct reg, used for ptrace and in signal contexts
40 * Note that in signal contexts, it's represented as an array.
41 * That array has to look exactly like 'struct reg' though.
42 */
43#define	R_V0	0
44#define	R_T0	1
45#define	R_T1	2
46#define	R_T2	3
47#define	R_T3	4
48#define	R_T4	5
49#define	R_T5	6
50#define	R_T6	7
51#define	R_T7	8
52#define	R_S0	9
53#define	R_S1	10
54#define	R_S2	11
55#define	R_S3	12
56#define	R_S4	13
57#define	R_S5	14
58#define	R_S6	15
59#define	R_A0	16
60#define	R_A1	17
61#define	R_A2	18
62#define	R_A3	19
63#define	R_A4	20
64#define	R_A5	21
65#define	R_T8	22
66#define	R_T9	23
67#define	R_T10	24
68#define	R_T11	25
69#define	R_RA	26
70#define	R_T12	27
71#define	R_AT	28
72#define	R_GP	29
73#define	R_SP	30
74#define	R_ZERO	31
75
76struct reg {
77	u_long	r_regs[32];
78};
79
80/*
81 * Floating point unit state. (also, register set used for ptrace.)
82 *
83 * The floating point registers for a process, saved only when
84 * necessary.
85 *
86 * Note that in signal contexts, it's represented as an array.
87 * That array has to look exactly like 'struct reg' though.
88 */
89struct fpreg {
90	u_long	fpr_regs[32];
91	u_long	fpr_cr;
92};
93
94#ifdef _KERNEL
95void	restorefpstate(struct fpreg *);
96void	savefpstate(struct fpreg *);
97void	frametoreg(struct trapframe *, struct reg *);
98void	regtoframe(struct reg *, struct trapframe *);
99#endif
100
101#endif /* _MACHINE_REG_H_ */
102