xref: /freebsd/sys/amd64/include/reg.h (revision 7660b554bc59a07be0431c17e0e33815818baa69)
1 /*-
2  * Copyright (c) 1990 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * William Jolitz.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *	This product includes software developed by the University of
19  *	California, Berkeley and its contributors.
20  * 4. Neither the name of the University nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  *	from: @(#)reg.h	5.5 (Berkeley) 1/18/91
37  * $FreeBSD$
38  */
39 
40 #ifndef _MACHINE_REG_H_
41 #define	_MACHINE_REG_H_
42 
43 /*
44  * Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS.
45  */
46 struct reg {
47 	register_t	r_r15;
48 	register_t	r_r14;
49 	register_t	r_r13;
50 	register_t	r_r12;
51 	register_t	r_r11;
52 	register_t	r_r10;
53 	register_t	r_r9;
54 	register_t	r_r8;
55 	register_t	r_rdi;
56 	register_t	r_rsi;
57 	register_t	r_rbp;
58 	register_t	r_rbx;
59 	register_t	r_rdx;
60 	register_t	r_rcx;
61 	register_t	r_rax;
62 	register_t	r_trapno;
63 	register_t	r_err;
64 	register_t	r_rip;
65 	register_t	r_cs;
66 	register_t	r_rflags;
67 	register_t	r_rsp;
68 	register_t	r_ss;
69 };
70 
71 /*
72  * Register set accessible via /proc/$pid/fpregs.
73  */
74 struct fpreg {
75 	/*
76 	 * XXX should get struct from npx.h.  Here we give a slightly
77 	 * simplified struct.  This may be too much detail.  Perhaps
78 	 * an array of unsigned longs is best.
79 	 */
80 	unsigned long	fpr_env[4];
81 	unsigned char	fpr_acc[8][16];
82 	unsigned char	fpr_xacc[16][16];
83 	unsigned long	fpr_spare[12];
84 };
85 
86 struct dbreg {
87 	unsigned long grrr;
88 };
89 
90 #ifdef _KERNEL
91 /*
92  * XXX these interfaces are MI, so they should be declared in a MI place.
93  */
94 int	fill_regs(struct thread *, struct reg *);
95 int	set_regs(struct thread *, struct reg *);
96 int	fill_fpregs(struct thread *, struct fpreg *);
97 int	set_fpregs(struct thread *, struct fpreg *);
98 int	fill_dbregs(struct thread *, struct dbreg *);
99 int	set_dbregs(struct thread *, struct dbreg *);
100 #endif
101 
102 #endif /* !_MACHINE_REG_H_ */
103