XED
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
xed-state.h
Go to the documentation of this file.
1 /*BEGIN_LEGAL
2 Intel Open Source License
3 
4 Copyright (c) 2002-2014 Intel Corporation. All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are
8 met:
9 
10 Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. Redistributions
12 in binary form must reproduce the above copyright notice, this list of
13 conditions and the following disclaimer in the documentation and/or
14 other materials provided with the distribution. Neither the name of
15 the Intel Corporation nor the names of its contributors may be used to
16 endorse or promote products derived from this software without
17 specific prior written permission.
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
23 ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 END_LEGAL */
33 
34 
35 
36 #ifndef _XED_STATE_H_
37 # define _XED_STATE_H_
38 #include "xed-types.h"
39 #include "xed-portability.h"
40 #include "xed-address-width-enum.h" // generated
41 #include "xed-machine-mode-enum.h" // generated
42 
43 
52 typedef struct xed_state_s {
57 } xed_state_t;
58 
60 
74  xed_machine_mode_enum_t arg_mmode,
75  xed_address_width_enum_t arg_ignored,
76  xed_address_width_enum_t arg_stack_addr_width) {
77  p->mmode=arg_mmode;
78  p->stack_addr_width=arg_stack_addr_width;
79  (void) arg_ignored; //pacify compiler unused arg warning
80 }
81 
93  xed_machine_mode_enum_t arg_mmode,
94  xed_address_width_enum_t arg_stack_addr_width) {
95  p->mmode=arg_mmode;
96  p->stack_addr_width=arg_stack_addr_width;
97 }
98 
104 }
105 
107 
109 
113  return p->mmode;
114 }
115 
116 
121 }
122 
126 }
127 
132 }
133 
138 }
139 
140 
144  xed_machine_mode_enum_t arg_mode) {
145  p->mmode = arg_mode;
146 }
148 
150 
154  xed_address_width_enum_t arg_addr_width) {
155  (void)p;
156  (void)arg_addr_width;
157 }
158 
162  switch(xed_state_get_machine_mode(p)) {
164  return XED_ADDRESS_WIDTH_64b;
165 
167  /* should be 20b... but if you are working w/real mode then you're
168  going to have to deal with somehow. Could easily make this be
169  20b if anyone cares. */
170  return XED_ADDRESS_WIDTH_32b;
171 
174  return XED_ADDRESS_WIDTH_32b;
177  return XED_ADDRESS_WIDTH_16b;
178  default:
180  }
181 }
182 
184 
186 
190  xed_address_width_enum_t arg_addr_width) {
191  p->stack_addr_width = arg_addr_width;
192 }
193 
194 
198  return p->stack_addr_width;
199 }
201 
203 XED_DLL_EXPORT int xed_state_print(const xed_state_t* p, char* buf, int buflen);
204 
205 #endif
206 
static XED_INLINE void xed_state_init2(xed_state_t *p, xed_machine_mode_enum_t arg_mmode, xed_address_width_enum_t arg_stack_addr_width)
Constructor.
Definition: xed-state.h:92
static XED_INLINE void xed_state_set_machine_mode(xed_state_t *p, xed_machine_mode_enum_t arg_mode)
Set the machine mode which corresponds to the default data operand size.
Definition: xed-state.h:143
XED_DLL_EXPORT int xed_state_print(const xed_state_t *p, char *buf, int buflen)
struct xed_state_s xed_state_t
Encapsulates machine modes for decoder/encoder requests.
static XED_INLINE void xed_state_set_address_width(xed_state_t *p, xed_address_width_enum_t arg_addr_width)
Set the address width.
Definition: xed-state.h:153
xed_address_width_enum_t stack_addr_width
for 16b/32b modes
Definition: xed-state.h:56
unsigned int xed_bool_t
Definition: xed-types.h:68
static XED_INLINE xed_bool_t xed_state_mode_width_16(const xed_state_t *p)
Definition: xed-state.h:129
xed_address_width_enum_t
#define XED_INLINE
static XED_INLINE xed_address_width_enum_t xed_state_get_address_width(const xed_state_t *p)
return the address width
Definition: xed-state.h:161
Encapsulates machine modes for decoder/encoder requests.
Definition: xed-state.h:52
static XED_INLINE xed_bool_t xed_state_real_mode(const xed_state_t *p)
Definition: xed-state.h:124
static XED_INLINE xed_address_width_enum_t xed_state_get_stack_address_width(const xed_state_t *p)
Return the STACK address width.
Definition: xed-state.h:197
static XED_INLINE void xed_state_zero(xed_state_t *p)
clear the xed_state_t
Definition: xed-state.h:101
static XED_INLINE xed_bool_t xed_state_mode_width_32(const xed_state_t *p)
Definition: xed-state.h:135
static XED_INLINE void xed_state_init(xed_state_t *p, xed_machine_mode_enum_t arg_mmode, xed_address_width_enum_t arg_ignored, xed_address_width_enum_t arg_stack_addr_width)
Constructor.
Definition: xed-state.h:73
static XED_INLINE xed_machine_mode_enum_t xed_state_get_machine_mode(const xed_state_t *p)
return the machine mode
Definition: xed-state.h:112
static XED_INLINE xed_bool_t xed_state_long64_mode(const xed_state_t *p)
true iff the machine is in LONG_64 mode
Definition: xed-state.h:119
static XED_INLINE void xed_state_set_stack_address_width(xed_state_t *p, xed_address_width_enum_t arg_addr_width)
set the STACK address width
Definition: xed-state.h:189
xed_machine_mode_enum_t
xed_machine_mode_enum_t mmode
real architected machine modes
Definition: xed-state.h:54
#define XED_DLL_EXPORT