Annotation of sys/arch/amd64/include/reg.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: reg.h,v 1.4 2005/12/13 00:18:19 jsg Exp $ */
2: /* $NetBSD: reg.h,v 1.1 2003/04/26 18:39:47 fvdl Exp $ */
3:
4: /*-
5: * Copyright (c) 1990 The Regents of the University of California.
6: * All rights reserved.
7: *
8: * This code is derived from software contributed to Berkeley by
9: * William Jolitz.
10: *
11: * Redistribution and use in source and binary forms, with or without
12: * modification, are permitted provided that the following conditions
13: * are met:
14: * 1. Redistributions of source code must retain the above copyright
15: * notice, this list of conditions and the following disclaimer.
16: * 2. Redistributions in binary form must reproduce the above copyright
17: * notice, this list of conditions and the following disclaimer in the
18: * documentation and/or other materials provided with the distribution.
19: * 3. Neither the name of the University nor the names of its contributors
20: * may be used to endorse or promote products derived from this software
21: * without specific prior written permission.
22: *
23: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33: * SUCH DAMAGE.
34: *
35: * @(#)reg.h 5.5 (Berkeley) 1/18/91
36: */
37:
38: #ifndef _AMD64_REG_H_
39: #define _AMD64_REG_H_
40:
41: #include <machine/mcontext.h>
42: #include <machine/fpu.h>
43:
44: /*
45: * XXX
46: * The #defines aren't used in the kernel, but some user-level code still
47: * expects them.
48: */
49:
50: /* When referenced during a trap/exception, registers are at these offsets */
51:
52: #define tRDI 0
53: #define tRSI 1
54: #define tRDX 2
55: #define tRCX 3
56: #define tR8 4
57: #define tR9 5
58: #define tR10 6
59: #define tR11 7
60: #define tR12 8
61: #define tR13 9
62: #define tR14 10
63: #define tR15 11
64: #define tRBP 12
65: #define tRBX 13
66: #define tRAX 14
67: #define tRSP 15
68: #define tRIP 16
69: #define tRFLAGS 17
70: #define tCS 18
71: #define tSS 19
72: #define tDS 20
73: #define tES 21
74: #define tFS 22
75: #define tGS 23
76:
77: /*
78: * Registers accessible to ptrace(2) syscall for debugger use.
79: * Same as mcontext.__gregs and struct trapframe, they must
80: * remain synced (XXX should use common structure).
81: */
82: struct reg {
83: int64_t r_rdi;
84: int64_t r_rsi;
85: int64_t r_rdx;
86: int64_t r_rcx;
87: int64_t r_r8;
88: int64_t r_r9;
89: int64_t r_r10;
90: int64_t r_r11;
91: int64_t r_r12;
92: int64_t r_r13;
93: int64_t r_r14;
94: int64_t r_r15;
95: int64_t r_rbp;
96: int64_t r_rbx;
97: int64_t r_rax;
98: int64_t r_rsp;
99: int64_t r_rip;
100: int64_t r_rflags;
101: int64_t r_cs;
102: int64_t r_ss;
103: int64_t r_ds;
104: int64_t r_es;
105: int64_t r_fs;
106: int64_t r_gs;
107: };
108:
109: struct fpreg {
110: struct fxsave64 fxstate;
111: };
112:
113: #define fp_fcw fxstate.fx_fcw
114: #define fp_fsw fxstate.fx_fsw
115: #define fp_ftw fxstate.fx_ftw
116: #define fp_fop fxstate.fx_fop
117: #define fp_rip fxstate.fx_rip
118: #define fp_rdp fxstate.fx_rdp
119: #define fp_mxcsr fxstate.fx_mxcsr
120: #define fp_mxcsr_mask fxstate.fx_mxcsr_mask
121: #define fp_st fxstate.fx_st
122: #define fp_xmm fxstate.fx_xmm
123:
124: #ifdef _KERNEL
125: int check_context(const struct reg *, struct trapframe *);
126: #endif
127:
128: #endif /* !_AMD64_REG_H_ */
CVSweb