xref: /illumos-gate/usr/src/lib/libc/amd64/unwind/reg_num.h (revision 1e56f352c1c208679012bca47d552e127f5b1072)
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 /*
28  * DWARF register numbers for AMD64
29  */
30 
31 #ifndef _REG_NUM_H
32 #define	_REG_NUM_H
33 
34 /*
35  * Dwarf register numbers for AMD64
36  * Only those with trailing comments are actually tracked
37  */
38 #define	GPR_RAX	0
39 #define	GPR_RDX	1
40 #define	GPR_RCX	2
41 #define	GPR_RBX	3	/* callee saves */
42 #define	GPR_RSI	4
43 #define	GPR_RDI	5
44 #define	FP_RBP	6	/* callee saves (optional frame pointer) */
45 #define	SP_RSP	7	/* stack pointer */
46 #define	EIR_R8	8
47 #define	EIR_R9	9
48 #define	EIR_R10	10
49 #define	EIR_R11	11
50 #define	EIR_R12	12	/* callee saves */
51 #define	EIR_R13	13	/* callee saves */
52 #define	EIR_R14	14	/* callee saves */
53 #define	EIR_R15	15	/* callee saves */
54 #define	RET_ADD	16	/* virtual register - really caller's PC */
55 #define	CF_ADDR	17	/* virtual register - tracks frame location */
56 
57 #if 0
58 #define	SSE_XMM0	17
59 #define	SSE_XMM1	18
60 #define	SSE_XMM2	19
61 #define	SSE_XMM3	20
62 #define	SSE_XMM4	21
63 #define	SSE_XMM5	22
64 #define	SSE_XMM6	23
65 #define	SSE_XMM7	24
66 #define	SSE_XMM8	25
67 #define	SSE_XMM9	26
68 #define	SSE_XMM10	27
69 #define	SSE_XMM11	28
70 #define	SSE_XMM12	29
71 #define	SSE_XMM13	30
72 #define	SSE_XMM14	31
73 #define	SSE_XMM15	32
74 #define	FP_ST0		33
75 #define	FP_ST1		34
76 #define	FP_ST2		35
77 #define	FP_ST3		36
78 #define	FP_ST4		37
79 #define	FP_ST5		38
80 #define	FP_ST6		39
81 #define	FP_ST7		40
82 #define	MMX_MMN0	41
83 #define	MMX_MMN1	42
84 #define	MMX_MMN2	43
85 #define	MMX_MMN3	44
86 #define	MMX_MMN4	45
87 #define	MMX_MMN5	46
88 #define	MMX_MMN6	47
89 #define	MMX_MMN7	48
90 #endif
91 #define	BAD_REG		49
92 
93 /*
94  * register arrays used in support routines contain 16 8-byte slots
95  * indexed from GPR_RAX to EIR_R15
96  *
97  *	%rax	0	0	<undefined>
98  *	%rdx	1	8	handler parameter
99  *	%rcx	2	16	handler parameter
100  *	%rbx	3	24	preserved
101  *	%rsi	4	32	handler parameter
102  *	%rdi	5	40	handler parameter
103  *	%rbp	6	48	frame pointer
104  *	%rsp	7	56	stack pointer
105  *	%r8	8	64	<undefined>
106  *	%r9	9	72	<undefined>
107  *	%r10	10	80	<undefined>
108  *	%r11	11	88	<undefined>
109  *	%r12	12	96	preserved
110  *	%r13	13	104	preserved
111  *	%r14	14	112	preserved
112  *	%r15	15	120	preserved
113  *
114  * register state arrays used to hold propagation information
115  * have two additional elements (indices RET_ADD and CF_ADDR)
116  */
117 
118 #endif	/* _REG_NUM_H */
119