00001 /*BEGIN_LEGAL 00002 Copyright (c) 2007, Intel Corp. 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are 00007 met: 00008 00009 * Redistributions of source code must retain the above copyright 00010 notice, this list of conditions and the following disclaimer. 00011 00012 * Redistributions in binary form must reproduce the above 00013 copyright notice, this list of conditions and the following 00014 disclaimer in the documentation and/or other materials provided 00015 with the distribution. 00016 00017 * Neither the name of Intel Corporation nor the names of its 00018 contributors may be used to endorse or promote products derived 00019 from this software without specific prior written permission. 00020 00021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00024 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00025 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 END_LEGAL */ 00035 00036 #ifndef _XED_FLAGS_H_ 00037 # define _XED_FLAGS_H_ 00038 00039 #include "xed-types.h" 00040 #include "xed-flag-enum.h" 00041 #include "xed-flag-action-enum.h" 00042 00043 00047 union XED_DLL_EXPORT xed_flag_set_s { 00048 struct { 00049 xed_uint32_t of:1; 00050 xed_uint32_t sf:1; 00051 xed_uint32_t zf:1; 00052 xed_uint32_t af:1; 00053 xed_uint32_t pf:1; 00054 xed_uint32_t cf:1; 00055 xed_uint32_t df:1; 00056 xed_uint32_t vif:1; 00057 xed_uint32_t iopl:1; 00058 xed_uint32_t _if:1; 00059 xed_uint32_t ac:1; 00060 xed_uint32_t vm:1; 00061 xed_uint32_t rf:1; 00062 xed_uint32_t nt:1; 00063 xed_uint32_t tf:1; 00064 xed_uint32_t id:1; 00065 xed_uint32_t vip:1; 00066 xed_uint32_t fc0:1; 00067 xed_uint32_t fc1:1; 00068 xed_uint32_t fc2:1; 00069 xed_uint32_t fc3:1; 00070 } s; 00071 xed_uint32_t flat; 00072 }; 00073 00074 typedef union xed_flag_set_s xed_flag_set_t; 00077 00078 00079 00080 XED_DLL_EXPORT int xed_flag_set_print(const xed_flag_set_t* p, char* buf, int buflen); 00084 XED_DLL_EXPORT xed_bool_t xed_flag_set_is_subset_of(const xed_flag_set_t* p, 00085 const xed_flag_set_t* other); 00087 00088 00090 00093 typedef struct XED_DLL_EXPORT xed_flag_enum_s { 00094 xed_flag_enum_t flag; 00095 // there are at most two actions per flag. The 2nd may be invalid. 00096 xed_flag_action_enum_t action; 00097 } xed_flag_action_t; 00098 00099 00100 00101 00104 00105 00106 00107 XED_DLL_EXPORT xed_flag_enum_t 00108 xed_flag_action_get_flag_name(const xed_flag_action_t* p); 00111 XED_DLL_EXPORT xed_flag_action_enum_t 00112 xed_flag_action_get_action(const xed_flag_action_t* p, unsigned int i); 00115 XED_DLL_EXPORT xed_bool_t 00116 xed_flag_action_action_invalid(const xed_flag_action_enum_t a); 00119 XED_DLL_EXPORT int xed_flag_action_print(const xed_flag_action_t* p, char* buf, int buflen); 00122 XED_DLL_EXPORT xed_bool_t 00123 xed_flag_action_read_flag(const xed_flag_action_t* p ); 00126 XED_DLL_EXPORT xed_bool_t 00127 xed_flag_action_writes_flag(const xed_flag_action_t* p); 00128 00131 XED_DLL_EXPORT xed_bool_t 00132 xed_flag_action_read_action( xed_flag_action_enum_t a); 00135 XED_DLL_EXPORT xed_bool_t 00136 xed_flag_action_write_action( xed_flag_action_enum_t a); 00138 00140 00141 #define XED_MAX_FLAG_ACTIONS (XED_FLAG_LAST + 3) 00144 typedef struct XED_DLL_EXPORT xed_simple_flag_s 00145 { 00146 xed_uint8_t nflags; 00147 00148 xed_bool_t may_write :1; 00149 xed_bool_t must_write :1; 00150 00152 xed_flag_action_t fa[XED_MAX_FLAG_ACTIONS]; 00153 00155 xed_flag_set_t read; 00156 00158 xed_flag_set_t written; 00159 } xed_simple_flag_t; 00160 00163 00164 00165 00166 XED_DLL_EXPORT unsigned int 00167 xed_simple_flag_get_nflags(const xed_simple_flag_t* p); 00168 00171 XED_DLL_EXPORT const xed_flag_set_t* 00172 xed_simple_flag_get_read_flag_set(const xed_simple_flag_t* p); 00173 00176 XED_DLL_EXPORT const xed_flag_set_t* 00177 xed_simple_flag_get_written_flag_set(const xed_simple_flag_t* p); 00178 00182 XED_DLL_EXPORT xed_bool_t xed_simple_flag_get_may_write(const xed_simple_flag_t* p); 00183 00186 XED_DLL_EXPORT xed_bool_t xed_simple_flag_get_must_write(const xed_simple_flag_t* p); 00187 00190 XED_DLL_EXPORT const xed_flag_action_t* 00191 xed_simple_flag_get_flag_action(const xed_simple_flag_t* p, unsigned int i); 00192 00195 XED_DLL_EXPORT xed_bool_t 00196 xed_simple_flag_reads_flags(const xed_simple_flag_t* p); 00197 00200 XED_DLL_EXPORT xed_bool_t xed_simple_flag_writes_flags(const xed_simple_flag_t* p); 00201 00204 XED_DLL_EXPORT int xed_simple_flag_print(const xed_simple_flag_t* p, char* buf, int buflen); 00206 00208 00209 00211 00212 #endif