xref: /illumos-gate/usr/src/uts/intel/sys/frame.h (revision dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/regset.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * In the Intel world, a stack frame looks like this:
40  *
41  * %fp0->|				 |
42  *	 |-------------------------------|
43  *	 |  Args to next subroutine	 |
44  *	 |-------------------------------|-\
45  * %sp0->|  One word struct-ret address	 | |
46  *	 |-------------------------------|  > minimum stack frame
47  * %fp1->|  Previous frame pointer (%fp0)| |
48  *	 |-------------------------------|-/
49  *	 |  Local variables		 |
50  * %sp1->|-------------------------------|
51  *
52  * For amd64, the minimum stack frame is 16 bytes and the frame pointer must
53  * be 16-byte aligned.
54  */
55 
56 struct frame {
57 	greg_t	fr_savfp;		/* saved frame pointer */
58 	greg_t	fr_savpc;		/* saved program counter */
59 };
60 
61 #ifdef _SYSCALL32
62 
63 /*
64  * Kernel's view of a 32-bit stack frame.
65  */
66 struct frame32 {
67 	greg32_t fr_savfp;		/* saved frame pointer */
68 	greg32_t fr_savpc;		/* saved program counter */
69 };
70 
71 #endif
72 
73 #ifdef	__cplusplus
74 }
75 #endif
76 
77 #endif	/* _SYS_FRAME_H */
78