1
2/*---------------------------------------------------------------*/
3/*--- begin                                   libvex_emnote.h ---*/
4/*---------------------------------------------------------------*/
5
6/*
7   This file is part of Valgrind, a dynamic binary instrumentation
8   framework.
9
10   Copyright (C) 2004-2015 OpenWorks LLP
11      info@open-works.net
12
13   This program is free software; you can redistribute it and/or
14   modify it under the terms of the GNU General Public License as
15   published by the Free Software Foundation; either version 2 of the
16   License, or (at your option) any later version.
17
18   This program is distributed in the hope that it will be useful, but
19   WITHOUT ANY WARRANTY; without even the implied warranty of
20   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21   General Public License for more details.
22
23   You should have received a copy of the GNU General Public License
24   along with this program; if not, write to the Free Software
25   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26   02110-1301, USA.
27
28   The GNU General Public License is contained in the file COPYING.
29
30   Neither the names of the U.S. Department of Energy nor the
31   University of California nor the names of its contributors may be
32   used to endorse or promote products derived from this software
33   without prior written permission.
34*/
35
36#ifndef __LIBVEX_EMNOTE_H
37#define __LIBVEX_EMNOTE_H
38
39#include "libvex_basictypes.h"
40
41/* VEX can sometimes generate code which returns to the dispatcher
42   with the guest state pointer set to VEX_TRC_JMP_EMWARN or
43   VEX_TRC_JMP_EMFAIL.  This means that VEX is trying to tell Valgrind
44   something noteworthy about emulation progress. For example, that Valgrind
45   is doing imprecise emulation in some sense.  The guest's pseudo-register
46   "guest_EMNOTE" will hold a value of type VexEmNote, which describes
47   the nature of the warning.  Currently the limitations that are
48   warned about apply primarily to floating point support.
49
50   All guest states must have a 32-bit (UInt) guest_EMNOTE pseudo-
51   register, that emulation warnings can be written in to.
52
53   Note that guest_EMNOTE only carries a valid value at the jump
54   marked as VEX_TRC_JMP_EMWARN / VEX_TRC_JMP_EMFAIL.  You can't assume
55   it will continue to carry a valid value from any amount of time after
56   the jump.
57*/
58
59typedef
60   enum {
61      /* no note indicated */
62      EmNote_NONE=0,
63
64      /* unmasking x87 FP exceptions is not supported */
65      EmWarn_X86_x87exns,
66
67      /* change of x87 FP precision away from 64-bit (mantissa) */
68      EmWarn_X86_x87precision,
69
70      /* unmasking SSE FP exceptions is not supported */
71      EmWarn_X86_sseExns,
72
73      /* setting mxcsr.fz is not supported */
74      EmWarn_X86_fz,
75
76      /* setting mxcsr.daz is not supported */
77      EmWarn_X86_daz,
78
79      /* settings to %eflags.ac (alignment check) are noted but ignored */
80      EmWarn_X86_acFlag,
81
82      /* unmasking PPC32/64 FP exceptions is not supported */
83      EmWarn_PPCexns,
84
85      /* overflow/underflow of the PPC64 _REDIR stack (ppc64 only) */
86      EmWarn_PPC64_redir_overflow,
87      EmWarn_PPC64_redir_underflow,
88
89      /* insn specifies a rounding mode other than "according to FPC"
90         which requires the floating point extension facility. But that
91         facility is not available on this host */
92      EmWarn_S390X_fpext_rounding,
93
94      /* insn (e.g. srnmb) specifies an invalid rounding mode */
95      EmWarn_S390X_invalid_rounding,
96
97      /* stfle insn is not supported on this host */
98      EmFail_S390X_stfle,
99
100      /* stckf insn is not supported on this host */
101      EmFail_S390X_stckf,
102
103      /* ecag insn is not supported on this host */
104      EmFail_S390X_ecag,
105
106      /* pfpo insn is not supported on this host */
107      EmFail_S390X_pfpo,
108
109      /* DFP insns are not supported on this host */
110      EmFail_S390X_DFP_insn,
111
112      /* insn needs floating point extension facility which is not
113         available on this host */
114      EmFail_S390X_fpext,
115
116      /* GPR 0 contains invalid rounding mode for PFPO instruction */
117      EmFail_S390X_invalid_PFPO_rounding_mode,
118
119      /* The function code specified in GPR 0 executed by PFPO
120         instruction is invalid */
121      EmFail_S390X_invalid_PFPO_function,
122
123      EmNote_NUMBER
124   }
125   VexEmNote;
126
127
128/* Produces a short string describing the warning. */
129extern const HChar* LibVEX_EmNote_string ( VexEmNote );
130
131
132#endif /* ndef __LIBVEX_EMNOTE_H */
133
134/*---------------------------------------------------------------*/
135/*---                                         libvex_emnote.h ---*/
136/*---------------------------------------------------------------*/
137