frame.h revision 114349
1139749Simp/*-
2193640Sariff * Copyright (c) 1990 The Regents of the University of California.
3193640Sariff * All rights reserved.
450724Scg *
550724Scg * This code is derived from software contributed to Berkeley by
650724Scg * William Jolitz.
750724Scg *
850724Scg * Redistribution and use in source and binary forms, with or without
950724Scg * modification, are permitted provided that the following conditions
1050724Scg * are met:
1150724Scg * 1. Redistributions of source code must retain the above copyright
1250724Scg *    notice, this list of conditions and the following disclaimer.
1350724Scg * 2. Redistributions in binary form must reproduce the above copyright
1450724Scg *    notice, this list of conditions and the following disclaimer in the
1550724Scg *    documentation and/or other materials provided with the distribution.
1650724Scg * 3. All advertising materials mentioning features or use of this software
1750724Scg *    must display the following acknowledgement:
1850724Scg *	This product includes software developed by the University of
1950724Scg *	California, Berkeley and its contributors.
2050724Scg * 4. Neither the name of the University nor the names of its contributors
2150724Scg *    may be used to endorse or promote products derived from this software
2250724Scg *    without specific prior written permission.
2350724Scg *
2450724Scg * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2550724Scg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2650724Scg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2750733Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2850724Scg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2950724Scg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30242435Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31242435Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32242435Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33170815Sariff * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34170815Sariff * SUCH DAMAGE.
35170815Sariff *
3674763Scg *	from: @(#)frame.h	5.2 (Berkeley) 1/18/91
3774763Scg * $FreeBSD: head/sys/amd64/include/frame.h 114349 2003-05-01 01:05:25Z peter $
3874763Scg */
39170815Sariff
40162588Snetchild#ifndef _MACHINE_FRAME_H_
4150724Scg#define _MACHINE_FRAME_H_ 1
4270944Sjhb
4370944Sjhb/*
4470944Sjhb * System stack frames.
4570618Sjhb */
46170815Sariff
47170815Sariff/*
48246421Shselasky * Exception/Trap Stack Frame
49246421Shselasky *
50170815Sariff * The ordering of this is specifically so that we can take first 6
51170815Sariff * the syscall arguments directly from the beginning of the frame.
52170815Sariff */
53170815Sariff
54170815Sariffstruct trapframe {
55170815Sariff	register_t	tf_rdi;
5674763Scg	register_t	tf_rsi;
5774763Scg	register_t	tf_rdx;
5874763Scg	register_t	tf_rcx;
5974763Scg	register_t	tf_r8;
60162738Sariff	register_t	tf_r9;
61162738Sariff	register_t	tf_rax;
62162738Sariff	register_t	tf_rbx;
63162738Sariff	register_t	tf_rbp;
6474763Scg	register_t	tf_r10;
65184610Salfred	register_t	tf_r11;
6650724Scg	register_t	tf_r12;
67162588Snetchild	register_t	tf_r13;
68162588Snetchild	register_t	tf_r14;
69170815Sariff	register_t	tf_r15;
70170815Sariff	register_t	tf_trapno;
71170815Sariff	/* below portion defined in hardware */
72170815Sariff	register_t	tf_err;
73170815Sariff	register_t	tf_rip;
74170815Sariff	register_t	tf_cs;
7574763Scg	register_t	tf_rflags;
7674763Scg	register_t	tf_rsp;
7774763Scg	register_t	tf_ss;
7874763Scg};
79170815Sariff
80170815Sariff/* Interrupt stack frame */
8170134Scg
82160385Snetchildstruct intrframe {
83242435Shselasky	register_t	if_rdi;
84242435Shselasky	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
110struct 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
136int	kdb_trap(int, int, struct trapframe *);
137
138#endif /* _MACHINE_FRAME_H_ */
139