xref: /freebsd/sys/amd64/include/frame.h (revision 0f8f86b71f022b803e99151c19db81b280f245dc)
1 /*-
2  * Copyright (c) 2003 Peter Wemm.
3  * Copyright (c) 1990 The Regents of the University of California.
4  * All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * William Jolitz.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *	This product includes software developed by the University of
20  *	California, Berkeley and its contributors.
21  * 4. Neither the name of the University nor the names of its contributors
22  *    may be used to endorse or promote products derived from this software
23  *    without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  *
37  *	from: @(#)frame.h	5.2 (Berkeley) 1/18/91
38  * $FreeBSD$
39  */
40 
41 #ifndef _MACHINE_FRAME_H_
42 #define _MACHINE_FRAME_H_ 1
43 
44 /*
45  * System stack frames.
46  */
47 
48 /*
49  * Exception/Trap Stack Frame
50  *
51  * The ordering of this is specifically so that we can take first 6
52  * the syscall arguments directly from the beginning of the frame.
53  */
54 
55 struct trapframe {
56 	register_t	tf_rdi;
57 	register_t	tf_rsi;
58 	register_t	tf_rdx;
59 	register_t	tf_rcx;
60 	register_t	tf_r8;
61 	register_t	tf_r9;
62 	register_t	tf_rax;
63 	register_t	tf_rbx;
64 	register_t	tf_rbp;
65 	register_t	tf_r10;
66 	register_t	tf_r11;
67 	register_t	tf_r12;
68 	register_t	tf_r13;
69 	register_t	tf_r14;
70 	register_t	tf_r15;
71 	register_t	tf_trapno;
72 	register_t	tf_addr;
73 	register_t	tf_flags;
74 	/* below portion defined in hardware */
75 	register_t	tf_err;
76 	register_t	tf_rip;
77 	register_t	tf_cs;
78 	register_t	tf_rflags;
79 	register_t	tf_rsp;
80 	register_t	tf_ss;
81 };
82 
83 /* Interrupt stack frame */
84 
85 struct intrframe {
86 	register_t	if_rdi;
87 	register_t	if_rsi;
88 	register_t	if_rdx;
89 	register_t	if_rcx;
90 	register_t	if_r8;
91 	register_t	if_r9;
92 	register_t	if_rax;
93 	register_t	if_rbx;
94 	register_t	if_rbp;
95 	register_t	if_r10;
96 	register_t	if_r11;
97 	register_t	if_r12;
98 	register_t	if_r13;
99 	register_t	if_r14;
100 	register_t	if_r15;
101 	register_t	:64;		/* compat with trap frame - trapno */
102 	register_t	:64;		/* compat with trap frame - addr */
103 	register_t	:64;		/* compat with trap frame - flags */
104 	register_t	:64;		/* compat with trap frame - err */
105 	/* below portion defined in hardware */
106 	register_t	if_rip;
107 	register_t	if_cs;
108 	register_t	if_rflags;
109 	register_t	if_rsp;
110 	register_t	if_ss;
111 };
112 
113 /* frame of clock (same as interrupt frame) */
114 
115 struct clockframe {
116 	register_t	cf_rdi;
117 	register_t	cf_rsi;
118 	register_t	cf_rdx;
119 	register_t	cf_rcx;
120 	register_t	cf_r8;
121 	register_t	cf_r9;
122 	register_t	cf_rax;
123 	register_t	cf_rbx;
124 	register_t	cf_rbp;
125 	register_t	cf_r10;
126 	register_t	cf_r11;
127 	register_t	cf_r12;
128 	register_t	cf_r13;
129 	register_t	cf_r14;
130 	register_t	cf_r15;
131 	register_t	:64;		/* compat with trap frame - trapno */
132 	register_t	:64;		/* compat with trap frame - addr */
133 	register_t	:64;		/* compat with trap frame - flags */
134 	register_t	:64;		/* compat with trap frame - err */
135 	/* below portion defined in hardware */
136 	register_t	cf_rip;
137 	register_t	cf_cs;
138 	register_t	cf_rflags;
139 	register_t	cf_rsp;
140 	register_t	cf_ss;
141 };
142 
143 int	kdb_trap(int, int, struct trapframe *);
144 
145 #endif /* _MACHINE_FRAME_H_ */
146