xref: /freebsd/sys/amd64/include/frame.h (revision 7773002178c8dbc52b44e4d705f07706409af8e4)
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 	register_t	tf_addr;
72 	register_t	tf_flags;
73 	/* below portion defined in hardware */
74 	register_t	tf_err;
75 	register_t	tf_rip;
76 	register_t	tf_cs;
77 	register_t	tf_rflags;
78 	register_t	tf_rsp;
79 	register_t	tf_ss;
80 };
81 
82 /* Interrupt stack frame */
83 
84 struct intrframe {
85 	register_t	if_rdi;
86 	register_t	if_rsi;
87 	register_t	if_rdx;
88 	register_t	if_rcx;
89 	register_t	if_r8;
90 	register_t	if_r9;
91 	register_t	if_rax;
92 	register_t	if_rbx;
93 	register_t	if_rbp;
94 	register_t	if_r10;
95 	register_t	if_r11;
96 	register_t	if_r12;
97 	register_t	if_r13;
98 	register_t	if_r14;
99 	register_t	if_r15;
100 	register_t	:64;		/* compat with trap frame - trapno */
101 	register_t	:64;		/* compat with trap frame - addr */
102 	register_t	:64;		/* compat with trap frame - flags */
103 	register_t	:64;		/* compat with trap frame - err */
104 	/* below portion defined in hardware */
105 	register_t	if_rip;
106 	register_t	if_cs;
107 	register_t	if_rflags;
108 	register_t	if_rsp;
109 	register_t	if_ss;
110 };
111 
112 /* frame of clock (same as interrupt frame) */
113 
114 struct clockframe {
115 	register_t	cf_rdi;
116 	register_t	cf_rsi;
117 	register_t	cf_rdx;
118 	register_t	cf_rcx;
119 	register_t	cf_r8;
120 	register_t	cf_r9;
121 	register_t	cf_rax;
122 	register_t	cf_rbx;
123 	register_t	cf_rbp;
124 	register_t	cf_r10;
125 	register_t	cf_r11;
126 	register_t	cf_r12;
127 	register_t	cf_r13;
128 	register_t	cf_r14;
129 	register_t	cf_r15;
130 	register_t	:64;		/* compat with trap frame - trapno */
131 	register_t	:64;		/* compat with trap frame - addr */
132 	register_t	:64;		/* compat with trap frame - flags */
133 	register_t	:64;		/* compat with trap frame - err */
134 	/* below portion defined in hardware */
135 	register_t	cf_rip;
136 	register_t	cf_cs;
137 	register_t	cf_rflags;
138 	register_t	cf_rsp;
139 	register_t	cf_ss;
140 };
141 
142 int	kdb_trap(int, int, struct trapframe *);
143 
144 #endif /* _MACHINE_FRAME_H_ */
145