xed-flags.h

Go to the documentation of this file.
00001 /*BEGIN_LEGAL 
00002 Intel Open Source License 
00003 
00004 Copyright (c) 2002-2009 Intel Corporation. All rights reserved.
00005  
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are
00008 met:
00009 
00010 Redistributions of source code must retain the above copyright notice,
00011 this list of conditions and the following disclaimer.  Redistributions
00012 in binary form must reproduce the above copyright notice, this list of
00013 conditions and the following disclaimer in the documentation and/or
00014 other materials provided with the distribution.  Neither the name of
00015 the Intel Corporation nor the names of its contributors may be used to
00016 endorse or promote products derived from this software without
00017 specific prior written permission.
00018  
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00022 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
00023 ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00024 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00025 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00026 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00027 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00028 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00029 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030 END_LEGAL */
00033 
00034 #ifndef _XED_FLAGS_H_
00035 # define  _XED_FLAGS_H_
00036 
00037 #include "xed-types.h"
00038 #include "xed-portability.h"
00039 #include "xed-flag-enum.h"
00040 #include "xed-flag-action-enum.h"
00041 
00042 
00046 union  XED_DLL_EXPORT xed_flag_set_s {
00047     struct {
00048         xed_uint32_t cf:1;
00049         xed_uint32_t must_be_1:1;
00050         xed_uint32_t pf:1;
00051         xed_uint32_t must_be_0a:1;
00052         xed_uint32_t af:1;
00053         xed_uint32_t must_be_0b:1;
00054         xed_uint32_t zf:1;
00055         xed_uint32_t sf:1;
00056         xed_uint32_t tf:1;
00057         xed_uint32_t _if:1;  
00058         xed_uint32_t df:1;
00059         xed_uint32_t of:1;
00060         xed_uint32_t iopl:1;
00061         xed_uint32_t nt:1;
00062         xed_uint32_t must_be_0c:1;
00063         xed_uint32_t rf:1;
00064         xed_uint32_t vm:1;
00065         xed_uint32_t ac:1;
00066         xed_uint32_t vif:1;
00067         xed_uint32_t vip:1; 
00068         xed_uint32_t id:1;
00069         xed_uint32_t mbz:6;  
00070         xed_uint32_t fc0:1;  
00071         xed_uint32_t fc1:1;  
00072         xed_uint32_t fc2:1;  
00073         xed_uint32_t fc3:1;  
00074     } s;
00075     xed_uint32_t flat;
00076 };
00077 
00078 typedef union xed_flag_set_s xed_flag_set_t;
00081 
00082 
00083 
00084 XED_DLL_EXPORT int  xed_flag_set_print(const xed_flag_set_t* p, char* buf, int buflen);
00088 XED_DLL_EXPORT xed_bool_t xed_flag_set_is_subset_of(const xed_flag_set_t* p,
00089                                const xed_flag_set_t* other);
00091 
00092 
00094 
00097 typedef struct XED_DLL_EXPORT xed_flag_enum_s {
00098     xed_flag_enum_t flag;
00099     // there are at most two actions per flag. The 2nd may be invalid.
00100     xed_flag_action_enum_t action;
00101 }  xed_flag_action_t;
00102 
00103 
00104 
00105 
00108 
00109 
00110 
00111 XED_DLL_EXPORT xed_flag_enum_t
00112 xed_flag_action_get_flag_name(const xed_flag_action_t* p);
00115 XED_DLL_EXPORT xed_flag_action_enum_t
00116 xed_flag_action_get_action(const xed_flag_action_t* p, unsigned int i);
00119 XED_DLL_EXPORT xed_bool_t 
00120 xed_flag_action_action_invalid(const xed_flag_action_enum_t a);
00123 XED_DLL_EXPORT int xed_flag_action_print(const xed_flag_action_t* p, char* buf, int buflen);
00126 XED_DLL_EXPORT xed_bool_t 
00127 xed_flag_action_read_flag(const xed_flag_action_t* p );
00130 XED_DLL_EXPORT xed_bool_t 
00131 xed_flag_action_writes_flag(const xed_flag_action_t* p);
00132   
00135 XED_DLL_EXPORT xed_bool_t 
00136 xed_flag_action_read_action( xed_flag_action_enum_t a);
00139 XED_DLL_EXPORT xed_bool_t 
00140 xed_flag_action_write_action( xed_flag_action_enum_t a);
00142 
00144 
00145 #define XED_MAX_FLAG_ACTIONS (XED_FLAG_LAST + 3)
00148 typedef struct  XED_DLL_EXPORT xed_simple_flag_s 
00149 {
00150     xed_uint8_t nflags;
00151 
00152     xed_bool_t may_write :1;
00153     xed_bool_t must_write :1;
00154 
00156     xed_flag_action_t fa[XED_MAX_FLAG_ACTIONS];
00157 
00159     xed_flag_set_t read;
00160 
00162     xed_flag_set_t written;
00163 
00165     xed_flag_set_t undefined;
00166 } xed_simple_flag_t;
00167 
00170 
00171 
00172 
00173 XED_DLL_EXPORT unsigned int 
00174 xed_simple_flag_get_nflags(const xed_simple_flag_t* p);
00175 
00178 XED_DLL_EXPORT const xed_flag_set_t* 
00179 xed_simple_flag_get_read_flag_set(const xed_simple_flag_t* p);
00180 
00183 XED_DLL_EXPORT const xed_flag_set_t*
00184 xed_simple_flag_get_written_flag_set(const xed_simple_flag_t* p);
00185 
00186 
00189 XED_DLL_EXPORT const xed_flag_set_t*
00190 xed_simple_flag_get_undefined_flag_set(const xed_simple_flag_t* p);
00191 
00195 XED_DLL_EXPORT xed_bool_t xed_simple_flag_get_may_write(const xed_simple_flag_t* p);
00196 
00199 XED_DLL_EXPORT xed_bool_t xed_simple_flag_get_must_write(const xed_simple_flag_t* p);
00200 
00203 XED_DLL_EXPORT const xed_flag_action_t*
00204 xed_simple_flag_get_flag_action(const xed_simple_flag_t* p, unsigned int i);
00205 
00208 XED_DLL_EXPORT xed_bool_t
00209 xed_simple_flag_reads_flags(const xed_simple_flag_t* p);
00210 
00213 XED_DLL_EXPORT xed_bool_t xed_simple_flag_writes_flags(const xed_simple_flag_t* p);
00214 
00217 XED_DLL_EXPORT int xed_simple_flag_print(const xed_simple_flag_t* p, char* buf, int buflen);
00218 
00221 static XED_INLINE int xed_flag_set_mask(const xed_flag_set_t* p) {
00222     return p->flat; // FIXME: could mask out the X87 flags
00223 }
00224 
00226 
00228 
00229 
00231 
00232 #endif

Generated on Tue Dec 15 03:23:59 2009 for XED2 by  doxygen 1.4.6