- Main Page
- Modules
- Data Structures
- Files

- Search for |

- File List
- Globals

# xed-immdis.h

Go to the documentation of this file.

    00001 /*BEGIN_LEGAL
    00002 Intel Open Source License
    00003
    00004 Copyright (c) 2002-2014 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
    00035
    00036 #ifndef _XED_IMMDIS_H_
    00037 # define _XED_IMMDIS_H_
    00038
    00039 #include "xed-types.h"
    00040 #include "xed-common-defs.h"
    00041 #include "xed-util.h"
    00042
    00043
    00045 // DEFINES
    00047
    00049 // TYPES
    00052 // PROTOTYPES
    00054
    00056 // GLOBALS
    00058
    00059 #define XED_MAX_IMMDIS_BYTES 8
    00060
    00061 // A union for speed of zeroing
    00062 union xed_immdis_values_t
    00063 {
    00064     xed_uint8_t x[XED_MAX_IMMDIS_BYTES];// STORED LITTLE ENDIAN. BYTE 0 is LSB
    00065     xed_uint64_t q;
    00066 };
    00067
    00069 typedef struct xed_immdis_s {
    00070     union xed_immdis_values_t value;
    00071     unsigned int currently_used_space :4; // current number of assigned bytes
    00072     unsigned int max_allocated_space :4; // max allocation, 4 or 8
    00073     xed_bool_t present : 1;
    00074     xed_bool_t immediate_is_unsigned : 1;
    00075 } xed_immdis_t;
    00076
    00077 XED_DLL_EXPORT void xed_immdis__check(xed_immdis_t* q, int p) ;
    00078
    00079
    00080 XED_DLL_EXPORT void xed_immdis_init(xed_immdis_t* p, int max_bytes);
    00081
    00083
    00084
    00085 XED_DLL_EXPORT unsigned int xed_immdis_get_bytes(const xed_immdis_t* p) ;
    00086
    00088
    00090
    00091 XED_DLL_EXPORT xed_int64_t
    00092 xed_immdis_get_signed64(const xed_immdis_t* p);
    00093
    00094 XED_DLL_EXPORT xed_uint64_t
    00095 xed_immdis_get_unsigned64(const xed_immdis_t* p);
    00096
    00097 XED_DLL_EXPORT xed_bool_t
    00098 xed_immdis_is_zero(const xed_immdis_t* p) ;
    00099
    00100 XED_DLL_EXPORT xed_bool_t
    00101 xed_immdis_is_one(const xed_immdis_t* p) ;
    00102
    00104 XED_DLL_EXPORT xed_uint8_t   xed_immdis_get_byte(const xed_immdis_t* p, unsigned int i) ;
    00106
    00108
    00109 XED_DLL_EXPORT void    xed_immdis_set_present(xed_immdis_t* p) ;
    00110
    00112 XED_DLL_EXPORT xed_bool_t    xed_immdis_is_present(const xed_immdis_t* p) ;
    00114
    00115
    00117
    00118 XED_DLL_EXPORT void     xed_immdis_set_max_len(xed_immdis_t* p, unsigned int mx) ;
    00119 XED_DLL_EXPORT void
    00120 xed_immdis_zero(xed_immdis_t* p);
    00121
    00122 XED_DLL_EXPORT unsigned int    xed_immdis_get_max_length(const xed_immdis_t* p) ;
    00123
    00125
    00127
    00128
    00129 XED_DLL_EXPORT xed_bool_t
    00130 xed_immdis_is_unsigned(const xed_immdis_t* p) ;
    00132 XED_DLL_EXPORT xed_bool_t
    00133 xed_immdis_is_signed(const xed_immdis_t* p) ;
    00134
    00136 XED_DLL_EXPORT void
    00137 xed_immdis_set_signed(xed_immdis_t* p) ;
    00139 XED_DLL_EXPORT void
    00140 xed_immdis_set_unsigned( xed_immdis_t* p) ;
    00142
    00143
    00145
    00146 XED_DLL_EXPORT void
    00147 xed_immdis_add_byte(xed_immdis_t* p, xed_uint8_t b);
    00148
    00149
    00150 XED_DLL_EXPORT void
    00151 xed_immdis_add_byte_array(xed_immdis_t* p, int nb, xed_uint8_t* ba);
    00152
    00162 XED_DLL_EXPORT void
    00163 xed_immdis_add_shortest_width_signed(xed_immdis_t* p, xed_int64_t x, xed_uint8_t legal_widths);
    00164
    00166 XED_DLL_EXPORT void
    00167 xed_immdis_add_shortest_width_unsigned(xed_immdis_t* p, xed_uint64_t x, xed_uint8_t legal_widths );
    00168
    00169
    00171 XED_DLL_EXPORT void
    00172 xed_immdis_add8(xed_immdis_t* p, xed_int8_t d);
    00173
    00175 XED_DLL_EXPORT void
    00176 xed_immdis_add16(xed_immdis_t* p, xed_int16_t d);
    00177
    00179 XED_DLL_EXPORT void
    00180 xed_immdis_add32(xed_immdis_t* p, xed_int32_t d);
    00181
    00183 XED_DLL_EXPORT void
    00184 xed_immdis_add64(xed_immdis_t* p, xed_int64_t d);
    00185
    00187
    00188
    00190
    00191
    00193 XED_DLL_EXPORT int xed_immdis_print(const xed_immdis_t* p, char* buf, int buflen);
    00194
    00197 XED_DLL_EXPORT int
    00198 xed_immdis_print_signed_or_unsigned(const xed_immdis_t* p, char* buf, int buflen);
    00199
    00201 XED_DLL_EXPORT int
    00202 xed_immdis_print_value_signed(const xed_immdis_t* p, char* buf, int buflen);
    00203
    00205 XED_DLL_EXPORT int
    00206 xed_immdis_print_value_unsigned(const xed_immdis_t* p, char* buf, int buflen);
    00207
    00208 int xed_immdis__print_ptr(const xed_immdis_t* p, char* buf, int buflen);
    00209 #endif
    00210
    00212
    00213