1 /* $OpenBSD: reg.h,v 1.6 2011/03/23 16:54:34 pirofti 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 _MACHINE_REG_H_ 39 #define _MACHINE_REG_H_ 40 41 #include <machine/fpu.h> 42 43 /* 44 * XXX 45 * The #defines aren't used in the kernel, but some user-level code still 46 * expects them. 47 */ 48 49 /* When referenced during a trap/exception, registers are at these offsets */ 50 51 #define tRDI 0 52 #define tRSI 1 53 #define tRDX 2 54 #define tRCX 3 55 #define tR8 4 56 #define tR9 5 57 #define tR10 6 58 #define tR11 7 59 #define tR12 8 60 #define tR13 9 61 #define tR14 10 62 #define tR15 11 63 #define tRBP 12 64 #define tRBX 13 65 #define tRAX 14 66 #define tRSP 15 67 #define tRIP 16 68 #define tRFLAGS 17 69 #define tCS 18 70 #define tSS 19 71 #define tDS 20 72 #define tES 21 73 #define tFS 22 74 #define tGS 23 75 76 /* 77 * Registers accessible to ptrace(2) syscall for debugger use. 78 * Same as mcontext.__gregs and struct trapframe, they must 79 * remain synced (XXX should use common structure). 80 */ 81 struct reg { 82 int64_t r_rdi; 83 int64_t r_rsi; 84 int64_t r_rdx; 85 int64_t r_rcx; 86 int64_t r_r8; 87 int64_t r_r9; 88 int64_t r_r10; 89 int64_t r_r11; 90 int64_t r_r12; 91 int64_t r_r13; 92 int64_t r_r14; 93 int64_t r_r15; 94 int64_t r_rbp; 95 int64_t r_rbx; 96 int64_t r_rax; 97 int64_t r_rsp; 98 int64_t r_rip; 99 int64_t r_rflags; 100 int64_t r_cs; 101 int64_t r_ss; 102 int64_t r_ds; 103 int64_t r_es; 104 int64_t r_fs; 105 int64_t r_gs; 106 }; 107 108 struct fpreg { 109 struct fxsave64 fxstate; 110 }; 111 112 #define fp_fcw fxstate.fx_fcw 113 #define fp_fsw fxstate.fx_fsw 114 #define fp_ftw fxstate.fx_ftw 115 #define fp_fop fxstate.fx_fop 116 #define fp_rip fxstate.fx_rip 117 #define fp_rdp fxstate.fx_rdp 118 #define fp_mxcsr fxstate.fx_mxcsr 119 #define fp_mxcsr_mask fxstate.fx_mxcsr_mask 120 #define fp_st fxstate.fx_st 121 #define fp_xmm fxstate.fx_xmm 122 123 #ifdef _KERNEL 124 int check_context(const struct reg *, struct trapframe *); 125 #endif 126 127 #endif /* !_MACHINE_REG_H_ */ 128