xref: /freebsd/sys/amd64/include/frame.h (revision 77b7cdf1999ee965ad494fddd184b18f532ac91a)
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: @(#)frame.h	5.2 (Berkeley) 1/18/91
37  * $FreeBSD$
38  */
39 
40 #ifndef _MACHINE_FRAME_H_
41 #define _MACHINE_FRAME_H_ 1
42 
43 /*
44  * System stack frames.
45  */
46 
47 /*
48  * Exception/Trap Stack Frame
49  *
50  * The ordering of this is specifically so that we can take first 6
51  * the syscall arguments directly from the beginning of the frame.
52  */
53 
54 struct trapframe {
55 	register_t	tf_rdi;
56 	register_t	tf_rsi;
57 	register_t	tf_rdx;
58 	register_t	tf_rcx;
59 	register_t	tf_r8;
60 	register_t	tf_r9;
61 	register_t	tf_rax;
62 	register_t	tf_rbx;
63 	register_t	tf_rbp;
64 	register_t	tf_r10;
65 	register_t	tf_r11;
66 	register_t	tf_r12;
67 	register_t	tf_r13;
68 	register_t	tf_r14;
69 	register_t	tf_r15;
70 	register_t	tf_trapno;
71 	/* below portion defined in hardware */
72 	register_t	tf_err;
73 	register_t	tf_rip;
74 	register_t	tf_cs;
75 	register_t	tf_rflags;
76 	register_t	tf_rsp;
77 	register_t	tf_ss;
78 };
79 
80 /* Interrupt stack frame */
81 
82 struct intrframe {
83 	register_t	if_rdi;
84 	register_t	if_rsi;
85 	register_t	if_rdx;
86 	register_t	if_rcx;
87 	register_t	if_r8;
88 	register_t	if_r9;
89 	register_t	if_rax;
90 	register_t	if_rbx;
91 	register_t	if_rbp;
92 	register_t	if_r10;
93 	register_t	if_r11;
94 	register_t	if_r12;
95 	register_t	if_r13;
96 	register_t	if_r14;
97 	register_t	if_r15;
98 	register_t	:64;		/* compat with trap frame - trapno */
99 	register_t	:64;		/* compat with trap frame - err */
100 	/* below portion defined in hardware */
101 	register_t	if_rip;
102 	register_t	if_cs;
103 	register_t	if_rflags;
104 	register_t	if_rsp;
105 	register_t	if_ss;
106 };
107 
108 /* frame of clock (same as interrupt frame) */
109 
110 struct clockframe {
111 	register_t	cf_rdi;
112 	register_t	cf_rsi;
113 	register_t	cf_rdx;
114 	register_t	cf_rcx;
115 	register_t	cf_r8;
116 	register_t	cf_r9;
117 	register_t	cf_rax;
118 	register_t	cf_rbx;
119 	register_t	cf_rbp;
120 	register_t	cf_r10;
121 	register_t	cf_r11;
122 	register_t	cf_r12;
123 	register_t	cf_r13;
124 	register_t	cf_r14;
125 	register_t	cf_r15;
126 	register_t	:64;		/* compat with trap frame - trapno */
127 	register_t	:64;		/* compat with trap frame - err */
128 	/* below portion defined in hardware */
129 	register_t	cf_rip;
130 	register_t	cf_cs;
131 	register_t	cf_rflags;
132 	register_t	cf_rsp;
133 	register_t	cf_ss;
134 };
135 
136 int	kdb_trap(int, int, struct trapframe *);
137 
138 #endif /* _MACHINE_FRAME_H_ */
139