xref: /illumos-gate/usr/src/uts/intel/sys/frame.h (revision 2d6eb4a5)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_FRAME_H
28 #define	_SYS_FRAME_H
29 
30 #include <sys/regset.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * In the Intel world, a stack frame looks like this:
38  *
39  * %fp0->|				 |
40  *	 |-------------------------------|
41  *	 |  Args to next subroutine	 |
42  *	 |-------------------------------|-\
43  * %sp0->|  One word struct-ret address	 | |
44  *	 |-------------------------------|  > minimum stack frame
45  * %fp1->|  Previous frame pointer (%fp0)| |
46  *	 |-------------------------------|-/
47  *	 |  Local variables		 |
48  * %sp1->|-------------------------------|
49  *
50  * For amd64, the minimum stack frame is 16 bytes and the frame pointer must
51  * be 16-byte aligned.
52  */
53 
54 struct frame {
55 	greg_t	fr_savfp;		/* saved frame pointer */
56 	greg_t	fr_savpc;		/* saved program counter */
57 };
58 
59 #ifdef _SYSCALL32
60 
61 /*
62  * Kernel's view of a 32-bit stack frame.
63  */
64 struct frame32 {
65 	greg32_t fr_savfp;		/* saved frame pointer */
66 	greg32_t fr_savpc;		/* saved program counter */
67 };
68 
69 #endif
70 
71 #ifdef	__cplusplus
72 }
73 #endif
74 
75 #endif	/* _SYS_FRAME_H */
76