fcml  1.2.2
fcml_common.hpp
Go to the documentation of this file.
1 /*
2  * FCML - Free Code Manipulation Library.
3  * Copyright (C) 2010-2020 Slawomir Wojtasiak
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
27 #ifndef FCML_COMMON_HPP_
28 #define FCML_COMMON_HPP_
29 
30 #include <stdlib.h>
31 #include <string.h>
32 #include <new>
33 #include <iostream>
34 #include <sstream>
35 #include <stdexcept>
36 #include <memory>
37 #include <vector>
38 
39 #include "fcml_types.h"
40 #include "fcml_common.h"
41 #include "fcml_common_utils.h"
42 #include "fcml_errors.h"
43 
44 namespace fcml {
45 
46 #define FCML_TO_CPP_BOOL( x ) ( (x) ? true : false )
47 
53 typedef std::basic_string<fcml_char> fcml_cstring;
54 
59 typedef std::basic_ostringstream<fcml_char> fcml_costream;
60 
68 class Env {
69 public:
74  static fcml_string strDup( const fcml_string str ) {
75  if ( !str ) {
76  return NULL;
77  }
78 #if defined(FCML_MSCC)
79  fcml_string newStr = _strdup( str );
80 #else
81  fcml_string newStr = strdup( str );
82 #endif
83  if ( !newStr ) {
84  throw std::bad_alloc();
85  }
86  return newStr;
87  }
88  static void strFree( fcml_string str ) {
89  free( str );
90  }
91 };
92 
97 template <typename T>
98 class Iterator {
99 public:
100 
101  Iterator() {}
102 
103  virtual ~Iterator() {}
104 
108  virtual bool hasNext() = 0;
109 
113  virtual T next() = 0;
114 };
115 
119 template<typename T>
120 class Nullable {
121 public:
122 
123  Nullable( const T& value, bool is_not_null = true ) :
124  _value( value ), _is_not_null( is_not_null ) {
125  }
126 
127  Nullable() :
128  _is_not_null( false ) {
129  }
130 
131  bool isNotNull() const {
132  return _is_not_null;
133  }
134 
135  void setNotNull(bool isNull) {
136  _is_not_null = isNull;
137  }
138 
139  T getValue() const {
140  return _value;
141  }
142 
143  T& getValue() {
144  return _value;
145  }
146 
147  void setValue(const T& value) {
148  this->_value = value;
149  }
150 
151 public:
152 
160  bool operator==(const Nullable &nullable) const {
161  return _value == nullable._value &&
162  _is_not_null == nullable._is_not_null;
163  }
164 
172  bool operator!=(const Nullable &nullable) const {
173  return !(nullable == *this);
174  }
175 
176 private:
178  T _value;
180  bool _is_not_null;
181 };
182 
188 public:
190  this->_error = error;
191  }
192  BaseException( const fcml_cstring &msg, fcml_ceh_error error = FCML_CEH_GEC_NO_ERROR ) {
193  this->_msg = msg;
194  this->_error = error;
195  }
196  BaseException( const BaseException &cpy ) {
197  this->_msg = cpy._msg;
198  this->_error = cpy._error;
199  }
200  virtual ~BaseException() {
201  }
202  BaseException& operator=( const BaseException &exc ) {
203  if ( &exc != this ) {
204  this->_msg = exc._msg;
205  this->_error = exc._error;
206  }
207  return *this;
208  }
209 public:
210  const fcml_cstring getMsg() const {
211  return _msg;
212  }
213  const fcml_ceh_error& getError() const {
214  return _error;
215  }
216 private:
217  void* operator new( size_t size ) {
218  return ::operator new( size );
219  }
220 private:
222  fcml_cstring _msg;
224  fcml_ceh_error _error;
225 };
226 
232 public:
233  InitException( const fcml_cstring &msg, fcml_ceh_error error = FCML_CEH_GEC_NO_ERROR ) :
234  BaseException( msg, error ) {
235  }
236 };
237 
243 public:
244  BadArgumentException( const fcml_cstring &msg, fcml_ceh_error error = FCML_CEH_GEC_NO_ERROR ) :
245  BaseException( msg, error ) {
246  }
247 };
248 
254 public:
255  IllegalStateException( const fcml_cstring &msg, fcml_ceh_error error = FCML_CEH_GEC_NO_ERROR ) :
256  BaseException( msg, error ) {
257  }
258 };
259 
265 public:
266  IllegalArgumentException( const fcml_cstring &msg, fcml_ceh_error error = FCML_CEH_GEC_NO_ERROR ) :
267  BaseException( msg, error ) {
268  }
269 };
270 
276 public:
277  OperationNotSupportedException( const fcml_cstring &msg ) :
278  BaseException( msg ) {
279  }
281  }
282 };
283 
288 class NonCopyable {
289 protected:
290  NonCopyable() {
291  }
292 private:
296  NonCopyable( const NonCopyable &cpy ) {
298  }
302  NonCopyable& operator=( const NonCopyable &exc ) {
304  }
305 };
306 
313 private:
319  static InstructionPrefix create( fcml_prefixes prefix ) {
320  InstructionPrefix instructionPrefix;
321  instructionPrefix._prefix = prefix;
322  return instructionPrefix;
323  }
324 public:
329  static const InstructionPrefix LOCK() {
330  return create(FCML_PREFIX_LOCK);
331  }
336  static const InstructionPrefix REPNE() {
337  return create(FCML_PREFIX_REPNE);
338  }
343  static const InstructionPrefix REPNZ() {
344  return create(FCML_PREFIX_REPNZ);
345  }
350  static const InstructionPrefix REP() {
351  return create(FCML_PREFIX_REP);
352  }
357  static const InstructionPrefix REPE() {
358  return create(FCML_PREFIX_REPE);
359  }
364  static const InstructionPrefix REPZ() {
365  return create(FCML_PREFIX_REPZ);
366  }
371  static const InstructionPrefix XACQUIRE() {
372  return create(FCML_PREFIX_XACQUIRE);
373  }
378  static const InstructionPrefix XRELEASE() {
379  return create(FCML_PREFIX_XRELEASE);
380  }
386  return create(FCML_PREFIX_BRANCH_HINT);
387  }
393  return create(FCML_PREFIX_NOBRANCH_HINT);
394  }
395 public:
396  fcml_prefixes _prefix;
397 };
398 
403 private:
409  _hint(hints) {
410  }
411 public:
416  static const InstructionHint NO_HINTS() {
418  }
423  static const InstructionHint NEAR_POINTER() {
425  }
430  static const InstructionHint FAR_POINTER() {
432  }
439  }
446  }
453  }
454 public:
456 };
457 
461 struct OperandHint {
462 private:
464  _hint(hint) {
465  }
466 public:
471  static const OperandHint UNDEFIEND() {
473  }
478  static const OperandHint MULTIMEDIA() {
480  }
487  }
492  static const OperandHint PSEUDO_OPCODE() {
494  }
501  }
508  }
513  static const OperandHint SIB_ENCODING() {
515  }
516 public:
517  fcml_en_operand_hints _hint;
518 };
519 
524 class EntryPoint {
525 public:
526 
532  OM_16_BIT = FCML_OM_16_BIT,
533  OM_32_BIT = FCML_OM_32_BIT,
534  OM_64_BIT = FCML_OM_64_BIT
535  };
536 
542  _opMode(OM_32_BIT),
543  _addressSizeAttribute(FCML_DS_32),
544  _operandSizeAttribute(FCML_DS_32),
545  _ip(0) {
546  }
547 
556  EntryPoint(OperatingMode opMode, fcml_ip ip = 0, fcml_usize addressSizeAttribute = FCML_DS_UNDEF, fcml_usize operandSizeAttribute = FCML_DS_UNDEF ) :
557  _opMode(opMode),
558  _addressSizeAttribute(addressSizeAttribute),
559  _operandSizeAttribute(operandSizeAttribute),
560  _ip(ip) {
561  }
562 
563  virtual ~EntryPoint() {
564  }
565 
566 public:
567 
575  bool operator==( const EntryPoint &ep ) const {
576  return _opMode == ep._opMode &&
577  _ip == ep._ip &&
578  _operandSizeAttribute == ep._operandSizeAttribute &&
579  _addressSizeAttribute == ep._addressSizeAttribute;
580  }
581 
589  bool operator!=( const EntryPoint &ep ) const {
590  return !(ep == *this);
591  }
592 
593 public:
594 
601  fcml_usize getAddressSizeAttribute() const {
602  return _addressSizeAttribute;
603  }
604 
611  void setAddressSizeAttribute( fcml_usize addressSizeAttribute ) {
612  _addressSizeAttribute = addressSizeAttribute;
613  }
614 
621  fcml_usize getOperandSizeAttribute() const {
622  return _operandSizeAttribute;
623  }
624 
631  void setOperandSizeAttribute( fcml_usize operandSizeAttribute ) {
632  _operandSizeAttribute = operandSizeAttribute;
633  }
634 
641  fcml_ip getIP() const {
642  return _ip;
643  }
644 
651  void setIP( fcml_ip ip ) {
652  _ip = ip;
653  }
654 
662  return _opMode;
663  }
664 
671  void setOpMode( OperatingMode opMode ) {
672  _opMode = opMode;
673  }
674 
681  void incrementIP( fcml_ip ip ) {
682  _ip += ip;
683  }
684 
685 private:
687  OperatingMode _opMode;
689  fcml_usize _addressSizeAttribute;
691  fcml_usize _operandSizeAttribute;
693  fcml_ip _ip;
694 };
695 
700 class Integer {
701 public:
702 
705  _size( FCML_DS_64 ), _isSigned( FCML_FALSE ), _vint8( 0 ), _vint16( 0 ), _vint32( 0 ), _vint64( 0 ) {
706  }
707 
709  Integer( fcml_int8_t value ) :
710  _size( FCML_DS_8 ), _isSigned( FCML_TRUE ), _vint8( value ), _vint16( 0 ), _vint32( 0 ), _vint64( 0 ) {
711  }
712 
714  Integer( fcml_int16_t value ) :
715  _size( FCML_DS_16 ), _isSigned( FCML_TRUE ), _vint8( 0 ), _vint16( value ), _vint32( 0 ), _vint64( 0 ) {
716  }
717 
719  Integer( fcml_int32_t value ) :
720  _size( FCML_DS_32 ), _isSigned( FCML_TRUE ), _vint8( 0 ), _vint16( 0 ), _vint32( value ), _vint64( 0 ) {
721  }
722 
724  Integer( fcml_int64_t value ) :
725  _size( FCML_DS_64 ), _isSigned( FCML_TRUE ), _vint8( 0 ), _vint16( 0 ), _vint32( 0 ), _vint64( value ) {
726  }
727 
729  Integer( fcml_uint8_t value ) :
730  _size( FCML_DS_8 ), _isSigned( FCML_FALSE ), _vint8( static_cast<fcml_uint8_t>( value ) ), _vint16( 0 ), _vint32( 0 ), _vint64( 0 ) {
731  }
732 
734  Integer( fcml_uint16_t value ) :
735  _size( FCML_DS_16 ), _isSigned( FCML_FALSE ), _vint8( 0 ), _vint16( static_cast<fcml_uint16_t>( value ) ), _vint32( 0 ), _vint64( 0 ) {
736  }
737 
739  Integer( fcml_uint32_t value ) :
740  _size( FCML_DS_32 ), _isSigned( FCML_FALSE ), _vint8( 0 ), _vint16( 0 ), _vint32( static_cast<fcml_uint32_t>( value ) ), _vint64( 0 ) {
741  }
742 
744  Integer( fcml_uint64_t value ) :
745  _size( FCML_DS_64 ), _isSigned( FCML_FALSE ), _vint8( 0 ), _vint16( 0 ), _vint32( 0 ), _vint64( static_cast<fcml_uint64_t>( value ) ) {
746  }
747 
749  virtual ~Integer() {
750  }
751 
752 public:
753 
755  fcml_int16_t getInt16() const {
756  return _vint16;
757  }
758 
760  Integer& setInt16( fcml_int16_t int16 ) {
761  _vint16 = int16;
762  return *this;
763  }
764 
766  fcml_int32_t getInt32() const {
767  return _vint32;
768  }
769 
771  Integer& setInt32( fcml_int32_t int32 ) {
772  _vint32 = int32;
773  return *this;
774  }
775 
777  fcml_int64_t getInt64() const {
778  return _vint64;
779  }
780 
782  Integer& setInt64( fcml_int64_t int64 ) {
783  _vint64 = int64;
784  return *this;
785  }
786 
788  fcml_int8_t getInt8() const {
789  return _vint8;
790  }
791 
793  Integer& setInt8( fcml_int8_t int8 ) {
794  _vint8 = int8;
795  return *this;
796  }
797 
799  fcml_bool isSigned() const {
800  return _isSigned;
801  }
802 
804  Integer& setSigned( fcml_bool isSigned ) {
805  _isSigned = isSigned;
806  return *this;
807  }
808 
810  fcml_usize getSize() const {
811  return _size;
812  }
813 
815  Integer& setSize( fcml_usize size ) {
816  _size = size;
817  return *this;
818  }
819 
827  bool operator==( const fcml_uint8_t value ) const {
828  return _isSigned ? static_cast<fcml_int64_t>( *this ) == static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) == static_cast<fcml_uint64_t>( value );
829  }
830 
838  bool operator==( const fcml_int8_t value ) const {
839  return _isSigned ? static_cast<fcml_int64_t>( *this ) == static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) == static_cast<fcml_uint64_t>( value );
840  }
841 
849  bool operator==( const fcml_uint16_t value ) const {
850  return _isSigned ? static_cast<fcml_int64_t>( *this ) == static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) == static_cast<fcml_uint64_t>( value );
851  }
852 
860  bool operator==( const fcml_int16_t value ) const {
861  return _isSigned ? static_cast<fcml_int64_t>( *this ) == static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) == static_cast<fcml_uint64_t>( value );
862  }
863 
871  bool operator==( const fcml_uint32_t value ) const {
872  return _isSigned ? static_cast<fcml_int64_t>( *this ) == static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) == static_cast<fcml_uint64_t>( value );
873  }
874 
882  bool operator==( const fcml_int32_t value ) const {
883  return _isSigned ? static_cast<fcml_int64_t>( *this ) == static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) == static_cast<fcml_uint64_t>( value );
884  }
885 
893  bool operator==( const fcml_uint64_t value ) const {
894  return _isSigned ? static_cast<fcml_int64_t>( *this ) == static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) == static_cast<fcml_uint64_t>( value );
895  }
896 
904  bool operator==( const fcml_int64_t value ) const {
905  return _isSigned ? static_cast<fcml_int64_t>( *this ) == static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) == static_cast<fcml_uint64_t>( value );
906  }
907 
915  bool operator==( const Integer &value ) const {
916  return _isSigned ? static_cast<fcml_int64_t>( *this ) == static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) == static_cast<fcml_uint64_t>( value );
917  }
918 
926  bool operator!=( const fcml_uint8_t value ) const {
927  return _isSigned ? static_cast<fcml_int64_t>( *this ) != static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) != static_cast<fcml_uint64_t>( value );
928  }
929 
937  bool operator!=( const fcml_int8_t value ) const {
938  return _isSigned ? static_cast<fcml_int64_t>( *this ) != static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) != static_cast<fcml_uint64_t>( value );
939  }
940 
948  bool operator!=( const fcml_uint16_t value ) const {
949  return _isSigned ? static_cast<fcml_int64_t>( *this ) != static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) != static_cast<fcml_uint64_t>( value );
950  }
951 
959  bool operator!=( const fcml_int16_t value ) const {
960  return _isSigned ? static_cast<fcml_int64_t>( *this ) != static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) != static_cast<fcml_uint64_t>( value );
961  }
962 
970  bool operator!=( const fcml_uint32_t value ) const {
971  return _isSigned ? static_cast<fcml_int64_t>( *this ) != static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) != static_cast<fcml_uint64_t>( value );
972  }
973 
981  bool operator!=( const fcml_int32_t value ) const {
982  return _isSigned ? static_cast<fcml_int64_t>( *this ) != static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) != static_cast<fcml_uint64_t>( value );
983  }
984 
992  bool operator!=( const fcml_uint64_t value ) const {
993  return _isSigned ? static_cast<fcml_int64_t>( *this ) != static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) != static_cast<fcml_uint64_t>( value );
994  }
995 
1003  bool operator!=( const fcml_int64_t value ) const {
1004  return _isSigned ? static_cast<fcml_int64_t>( *this ) != static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) != static_cast<fcml_uint64_t>( value );
1005  }
1006 
1014  bool operator!=( const Integer &value ) const {
1015  return _isSigned ? static_cast<fcml_int64_t>( *this ) != static_cast<fcml_int64_t>( value ) : static_cast<fcml_uint64_t>( *this ) != static_cast<fcml_uint64_t>( value );
1016  }
1017 
1023  operator fcml_int8_t() const {
1024  fcml_int8_t result;
1025  switch ( _size ) {
1026  case FCML_DS_8:
1027  result = static_cast<fcml_int8_t>( _isSigned ? _vint8 : (fcml_uint8_t)_vint8 );
1028  break;
1029  case FCML_DS_16:
1030  result = static_cast<fcml_int8_t>( _isSigned ? _vint16 : (fcml_uint16_t)_vint16 );
1031  break;
1032  case FCML_DS_32:
1033  result = static_cast<fcml_int8_t>( _isSigned ? _vint32 : (fcml_uint32_t)_vint32 );
1034  break;
1035  case FCML_DS_64:
1036  result = static_cast<fcml_int8_t>( _isSigned ? _vint64 : (fcml_uint64_t)_vint64 );
1037  break;
1038  default:
1039  throw BadArgumentException( FCML_TEXT( "Wrong size." ) );
1040  }
1041  return result;
1042  }
1048  operator fcml_uint8_t() const {
1049  fcml_uint8_t result;
1050  switch ( _size ) {
1051  case FCML_DS_8:
1052  result = static_cast<fcml_uint8_t>( _isSigned ? _vint8 : (fcml_uint8_t)_vint8 );
1053  break;
1054  case FCML_DS_16:
1055  result = static_cast<fcml_uint8_t>( _isSigned ? _vint16 : (fcml_uint16_t)_vint16 );
1056  break;
1057  case FCML_DS_32:
1058  result = static_cast<fcml_uint8_t>( _isSigned ? _vint32 : (fcml_uint32_t)_vint32 );
1059  break;
1060  case FCML_DS_64:
1061  result = static_cast<fcml_uint8_t>( _isSigned ? _vint64 : (fcml_uint64_t)_vint64 );
1062  break;
1063  default:
1064  throw BadArgumentException( FCML_TEXT( "Wrong size." ) );
1065  }
1066  return result;
1067  }
1068 
1074  operator fcml_int16_t() const {
1075  fcml_int16_t result;
1076  switch ( _size ) {
1077  case FCML_DS_8:
1078  result = static_cast<fcml_int16_t>( _isSigned ? _vint8 : (fcml_uint8_t)_vint8 );
1079  break;
1080  case FCML_DS_16:
1081  result = static_cast<fcml_int16_t>( _isSigned ? _vint16 : (fcml_uint16_t)_vint16 );
1082  break;
1083  case FCML_DS_32:
1084  result = static_cast<fcml_int16_t>( _isSigned ? _vint32 : (fcml_uint32_t)_vint32 );
1085  break;
1086  case FCML_DS_64:
1087  result = static_cast<fcml_int16_t>( _isSigned ? _vint64 : (fcml_uint64_t)_vint64 );
1088  break;
1089  default:
1090  throw BadArgumentException( FCML_TEXT( "Wrong size." ) );
1091  }
1092  return result;
1093  }
1094 
1100  operator fcml_uint16_t() const {
1101  fcml_uint16_t result;
1102  switch ( _size ) {
1103  case FCML_DS_8:
1104  result = static_cast<fcml_uint16_t>( _isSigned ? _vint8 : (fcml_uint8_t)_vint8 );
1105  break;
1106  case FCML_DS_16:
1107  result = static_cast<fcml_uint16_t>( _isSigned ? _vint16 : (fcml_uint16_t)_vint16 );
1108  break;
1109  case FCML_DS_32:
1110  result = static_cast<fcml_uint16_t>( _isSigned ? _vint32 : (fcml_uint32_t)_vint32 );
1111  break;
1112  case FCML_DS_64:
1113  result = static_cast<fcml_uint16_t>( _isSigned ? _vint64 : (fcml_uint64_t)_vint64 );
1114  break;
1115  default:
1116  throw BadArgumentException( FCML_TEXT( "Wrong size." ) );
1117  }
1118  return result;
1119  }
1120 
1126  operator fcml_int32_t() const {
1127  fcml_int32_t result;
1128  switch ( _size ) {
1129  case FCML_DS_8:
1130  result = static_cast<fcml_int32_t>( _isSigned ? _vint8 : (fcml_uint8_t)_vint8 );
1131  break;
1132  case FCML_DS_16:
1133  result = static_cast<fcml_int32_t>( _isSigned ? _vint16 : (fcml_uint16_t)_vint16 );
1134  break;
1135  case FCML_DS_32:
1136  result = static_cast<fcml_int32_t>( _isSigned ? _vint32 : (fcml_uint32_t)_vint32 );
1137  break;
1138  case FCML_DS_64:
1139  result = static_cast<fcml_int32_t>( _isSigned ? _vint64 : (fcml_uint64_t)_vint64 );
1140  break;
1141  default:
1142  throw BadArgumentException( FCML_TEXT( "Wrong size." ) );
1143  }
1144  return result;
1145  }
1146 
1152  operator fcml_uint32_t() const {
1153  fcml_uint32_t result;
1154  switch ( _size ) {
1155  case FCML_DS_8:
1156  result = static_cast<fcml_uint32_t>( _isSigned ? _vint8 : (fcml_uint8_t)_vint8 );
1157  break;
1158  case FCML_DS_16:
1159  result = static_cast<fcml_uint32_t>( _isSigned ? _vint16 : (fcml_uint16_t)_vint16 );
1160  break;
1161  case FCML_DS_32:
1162  result = static_cast<fcml_uint32_t>( _isSigned ? _vint32 : (fcml_uint32_t)_vint32 );
1163  break;
1164  case FCML_DS_64:
1165  result = static_cast<fcml_uint32_t>( _isSigned ? _vint64 : (fcml_uint64_t)_vint64 );
1166  break;
1167  default:
1168  throw BadArgumentException( FCML_TEXT( "Wrong size." ) );
1169  }
1170  return result;
1171  }
1172 
1178  operator fcml_int64_t() const {
1179  fcml_int64_t result;
1180  switch ( _size ) {
1181  case FCML_DS_8:
1182  result = static_cast<fcml_int64_t>( _isSigned ? _vint8 : (fcml_uint8_t)_vint8 );
1183  break;
1184  case FCML_DS_16:
1185  result = static_cast<fcml_int64_t>( _isSigned ? _vint16 : (fcml_uint16_t)_vint16 );
1186  break;
1187  case FCML_DS_32:
1188  result = static_cast<fcml_int64_t>( _isSigned ? _vint32 : (fcml_uint32_t)_vint32 );
1189  break;
1190  case FCML_DS_64:
1191  result = static_cast<fcml_int64_t>( _isSigned ? _vint64 : (fcml_uint64_t)_vint64 );
1192  break;
1193  default:
1194  throw BadArgumentException( FCML_TEXT( "Wrong size." ) );
1195  }
1196  return result;
1197  }
1198 
1204  operator fcml_uint64_t() const {
1205  fcml_uint64_t result;
1206  switch ( _size ) {
1207  case FCML_DS_8:
1208  result = static_cast<fcml_uint64_t>( _isSigned ? _vint8 : (fcml_uint8_t)_vint8 );
1209  break;
1210  case FCML_DS_16:
1211  result = static_cast<fcml_uint64_t>( _isSigned ? _vint16 : (fcml_uint16_t)_vint16 );
1212  break;
1213  case FCML_DS_32:
1214  result = static_cast<fcml_uint64_t>( _isSigned ? _vint32 : (fcml_uint32_t)_vint32 );
1215  break;
1216  case FCML_DS_64:
1217  result = static_cast<fcml_uint64_t>( _isSigned ? _vint64 : (fcml_uint64_t)_vint64 );
1218  break;
1219  default:
1220  throw BadArgumentException( FCML_TEXT( "Wrong size." ) );
1221  }
1222  return result;
1223  }
1224 
1229  Integer& operator +=( const Integer &arg ) {
1230  plus( *this, arg );
1231  return ( *this );
1232  }
1233 
1238  Integer& operator *=( const Integer &arg ) {
1239  mul( *this, arg );
1240  return ( *this );
1241  }
1242 
1247  Integer& operator /=( const Integer &arg ) {
1248  div( *this, arg );
1249  return ( *this );
1250  }
1251 
1256  Integer& operator -=( const Integer &arg ) {
1257  minus( *this, arg );
1258  return ( *this );
1259  }
1260 
1265  Integer operator+( const Integer &src ) const {
1266  const Integer &thisRef = *this;
1267  Integer result( thisRef );
1268  plus( result, src );
1269  return result;
1270  }
1271 
1276  Integer operator-( const Integer &src ) const {
1277  const Integer &thisRef = *this;
1278  Integer result( thisRef );
1279  minus( result, src );
1280  return result;
1281  }
1282 
1287  Integer operator*( const Integer &src ) const {
1288  const Integer &thisRef = *this;
1289  Integer result( thisRef );
1290  mul( result, src );
1291  return result;
1292  }
1293 
1298  Integer operator/( const Integer &src ) const {
1299  const Integer &thisRef = *this;
1300  Integer result( thisRef );
1301  div( result, src );
1302  return result;
1303  }
1304 
1305 public:
1306 
1313  static Integer int8( fcml_int8_t value ) {
1314  return Integer( value );
1315  }
1316 
1323  static Integer uint8( fcml_uint8_t value ) {
1324  return Integer( value );
1325  }
1326 
1333  static Integer int16( fcml_int16_t value ) {
1334  return Integer( value );
1335  }
1336 
1343  static Integer uint16( fcml_uint16_t value ) {
1344  return Integer( value );
1345  }
1346 
1353  static Integer int32( fcml_int32_t value ) {
1354  return Integer( value );
1355  }
1356 
1363  static Integer uint32( fcml_uint32_t value ) {
1364  return Integer( value );
1365  }
1366 
1373  static Integer int64( fcml_int64_t value ) {
1374  return Integer( value );
1375  }
1376 
1383  static Integer uint64( fcml_uint64_t value ) {
1384  return Integer( value );
1385  }
1386 
1387 private:
1388 
1393  void minus( Integer &result, const Integer &src ) const {
1394  callMathExpression( &doMinus, &doUMinus, result, src );
1395  }
1396 
1401  void mul( Integer &result, const Integer &src ) const {
1402  callMathExpression( &doMul, &doUMul, result, src );
1403  }
1404 
1409  void div( Integer &result, const Integer &src ) const {
1410  callMathExpression( &doDiv, &doUDiv, result, src );
1411  }
1412 
1417  void plus( Integer &result, const Integer &src ) const {
1418  callMathExpression( &doPlus, &doUPlus, result, src );
1419  }
1420 
1421 private:
1422 
1427  static fcml_int64_t doPlus( fcml_int64_t thisValue, fcml_int64_t thatValue ) {
1428  return thisValue + thatValue;
1429  }
1430 
1435  static fcml_int64_t doMinus( fcml_int64_t thisValue, fcml_int64_t thatValue ) {
1436  return thisValue - thatValue;
1437  }
1438 
1443  static fcml_int64_t doMul( fcml_int64_t thisValue, fcml_int64_t thatValue ) {
1444  return thisValue * thatValue;
1445  }
1446 
1451  static fcml_int64_t doDiv( fcml_int64_t thisValue, fcml_int64_t thatValue ) {
1452  return thisValue / thatValue;
1453  }
1454 
1459  static fcml_uint64_t doUPlus( fcml_uint64_t thisValue, fcml_uint64_t thatValue ) {
1460  return thisValue + thatValue;
1461  }
1462 
1467  static fcml_uint64_t doUMinus( fcml_uint64_t thisValue, fcml_uint64_t thatValue ) {
1468  return thisValue - thatValue;
1469  }
1470 
1475  static fcml_uint64_t doUMul( fcml_uint64_t thisValue, fcml_uint64_t thatValue ) {
1476  return thisValue * thatValue;
1477  }
1478 
1483  static fcml_uint64_t doUDiv( fcml_uint64_t thisValue, fcml_uint64_t thatValue ) {
1484  return thisValue / thatValue;
1485  }
1486 
1491  void callMathExpression( fcml_int64_t (*signedExpressionFn)( fcml_int64_t thisValue, fcml_int64_t thatValue ),
1492  fcml_uint64_t (*unsignedExpressionFn)( fcml_uint64_t thisValue, fcml_uint64_t thatValue ),
1493  Integer &result, const Integer &src ) const {
1494 
1495  if( _isSigned ) {
1496 
1497  fcml_int64_t thisValue;
1498  fcml_int64_t thatValue;
1499 
1500  // Prepare "that". It has to be converted to the same sign.
1501  switch( src._size ) {
1502  case FCML_DS_8:
1503  thatValue = src._isSigned ? src._vint8 : static_cast<fcml_uint8_t>( src._vint8 );
1504  break;
1505  case FCML_DS_16:
1506  thatValue = src._isSigned ? src._vint16 : static_cast<fcml_uint16_t>( src._vint16 );
1507  break;
1508  case FCML_DS_32:
1509  thatValue = src._isSigned ? src._vint32 : static_cast<fcml_uint32_t>( src._vint32 );
1510  break;
1511  case FCML_DS_64:
1512  thatValue = src._isSigned ? src._vint64 : static_cast<fcml_uint64_t>( src._vint64 );
1513  break;
1514  }
1515 
1516  // Now "this".
1517  switch( result._size ) {
1518  case FCML_DS_8:
1519  thisValue = result._isSigned ? result._vint8 : static_cast<fcml_uint8_t>(result._vint8 );
1520  thisValue = (*signedExpressionFn)( thisValue, thatValue );
1521  result._vint8 = static_cast<fcml_int8_t>( thisValue );
1522  break;
1523  case FCML_DS_16:
1524  thisValue = result._isSigned ? result._vint16 : static_cast<fcml_uint16_t>( result._vint16 );
1525  thisValue = (*signedExpressionFn)( thisValue, thatValue );
1526  result._vint16 = static_cast<fcml_int16_t>( thisValue );
1527  break;
1528  case FCML_DS_32:
1529  thisValue = result._isSigned ? result._vint32 : static_cast<fcml_uint32_t>( result._vint32 );
1530  thisValue = (*signedExpressionFn)( thisValue, thatValue );
1531  result._vint32 = static_cast<fcml_int32_t>( thisValue );
1532  break;
1533  case FCML_DS_64:
1534  thisValue = result._isSigned ? result._vint64 : static_cast<fcml_uint64_t>( result._vint64 );
1535  thisValue = (*signedExpressionFn)( thisValue, thatValue );
1536  result._vint64 = thisValue;
1537  break;
1538  }
1539 
1540  } else {
1541 
1542  fcml_uint64_t thisValue;
1543  fcml_uint64_t thatValue;
1544 
1545  // Prepare "that". It has to be converted to the same sign.
1546  switch( src._size ) {
1547  case FCML_DS_8:
1548  thatValue = src._isSigned ? src._vint8 : static_cast<fcml_uint8_t>( src._vint8 );
1549  break;
1550  case FCML_DS_16:
1551  thatValue = src._isSigned ? src._vint16 : static_cast<fcml_uint16_t>( src._vint16 );
1552  break;
1553  case FCML_DS_32:
1554  thatValue = src._isSigned ? src._vint32 : static_cast<fcml_uint32_t>( src._vint32 );
1555  break;
1556  case FCML_DS_64:
1557  thatValue = src._isSigned ? src._vint64 : static_cast<fcml_uint64_t>( src._vint64 );
1558  break;
1559  }
1560 
1561  // Now "this".
1562  switch( result._size ) {
1563  case FCML_DS_8:
1564  thisValue = result._isSigned ? result._vint8 : static_cast<fcml_uint8_t>( result._vint8 );
1565  thisValue = (*unsignedExpressionFn)( thisValue, thatValue );
1566  result._vint8 = static_cast<fcml_int8_t>( thisValue );
1567  break;
1568  case FCML_DS_16:
1569  thisValue = result._isSigned ? result._vint16 : static_cast<fcml_uint16_t>( result._vint16 );
1570  thisValue = (*unsignedExpressionFn)( thisValue, thatValue );
1571  result._vint16 = static_cast<fcml_int16_t>( thisValue );
1572  break;
1573  case FCML_DS_32:
1574  thisValue = result._isSigned ? result._vint32 : static_cast<fcml_uint32_t>( result._vint32 );
1575  thisValue = (*unsignedExpressionFn)( thisValue, thatValue );
1576  result._vint32 = static_cast<fcml_int32_t>( thisValue );
1577  break;
1578  case FCML_DS_64:
1579  thisValue = result._isSigned ? result._vint64 : static_cast<fcml_uint64_t>( result._vint64 );
1580  thisValue = (*unsignedExpressionFn)( thisValue, thatValue );
1581  result._vint64 = thisValue;
1582  break;
1583  }
1584  }
1585 
1586  }
1587 
1588 private:
1589  fcml_usize _size;
1590  fcml_bool _isSigned;
1591  fcml_int8_t _vint8;
1592  fcml_int16_t _vint16;
1593  fcml_int32_t _vint32;
1594  fcml_int64_t _vint64;
1595 };
1596 
1601 class Register {
1602 public:
1603 
1604  // TODO: Do we need this REG_ prefix here?
1610  REG_UNDEFINED = FCML_REG_UNDEFINED,
1612  REG_GPR = FCML_REG_GPR,
1614  REG_SIMD = FCML_REG_SIMD,
1616  REG_FPU = FCML_REG_FPU,
1618  REG_SEG = FCML_REG_SEG,
1620  REG_CR = FCML_REG_CR,
1622  REG_DR = FCML_REG_DR,
1624  REG_IP = FCML_REG_IP,
1628  REG_OPMASK = FCML_REG_OPMASK
1629  };
1630 
1636  _type(REG_UNDEFINED),
1637  _size(0),
1638  _reg(0),
1639  _x64_exp(FCML_FALSE) {
1640  }
1641 
1647  Register( const fcml_st_register &reg ) :
1648  _type(static_cast<RegisterType>( reg.type )),
1649  _size(reg.size),
1650  _reg(reg.reg),
1651  _x64_exp(reg.x64_exp? true : false) {
1652  }
1653 
1662  Register( fcml_uint8_t reg, fcml_usize size, RegisterType type = REG_GPR, fcml_bool x64_exp = FCML_FALSE ) :
1663  _type(type),
1664  _size(size),
1665  _reg(reg),
1666  _x64_exp(x64_exp?true:false) {
1667  }
1668 
1672  virtual ~Register() {
1673  }
1674 
1675 public:
1676 
1682  fcml_uint8_t getReg() const {
1683  return _reg;
1684  }
1685 
1691  void setReg( fcml_uint8_t reg ) {
1692  _reg = reg;
1693  }
1694 
1700  fcml_usize getSize() const {
1701  return _size;
1702  }
1703 
1709  void setSize( fcml_usize size ) {
1710  _size = size;
1711  }
1712 
1719  return _type;
1720  }
1721 
1727  void setType( RegisterType type ) {
1728  _type = type;
1729  }
1730 
1736  bool getX64Exp() const {
1737  return _x64_exp;
1738  }
1739 
1745  void setX64Exp( bool x64Exp ) {
1746  _x64_exp = x64Exp;
1747  }
1748 
1749 public:
1750 
1757  bool operator==( const Register &reg ) const {
1758  return _reg == reg._reg && _type == reg._type && _size == reg._size && _x64_exp == reg._x64_exp;
1759  }
1760 
1767  bool operator!=( const Register &reg ) const {
1768  return !( reg == *this );
1769  }
1770 
1771 public:
1772 
1778  static const Register UNDEF() {
1779  Register reg( 0, 0, Register::REG_UNDEFINED, FCML_FALSE );
1780  return reg;
1781  }
1782 
1788  static const Register AL() {
1789  Register reg( ::fcml_reg_AL );
1790  return reg;
1791  }
1792 
1798  static const Register AX() {
1799  Register reg( ::fcml_reg_AX );
1800  return reg;
1801  }
1802 
1808  static const Register EAX() {
1809  Register reg( ::fcml_reg_EAX );
1810  return reg;
1811  }
1812 
1818  static const Register RAX() {
1819  Register reg( ::fcml_reg_RAX );
1820  return reg;
1821  }
1822 
1828  static const Register MM0() {
1829  Register reg( ::fcml_reg_MM0 );
1830  return reg;
1831  }
1832 
1838  static const Register XMM0() {
1839  Register reg( ::fcml_reg_XMM0 );
1840  return reg;
1841  }
1842 
1848  static const Register YMM0() {
1849  Register reg( ::fcml_reg_YMM0 );
1850  return reg;
1851  }
1852 
1858  static const Register ZMM0() {
1859  Register reg( ::fcml_reg_ZMM0 );
1860  return reg;
1861  }
1862 
1868  static const Register CL() {
1869  Register reg( ::fcml_reg_CL );
1870  return reg;
1871  }
1872 
1878  static const Register CX() {
1879  Register reg( ::fcml_reg_CX );
1880  return reg;
1881  }
1882 
1888  static const Register ECX() {
1889  Register reg( ::fcml_reg_ECX );
1890  return reg;
1891  }
1892 
1898  static const Register RCX() {
1899  Register reg( ::fcml_reg_RCX );
1900  return reg;
1901  }
1902 
1908  static const Register MM1() {
1909  Register reg( ::fcml_reg_MM1 );
1910  return reg;
1911  }
1912 
1918  static const Register XMM1() {
1919  Register reg( ::fcml_reg_XMM1 );
1920  return reg;
1921  }
1922 
1928  static const Register YMM1() {
1929  Register reg( ::fcml_reg_YMM1 );
1930  return reg;
1931  }
1932 
1938  static const Register ZMM1() {
1939  Register reg( ::fcml_reg_ZMM1 );
1940  return reg;
1941  }
1942 
1948  static const Register DL() {
1949  Register reg( ::fcml_reg_DL );
1950  return reg;
1951  }
1952 
1958  static const Register DX() {
1959  Register reg( ::fcml_reg_DX );
1960  return reg;
1961  }
1962 
1968  static const Register EDX() {
1969  Register reg( ::fcml_reg_EDX );
1970  return reg;
1971  }
1972 
1978  static const Register RDX() {
1979  Register reg( ::fcml_reg_RDX );
1980  return reg;
1981  }
1982 
1988  static const Register MM2() {
1989  Register reg( ::fcml_reg_MM2 );
1990  return reg;
1991  }
1992 
1998  static const Register XMM2() {
1999  Register reg( ::fcml_reg_XMM2 );
2000  return reg;
2001  }
2002 
2008  static const Register YMM2() {
2009  Register reg( ::fcml_reg_YMM2 );
2010  return reg;
2011  }
2012 
2018  static const Register ZMM2() {
2019  Register reg( ::fcml_reg_ZMM2 );
2020  return reg;
2021  }
2022 
2028  static const Register BL() {
2029  Register reg( ::fcml_reg_BL );
2030  return reg;
2031  }
2032 
2038  static const Register BX() {
2039  Register reg( ::fcml_reg_BX );
2040  return reg;
2041  }
2042 
2048  static const Register EBX() {
2049  Register reg( ::fcml_reg_EBX );
2050  return reg;
2051  }
2052 
2058  static const Register RBX() {
2059  Register reg( ::fcml_reg_RBX );
2060  return reg;
2061  }
2062 
2068  static const Register MM3() {
2069  Register reg( ::fcml_reg_MM3 );
2070  return reg;
2071  }
2072 
2078  static const Register XMM3() {
2079  Register reg( ::fcml_reg_XMM3 );
2080  return reg;
2081  }
2082 
2088  static const Register YMM3() {
2089  Register reg( ::fcml_reg_YMM3 );
2090  return reg;
2091  }
2092 
2098  static const Register ZMM3() {
2099  Register reg( ::fcml_reg_ZMM3 );
2100  return reg;
2101  }
2102 
2108  static const Register AH() {
2109  Register reg( ::fcml_reg_AH );
2110  return reg;
2111  }
2112 
2118  static const Register SPL() {
2119  Register reg( ::fcml_reg_SPL );
2120  return reg;
2121  }
2122 
2128  static const Register SP() {
2129  Register reg( ::fcml_reg_SP );
2130  return reg;
2131  }
2132 
2138  static const Register ESP() {
2139  Register reg( ::fcml_reg_ESP );
2140  return reg;
2141  }
2142 
2148  static const Register RSP() {
2149  Register reg( ::fcml_reg_RSP );
2150  return reg;
2151  }
2152 
2158  static const Register MM4() {
2159  Register reg( ::fcml_reg_MM4 );
2160  return reg;
2161  }
2162 
2168  static const Register XMM4() {
2169  Register reg( ::fcml_reg_XMM4 );
2170  return reg;
2171  }
2172 
2178  static const Register YMM4() {
2179  Register reg( ::fcml_reg_YMM4 );
2180  return reg;
2181  }
2182 
2188  static const Register ZMM4() {
2189  Register reg( ::fcml_reg_ZMM4 );
2190  return reg;
2191  }
2192 
2193 
2199  static const Register CH() {
2200  Register reg( ::fcml_reg_CH );
2201  return reg;
2202  }
2203 
2209  static const Register BPL() {
2210  Register reg( ::fcml_reg_BPL );
2211  return reg;
2212  }
2213 
2219  static const Register BP() {
2220  Register reg( ::fcml_reg_BP );
2221  return reg;
2222  }
2223 
2229  static const Register EBP() {
2230  Register reg( ::fcml_reg_EBP );
2231  return reg;
2232  }
2233 
2239  static const Register RBP() {
2240  Register reg( ::fcml_reg_RBP );
2241  return reg;
2242  }
2243 
2249  static const Register MM5() {
2250  Register reg( ::fcml_reg_MM5 );
2251  return reg;
2252  }
2253 
2259  static const Register XMM5() {
2260  Register reg( ::fcml_reg_XMM5 );
2261  return reg;
2262  }
2263 
2269  static const Register YMM5() {
2270  Register reg( ::fcml_reg_YMM5 );
2271  return reg;
2272  }
2273 
2279  static const Register ZMM5() {
2280  Register reg( ::fcml_reg_ZMM5 );
2281  return reg;
2282  }
2283 
2289  static const Register DH() {
2290  Register reg( ::fcml_reg_DH );
2291  return reg;
2292  }
2293 
2299  static const Register SIL() {
2300  Register reg( ::fcml_reg_SIL );
2301  return reg;
2302  }
2303 
2309  static const Register SI() {
2310  Register reg( ::fcml_reg_SI );
2311  return reg;
2312  }
2313 
2319  static const Register ESI() {
2320  Register reg( ::fcml_reg_ESI );
2321  return reg;
2322  }
2323 
2329  static const Register RSI() {
2330  Register reg( ::fcml_reg_RSI );
2331  return reg;
2332  }
2333 
2339  static const Register MM6() {
2340  Register reg( ::fcml_reg_MM6 );
2341  return reg;
2342  }
2343 
2349  static const Register XMM6() {
2350  Register reg( ::fcml_reg_XMM6 );
2351  return reg;
2352  }
2353 
2359  static const Register YMM6() {
2360  Register reg( ::fcml_reg_YMM6 );
2361  return reg;
2362  }
2363 
2369  static const Register ZMM6() {
2370  Register reg( ::fcml_reg_ZMM6 );
2371  return reg;
2372  }
2373 
2374 
2380  static const Register BH() {
2381  Register reg( ::fcml_reg_BH );
2382  return reg;
2383  }
2384 
2390  static const Register DIL() {
2391  Register reg( ::fcml_reg_DIL );
2392  return reg;
2393  }
2394 
2400  static const Register DI() {
2401  Register reg( ::fcml_reg_DI );
2402  return reg;
2403  }
2404 
2410  static const Register EDI() {
2411  Register reg( ::fcml_reg_EDI );
2412  return reg;
2413  }
2414 
2420  static const Register RDI() {
2421  Register reg( ::fcml_reg_RDI );
2422  return reg;
2423  }
2424 
2430  static const Register MM7() {
2431  Register reg( ::fcml_reg_MM7 );
2432  return reg;
2433  }
2434 
2440  static const Register XMM7() {
2441  Register reg( ::fcml_reg_XMM7 );
2442  return reg;
2443  }
2444 
2450  static const Register YMM7() {
2451  Register reg( ::fcml_reg_YMM7 );
2452  return reg;
2453  }
2454 
2460  static const Register ZMM7() {
2461  Register reg( ::fcml_reg_ZMM7 );
2462  return reg;
2463  }
2464 
2470  static const Register R8L() {
2471  Register reg( ::fcml_reg_R8L );
2472  return reg;
2473  }
2474 
2480  static const Register R8W() {
2481  Register reg( ::fcml_reg_R8W );
2482  return reg;
2483  }
2484 
2490  static const Register R8D() {
2491  Register reg( ::fcml_reg_R8D );
2492  return reg;
2493  }
2494 
2500  static const Register R8() {
2501  Register reg( ::fcml_reg_R8 );
2502  return reg;
2503  }
2504 
2510  static const Register XMM8() {
2511  Register reg( ::fcml_reg_XMM8 );
2512  return reg;
2513  }
2514 
2520  static const Register YMM8() {
2521  Register reg( ::fcml_reg_YMM8 );
2522  return reg;
2523  }
2524 
2530  static const Register ZMM8() {
2531  Register reg( ::fcml_reg_ZMM8 );
2532  return reg;
2533  }
2534 
2540  static const Register R9L() {
2541  Register reg( ::fcml_reg_R9L );
2542  return reg;
2543  }
2544 
2550  static const Register R9W() {
2551  Register reg( ::fcml_reg_R9W );
2552  return reg;
2553  }
2554 
2560  static const Register R9D() {
2561  Register reg( ::fcml_reg_R9D );
2562  return reg;
2563  }
2564 
2570  static const Register R9() {
2571  Register reg( ::fcml_reg_R9 );
2572  return reg;
2573  }
2574 
2580  static const Register XMM9() {
2581  Register reg( ::fcml_reg_XMM9 );
2582  return reg;
2583  }
2584 
2590  static const Register YMM9() {
2591  Register reg( ::fcml_reg_YMM9 );
2592  return reg;
2593  }
2594 
2600  static const Register ZMM9() {
2601  Register reg( ::fcml_reg_ZMM9 );
2602  return reg;
2603  }
2604 
2610  static const Register R10L() {
2611  Register reg( ::fcml_reg_R10L );
2612  return reg;
2613  }
2614 
2620  static const Register R10W() {
2621  Register reg( ::fcml_reg_R10W );
2622  return reg;
2623  }
2624 
2630  static const Register R10D() {
2631  Register reg( ::fcml_reg_R10D );
2632  return reg;
2633  }
2634 
2640  static const Register R10() {
2641  Register reg( ::fcml_reg_R10 );
2642  return reg;
2643  }
2644 
2650  static const Register XMM10() {
2651  Register reg( ::fcml_reg_XMM10 );
2652  return reg;
2653  }
2654 
2660  static const Register YMM10() {
2661  Register reg( ::fcml_reg_YMM10 );
2662  return reg;
2663  }
2664 
2670  static const Register ZMM10() {
2671  Register reg( ::fcml_reg_ZMM10 );
2672  return reg;
2673  }
2674 
2680  static const Register R11L() {
2681  Register reg( ::fcml_reg_R11L );
2682  return reg;
2683  }
2684 
2690  static const Register R11W() {
2691  Register reg( ::fcml_reg_R11W );
2692  return reg;
2693  }
2694 
2700  static const Register R11D() {
2701  Register reg( ::fcml_reg_R11D );
2702  return reg;
2703  }
2704 
2710  static const Register R11() {
2711  Register reg( ::fcml_reg_R11 );
2712  return reg;
2713  }
2714 
2720  static const Register XMM11() {
2721  Register reg( ::fcml_reg_XMM11 );
2722  return reg;
2723  }
2724 
2730  static const Register YMM11() {
2731  Register reg( ::fcml_reg_YMM11 );
2732  return reg;
2733  }
2734 
2740  static const Register ZMM11() {
2741  Register reg( ::fcml_reg_ZMM11 );
2742  return reg;
2743  }
2744 
2750  static const Register R12L() {
2751  Register reg( ::fcml_reg_R12L );
2752  return reg;
2753  }
2754 
2760  static const Register R12W() {
2761  Register reg( ::fcml_reg_R12W );
2762  return reg;
2763  }
2764 
2770  static const Register R12D() {
2771  Register reg( ::fcml_reg_R12D );
2772  return reg;
2773  }
2774 
2780  static const Register R12() {
2781  Register reg( ::fcml_reg_R12 );
2782  return reg;
2783  }
2784 
2790  static const Register XMM12() {
2791  Register reg( ::fcml_reg_XMM12 );
2792  return reg;
2793  }
2794 
2800  static const Register YMM12() {
2801  Register reg( ::fcml_reg_YMM12 );
2802  return reg;
2803  }
2804 
2810  static const Register ZMM12() {
2811  Register reg( ::fcml_reg_ZMM12 );
2812  return reg;
2813  }
2814 
2820  static const Register R13L() {
2821  Register reg( ::fcml_reg_R13L );
2822  return reg;
2823  }
2824 
2830  static const Register R13W() {
2831  Register reg( ::fcml_reg_R13W );
2832  return reg;
2833  }
2834 
2840  static const Register R13D() {
2841  Register reg( ::fcml_reg_R13D );
2842  return reg;
2843  }
2844 
2850  static const Register R13() {
2851  Register reg( ::fcml_reg_R13 );
2852  return reg;
2853  }
2854 
2860  static const Register XMM13() {
2861  Register reg( ::fcml_reg_XMM13 );
2862  return reg;
2863  }
2864 
2870  static const Register YMM13() {
2871  Register reg( ::fcml_reg_YMM13 );
2872  return reg;
2873  }
2874 
2880  static const Register ZMM13() {
2881  Register reg( ::fcml_reg_ZMM13 );
2882  return reg;
2883  }
2884 
2890  static const Register R14L() {
2891  Register reg( ::fcml_reg_R14L );
2892  return reg;
2893  }
2894 
2900  static const Register R14W() {
2901  Register reg( ::fcml_reg_R14W );
2902  return reg;
2903  }
2904 
2910  static const Register R14D() {
2911  Register reg( ::fcml_reg_R14D );
2912  return reg;
2913  }
2914 
2920  static const Register R14() {
2921  Register reg( ::fcml_reg_R14 );
2922  return reg;
2923  }
2924 
2930  static const Register XMM14() {
2931  Register reg( ::fcml_reg_XMM14 );
2932  return reg;
2933  }
2934 
2940  static const Register YMM14() {
2941  Register reg( ::fcml_reg_YMM14 );
2942  return reg;
2943  }
2944 
2950  static const Register ZMM14() {
2951  Register reg( ::fcml_reg_ZMM14 );
2952  return reg;
2953  }
2954 
2960  static const Register R15L() {
2961  Register reg( ::fcml_reg_R15L );
2962  return reg;
2963  }
2964 
2970  static const Register R15W() {
2971  Register reg( ::fcml_reg_R15W );
2972  return reg;
2973  }
2974 
2980  static const Register R15D() {
2981  Register reg( ::fcml_reg_R15D );
2982  return reg;
2983  }
2984 
2990  static const Register R15() {
2991  Register reg( ::fcml_reg_R15 );
2992  return reg;
2993  }
2994 
3000  static const Register XMM15() {
3001  Register reg( ::fcml_reg_XMM15 );
3002  return reg;
3003  }
3004 
3010  static const Register YMM15() {
3011  Register reg( ::fcml_reg_YMM15 );
3012  return reg;
3013  }
3014 
3020  static const Register ZMM15() {
3021  Register reg( ::fcml_reg_ZMM15 );
3022  return reg;
3023  }
3024 
3030  static const Register XMM16() {
3031  Register reg( ::fcml_reg_XMM16 );
3032  return reg;
3033  }
3034 
3040  static const Register YMM16() {
3041  Register reg( ::fcml_reg_YMM16 );
3042  return reg;
3043  }
3044 
3050  static const Register ZMM16() {
3051  Register reg( ::fcml_reg_ZMM16 );
3052  return reg;
3053  }
3054 
3060  static const Register XMM17() {
3061  Register reg( ::fcml_reg_XMM17 );
3062  return reg;
3063  }
3064 
3070  static const Register YMM17() {
3071  Register reg( ::fcml_reg_YMM17 );
3072  return reg;
3073  }
3074 
3080  static const Register ZMM17() {
3081  Register reg( ::fcml_reg_ZMM17 );
3082  return reg;
3083  }
3084 
3090  static const Register XMM18() {
3091  Register reg( ::fcml_reg_XMM18 );
3092  return reg;
3093  }
3094 
3100  static const Register YMM18() {
3101  Register reg( ::fcml_reg_YMM18 );
3102  return reg;
3103  }
3104 
3110  static const Register ZMM18() {
3111  Register reg( ::fcml_reg_ZMM18 );
3112  return reg;
3113  }
3114 
3120  static const Register XMM19() {
3121  Register reg( ::fcml_reg_XMM19 );
3122  return reg;
3123  }
3124 
3130  static const Register YMM19() {
3131  Register reg( ::fcml_reg_YMM19 );
3132  return reg;
3133  }
3134 
3140  static const Register ZMM19() {
3141  Register reg( ::fcml_reg_ZMM19 );
3142  return reg;
3143  }
3144 
3150  static const Register XMM20() {
3151  Register reg( ::fcml_reg_XMM20 );
3152  return reg;
3153  }
3154 
3160  static const Register YMM20() {
3161  Register reg( ::fcml_reg_YMM20 );
3162  return reg;
3163  }
3164 
3170  static const Register ZMM20() {
3171  Register reg( ::fcml_reg_ZMM20 );
3172  return reg;
3173  }
3174 
3180  static const Register XMM21() {
3181  Register reg( ::fcml_reg_XMM21 );
3182  return reg;
3183  }
3184 
3190  static const Register YMM21() {
3191  Register reg( ::fcml_reg_YMM21 );
3192  return reg;
3193  }
3194 
3200  static const Register ZMM21() {
3201  Register reg( ::fcml_reg_ZMM21 );
3202  return reg;
3203  }
3204 
3210  static const Register XMM22() {
3211  Register reg( ::fcml_reg_XMM22 );
3212  return reg;
3213  }
3214 
3220  static const Register YMM22() {
3221  Register reg( ::fcml_reg_YMM22 );
3222  return reg;
3223  }
3224 
3230  static const Register ZMM22() {
3231  Register reg( ::fcml_reg_ZMM22 );
3232  return reg;
3233  }
3234 
3240  static const Register XMM23() {
3241  Register reg( ::fcml_reg_XMM23 );
3242  return reg;
3243  }
3244 
3250  static const Register YMM23() {
3251  Register reg( ::fcml_reg_YMM23 );
3252  return reg;
3253  }
3254 
3260  static const Register ZMM23() {
3261  Register reg( ::fcml_reg_ZMM23 );
3262  return reg;
3263  }
3264 
3270  static const Register XMM24() {
3271  Register reg( ::fcml_reg_XMM24 );
3272  return reg;
3273  }
3274 
3280  static const Register YMM24() {
3281  Register reg( ::fcml_reg_YMM24 );
3282  return reg;
3283  }
3284 
3290  static const Register ZMM24() {
3291  Register reg( ::fcml_reg_ZMM24 );
3292  return reg;
3293  }
3294 
3300  static const Register XMM25() {
3301  Register reg( ::fcml_reg_XMM25 );
3302  return reg;
3303  }
3304 
3310  static const Register YMM25() {
3311  Register reg( ::fcml_reg_YMM25 );
3312  return reg;
3313  }
3314 
3320  static const Register ZMM25() {
3321  Register reg( ::fcml_reg_ZMM25 );
3322  return reg;
3323  }
3324 
3330  static const Register XMM26() {
3331  Register reg( ::fcml_reg_XMM26 );
3332  return reg;
3333  }
3334 
3340  static const Register YMM26() {
3341  Register reg( ::fcml_reg_YMM26 );
3342  return reg;
3343  }
3344 
3350  static const Register ZMM26() {
3351  Register reg( ::fcml_reg_ZMM26 );
3352  return reg;
3353  }
3354 
3360  static const Register XMM27() {
3361  Register reg( ::fcml_reg_XMM27 );
3362  return reg;
3363  }
3364 
3370  static const Register YMM27() {
3371  Register reg( ::fcml_reg_YMM27 );
3372  return reg;
3373  }
3374 
3380  static const Register ZMM27() {
3381  Register reg( ::fcml_reg_ZMM27 );
3382  return reg;
3383  }
3384 
3390  static const Register XMM28() {
3391  Register reg( ::fcml_reg_XMM28 );
3392  return reg;
3393  }
3394 
3400  static const Register YMM28() {
3401  Register reg( ::fcml_reg_YMM28 );
3402  return reg;
3403  }
3404 
3410  static const Register ZMM28() {
3411  Register reg( ::fcml_reg_ZMM28 );
3412  return reg;
3413  }
3414 
3420  static const Register XMM29() {
3421  Register reg( ::fcml_reg_XMM29 );
3422  return reg;
3423  }
3424 
3430  static const Register YMM29() {
3431  Register reg( ::fcml_reg_YMM29 );
3432  return reg;
3433  }
3434 
3440  static const Register ZMM29() {
3441  Register reg( ::fcml_reg_ZMM29 );
3442  return reg;
3443  }
3444 
3450  static const Register XMM30() {
3451  Register reg( ::fcml_reg_XMM30 );
3452  return reg;
3453  }
3454 
3460  static const Register YMM30() {
3461  Register reg( ::fcml_reg_YMM30 );
3462  return reg;
3463  }
3464 
3470  static const Register ZMM30() {
3471  Register reg( ::fcml_reg_ZMM30 );
3472  return reg;
3473  }
3474 
3480  static const Register XMM31() {
3481  Register reg( ::fcml_reg_XMM31 );
3482  return reg;
3483  }
3484 
3490  static const Register YMM31() {
3491  Register reg( ::fcml_reg_YMM31 );
3492  return reg;
3493  }
3494 
3500  static const Register ZMM31() {
3501  Register reg( ::fcml_reg_ZMM31 );
3502  return reg;
3503  }
3504 
3510  static const Register ES() {
3511  Register reg( ::fcml_reg_ES );
3512  return reg;
3513  }
3514 
3520  static const Register CS() {
3521  Register reg( ::fcml_reg_CS );
3522  return reg;
3523  }
3524 
3530  static const Register SS() {
3531  Register reg( ::fcml_reg_SS );
3532  return reg;
3533  }
3534 
3540  static const Register DS() {
3541  Register reg( ::fcml_reg_DS );
3542  return reg;
3543  }
3544 
3550  static const Register FS() {
3551  Register reg( ::fcml_reg_FS );
3552  return reg;
3553  }
3554 
3560  static const Register GS() {
3561  Register reg( ::fcml_reg_GS );
3562  return reg;
3563  }
3564 
3570  static const Register ST0() {
3571  Register reg( ::fcml_reg_ST0 );
3572  return reg;
3573  }
3574 
3580  static const Register ST1() {
3581  Register reg( ::fcml_reg_ST1 );
3582  return reg;
3583  }
3584 
3590  static const Register ST2() {
3591  Register reg( ::fcml_reg_ST2 );
3592  return reg;
3593  }
3594 
3600  static const Register ST3() {
3601  Register reg( ::fcml_reg_ST3 );
3602  return reg;
3603  }
3604 
3610  static const Register ST4() {
3611  Register reg( ::fcml_reg_ST4 );
3612  return reg;
3613  }
3614 
3620  static const Register ST5() {
3621  Register reg( ::fcml_reg_ST5 );
3622  return reg;
3623  }
3624 
3630  static const Register ST6() {
3631  Register reg( ::fcml_reg_ST6 );
3632  return reg;
3633  }
3634 
3640  static const Register ST7() {
3641  Register reg( ::fcml_reg_ST7 );
3642  return reg;
3643  }
3644 
3650  static const Register CR0() {
3651  Register reg( ::fcml_reg_CR0 );
3652  return reg;
3653  }
3654 
3660  static const Register CR2() {
3661  Register reg( ::fcml_reg_CR2 );
3662  return reg;
3663  }
3664 
3670  static const Register CR3() {
3671  Register reg( ::fcml_reg_CR3 );
3672  return reg;
3673  }
3674 
3680  static const Register CR4() {
3681  Register reg( ::fcml_reg_CR4 );
3682  return reg;
3683  }
3684 
3690  static const Register CR8() {
3691  Register reg( ::fcml_reg_CR8 );
3692  return reg;
3693  }
3694 
3700  static const Register DR0() {
3701  Register reg( ::fcml_reg_DR0 );
3702  return reg;
3703  }
3704 
3710  static const Register DR1() {
3711  Register reg( ::fcml_reg_DR1 );
3712  return reg;
3713  }
3714 
3720  static const Register DR2() {
3721  Register reg( ::fcml_reg_DR2 );
3722  return reg;
3723  }
3724 
3730  static const Register DR3() {
3731  Register reg( ::fcml_reg_DR3 );
3732  return reg;
3733  }
3734 
3740  static const Register DR4() {
3741  Register reg( ::fcml_reg_DR4 );
3742  return reg;
3743  }
3744 
3750  static const Register DR5() {
3751  Register reg( ::fcml_reg_DR5 );
3752  return reg;
3753  }
3754 
3760  static const Register DR6() {
3761  Register reg( ::fcml_reg_DR6 );
3762  return reg;
3763  }
3764 
3770  static const Register DR7() {
3771  Register reg( ::fcml_reg_DR7 );
3772  return reg;
3773  }
3774 
3780  static const Register IP() {
3781  Register reg( ::fcml_reg_IP );
3782  return reg;
3783  }
3784 
3790  static const Register EIP() {
3791  Register reg( ::fcml_reg_EIP );
3792  return reg;
3793  }
3794 
3800  static const Register RIP() {
3801  Register reg( ::fcml_reg_RIP );
3802  return reg;
3803  }
3804 
3810  static const Register K0() {
3811  Register reg( ::fcml_reg_K0 );
3812  return reg;
3813  }
3814 
3820  static const Register K1() {
3821  Register reg( ::fcml_reg_K1 );
3822  return reg;
3823  }
3824 
3830  static const Register K2() {
3831  Register reg( ::fcml_reg_K2 );
3832  return reg;
3833  }
3834 
3840  static const Register K3() {
3841  Register reg( ::fcml_reg_K3 );
3842  return reg;
3843  }
3844 
3850  static const Register K4() {
3851  Register reg( ::fcml_reg_K4 );
3852  return reg;
3853  }
3854 
3860  static const Register K5() {
3861  Register reg( ::fcml_reg_K5 );
3862  return reg;
3863  }
3864 
3870  static const Register K6() {
3871  Register reg( ::fcml_reg_K6 );
3872  return reg;
3873  }
3874 
3880  static const Register K7() {
3881  Register reg( ::fcml_reg_K7 );
3882  return reg;
3883  }
3884 
3885 private:
3886 
3888  RegisterType _type;
3890  fcml_usize _size;
3892  fcml_uint8_t _reg;
3894  bool _x64_exp;
3895 
3896 };
3897 
3902 class FarPointer {
3903 
3904 public:
3905 
3911  _segment(0),
3912  _offset_size(0),
3913  _offset16(0),
3914  _offset32(0) {
3915  }
3916 
3923  FarPointer( fcml_uint16_t segment, fcml_int16_t offset16 ) :
3924  _segment(segment),
3925  _offset_size(FCML_DS_16),
3926  _offset16(offset16),
3927  _offset32(0) {
3928  }
3935  FarPointer( fcml_uint16_t segment, fcml_int32_t offset32 ) :
3936  _segment(segment),
3937  _offset_size(FCML_DS_32),
3938  _offset16(0),
3939  _offset32(offset32) {
3940  }
3941 
3942  virtual ~FarPointer() {
3943  }
3944 
3945 public:
3946 
3953  bool operator==( const FarPointer &fp ) const {
3954  fcml_int32_t thisOffset;
3955  switch( _offset_size ) {
3956  case FCML_DS_32:
3957  thisOffset = _offset32;
3958  break;
3959  case FCML_DS_16:
3960  thisOffset = _offset16;
3961  break;
3962  }
3963  fcml_int32_t thatOffset;
3964  switch( fp._offset_size ) {
3965  case FCML_DS_32:
3966  thatOffset = fp._offset32;
3967  break;
3968  case FCML_DS_16:
3969  thatOffset = fp._offset16;
3970  break;
3971  }
3972  return thisOffset == thatOffset;
3973  }
3974 
3981  bool operator!=( const FarPointer &fp) const {
3982  return !(fp == *this);
3983  }
3984 
3985 public:
3986 
3995  static FarPointer off16( fcml_uint16_t segment, fcml_int16_t offset ) {
3996  return FarPointer(segment, offset);
3997  }
3998 
4006  static FarPointer off32( fcml_uint16_t segment, fcml_int32_t offset ) {
4007  return FarPointer(segment, offset);
4008  }
4009 
4010 public:
4011 
4018  fcml_usize getOffsetSize() const {
4019  return _offset_size;
4020  }
4021 
4028  void setOffsetSize( fcml_usize offsetSize ) {
4029  _offset_size = offsetSize;
4030  }
4031 
4038  fcml_int16_t getOffset16() const {
4039  return _offset16;
4040  }
4041 
4048  void setOffset16( fcml_int16_t offset16 ) {
4049  _offset16 = offset16;
4050  }
4051 
4058  fcml_int32_t getOffset32() const {
4059  return _offset32;
4060  }
4061 
4068  void setOffset32( fcml_int32_t offset32 ) {
4069  _offset32 = offset32;
4070  }
4071 
4078  fcml_uint16_t getSegment() const {
4079  return _segment;
4080  }
4081 
4088  void setSegment( fcml_uint16_t segment ) {
4089  _segment = segment;
4090  }
4091 
4092 private:
4093 
4095  fcml_uint16_t _segment;
4097  fcml_usize _offset_size;
4099  fcml_int16_t _offset16;
4101  fcml_int32_t _offset32;
4102 
4103 };
4104 
4110 public:
4111 
4117  _segmentSelector(),
4118  _isDefaultReg(false) {
4119  }
4120 
4127  SegmentSelector( const Register &segmentSelector, bool isDefaultReg = FCML_TRUE ) :
4128  _segmentSelector(segmentSelector),
4129  _isDefaultReg(isDefaultReg) {
4130  }
4131 
4132  virtual ~SegmentSelector() {
4133  }
4134 
4135 public:
4136 
4143  bool operator==( const SegmentSelector &segmentSelector ) const {
4144  // It really doesn't matter if it is the default segment register in a given context.
4145  return segmentSelector._segmentSelector == _segmentSelector;
4146  }
4147 
4154  bool operator!=( const SegmentSelector &segmentSelector ) const {
4155  return !(*this == segmentSelector);
4156  }
4157 
4163  operator Register() const {
4164  return _segmentSelector;
4165  }
4166 
4174  if( &reg != this ) {
4175  _isDefaultReg = reg._isDefaultReg;
4176  _segmentSelector = reg._segmentSelector;
4177  }
4178  return *this;
4179  }
4180 
4181 public:
4182 
4191  static SegmentSelector seg( const Register &segmentSelector, bool isDefaultReg ) {
4192  return SegmentSelector( segmentSelector, isDefaultReg );
4193  }
4194 
4195 public:
4196 
4204  bool isDefaultReg() const {
4205  return _isDefaultReg;
4206  }
4207 
4214  void setDefaultReg( bool isDefaultReg ) {
4215  _isDefaultReg = isDefaultReg;
4216  }
4217 
4224  const Register& getSegmentSelector() const {
4225  return _segmentSelector;
4226  }
4227 
4235  return _segmentSelector;
4236  }
4237 
4244  void setSegmentSelector( const Register& segmentSelector ) {
4245  _segmentSelector = segmentSelector;
4246  }
4247 
4248 private:
4250  Register _segmentSelector;
4252  bool _isDefaultReg;
4253 };
4254 
4262 public:
4263 
4269  _scaleFactor(0){
4270  }
4271 
4277  EffectiveAddress( const Integer &displacement ) :
4278  _scaleFactor(0),
4279  _displacement(displacement) {
4280  }
4281 
4287  EffectiveAddress( const Register &base ) :
4288  _base(base),
4289  _scaleFactor(0) {
4290  }
4291 
4298  EffectiveAddress( const Register &base, const Integer &displacement ) :
4299  _base(base),
4300  _scaleFactor(0),
4301  _displacement(displacement) {
4302  }
4303 
4311  EffectiveAddress( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) :
4312  _index(index),
4313  _scaleFactor(scaleFactor),
4314  _displacement(displacement) {
4315  }
4316 
4323  EffectiveAddress( const Register &base, const Register &index ) :
4324  _base(base),
4325  _index(index),
4326  _scaleFactor(0) {
4327  }
4328 
4336  EffectiveAddress( const Register &base, const Register &index, fcml_uint8_t scaleFactor ) :
4337  _base(base),
4338  _index(index),
4339  _scaleFactor(scaleFactor) {
4340  }
4341 
4350  EffectiveAddress( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) :
4351  _base(base),
4352  _index(index),
4353  _scaleFactor(scaleFactor),
4354  _displacement(displacement) {
4355  }
4356 
4360  virtual ~EffectiveAddress() {
4361  }
4362 
4363 public:
4364 
4371  bool operator==( const EffectiveAddress &address ) const {
4372  if( &address == this ) {
4373  return true;
4374  }
4375  return _base == address._base &&
4376  _index == address._index &&
4377  _scaleFactor == address._scaleFactor &&
4378  _displacement == address._displacement;
4379  }
4380 
4387  bool operator!=( const EffectiveAddress &address ) const {
4388  return !(address == *this);
4389  }
4390 
4391 public:
4392 
4398  static EffectiveAddress addr( const Integer &displacement ) {
4399  return EffectiveAddress( displacement );
4400  }
4401 
4407  static EffectiveAddress addr( const Register &base ) {
4408  return EffectiveAddress( base );
4409  }
4410 
4417  static EffectiveAddress addr( const Register &base, const Integer &displacement ) {
4418  return EffectiveAddress( base, displacement );
4419  }
4420 
4428  static EffectiveAddress addr( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
4429  return EffectiveAddress( index, scaleFactor, displacement );
4430  }
4431 
4438  static EffectiveAddress addr( const Register &base, const Register &index ) {
4439  return EffectiveAddress( base, index, 0 );
4440  }
4441 
4449  static EffectiveAddress addr( const Register &base, const Register &index, fcml_uint8_t scaleFactor ) {
4450  return EffectiveAddress( base, index, scaleFactor );
4451  }
4452 
4461  static EffectiveAddress addr( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
4462  return EffectiveAddress( base, index, scaleFactor, displacement );
4463  }
4464 
4465 public:
4466 
4473  const Register& getBase() const {
4474  return _base;
4475  }
4476 
4484  return _base;
4485  }
4486 
4495  _base = base;
4496  return *this;
4497  }
4498 
4505  const Integer& getDisplacement() const {
4506  return _displacement;
4507  }
4508 
4516  return _displacement;
4517  }
4518 
4526  EffectiveAddress& setDisplacement( const Integer &displacement ) {
4527  _displacement = displacement;
4528  return *this;
4529  }
4530 
4537  const Register& getIndex() const {
4538  return _index;
4539  }
4540 
4548  return _index;
4549  }
4550 
4559  _index = index;
4560  return *this;
4561  }
4562 
4569  fcml_uint8_t getScaleFactor() const {
4570  return _scaleFactor;
4571  }
4572 
4580  EffectiveAddress& setScaleFactor( fcml_uint8_t scaleFactor ) {
4581  _scaleFactor = scaleFactor;
4582  return *this;
4583  }
4584 
4585 private:
4587  Register _base;
4589  Register _index;
4591  fcml_uint8_t _scaleFactor;
4593  Integer _displacement;
4594 };
4595 
4601 class Address {
4602 
4603 public:
4604 
4610  AF_UNDEFINED = FCML_AF_UNDEFINED,
4612  AF_OFFSET = FCML_AF_OFFSET,
4614  AF_COMBINED = FCML_AF_COMBINED
4615  };
4616 
4622  _size_operator( FCML_DS_UNDEF ),
4623  _address_form( AF_UNDEFINED ) {
4624  }
4625 
4633  Address( const Integer &offset, fcml_usize sizeOperator = FCML_DS_UNDEF ) :
4634  _size_operator( sizeOperator ),
4635  _address_form( AF_OFFSET ),
4636  _offset( offset ) {
4637  }
4638 
4646  Address( const EffectiveAddress &effectiveAddress, fcml_usize sizeOperator = FCML_DS_UNDEF ) :
4647  _size_operator( sizeOperator ),
4648  _address_form( AF_COMBINED ),
4649  _effective_address( effectiveAddress ) {
4650  }
4651 
4660  Address( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector, fcml_usize sizeOperator = FCML_DS_UNDEF ) :
4661  _size_operator( sizeOperator ),
4662  _address_form( AF_COMBINED ),
4663  _segment_selector( segmentSelector ),
4664  _effective_address( effectiveAddress ) {
4665  }
4666 
4668  virtual ~Address() {
4669  }
4670 
4671 public:
4672 
4679  static Address effective( const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
4680  return effective( EffectiveAddress( displacement ), sizeOperator );
4681  }
4682 
4689  static Address effective( const Register &base, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
4690  return effective( EffectiveAddress( base ), sizeOperator );
4691  }
4692 
4700  static Address effective( const Register &base, const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
4701  return effective( EffectiveAddress( base, displacement ), sizeOperator );
4702  }
4703 
4712  static Address effective( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
4713  return effective( EffectiveAddress( index, scaleFactor, displacement ), sizeOperator );
4714  }
4715 
4723  static Address effective( const Register &base, const Register &index, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
4724  return effective( EffectiveAddress( base, index, 0 ), sizeOperator );
4725  }
4726 
4735  static Address effective( const Register &base, const Register &index, fcml_uint8_t scaleFactor, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
4736  return effective( EffectiveAddress( base, index, scaleFactor ), sizeOperator );
4737  }
4738 
4748  static Address effective( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
4749  return effective( EffectiveAddress( base, index, scaleFactor, displacement ), sizeOperator );
4750  }
4751 
4752 
4753 public:
4754 
4761  bool operator==( const Address &address ) const {
4762  if( &address == this ) {
4763  return true;
4764  }
4765  return _size_operator == address._size_operator &&
4766  _address_form == address._address_form &&
4767  _segment_selector == address._segment_selector &&
4768  _effective_address == address._effective_address &&
4769  _offset == address._offset;
4770  }
4771 
4778  bool operator!=( const Address &address ) const {
4779  return !(address == *this );
4780  }
4781 
4782 public:
4783 
4793  static Address effective( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
4794  return Address( effectiveAddress, segmentSelector, sizeOperator );
4795  }
4796 
4805  static Address effective( const EffectiveAddress &effectiveAddress, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
4806  return Address( effectiveAddress, sizeOperator );
4807  }
4808 
4817  static Address offset( const Integer &offset, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
4818  return Address( offset, sizeOperator );
4819  }
4820 
4821 public:
4822 
4829  bool isEffectiveAddress() const {
4830  return _address_form == AF_COMBINED;
4831  }
4832 
4839  bool isOffset() const {
4840  return _address_form == AF_OFFSET;
4841  }
4842 
4850  return _address_form;
4851  }
4852 
4862  _address_form = addressForm;
4863  return *this;
4864  }
4865 
4873  return _effective_address;
4874  }
4875 
4883  return _effective_address;
4884  }
4885 
4893  Address& setEffectiveAddress( const EffectiveAddress& effectiveAddress ) {
4894  _effective_address = effectiveAddress;
4895  return *this;
4896  }
4897 
4904  const Integer& getOffset() const {
4905  return _offset;
4906  }
4907 
4915  return _offset;
4916  }
4917 
4925  Address& setOffset( const Integer &offset ) {
4926  this->_offset = offset;
4927  return *this;
4928  }
4929 
4937  return _segment_selector;
4938  }
4939 
4947  return _segment_selector;
4948  }
4949 
4957  Address& setSegmentSelector( const SegmentSelector &segmentSelector ) {
4958  _segment_selector = segmentSelector;
4959  return *this;
4960  }
4961 
4968  fcml_usize getSizeOperator() const {
4969  return _size_operator;
4970  }
4971 
4978  Address& setSizeOperator( fcml_usize sizeOperator ) {
4979  _size_operator = sizeOperator;
4980  return *this;
4981  }
4982 
4983 private:
4984 
4986  fcml_usize _size_operator;
4988  AddressForm _address_form;
4990  SegmentSelector _segment_selector;
4992  EffectiveAddress _effective_address;
4994  Integer _offset;
4995 
4996 };
4997 
5001 class Decorators {
5002 public:
5003 
5008  FCML_ERC_RNE = 0,
5009  FCML_ERC_RD,
5010  FCML_ERC_RU,
5011  FCML_ERC_RZ
5012  };
5013 
5018  Decorators() : _z(FCML_FALSE), _operandMaskReg(Register::UNDEF()),
5019  _sae(FCML_FALSE) {
5020  }
5021 
5029  Decorators& setZ(fcml_bool z) {
5030  _z = z;
5031  return *this;
5032  }
5033 
5042  _bcast = bcast;
5043  return *this;
5044  }
5045 
5052  Decorators& setOpmaskReg( const Register& opmaskReg ) {
5053  _operandMaskReg = opmaskReg;
5054  return *this;
5055  }
5056 
5064  _er = er;
5065  return *this;
5066  }
5067 
5074  Decorators& setSae(const fcml_bool sae) {
5075  _sae = sae;
5076  return *this;
5077  }
5078 
5085  fcml_bool isZ() const {
5086  return _z;
5087  }
5088 
5096  return _bcast;
5097  }
5098 
5105  const Register& getOpmaskReg() const {
5106  return _operandMaskReg;
5107  }
5108 
5116  return _operandMaskReg;
5117  }
5118 
5126  return _er;
5127  }
5128 
5135  fcml_bool isSae() const {
5136  return _sae;
5137  }
5138 
5139 public:
5140 
5147  bool operator==(const Decorators &decorators) const {
5148  if(&decorators == this) {
5149  return true;
5150  }
5151  return _z == decorators._z &&
5152  _bcast == decorators._bcast &&
5153  _operandMaskReg == decorators._operandMaskReg &&
5154  _er == decorators._er &&
5155  _sae == decorators._sae;
5156  }
5157 
5164  bool operator!=(const Decorators &decorators) const {
5165  return !(decorators == *this);
5166  }
5167 
5168 private:
5170  Nullable<fcml_uint8_t> _bcast;
5172  fcml_bool _z;
5174  Register _operandMaskReg;
5178  fcml_bool _sae;
5179 };
5180 
5184 class Operand {
5185 public:
5186 
5192  OT_NONE = FCML_OT_NONE,
5194  OT_IMMEDIATE = FCML_OT_IMMEDIATE,
5196  OT_FAR_POINTER = FCML_OT_FAR_POINTER,
5198  OT_ADDRESS = FCML_OT_ADDRESS,
5200  OT_REGISTER = FCML_OT_REGISTER,
5202  OT_VIRTUAL = FCML_OT_VIRTUAL
5203  };
5204 
5210  _hints( FCML_OP_HINT_UNDEFIEND ),
5211  _operandType( OT_NONE ) {
5212  }
5213 
5222  _hints( hints ),
5223  _operandType(OT_IMMEDIATE ),
5224  _immediate( imm ) {
5225  }
5226 
5235  _hints( hints ),
5236  _operandType( OT_FAR_POINTER ),
5237  _farPointer( pointer ) {
5238  }
5239 
5247  Operand( const Address &address, fcml_hints hints = FCML_OP_HINT_UNDEFIEND ) :
5248  _hints( hints ),
5249  _operandType( OT_ADDRESS ),
5250  _address( address ) {
5251  }
5252 
5261  _hints( hints ),
5262  _operandType( OT_REGISTER ),
5263  _register( reg ) {
5264  }
5265 
5266 public:
5267 
5275  bool operator==( const Operand &op ) const {
5276  if( &op == this ) {
5277  return true;
5278  }
5279  bool equal = false;
5280  switch( _operandType ) {
5281  case OT_ADDRESS:
5282  equal = _address == op._address;
5283  break;
5284  case OT_FAR_POINTER:
5285  equal = _farPointer == op._farPointer;
5286  break;
5287  case OT_IMMEDIATE:
5288  equal = _immediate == op._immediate;
5289  break;
5290  case OT_REGISTER:
5291  equal = _register == op._register;
5292  break;
5293  case OT_VIRTUAL:
5294  equal = true;
5295  break;
5296  case OT_NONE:
5297  equal = true;
5298  break;
5299  }
5300  return equal && op._hints == _hints && op._decorators == _decorators;
5301  }
5302 
5310  bool operator!=( const Operand &op ) const {
5311  return !(op == *this);
5312  }
5313 
5314 public:
5315 
5320  void undef() {
5321  _operandType = OT_NONE;
5322  }
5323 
5330  void imm( const Integer &imm ) {
5331  _operandType = OT_IMMEDIATE;
5332  _immediate = imm;
5333  }
5334 
5342  void far_ptr( fcml_uint16_t seg, fcml_int16_t addr ) {
5343  _operandType = OT_FAR_POINTER;
5344  _farPointer = FarPointer( seg, addr );
5345  }
5346 
5354  void far_ptr( fcml_uint16_t seg, fcml_int32_t addr ) {
5355  _operandType = OT_FAR_POINTER;
5356  _farPointer = FarPointer( seg, addr );
5357  }
5358 
5365  void far_ptr( const FarPointer &pointer ) {
5366  _operandType = OT_FAR_POINTER;
5367  _farPointer = pointer;
5368  }
5369 
5376  void addr( const Address &address ) {
5377  _operandType = OT_ADDRESS;
5378  _address = address;
5379  }
5380 
5388  void off( const Integer &offset, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
5389  _operandType = OT_ADDRESS;
5390  _address = Address( offset, sizeOperator );
5391  }
5392 
5400  void addr( const EffectiveAddress &effectiveAddress, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
5401  _operandType = OT_ADDRESS;
5402  _address = Address( effectiveAddress, sizeOperator );
5403  }
5404 
5413  void addr( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
5414  _operandType = OT_ADDRESS;
5415  _address = Address( effectiveAddress, segmentSelector, sizeOperator );
5416  }
5417 
5424  void reg( const Register &reg ) {
5425  _operandType = OT_REGISTER;
5426  _register = reg;
5427  }
5428 
5438  void reg( fcml_uint8_t reg, fcml_usize size, Register::RegisterType type = Register::REG_GPR, fcml_bool x64_exp = FCML_FALSE ) {
5439  _operandType = OT_REGISTER;
5440  _register = Register( reg, size, type, x64_exp );
5441  }
5442 
5443 public:
5444 
5451  bool isImm() const {
5452  return _operandType == OT_IMMEDIATE;
5453  }
5454 
5461  bool isReg() const {
5462  return _operandType == OT_REGISTER;
5463  }
5464 
5471  bool isAddr() const {
5472  return _operandType == OT_ADDRESS;
5473  }
5474 
5481  bool isFar() const {
5482  return _operandType == OT_FAR_POINTER;
5483  }
5484 
5491  const Address& getAddress() const {
5492  return _address;
5493  }
5494 
5502  return _address;
5503  }
5504 
5512  Operand& setAddress( const Address &address ) {
5513  _address = address;
5514  return *this;
5515  }
5516 
5523  const FarPointer& getFarPointer() const {
5524  return _farPointer;
5525  }
5526 
5534  return _farPointer;
5535  }
5536 
5544  Operand& setFarPointer( const FarPointer &farPointer ) {
5545  _farPointer = farPointer;
5546  return *this;
5547  }
5548 
5555  const Integer& getImmediate() const {
5556  return _immediate;
5557  }
5558 
5566  return _immediate;
5567  }
5568 
5576  Operand& setImmediate( const Integer &immediate ) {
5577  _immediate = immediate;
5578  return *this;
5579  }
5580 
5588  return _operandType;
5589  }
5590 
5599  _operandType = operandType;
5600  return *this;
5601  }
5602 
5609  const Register& getRegister() const {
5610  return _register;
5611  }
5612 
5620  return _register;
5621  }
5622 
5630  Operand& setRegister( const Register &reg ) {
5631  this->_register = reg;
5632  return *this;
5633  }
5634 
5642  return _hints;
5643  }
5644 
5653  _hints = hints;
5654  return *this;
5655  }
5656 
5663  const Decorators& getDecorators() const {
5664  return _decorators;
5665  }
5666 
5674  return _decorators;
5675  }
5676 
5684  Operand& setDecorators(const Decorators& decorators) {
5685  _decorators = decorators;
5686  return *this;
5687  }
5688 
5689  // Hints
5690 
5698  bool isMultimedia() const {
5699  return _hints & FCML_OP_HINT_MULTIMEDIA_INSTRUCTION;
5700  }
5701 
5708  bool isDisRelativeAddress() const {
5709  return ( _hints & FCML_OP_HINT_DISPLACEMENT_RELATIVE_ADDRESS ) ? true : false;
5710  }
5711 
5719  bool isPseudoOpcode() const {
5720  return ( _hints & FCML_OP_HINT_PSEUDO_OPCODE ) ? true : false;
5721  }
5722 
5729  bool isAbsoluteAddressing() const {
5730  return ( _hints & FCML_OP_HINT_ABSOLUTE_ADDRESSING ) ? true : false;
5731  }
5732 
5739  bool isRelativeAddressing() const {
5740  return ( _hints & FCML_OP_HINT_RELATIVE_ADDRESSING ) ? true : false;
5741  }
5742 
5749  bool isSIBEncoding() const {
5750  return ( _hints & FCML_OP_HINT_SIB_ENCODING ) ? true : false;
5751  }
5752 
5753 public:
5754 
5759  operator const Integer&() const {
5760  return _immediate;
5761  }
5762 
5767  operator const FarPointer&() const {
5768  return _farPointer;
5769  }
5770 
5775  operator const Address&() const {
5776  return _address;
5777  }
5778 
5783  operator const Register&() const {
5784  return _register;
5785  }
5786 
5787 private:
5788 
5790  fcml_hints _hints;
5792  OperandType _operandType;
5794  Integer _immediate;
5796  FarPointer _farPointer;
5798  Address _address;
5800  Register _register;
5804  Decorators _decorators;
5805 
5806 };
5807 
5816 class OB {
5817 public:
5818 
5824  static Operand undef() {
5825  return Operand();
5826  }
5827 
5833  static Operand imm( const Integer &imm ) {
5834  return Operand( imm );
5835  }
5836 
5844  static Operand far_ptr( fcml_uint16_t seg, fcml_int16_t addr ) {
5845  return Operand( FarPointer( seg, addr ) );
5846  }
5847 
5855  static Operand far_ptr( fcml_uint16_t seg, fcml_int32_t addr ) {
5856  return Operand( FarPointer( seg, addr ) );
5857  }
5858 
5865  static Operand far_ptr( const FarPointer &pointer ) {
5866  return Operand( pointer );
5867  }
5868 
5875  static Operand addr( const Address &address ) {
5876  return Operand( address );
5877  }
5878 
5886  static Operand off( const Integer &offset, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
5887  return Operand( Address( offset, sizeOperator ) );
5888  }
5889 
5896  static Operand offb( const Integer &offset ) {
5897  return Operand( Address( offset, FCML_DS_8 ) );
5898  }
5899 
5906  static Operand offw( const Integer &offset ) {
5907  return Operand( Address( offset, FCML_DS_16 ) );
5908  }
5909 
5916  static Operand offd( const Integer &offset ) {
5917  return Operand( Address( offset, FCML_DS_32 ) );
5918  }
5919 
5926  static Operand offq( const Integer &offset ) {
5927  return Operand( Address( offset, FCML_DS_64 ) );
5928  }
5929 
5937  static Operand addr( const EffectiveAddress &effectiveAddress, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
5938  return Operand( Address( effectiveAddress, sizeOperator ) );
5939  }
5940 
5947  static Operand addrb( const EffectiveAddress &effectiveAddress ) {
5948  return Operand( Address( effectiveAddress, FCML_DS_8 ) );
5949  }
5950 
5957  static Operand addrw( const EffectiveAddress &effectiveAddress ) {
5958  return Operand( Address( effectiveAddress, FCML_DS_16 ) );
5959  }
5960 
5967  static Operand addrd( const EffectiveAddress &effectiveAddress ) {
5968  return Operand( Address( effectiveAddress, FCML_DS_32 ) );
5969  }
5970 
5977  static Operand addrq( const EffectiveAddress &effectiveAddress ) {
5978  return Operand( Address( effectiveAddress, FCML_DS_64 ) );
5979  }
5980 
5989  static Operand addr( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
5990  return Operand( Address( effectiveAddress, segmentSelector, sizeOperator ) );
5991  }
5992 
6000  static Operand addrb( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector ) {
6001  return Operand( Address( effectiveAddress, segmentSelector, FCML_DS_8 ) );
6002  }
6003 
6011  static Operand addrw( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector ) {
6012  return Operand( Address( effectiveAddress, segmentSelector, FCML_DS_16 ) );
6013  }
6014 
6022  static Operand addrd( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector ) {
6023  return Operand( Address( effectiveAddress, segmentSelector, FCML_DS_32 ) );
6024  }
6025 
6033  static Operand addrq( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector ) {
6034  return Operand( Address( effectiveAddress, segmentSelector, FCML_DS_64 ) );
6035  }
6036 
6043  static Operand reg( const Register &reg ) {
6044  return Operand( reg );
6045  }
6046 
6056  static Operand reg( fcml_uint8_t reg, fcml_usize size, Register::RegisterType type = Register::REG_GPR, fcml_bool x64_exp = FCML_FALSE ) {
6057  return Operand( Register( reg, size, type, x64_exp ) );
6058  }
6059 
6067  static Operand eff( const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
6068  return addr( EffectiveAddress( displacement ), sizeOperator );
6069  }
6070 
6077  static Operand effb( const Integer &displacement ) {
6078  return addr( EffectiveAddress( displacement ), FCML_DS_8 );
6079  }
6080 
6087  static Operand effw( const Integer &displacement ) {
6088  return addr( EffectiveAddress( displacement ), FCML_DS_16 );
6089  }
6090 
6097  static Operand effd( const Integer &displacement ) {
6098  return addr( EffectiveAddress( displacement ), FCML_DS_32 );
6099  }
6100 
6107  static Operand effq( const Integer &displacement ) {
6108  return addr( EffectiveAddress( displacement ), FCML_DS_64 );
6109  }
6110 
6118  static Operand eff( const Register &base, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
6119  return addr( EffectiveAddress( base ), sizeOperator );
6120  }
6121 
6128  static Operand effb( const Register &base ) {
6129  return addr( EffectiveAddress( base ), FCML_DS_8 );
6130  }
6131 
6138  static Operand effw( const Register &base ) {
6139  return addr( EffectiveAddress( base ), FCML_DS_16 );
6140  }
6141 
6148  static Operand effd( const Register &base ) {
6149  return addr( EffectiveAddress( base ), FCML_DS_32 );
6150  }
6151 
6158  static Operand effq( const Register &base ) {
6159  return addr( EffectiveAddress( base ), FCML_DS_64 );
6160  }
6161 
6170  static Operand eff( const Register &base, const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
6171  return addr( EffectiveAddress( base, displacement ), sizeOperator );
6172  }
6173 
6181  static Operand effb( const Register &base, const Integer &displacement ) {
6182  return addr( EffectiveAddress( base, displacement ), FCML_DS_8 );
6183  }
6184 
6192  static Operand effw( const Register &base, const Integer &displacement ) {
6193  return addr( EffectiveAddress( base, displacement ), FCML_DS_16 );
6194  }
6195 
6203  static Operand effd( const Register &base, const Integer &displacement ) {
6204  return addr( EffectiveAddress( base, displacement ), FCML_DS_32 );
6205  }
6206 
6214  static Operand effq( const Register &base, const Integer &displacement ) {
6215  return addr( EffectiveAddress( base, displacement ), FCML_DS_64 );
6216  }
6217 
6227  static Operand eff( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
6228  return addr( EffectiveAddress( index, scaleFactor, displacement ), sizeOperator );
6229  }
6230 
6239  static Operand effb( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
6240  return addr( EffectiveAddress( index, scaleFactor, displacement ), FCML_DS_8 );
6241  }
6242 
6251  static Operand effw( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
6252  return addr( EffectiveAddress( index, scaleFactor, displacement ), FCML_DS_16 );
6253  }
6254 
6263  static Operand effd( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
6264  return addr( EffectiveAddress( index, scaleFactor, displacement ), FCML_DS_32 );
6265  }
6266 
6275  static Operand effq( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
6276  return addr( EffectiveAddress( index, scaleFactor, displacement ), FCML_DS_64 );
6277  }
6278 
6287  static Operand eff( const Register &base, const Register &index, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
6288  return addr( EffectiveAddress( base, index ), sizeOperator );
6289  }
6290 
6298  static Operand effb( const Register &base, const Register &index ) {
6299  return addr( EffectiveAddress( base, index ), FCML_DS_8 );
6300  }
6301 
6309  static Operand effw( const Register &base, const Register &index ) {
6310  return addr( EffectiveAddress( base, index ), FCML_DS_16 );
6311  }
6312 
6320  static Operand effd( const Register &base, const Register &index ) {
6321  return addr( EffectiveAddress( base, index ), FCML_DS_32 );
6322  }
6323 
6331  static Operand effq( const Register &base, const Register &index ) {
6332  return addr( EffectiveAddress( base, index ), FCML_DS_64 );
6333  }
6334 
6344  static Operand eff( const Register &base, const Register &index, fcml_uint8_t scaleFactor, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
6345  return addr( EffectiveAddress( base, index, scaleFactor ), sizeOperator );
6346  }
6347 
6356  static Operand effb( const Register &base, const Register &index, fcml_uint8_t scaleFactor ) {
6357  return addr( EffectiveAddress( base, index, scaleFactor ), FCML_DS_8 );
6358  }
6359 
6368  static Operand effw( const Register &base, const Register &index, fcml_uint8_t scaleFactor ) {
6369  return addr( EffectiveAddress( base, index, scaleFactor ), FCML_DS_16 );
6370  }
6371 
6380  static Operand effd( const Register &base, const Register &index, fcml_uint8_t scaleFactor ) {
6381  return addr( EffectiveAddress( base, index, scaleFactor ), FCML_DS_32 );
6382  }
6383 
6392  static Operand effq( const Register &base, const Register &index, fcml_uint8_t scaleFactor ) {
6393  return addr( EffectiveAddress( base, index, scaleFactor ), FCML_DS_64 );
6394  }
6395 
6406  static Operand eff( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
6407  return addr( EffectiveAddress( base, index, scaleFactor, displacement ), sizeOperator );
6408  }
6409 
6419  static Operand effb( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
6420  return addr( EffectiveAddress( base, index, scaleFactor, displacement ), FCML_DS_8 );
6421  }
6422 
6432  static Operand effw( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
6433  return addr( EffectiveAddress( base, index, scaleFactor, displacement ), FCML_DS_16 );
6434  }
6435 
6445  static Operand effd( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
6446  return addr( EffectiveAddress( base, index, scaleFactor, displacement ), FCML_DS_32 );
6447  }
6448 
6458  static Operand effq( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
6459  return addr( EffectiveAddress( base, index, scaleFactor, displacement ), FCML_DS_64 );
6460  }
6461 
6462 };
6463 
6470 class Condition {
6471 
6472 public:
6473 
6479  CONDITION_O = FCML_CONDITION_O,
6481  CONDITION_B = FCML_CONDITION_B,
6483  CONDITION_E = FCML_CONDITION_E,
6485  CONDITION_BE = FCML_CONDITION_BE,
6487  CONDITION_S = FCML_CONDITION_S,
6489  CONDITION_P = FCML_CONDITION_P,
6491  CONDITION_L = FCML_CONDITION_L,
6493  CONDITION_LE = FCML_CONDITION_LE
6494  };
6495 
6501  _conditionType(CONDITION_O),
6502  _isNegation(false) {
6503  }
6504 
6512  Condition( ConditionType type, bool negation = false ) :
6513  _conditionType( type ),
6514  _isNegation( negation ) {
6515  }
6516 
6517 public:
6518 
6524  bool isO() const {
6525  return check( CONDITION_O );
6526  }
6527 
6533  static const Condition O() {
6534  const Condition condition( CONDITION_O );
6535  return condition;
6536  }
6537 
6543  bool isNO() const {
6544  return check( CONDITION_O, true );
6545  }
6546 
6552  static const Condition NO() {
6553  const Condition condition( CONDITION_O );
6554  return condition;
6555  }
6556 
6562  bool isB() const {
6563  return check( CONDITION_B );
6564  }
6565 
6571  static const Condition B() {
6572  const Condition condition( CONDITION_B );
6573  return condition;
6574  }
6575 
6581  bool isNB() const {
6582  return check( CONDITION_B, true );
6583  }
6584 
6590  static const Condition NB() {
6591  const Condition condition( CONDITION_B, true );
6592  return condition;
6593  }
6594 
6600  bool isNAE() const {
6601  return check( CONDITION_B );
6602  }
6603 
6609  static const Condition NAE() {
6610  const Condition condition( CONDITION_B );
6611  return condition;
6612  }
6613 
6619  bool isAE() const {
6620  return check( CONDITION_B, true );
6621  }
6622 
6628  static const Condition AE() {
6629  const Condition condition( CONDITION_B, true );
6630  return condition;
6631  }
6632 
6638  bool isC() const {
6639  return check( CONDITION_B );
6640  }
6641 
6647  static const Condition C() {
6648  const Condition condition( CONDITION_B );
6649  return condition;
6650  }
6651 
6657  bool isNC() const {
6658  return check( CONDITION_B, true );
6659  }
6660 
6666  static const Condition NC() {
6667  const Condition condition( CONDITION_B, true );
6668  return condition;
6669  }
6670 
6676  bool isE() const {
6677  return check( CONDITION_E );
6678  }
6679 
6685  static const Condition E() {
6686  const Condition condition( CONDITION_E );
6687  return condition;
6688  }
6689 
6695  bool isZ() const {
6696  return check( CONDITION_E );
6697  }
6698 
6704  static const Condition Z() {
6705  const Condition condition( CONDITION_E );
6706  return condition;
6707  }
6708 
6714  bool isNE() const {
6715  return check( CONDITION_E, true );
6716  }
6717 
6723  static const Condition NE() {
6724  const Condition condition( CONDITION_E, true );
6725  return condition;
6726  }
6727 
6733  bool isNZ() const {
6734  return check( CONDITION_E, true );
6735  }
6736 
6742  static const Condition NZ() {
6743  const Condition condition( CONDITION_E, true );
6744  return condition;
6745  }
6746 
6752  bool isBE() const {
6753  return check( CONDITION_BE );
6754  }
6755 
6761  static const Condition BE() {
6762  const Condition condition( CONDITION_BE );
6763  return condition;
6764  }
6765 
6771  bool isNA() const {
6772  return check( CONDITION_BE );
6773  }
6774 
6780  static const Condition NA() {
6781  const Condition condition( CONDITION_BE );
6782  return condition;
6783  }
6784 
6790  bool isNBE() const {
6791  return check( CONDITION_BE, true );
6792  }
6793 
6799  static const Condition NBE() {
6800  const Condition condition( CONDITION_BE, true );
6801  return condition;
6802  }
6803 
6809  bool isA() const {
6810  return check( CONDITION_BE, true );
6811  }
6812 
6818  static const Condition A() {
6819  const Condition condition( CONDITION_BE, true );
6820  return condition;
6821  }
6822 
6828  bool isS() const {
6829  return check( CONDITION_S );
6830  }
6831 
6837  static const Condition S() {
6838  const Condition condition( CONDITION_S );
6839  return condition;
6840  }
6841 
6847  bool isNS() const {
6848  return check( CONDITION_S, true );
6849  }
6850 
6856  static const Condition NS() {
6857  const Condition condition( CONDITION_S, true );
6858  return condition;
6859  }
6860 
6866  bool isP() const {
6867  return check( CONDITION_P );
6868  }
6869 
6875  static const Condition P() {
6876  const Condition condition( CONDITION_P );
6877  return condition;
6878  }
6879 
6885  bool isPE() const {
6886  return check( CONDITION_P );
6887  }
6888 
6894  static const Condition PE() {
6895  const Condition condition( CONDITION_P );
6896  return condition;
6897  }
6898 
6904  bool isNP() const {
6905  return check( CONDITION_P, true );
6906  }
6907 
6913  static const Condition NP() {
6914  const Condition condition( CONDITION_P, true );
6915  return condition;
6916  }
6917 
6923  bool isPO() const {
6924  return check( CONDITION_P, true );
6925  }
6926 
6932  static const Condition PO() {
6933  const Condition condition( CONDITION_P, true );
6934  return condition;
6935  }
6936 
6942  bool isL() const {
6943  return check( CONDITION_L );
6944  }
6945 
6951  static const Condition L() {
6952  const Condition condition( CONDITION_L );
6953  return condition;
6954  }
6955 
6961  bool isNGE() const {
6962  return check( CONDITION_L );
6963  }
6964 
6970  static const Condition NGE() {
6971  const Condition condition( CONDITION_L );
6972  return condition;
6973  }
6974 
6980  bool isNL() const {
6981  return check( CONDITION_L, true );
6982  }
6983 
6989  static const Condition NL() {
6990  const Condition condition( CONDITION_L, true );
6991  return condition;
6992  }
6993 
6999  bool isGE() const {
7000  return check( CONDITION_L, true );
7001  }
7002 
7008  static const Condition GE() {
7009  const Condition condition( CONDITION_L, true );
7010  return condition;
7011  }
7012 
7018  bool isLE() const {
7019  return check( CONDITION_LE );
7020  }
7021 
7027  static const Condition LE() {
7028  const Condition condition( CONDITION_LE );
7029  return condition;
7030  }
7031 
7037  bool isNG() const {
7038  return check( CONDITION_LE );
7039  }
7040 
7046  static const Condition NG() {
7047  const Condition condition( CONDITION_LE );
7048  return condition;
7049  }
7050 
7056  bool isNLE() const {
7057  return check( CONDITION_LE, true );
7058  }
7059 
7065  static const Condition NLE() {
7066  const Condition condition( CONDITION_LE, true );
7067  return condition;
7068  }
7069 
7075  bool isG() const {
7076  return check( CONDITION_LE, true );
7077  }
7078 
7084  static const Condition G() {
7085  const Condition condition( CONDITION_LE, true );
7086  return condition;
7087  }
7088 
7089 public:
7090 
7098  bool operator==( const Condition &cond ) const {
7099  return cond._conditionType == _conditionType && cond._isNegation == _isNegation;
7100  }
7101 
7109  bool operator!=( const Condition &cond ) const {
7110  return !(*this == cond);
7111  }
7112 
7113 public:
7114 
7122  return _conditionType;
7123  }
7124 
7132  _conditionType = conditionType;
7133  return *this;
7134  }
7135 
7142  bool isNegation() const {
7143  return _isNegation;
7144  }
7145 
7152  Condition& setNegation( bool isNegation ) {
7153  _isNegation = isNegation;
7154  return *this;
7155  }
7156 
7157 private:
7158 
7167  bool check( ConditionType type, bool negation = false ) const {
7168  return _conditionType == type && _isNegation == negation;
7169  }
7170 
7171 private:
7172 
7173  /* Condition type.*/
7174  ConditionType _conditionType;
7175  /* True if condition should be negated.*/
7176  bool _isNegation;
7177 
7178 };
7179 
7186 public:
7187 
7193  _prefixes(0),
7194  _hints(FCML_HINT_NO_HINTS),
7195  _isConditional(false),
7196  _operandsCount(0) {
7197  }
7198 
7205  Instruction( const fcml_cstring &mnemonic ) :
7206  _prefixes(0),
7207  _hints(FCML_HINT_NO_HINTS),
7208  _mnemonic(mnemonic),
7209  _isConditional(false),
7210  _operandsCount(0) {
7211  }
7212 
7213 public:
7214 
7222  void add( const Operand &operand ) {
7223  if( _operandsCount == FCML_OPERANDS_COUNT ) {
7224  throw IllegalStateException( FCML_TEXT( "No more operands allowed." ) );
7225  }
7226  _operands[_operandsCount++] = operand;
7227  }
7228 
7237  void setOperand( const Operand &operand, fcml_int index ) {
7238  if( index >= FCML_OPERANDS_COUNT ) {
7239  throw IllegalStateException( FCML_TEXT( "Operand's number exceeds maximal number of operands allowed." ) );
7240  }
7241  _operands[index] = operand;
7242  }
7243 
7251  const Operand & operator[]( fcml_int index ) const {
7252  checkArrayAccess(index);
7253  return _operands[index];
7254  }
7255 
7263  Operand & operator[]( fcml_int index ) {
7264  checkArrayAccess(index);
7265  return _operands[index];
7266  }
7267 
7272  void clean() {
7273  for( int i = 0; i < FCML_OPERANDS_COUNT; i++ ) {
7274  // Clean the operand.
7275  _operands[i] = Operand();
7276  }
7277  _operandsCount = 0;
7278  }
7279 
7280 public:
7281 
7288  const Condition& getCondition() const {
7289  return _condition;
7290  }
7291 
7299  return _condition;
7300  }
7301 
7309  Instruction& setCondition( const Condition &condition ) {
7310  _condition = condition;
7311  return *this;
7312  }
7313 
7321  return _hints;
7322  }
7323 
7332  _hints = hints;
7333  return *this;
7334  }
7335 
7342  bool isConditional() const {
7343  return _isConditional;
7344  }
7345 
7353  Instruction& setConditional( bool isConditional ) {
7354  _isConditional = isConditional;
7355  return *this;
7356  }
7357 
7364  const fcml_cstring& getMnemonic() const {
7365  return _mnemonic;
7366  }
7367 
7375  Instruction& setMnemonic( const fcml_cstring &mnemonic ) {
7376  _mnemonic = mnemonic;
7377  return *this;
7378  }
7379 
7386  fcml_int getOperandsCount() const {
7387  return _operandsCount;
7388  }
7389 
7397  Instruction& setOperandsCount( fcml_int operandsCount ) {
7398  _operandsCount = operandsCount;
7399  return *this;
7400  }
7401 
7409  return _prefixes;
7410  }
7411 
7420  _prefixes = prefixes;
7421  return *this;
7422  }
7423 
7424 public:
7425 
7426  // Helper methods to identify prefixes and hints.
7427 
7433  bool isLock() const {
7434  return ( _prefixes & FCML_PREFIX_LOCK ) ? true : false;
7435  }
7436 
7442  bool isRepne() const {
7443  return ( _prefixes & FCML_PREFIX_REPNE ) ? true : false;
7444  }
7445 
7451  bool isRepnz() const {
7452  return ( _prefixes & FCML_PREFIX_REPNZ ) ? true : false;
7453  }
7454 
7460  bool isRep() const {
7461  return ( _prefixes & FCML_PREFIX_REP ) ? true : false;
7462  }
7463 
7469  bool isRepe() const {
7470  return ( _prefixes & FCML_PREFIX_REPE ) ? true : false;
7471  }
7472 
7478  bool isRepz() const {
7479  return ( _prefixes & FCML_PREFIX_REPZ ) ? true : false;
7480  }
7481 
7487  bool isXAcquire() const {
7488  return ( _prefixes & FCML_PREFIX_XACQUIRE ) ? true : false;
7489  }
7490 
7496  bool isXRelease() const {
7497  return ( _prefixes & FCML_PREFIX_XRELEASE ) ? true : false;
7498  }
7499 
7505  bool isBranchHint() const {
7506  return ( _prefixes & FCML_PREFIX_BRANCH_HINT ) ? true : false;
7507  }
7508 
7514  bool isNoBranchHint() const {
7515  return ( _prefixes & FCML_PREFIX_NOBRANCH_HINT ) ? true : false;
7516  }
7517 
7523  bool isFarPointer() const {
7524  return ( _hints & FCML_HINT_FAR_POINTER ) ? true : false;
7525  }
7526 
7532  bool isNearPointer() const {
7533  return ( _hints & FCML_HINT_NEAR_POINTER ) ? true : false;
7534  }
7535 
7541  bool isLongFormPointer() const {
7542  return ( _hints & FCML_HINT_LONG_FORM_POINTER ) ? true : false;
7543  }
7544 
7550  bool isIndirectPointer() const {
7551  return ( _hints & FCML_HINT_INDIRECT_POINTER ) ? true : false;
7552  }
7553 
7559  bool isDirectPointer() const {
7560  return ( _hints & FCML_HINT_DIRECT_POINTER ) ? true : false;
7561  }
7562 
7563 private:
7564 
7570  void checkArrayAccess( fcml_int index) const {
7571  if( index < 0 || index >= FCML_OPERANDS_COUNT ) {
7572  throw BadArgumentException( FCML_TEXT( "Index exceeds the allowed number of operands." ) );
7573  }
7574  }
7575 
7576 private:
7577 
7579  fcml_prefixes _prefixes;
7581  fcml_hints _hints;
7583  fcml_cstring _mnemonic;
7585  bool _isConditional;
7587  Condition _condition;
7589  Operand _operands[FCML_OPERANDS_COUNT];
7591  fcml_int _operandsCount;
7592 
7593 };
7594 
7602 class IB {
7603 
7604 public:
7605 
7611  IB( const fcml_cstring &mnemonic ) :
7612  _hints(FCML_HINT_NO_HINTS),
7613  _prefixes(0),
7614  _mnemonic(mnemonic),
7615  _operandsCount(0) {
7616  }
7617 
7625  IB( fcml_prefixes prefixes, const fcml_cstring &mnemonic ) :
7626  _hints(FCML_HINT_NO_HINTS),
7627  _prefixes(prefixes),
7628  _mnemonic(mnemonic),
7629  _operandsCount(0) {
7630  }
7631 
7639  IB( const fcml_cstring &mnemonic, fcml_hints hints) :
7640  _hints(hints),
7641  _prefixes(0),
7642  _mnemonic(mnemonic),
7643  _operandsCount(0) {
7644  }
7645 
7654  IB( fcml_prefixes prefixes, const fcml_cstring &mnemonic, fcml_hints hints ) :
7655  _hints(hints),
7656  _prefixes(prefixes),
7657  _mnemonic(mnemonic),
7658  _operandsCount(0) {
7659  }
7660 
7666  operator Instruction() const {
7667  return build();
7668  }
7669 
7676  Instruction build() const {
7677  Instruction instruction(_mnemonic);
7678  instruction.setHints(_hints);
7679  instruction.setPrefixes(_prefixes);
7680  instruction.setOperandsCount(_operandsCount);
7681  for( int i = 0; i < FCML_OPERANDS_COUNT; i++ ) {
7682  instruction.setOperand( _operands[i], i );
7683  }
7684  return instruction;
7685  }
7686 
7694  void op( const Operand &operand ) {
7695  if( _operandsCount == FCML_OPERANDS_COUNT ) {
7696  throw IllegalStateException( FCML_TEXT( "No more operands allowed." ) );
7697  }
7698  _operands[_operandsCount++] = operand;
7699  }
7700 
7708  static IB inst( const fcml_cstring &mnemonic ) {
7709  return IB(mnemonic);
7710  }
7711 
7712  // Hints.
7713 
7721  static const InstructionHint FAR_PTR() {
7723  }
7724 
7730  IB& farPtr() {
7731  _hints |= FCML_HINT_FAR_POINTER;
7732  return *this;
7733  }
7734 
7742  static const InstructionHint NEAR_PTR() {
7744  }
7745 
7752  _hints |= FCML_HINT_NEAR_POINTER;
7753  return *this;
7754  }
7755 
7765  }
7766 
7773  _hints |= FCML_HINT_LONG_FORM_POINTER;
7774  return *this;
7775  }
7776 
7786  }
7787 
7794  _hints |= FCML_HINT_INDIRECT_POINTER;
7795  return *this;
7796  }
7797 
7805  static const InstructionHint DIRECT_PTR() {
7807  }
7808 
7815  _hints |= FCML_HINT_DIRECT_POINTER;
7816  return *this;
7817  }
7818 
7819  // Prefixes.
7820 
7828  static const InstructionPrefix LOCK() {
7829  return InstructionPrefix::LOCK();
7830  }
7831 
7837  IB& lock() {
7838  _prefixes |= FCML_PREFIX_LOCK;
7839  return *this;
7840  }
7841 
7849  static const InstructionPrefix REPNE() {
7850  return InstructionPrefix::REPNE();
7851  }
7852 
7858  IB& repne() {
7859  _prefixes |= FCML_PREFIX_REPNE;
7860  return *this;
7861  }
7862 
7870  static const InstructionPrefix REPNZ() {
7871  return InstructionPrefix::REPNZ();
7872  }
7873 
7879  IB& repnz() {
7880  _prefixes |= FCML_PREFIX_REPNZ;
7881  return *this;
7882  }
7883 
7891  static const InstructionPrefix REP() {
7892  return InstructionPrefix::REP();
7893  }
7894 
7900  IB& rep() {
7901  _prefixes |= FCML_PREFIX_REP;
7902  return *this;
7903  }
7904 
7912  static const InstructionPrefix REPE() {
7913  return InstructionPrefix::REPE();
7914  }
7915 
7921  IB& repe() {
7922  _prefixes |= FCML_PREFIX_REPE;
7923  return *this;
7924  }
7925 
7933  static const InstructionPrefix REPZ() {
7934  return InstructionPrefix::REPZ();
7935  }
7936 
7942  IB& repz() {
7943  _prefixes |= FCML_PREFIX_REPZ;
7944  return *this;
7945  }
7946 
7954  static const InstructionPrefix XACQUIRE() {
7955  return InstructionPrefix::XACQUIRE();
7956  }
7957 
7964  _prefixes |= FCML_PREFIX_XACQUIRE;
7965  return *this;
7966  }
7967 
7975  static const InstructionPrefix XRELEASE() {
7976  return InstructionPrefix::XRELEASE();
7977  }
7978 
7985  _prefixes |= FCML_PREFIX_XRELEASE;
7986  return *this;
7987  }
7988 
7996  static const InstructionPrefix BRANCH() {
7998  }
7999 
8006  _prefixes |= FCML_PREFIX_BRANCH_HINT;
8007  return *this;
8008  }
8009 
8017  static const InstructionPrefix NO_BRANCH() {
8019  }
8020 
8027  _prefixes |= FCML_PREFIX_NOBRANCH_HINT;
8028  return *this;
8029  }
8030 
8036  return OperandHint::MULTIMEDIA();
8037  }
8038 
8045  }
8046 
8053  }
8054 
8059  static const OperandHint OP_SIB_ENCODING() {
8060  return OperandHint::SIB_ENCODING();
8061  }
8062 
8068  set( OP_MULTIMEDIA_HINT() );
8069  return *this;
8070  }
8071 
8077  set( OP_MULTIMEDIA_HINT() );
8078  return *this;
8079  }
8080 
8086  set( OP_MULTIMEDIA_HINT() );
8087  return *this;
8088  }
8089 
8095  set( OP_MULTIMEDIA_HINT() );
8096  return *this;
8097  }
8098 
8099  // Operands.
8100 
8106  IB& imm( const Integer &imm ) {
8107  sanityCheck();
8108  _operands[_operandsCount++].imm(imm);
8109  return *this;
8110  }
8111 
8119  IB& far_ptr( fcml_uint16_t seg, fcml_int16_t addr ) {
8120  sanityCheck();
8121  _operands[_operandsCount++].far_ptr(seg, addr);
8122  return *this;
8123  }
8124 
8132  IB& far_ptr( fcml_uint16_t seg, fcml_int32_t addr ) {
8133  sanityCheck();
8134  _operands[_operandsCount++].far_ptr(seg, addr);
8135  return *this;
8136  }
8137 
8144  IB& far_ptr( const FarPointer &pointer ) {
8145  sanityCheck();
8146  _operands[_operandsCount++].far_ptr( pointer );
8147  return *this;
8148  }
8149 
8156  IB& addr( const Address &address ) {
8157  sanityCheck();
8158  _operands[_operandsCount++].addr(address);
8159  return *this;
8160  }
8161 
8169  IB& off( const Integer &offset, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
8170  sanityCheck();
8171  _operands[_operandsCount++].off( offset, sizeOperator );
8172  return *this;
8173  }
8174 
8181  IB& offb( const Integer &offset ) {
8182  sanityCheck();
8183  _operands[_operandsCount++].off( offset, FCML_DS_8 );
8184  return *this;
8185  }
8186 
8193  IB& offw( const Integer &offset ) {
8194  sanityCheck();
8195  _operands[_operandsCount++].off( offset, FCML_DS_16 );
8196  return *this;
8197  }
8198 
8205  IB& offd( const Integer &offset ) {
8206  sanityCheck();
8207  _operands[_operandsCount++].off( offset, FCML_DS_32 );
8208  return *this;
8209  }
8210 
8217  IB& offq( const Integer &offset ) {
8218  sanityCheck();
8219  _operands[_operandsCount++].off( offset, FCML_DS_64 );
8220  return *this;
8221  }
8222 
8230  IB& addr( const EffectiveAddress &effectiveAddress, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
8231  sanityCheck();
8232  _operands[_operandsCount++].addr( effectiveAddress, sizeOperator );
8233  return *this;
8234  }
8235 
8242  IB& addrb( const EffectiveAddress &effectiveAddress ) {
8243  sanityCheck();
8244  _operands[_operandsCount++].addr( effectiveAddress, FCML_DS_8 );
8245  return *this;
8246  }
8247 
8254  IB& addrw( const EffectiveAddress &effectiveAddress ) {
8255  sanityCheck();
8256  _operands[_operandsCount++].addr( effectiveAddress, FCML_DS_16 );
8257  return *this;
8258  }
8259 
8266  IB& addrd( const EffectiveAddress &effectiveAddress ) {
8267  sanityCheck();
8268  _operands[_operandsCount++].addr( effectiveAddress, FCML_DS_32 );
8269  return *this;
8270  }
8271 
8278  IB& addrq( const EffectiveAddress &effectiveAddress ) {
8279  sanityCheck();
8280  _operands[_operandsCount++].addr( effectiveAddress, FCML_DS_64 );
8281  return *this;
8282  }
8283 
8292  IB& addr( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
8293  sanityCheck();
8294  _operands[_operandsCount++].addr( effectiveAddress, segmentSelector, sizeOperator );
8295  return *this;
8296  }
8297 
8305  IB& addrb( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector ) {
8306  sanityCheck();
8307  _operands[_operandsCount++].addr( effectiveAddress, segmentSelector, FCML_DS_8 );
8308  return *this;
8309  }
8310 
8318  IB& addrw( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector ) {
8319  sanityCheck();
8320  _operands[_operandsCount++].addr( effectiveAddress, segmentSelector, FCML_DS_8 );
8321  return *this;
8322  }
8323 
8331  IB& addrd( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector ) {
8332  sanityCheck();
8333  _operands[_operandsCount++].addr( effectiveAddress, segmentSelector, FCML_DS_8 );
8334  return *this;
8335  }
8336 
8344  IB& addrq( const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector ) {
8345  sanityCheck();
8346  _operands[_operandsCount++].addr( effectiveAddress, segmentSelector, FCML_DS_8 );
8347  return *this;
8348  }
8349 
8356  IB& reg( const Register &reg ) {
8357  sanityCheck();
8358  _operands[_operandsCount++].reg( reg );
8359  return *this;
8360  }
8361 
8371  IB& reg( fcml_uint8_t reg, fcml_usize size, Register::RegisterType type = Register::REG_GPR, fcml_bool x64_exp = FCML_FALSE ) {
8372  sanityCheck();
8373  _operands[_operandsCount++].reg( Register( reg, size, type, x64_exp ) );
8374  return *this;
8375  }
8376 
8384  IB& eff( const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
8385  next().addr( EffectiveAddress(displacement), sizeOperator );
8386  return *this;
8387  }
8388 
8395  IB& effb( const Integer &displacement ) {
8396  next().addr( EffectiveAddress(displacement), FCML_DS_8 );
8397  return *this;
8398  }
8399 
8406  IB& effw( const Integer &displacement ) {
8407  next().addr( EffectiveAddress(displacement), FCML_DS_16 );
8408  return *this;
8409  }
8410 
8417  IB& effd( const Integer &displacement ) {
8418  next().addr( EffectiveAddress(displacement), FCML_DS_32 );
8419  return *this;
8420  }
8421 
8428  IB& effq( const Integer &displacement ) {
8429  next().addr( EffectiveAddress(displacement), FCML_DS_64 );
8430  return *this;
8431  }
8432 
8440  IB& eff( const Register &base, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
8441  next().addr( EffectiveAddress(base), sizeOperator );
8442  return *this;
8443  }
8444 
8451  IB& effb( const Register &base ) {
8452  next().addr( EffectiveAddress(base), FCML_DS_8 );
8453  return *this;
8454  }
8455 
8462  IB& effw( const Register &base ) {
8463  next().addr( EffectiveAddress(base), FCML_DS_16 );
8464  return *this;
8465  }
8466 
8473  IB& effd( const Register &base ) {
8474  next().addr( EffectiveAddress(base), FCML_DS_32 );
8475  return *this;
8476  }
8477 
8484  IB& effq( const Register &base ) {
8485  next().addr( EffectiveAddress(base), FCML_DS_64 );
8486  return *this;
8487  }
8488 
8497  IB& eff( const Register &base, const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
8498  next().addr( EffectiveAddress( base, displacement ), sizeOperator );
8499  return *this;
8500  }
8501 
8509  IB& effb( const Register &base, const Integer &displacement ) {
8510  next().addr( EffectiveAddress( base, displacement ), FCML_DS_8 );
8511  return *this;
8512  }
8513 
8521  IB& effw( const Register &base, const Integer &displacement ) {
8522  next().addr( EffectiveAddress( base, displacement ), FCML_DS_16 );
8523  return *this;
8524  }
8525 
8533  IB& effd( const Register &base, const Integer &displacement ) {
8534  next().addr( EffectiveAddress( base, displacement ), FCML_DS_32 );
8535  return *this;
8536  }
8537 
8545  IB& effq( const Register &base, const Integer &displacement ) {
8546  next().addr( EffectiveAddress( base, displacement ), FCML_DS_64 );
8547  return *this;
8548  }
8549 
8559  IB& eff( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
8560  next().addr( EffectiveAddress( index, scaleFactor, displacement ), sizeOperator );
8561  return *this;
8562  }
8563 
8572  IB& effb( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
8573  next().addr( EffectiveAddress( index, scaleFactor, displacement ), FCML_DS_8 );
8574  return *this;
8575  }
8576 
8585  IB& effw( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
8586  next().addr( EffectiveAddress( index, scaleFactor, displacement ), FCML_DS_16 );
8587  return *this;
8588  }
8589 
8598  IB& effd( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
8599  next().addr( EffectiveAddress( index, scaleFactor, displacement ), FCML_DS_32 );
8600  return *this;
8601  }
8602 
8611  IB& effq( const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
8612  next().addr( EffectiveAddress( index, scaleFactor, displacement ), FCML_DS_64 );
8613  return *this;
8614  }
8615 
8624  IB& eff( const Register &base, const Register &index, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
8625  next().addr( EffectiveAddress( base, index ), sizeOperator );
8626  return *this;
8627  }
8628 
8636  IB& effb( const Register &base, const Register &index ) {
8637  next().addr( EffectiveAddress( base, index ), FCML_DS_8 );
8638  return *this;
8639  }
8640 
8648  IB& effw( const Register &base, const Register &index ) {
8649  next().addr( EffectiveAddress( base, index ), FCML_DS_16 );
8650  return *this;
8651  }
8652 
8660  IB& effd( const Register &base, const Register &index ) {
8661  next().addr( EffectiveAddress( base, index ), FCML_DS_32 );
8662  return *this;
8663  }
8664 
8672  IB& effq( const Register &base, const Register &index ) {
8673  next().addr( EffectiveAddress( base, index ), FCML_DS_64 );
8674  return *this;
8675  }
8676 
8686  IB& eff( const Register &base, const Register &index, fcml_uint8_t scaleFactor, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
8687  next().addr( EffectiveAddress( base, index, scaleFactor ), sizeOperator );
8688  return *this;
8689  }
8690 
8699  IB& effb( const Register &base, const Register &index, fcml_uint8_t scaleFactor ) {
8700  next().addr( EffectiveAddress( base, index, scaleFactor ), FCML_DS_8 );
8701  return *this;
8702  }
8703 
8712  IB& effw( const Register &base, const Register &index, fcml_uint8_t scaleFactor ) {
8713  next().addr( EffectiveAddress( base, index, scaleFactor ), FCML_DS_16 );
8714  return *this;
8715  }
8716 
8725  IB& effd( const Register &base, const Register &index, fcml_uint8_t scaleFactor ) {
8726  next().addr( EffectiveAddress( base, index, scaleFactor ), FCML_DS_32 );
8727  return *this;
8728  }
8729 
8738  IB& effq( const Register &base, const Register &index, fcml_uint8_t scaleFactor ) {
8739  next().addr( EffectiveAddress( base, index, scaleFactor ), FCML_DS_64 );
8740  return *this;
8741  }
8742 
8753  IB& eff( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator = FCML_DS_UNDEF ) {
8754  next().addr( EffectiveAddress( base, index, scaleFactor, displacement ), sizeOperator );
8755  return *this;
8756  }
8757 
8767  IB& effb( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
8768  next().addr( EffectiveAddress( base, index, scaleFactor, displacement ), FCML_DS_8 );
8769  return *this;
8770  }
8771 
8781  IB& effw( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
8782  next().addr( EffectiveAddress( base, index, scaleFactor, displacement ), FCML_DS_16 );
8783  return *this;
8784  }
8785 
8795  IB& effd( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
8796  next().addr( EffectiveAddress( base, index, scaleFactor, displacement ), FCML_DS_32 );
8797  return *this;
8798  }
8799 
8809  IB& effq( const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement ) {
8810  next().addr( EffectiveAddress( base, index, scaleFactor, displacement ), FCML_DS_64 );
8811  return *this;
8812  }
8813 
8820  IB& operator <<(const Operand &operand) {
8821  next() = operand;
8822  return *this;
8823  }
8824 
8831  IB& operator <<(const InstructionPrefix &prefix) {
8832  return set(prefix);
8833  }
8834 
8841  IB& operator <<(const InstructionHint &hint) {
8842  return set( hint );
8843  }
8844 
8851  IB& operator <<(const OperandHint &hint) {
8852  return set( hint );
8853  }
8854 
8861  IB& set( const InstructionPrefix &prefix ) {
8862  _prefixes |= prefix._prefix;
8863  return *this;
8864  }
8865 
8872  IB& set( const InstructionHint &hint ) {
8873  _hints |= hint._hint;
8874  return *this;
8875  }
8876 
8883  IB& set( const OperandHint &hint ) {
8884  if( _operandsCount == 0 ) {
8885  throw IllegalStateException( FCML_TEXT( "There are no operands yet for the current instruction.." ) );
8886  }
8887  _operands[_operandsCount-1].setHints( _operands[_operandsCount-1].getHints() | hint._hint );
8888  return *this;
8889  }
8890 
8891 private:
8892 
8898  Operand& next() {
8899  sanityCheck();
8900  return _operands[_operandsCount++];
8901  }
8902 
8908  void sanityCheck() const {
8909  if( _operandsCount == FCML_OPERANDS_COUNT ) {
8910  throw IllegalStateException( FCML_TEXT( "Operand's number exceeds maximal number of operands allowed." ) );
8911  }
8912  }
8913 
8914 private:
8915 
8917  fcml_hints _hints;
8919  fcml_prefixes _prefixes;
8921  fcml_cstring _mnemonic;
8923  fcml_int _operandsCount;
8925  Operand _operands[FCML_OPERANDS_COUNT];
8926 
8927 };
8928 
8934 public:
8935 
8936  static void convert( const fcml_st_entry_point &src, EntryPoint &dest ) {
8937  dest.setIP( src.ip );
8938  dest.setOpMode( static_cast<EntryPoint::OperatingMode>( src.op_mode ) );
8941  }
8942 
8943  static void convert( const EntryPoint &src, fcml_st_entry_point &dest ) {
8944  dest.ip = src.getIP();
8945  dest.op_mode = static_cast<fcml_en_operating_mode>( src.getOpMode() );
8948  }
8949 
8950  static void convert( const fcml_st_integer &src, Integer &dest ) {
8951  dest.setInt8( src.int8 );
8952  dest.setInt16( src.int16 );
8953  dest.setInt32( src.int32 );
8954  dest.setInt64( src.int64 );
8955  dest.setSigned( src.is_signed );
8956  dest.setSize( src.size );
8957  }
8958 
8959  static void convert( const Integer &src, fcml_st_integer &dest ) {
8960  dest.int8 = src.getInt8();
8961  dest.int16 = src.getInt16();
8962  dest.int32 = src.getInt32();
8963  dest.int64 = src.getInt64();
8964  dest.is_signed = src.isSigned();
8965  dest.size = src.getSize();
8966  }
8967 
8968  static void convert( const fcml_st_offset &src, Integer &dest ) {
8969  dest.setInt16( src.off16 );
8970  dest.setInt32( src.off32 );
8971  dest.setInt64( src.off64 );
8972  dest.setSigned( src.is_signed );
8973  dest.setSize( src.size );
8974  }
8975 
8976  static void convert( const Integer &src, fcml_st_offset &dest ) {
8977  dest.off16 = src.getSize() == FCML_DS_8 ? src.getInt8() : src.getInt16();
8978  dest.off32 = src.getInt32();
8979  dest.off64 = src.getInt64();
8980  dest.is_signed = src.isSigned();
8981  dest.size = src.getSize();
8982  }
8983 
8984  static void convert( const fcml_st_register &src, Register &dest ) {
8985  dest.setReg( src.reg );
8986  dest.setSize( src.size );
8987  dest.setType( static_cast<Register::RegisterType>( src.type ) );
8988  dest.setX64Exp( src.x64_exp ? true : false );
8989  }
8990 
8991  static void convert( const Register &src, fcml_st_register &dest ) {
8992  dest.reg = src.getReg();
8993  dest.size = src.getSize();
8994  dest.type = static_cast<fcml_en_register>( src.getType() );
8995  dest.x64_exp = src.getX64Exp();
8996  }
8997 
8998  static void convert( const fcml_st_far_pointer &src, FarPointer &dest ) {
8999  dest.setOffset16( src.offset16 );
9000  dest.setOffset32( src.offset32 );
9001  dest.setOffsetSize( src.offset_size );
9002  dest.setSegment( src.segment );
9003  }
9004 
9005  static void convert( const FarPointer &src, fcml_st_far_pointer &dest ) {
9006  dest.offset16 = src.getOffset16();
9007  dest.offset32 = src.getOffset32();
9008  dest.offset_size = src.getOffsetSize();
9009  dest.segment = src.getSegment();
9010  }
9011 
9012  static void convert( const fcml_st_segment_selector &src, SegmentSelector &dest ) {
9013  dest.setDefaultReg( src.is_default_reg ? true : false );
9014  convert( src.segment_selector, dest.getSegmentSelector() );
9015  }
9016 
9017  static void convert( const SegmentSelector &src, fcml_st_segment_selector &dest ) {
9018  dest.is_default_reg = src.isDefaultReg();
9019  convert( src.getSegmentSelector(), dest.segment_selector );
9020  }
9021 
9022  static void convert( const fcml_st_effective_address &src, EffectiveAddress &dest ) {
9023  convert( src.base, dest.getBase() );
9024  convert( src.index, dest.getIndex() );
9025  convert( src.displacement, dest.getDisplacement() );
9026  dest.setScaleFactor(src.scale_factor);
9027  }
9028 
9029  static void convert( const EffectiveAddress &src, fcml_st_effective_address &dest ) {
9030  convert( src.getBase(), dest.base );
9031  convert( src.getIndex(), dest.index );
9032  convert( src.getDisplacement(), dest.displacement );
9033  dest.scale_factor = src.getScaleFactor();
9034  }
9035 
9036  static void convert( const fcml_st_address &src, Address &dest ) {
9037  dest.setAddressForm( static_cast<Address::AddressForm>( src.address_form ) );
9038  dest.setSizeOperator( src.size_operator );
9039  convert( src.segment_selector, dest.getSegmentSelector() );
9040  convert( src.effective_address, dest.getEffectiveAddress() );
9041  convert( src.offset, dest.getOffset() );
9042  }
9043 
9044  static void convert( const Address &src, fcml_st_address &dest ) {
9045  dest.address_form = static_cast<fcml_en_effective_address_form>( src.getAddressForm() );
9046  dest.size_operator = src.getSizeOperator();
9047  convert( src.getSegmentSelector(), dest.segment_selector );
9048  convert( src.getEffectiveAddress(), dest.effective_address );
9049  convert( src.getOffset(), dest.offset );
9050  }
9051 
9052  static void convert(const fcml_st_operand &src, Operand &dest) {
9053  dest.setHints(src.hints);
9054  dest.setOperandType(static_cast<Operand::OperandType>(src.type));
9055  convert(src.address, dest.getAddress());
9056  convert(src.far_pointer, dest.getFarPointer());
9057  convert(src.immediate, dest.getImmediate());
9058  convert(src.reg, dest.getRegister());
9059  convert(src.decorators, dest.getDecorators());
9060  }
9061 
9062  static void convert(const Operand &src, fcml_st_operand &dest) {
9063  dest.hints = src.getHints();
9064  dest.type = static_cast<fcml_en_operand_type>(src.getOperandType());
9065  convert(src.getAddress(), dest.address);
9066  convert(src.getFarPointer(), dest.far_pointer);
9067  convert(src.getImmediate(), dest.immediate);
9068  convert(src.getRegister(), dest.reg);
9069  convert(src.getDecorators(), dest.decorators);
9070  }
9071 
9072  static void convert(const fcml_st_operand_decorators &src,
9073  Decorators &dest) {
9074  Nullable<fcml_uint8_t> bcast;
9075  bcast.setNotNull(FCML_TO_CPP_BOOL(src.bcast.is_not_null));
9076  bcast.setValue(src.bcast.value);
9077  dest.setBcast(bcast);
9079  er.setNotNull(FCML_TO_CPP_BOOL(src.er.is_not_null));
9080  er.setValue(static_cast<Decorators::EmbeededRoundingControl>(src.er.value));
9081  dest.setEr(er);
9082  dest.setZ(src.z);
9083  dest.setSae(src.sae);
9084  convert(src.operand_mask_reg, dest.getOpmaskReg());
9085  }
9086 
9087  static void convert(const Decorators &src, fcml_st_operand_decorators &dest) {
9088  dest.bcast.is_not_null = src.getBcast().isNotNull();
9089  dest.bcast.value = src.getBcast().getValue();
9090  dest.er.is_not_null = src.getEr().isNotNull();
9091  dest.er.value = static_cast<fcml_uint8_t>(src.getEr().getValue());
9092  dest.z = src.isZ();
9093  dest.sae = src.isSae();
9094  convert(src.getOpmaskReg(), dest.operand_mask_reg);
9095  }
9096 
9097  static void convert( const fcml_st_condition &src, Condition &dest ) {
9098  dest.setConditionType( static_cast<Condition::ConditionType>( src.condition_type ) );
9099  dest.setNegation( src.is_negation ? true : false );
9100  }
9101 
9102  static void convert( const Condition &src, fcml_st_condition &dest ) {
9103  dest.condition_type = static_cast<fcml_en_condition_type>( src.getConditionType() );
9104  dest.is_negation = src.isNegation();
9105  }
9106 
9107  static void convert( const fcml_st_instruction &src, Instruction &dest ) {
9108  dest.setMnemonic( src.mnemonic );
9109  convert( src.condition, dest.getCondition() );
9110  dest.setHints( src.hints );
9111  dest.setPrefixes( src.prefixes );
9112  dest.setConditional( src.is_conditional ? true : false );
9113  for( int i = 0; i < FCML_OPERANDS_COUNT; i++ ) {
9114  convert( src.operands[i], dest[i] );
9115  }
9116  dest.setOperandsCount(src.operands_count);
9117  }
9118 
9119  static void convert( const Instruction &src, fcml_st_instruction &dest ) {
9120  // Bear in mind that you are responsible for freeing mnemonic duplicated here.
9121  dest.mnemonic = Env::strDup( src.getMnemonic().c_str() );
9122  convert( src.getCondition(), dest.condition );
9123  dest.hints = src.getHints();
9124  dest.prefixes = src.getPrefixes();
9125  dest.is_conditional = src.isConditional();
9126  for( int i = 0; i < FCML_OPERANDS_COUNT; i++ ) {
9127  convert( src[i], dest.operands[i] );
9128  }
9129  dest.operands_count = src.getOperandsCount();
9130  }
9131 
9132  static void free( fcml_st_instruction &instruction ) {
9133  if( instruction.mnemonic ) {
9134  Env::strFree( instruction.mnemonic );
9135  instruction.mnemonic = NULL;
9136  }
9137  }
9138 };
9139 
9140 }
9141 
9142 #endif //FCML_COMMON_HPP_
fcml_char * mnemonic
Dialect-dependent instruction mnemonic.
Definition: fcml_common.h:791
IB & effw(const Register &base)
Adds an an effective address based operator for a base register and word size operator.
Definition: fcml_common.hpp:8462
EntryPoint()
Creates an empty entry point instance.
Definition: fcml_common.hpp:541
fcml_hints getHints() const
Gets instruction level hits associated with the instruction.
Definition: fcml_common.hpp:7320
static const Register ZMM15()
Factory method for a register.
Definition: fcml_common.hpp:3020
IB & eff(const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Adds an an effective address based operator for a displacement and optional size operator.
Definition: fcml_common.hpp:8384
An instruction builder.
Definition: fcml_common.hpp:7602
bool isRepnz() const
Returns true if lock repnz is set.
Definition: fcml_common.hpp:7451
bool isOffset() const
Returns true if address holds an offset only.
Definition: fcml_common.hpp:4839
fcml_ip ip
Instruction pointer EIP/RIP.
Definition: fcml_common.h:833
#define FCML_PREFIX_LOCK
LOCK prefix (0xF0)
Definition: fcml_common.h:48
static Operand effw(const Register &base, const Register &index, fcml_uint8_t scaleFactor)
Factory method which creates an effective address based operator for a base register, index register, scale factor and word size operator.
Definition: fcml_common.hpp:6368
static const Register R14()
Factory method for a register.
Definition: fcml_common.hpp:2920
IB & far_ptr(fcml_uint16_t seg, fcml_int32_t addr)
Adds a far pointer operand.
Definition: fcml_common.hpp:8132
static const Register DIL()
Factory method for a register.
Definition: fcml_common.hpp:2390
static FarPointer off32(fcml_uint16_t segment, fcml_int32_t offset)
Creates FarPointer instance for 16 bit segment and 32-bit offset.
Definition: fcml_common.hpp:4006
bool isNoBranchHint() const
Returns true if no_branch_hint prefix is set.
Definition: fcml_common.hpp:7514
const Nullable< EmbeededRoundingControl > & getEr() const
Gets AVX-512 {er} decorator.
Definition: fcml_common.hpp:5125
bool isNS() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6847
static const Register RIP()
Factory method for a register.
Definition: fcml_common.hpp:3800
static Operand reg(const Register &reg)
Factory method which creates an register based operator for given register.
Definition: fcml_common.hpp:6043
static const Register YMM6()
Factory method for a register.
Definition: fcml_common.hpp:2359
static const Register EDX()
Factory method for a register.
Definition: fcml_common.hpp:1968
static Operand offb(const Integer &offset)
Factory method which builds an offset based address operand with byte size operator.
Definition: fcml_common.hpp:5896
void reg(const Register &reg)
Prepares operator for the given register.
Definition: fcml_common.hpp:5424
IB & effd(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Adds an an effective address based operator for an index register, scaleFactor, displacement and doub...
Definition: fcml_common.hpp:8598
const EffectiveAddress & getEffectiveAddress() const
Gets reference to the constant effective address associated with the address.
Definition: fcml_common.hpp:4872
bool isNP() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6904
bool isRelativeAddressing() const
Returns true is relative addressing is used.
Definition: fcml_common.hpp:5739
static const Register R9W()
Factory method for a register.
Definition: fcml_common.hpp:2550
EffectiveAddress & setScaleFactor(fcml_uint8_t scaleFactor)
Sets a new scale factor for the effective address.
Definition: fcml_common.hpp:4580
static const Condition S()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6837
Describes segment register.
Definition: fcml_common.h:619
static Operand eff(const Register &base, const Register &index, fcml_uint8_t scaleFactor, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address based operator for a base register, index register, scale factor and optional size operator.
Definition: fcml_common.hpp:6344
Integer operator/(const Integer &src) const
Division operator.
Definition: fcml_common.hpp:1298
IB & eff(const Register &base, fcml_usize sizeOperator=FCML_DS_UNDEF)
Adds an an effective address based operator for a base register and optional size operator...
Definition: fcml_common.hpp:8440
static Operand addrb(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector)
Factory method which creates address type operand for given effective address and byte size operator...
Definition: fcml_common.hpp:6000
static const Register CX()
Factory method for a register.
Definition: fcml_common.hpp:1878
bool isRep() const
Returns true if rep prefix is set.
Definition: fcml_common.hpp:7460
IB & lock()
Sets a prefix described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7837
Register()
Creates an empty register instance.
Definition: fcml_common.hpp:1635
Address(const Integer &offset, fcml_usize sizeOperator=FCML_DS_UNDEF)
Creates an address instance with an offset and optional size operator set.
Definition: fcml_common.hpp:4633
static const InstructionPrefix REPNE()
Creates a prefix instance described by the name of the method.
Definition: fcml_common.hpp:7849
static const Register ESP()
Factory method for a register.
Definition: fcml_common.hpp:2138
IB & xacquire()
Sets a prefix described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7963
static const OperandHint OP_SIB_ENCODING()
Gets SIB encoding hint for the operand.
Definition: fcml_common.hpp:8059
Integer & setSigned(fcml_bool isSigned)
Definition: fcml_common.hpp:804
fcml_uint8_t getReg() const
Gets the register number.
Definition: fcml_common.hpp:1682
static const Register SS()
Factory method for a register.
Definition: fcml_common.hpp:3530
#define FCML_PREFIX_REPNE
REPNE prefix (0xF2)
Definition: fcml_common.h:50
static const Register DH()
Factory method for a register.
Definition: fcml_common.hpp:2289
fcml_usize operand_size_attribute
Default operand size attribute (See &#39;D&#39; flag of segment descriptor.)
Definition: fcml_common.h:830
Defines instruction&#39;s condition.
Definition: fcml_common.h:495
static const Condition PO()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6932
static Integer uint64(fcml_uint64_t value)
Factory method which creates an insatnce fo the Integer for given parameter.
Definition: fcml_common.hpp:1383
Effective address combined from address components like base register, index registers, factor, displacement etc...
Definition: fcml_common.h:583
EffectiveAddress()
Creates an empry effective address.
Definition: fcml_common.hpp:4268
static const Register ZMM9()
Factory method for a register.
Definition: fcml_common.hpp:2600
IB & effw(const Register &base, const Register &index, fcml_uint8_t scaleFactor)
Adds an an effective address based operator for a base register, index register, scale factor and wor...
Definition: fcml_common.hpp:8712
static const Register XMM30()
Factory method for a register.
Definition: fcml_common.hpp:3450
fcml_uint16_t segment
16-bit Code segment.
Definition: fcml_common.h:558
fcml_int16_t offset16
16-bit offset.
Definition: fcml_common.h:562
static const Register YMM7()
Factory method for a register.
Definition: fcml_common.hpp:2450
static Address effective(const Register &base, const Register &index, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address instance with the base register and index register...
Definition: fcml_common.hpp:4723
const Decorators & getDecorators() const
Gets constant decorators associated with the operand.
Definition: fcml_common.hpp:5663
IB & eff(const Register &base, const Register &index, fcml_usize sizeOperator=FCML_DS_UNDEF)
Adds an an effective address based operator for a base register, index register and optional size ope...
Definition: fcml_common.hpp:8624
static IB inst(const fcml_cstring &mnemonic)
Factory method that can be used to create instruction builder.
Definition: fcml_common.hpp:7708
bool operator==(const SegmentSelector &segmentSelector) const
Checks if two segment selector are equal.
Definition: fcml_common.hpp:4143
fcml_en_register
Register type.
Definition: fcml_common.h:426
static const Register R9L()
Factory method for a register.
Definition: fcml_common.hpp:2540
Instruction & setOperandsCount(fcml_int operandsCount)
Sets number of operands available in the instruction.
Definition: fcml_common.hpp:7397
Operand & setRegister(const Register &reg)
Sets a new register for the operand.
Definition: fcml_common.hpp:5630
Illegal state exception.
Definition: fcml_common.hpp:253
static const Register ZMM12()
Factory method for a register.
Definition: fcml_common.hpp:2810
void setSegmentSelector(const Register &segmentSelector)
Sets segment register for the selector.
Definition: fcml_common.hpp:4244
static const Register DR0()
Factory method for a register.
Definition: fcml_common.hpp:3700
Two way conversion for common types.
Definition: fcml_common.hpp:8933
void setIP(fcml_ip ip)
Sets a new instruction pointer for the entry point.
Definition: fcml_common.hpp:651
Container for operand decorators.
Definition: fcml_common.h:657
void setOperandSizeAttribute(fcml_usize operandSizeAttribute)
Sets a new operand size attribute for the entry point.
Definition: fcml_common.hpp:631
fcml_st_integer immediate
Immediate value operand.
Definition: fcml_common.h:741
bool isO() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6524
bool operator==(const EntryPoint &ep) const
Checks if two entry points are equal.
Definition: fcml_common.hpp:575
static const Register YMM30()
Factory method for a register.
Definition: fcml_common.hpp:3460
static Operand effd(const Integer &displacement)
Factory method which creates an effective address based operator for a displacement and double word s...
Definition: fcml_common.hpp:6097
static Operand effq(const Register &base)
Factory method which creates an effective address based operator for a base register and quadro word ...
Definition: fcml_common.hpp:6158
const Register & getRegister() const
Returns a reference to the constant register associated with the operand.
Definition: fcml_common.hpp:5609
static Integer uint16(fcml_uint16_t value)
Factory method which creates an instance fo the Integer for given parameter.
Definition: fcml_common.hpp:1343
const Nullable< fcml_uint8_t > & getBcast() const
Gets AVX-512 {bcast} decorator.
Definition: fcml_common.hpp:5095
#define FCML_PREFIX_REPZ
REPZ prefix (0xF3)
Definition: fcml_common.h:58
void setX64Exp(bool x64Exp)
Sets x64exp flag, see manual.
Definition: fcml_common.hpp:1745
bool operator!=(const fcml_int16_t value) const
Checks if the integer is not equal to the passed value.
Definition: fcml_common.hpp:959
static const Register ES()
Factory method for a register.
Definition: fcml_common.hpp:3510
static const Register DL()
Factory method for a register.
Definition: fcml_common.hpp:1948
static const Register YMM19()
Factory method for a register.
Definition: fcml_common.hpp:3130
virtual ~Address()
Definition: fcml_common.hpp:4668
static const Condition GE()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:7008
fcml_st_operand_decorators decorators
Operand decorators.
Definition: fcml_common.h:749
static const Register YMM13()
Factory method for a register.
Definition: fcml_common.hpp:2870
static const Register YMM8()
Factory method for a register.
Definition: fcml_common.hpp:2520
6 Less than
Definition: fcml_common.h:487
IB & nobranchHint()
Sets a prefix described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:8026
static const Register YMM31()
Factory method for a register.
Definition: fcml_common.hpp:3490
static const OperandHint MULTIMEDIA()
Creates operand level hint: MULTIMEDIA_INSTRUCTION.
Definition: fcml_common.hpp:478
bool isSIBEncoding() const
Returns true if the SIB byte is used.
Definition: fcml_common.hpp:5749
static const Register CH()
Factory method for a register.
Definition: fcml_common.hpp:2199
fcml_bool x64_exp
In case of SPL,BPL,SIL,DIL GPR registers has to be set to true.
Definition: fcml_common.h:458
Control register.
Definition: fcml_common.h:438
Condition(ConditionType type, bool negation=false)
Creates a condition for given parameters.
Definition: fcml_common.hpp:6512
Segment register.
Definition: fcml_common.h:436
bool operator==(const Address &address) const
Checks if two addresses are equal or not.
Definition: fcml_common.hpp:4761
Operand mask register.
Definition: fcml_common.h:444
Describes segment register.
Definition: fcml_common.hpp:4109
bool isBranchHint() const
Returns true if branch_hint prefix is set.
Definition: fcml_common.hpp:7505
Operand & setImmediate(const Integer &immediate)
Sets a new immediate value for the address.
Definition: fcml_common.hpp:5576
static const Register RBP()
Factory method for a register.
Definition: fcml_common.hpp:2239
SegmentSelector & getSegmentSelector()
Gets the segment selector associated with the address.
Definition: fcml_common.hpp:4946
fcml_bool isZ() const
Gets AVX-512 {z} operator.
Definition: fcml_common.hpp:5085
virtual ~Register()
Definition: fcml_common.hpp:1672
static const Register RDX()
Factory method for a register.
Definition: fcml_common.hpp:1978
static const InstructionPrefix LOCK()
Creates a prefix instance described by the name of the method.
Definition: fcml_common.hpp:7828
static const Register XMM2()
Factory method for a register.
Definition: fcml_common.hpp:1998
const Integer & getImmediate() const
Gets a reference to the constant immediate value associated with the operand.
Definition: fcml_common.hpp:5555
static const Register ZMM22()
Factory method for a register.
Definition: fcml_common.hpp:3230
std::basic_string< fcml_char > fcml_cstring
By using this type definition here, it will be definitely much easier to support UNICODE in future re...
Definition: fcml_common.hpp:53
RegisterType getType() const
Gets the register type.
Definition: fcml_common.hpp:1718
Address operand.
Definition: fcml_common.hpp:4601
bool isNB() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6581
fcml_st_register operand_mask_reg
The 64-bit k registers are: k0 through k7.
Definition: fcml_common.h:663
x86 - 64 register representation.
Definition: fcml_common.hpp:1601
bool operator==(const EffectiveAddress &address) const
Checks whether two effective addresses are equal or not.
Definition: fcml_common.hpp:4371
static const Register R12W()
Factory method for a register.
Definition: fcml_common.hpp:2760
static const Register XMM26()
Factory method for a register.
Definition: fcml_common.hpp:3330
fcml_st_segment_selector segment_selector
Segment register.
Definition: fcml_common.h:639
static EffectiveAddress addr(const Register &base, const Register &index)
Factory method which creates an effective address instance with the base register and index register...
Definition: fcml_common.hpp:4438
static const Register MM1()
Factory method for a register.
Definition: fcml_common.hpp:1908
static const Register ZMM25()
Factory method for a register.
Definition: fcml_common.hpp:3320
IB & effq(const Register &base, const Register &index, fcml_uint8_t scaleFactor)
Adds an an effective address based operator for a base register, index register, scale factor and qua...
Definition: fcml_common.hpp:8738
static Operand addrq(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector)
Factory method which creates address type operand for given effective address and quadro word size op...
Definition: fcml_common.hpp:6033
IB & effq(const Register &base, const Register &index)
Adds an an effective address based operator for a base register, index register and quadro word size ...
Definition: fcml_common.hpp:8672
fcml_bool isSigned() const
Definition: fcml_common.hpp:799
fcml_en_operand_type
Supported operand types.
Definition: fcml_common.h:673
static const Register XMM17()
Factory method for a register.
Definition: fcml_common.hpp:3060
void incrementIP(fcml_ip ip)
Increments the instruction pointer by given number of bytes.
Definition: fcml_common.hpp:681
bool operator!=(const Condition &cond) const
Checks if two condition are equal.
Definition: fcml_common.hpp:7109
static Address offset(const Integer &offset, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factor method which creates an address instance with an offset and optional size operator set...
Definition: fcml_common.hpp:4817
Relative address.
Definition: fcml_common.h:710
static const InstructionPrefix NO_BRANCH()
Creates a prefix instance described by the name of the method.
Definition: fcml_common.hpp:8017
fcml_uint16_t fcml_hints
Type used for storing instruction and operand hint masks.
Definition: fcml_common.h:86
#define FCML_PREFIX_REPE
REPE prefix (0xF3)
Definition: fcml_common.h:56
const Condition & getCondition() const
Gets a pointer to the constant condition associated with the instruction.
Definition: fcml_common.hpp:7288
static const Register XMM28()
Factory method for a register.
Definition: fcml_common.hpp:3390
static Address effective(const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address instance with the displacement only.
Definition: fcml_common.hpp:4679
Wraps operand hint and exposes factory methods for instruction hints.
Definition: fcml_common.hpp:461
IB & effb(const Register &base, const Register &index)
Adds an an effective address based operator for a base register, index register and byte size operato...
Definition: fcml_common.hpp:8636
static Operand addrd(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector)
Factory method which creates address type operand for given effective address and double word size op...
Definition: fcml_common.hpp:6022
static const Condition A()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6818
static Operand eff(const Register &base, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address based operator for a base register and optional siz...
Definition: fcml_common.hpp:6118
EffectiveAddress(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Creates an effective address instance with the index register, scale factor and displacement.
Definition: fcml_common.hpp:4311
IB & effd(const Register &base, const Register &index)
Adds an an effective address based operator for a base register, index register and double word size ...
Definition: fcml_common.hpp:8660
fcml_usize size
Offset size 16,32 or 64 bits.
Definition: fcml_common.h:591
fcml_usize getSizeOperator() const
Gets the size operator associated with the address.
Definition: fcml_common.hpp:4968
bool isNG() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:7037
General purpose register.
Definition: fcml_common.h:430
5 Parity
Definition: fcml_common.h:485
bool isRepz() const
Returns true if repz prefix is set.
Definition: fcml_common.hpp:7478
fcml_en_operating_mode
Supported processor operating modes.
Definition: fcml_common.h:73
Integer(fcml_int8_t value)
Definition: fcml_common.hpp:709
Common general purpose utility functions.
static const Register AH()
Factory method for a register.
Definition: fcml_common.hpp:2108
static const Register YMM18()
Factory method for a register.
Definition: fcml_common.hpp:3100
bool isDefaultReg() const
Returns true if a register stored in the segment selector is the default one in the context the segme...
Definition: fcml_common.hpp:4204
static const Register YMM27()
Factory method for a register.
Definition: fcml_common.hpp:3370
static const InstructionPrefix REPZ()
Creates a prefix instance described by the name of the method.
Definition: fcml_common.hpp:7933
ConditionType
See fcml_st_condition for more details.
Definition: fcml_common.hpp:6477
IB & branchHint()
Sets a prefix described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:8005
IB & addrw(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector)
Adds an address type operand for given effective address and byte size operator.
Definition: fcml_common.hpp:8318
bool isMultimedia() const
Returns information if the operand is multimedia one or not.
Definition: fcml_common.hpp:5698
Integer & setInt64(fcml_int64_t int64)
Definition: fcml_common.hpp:782
void undef()
Converts operand to the undefined one.
Definition: fcml_common.hpp:5320
static const Condition P()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6875
Instruction & setCondition(const Condition &condition)
Sets a new condition for the instruction.
Definition: fcml_common.hpp:7309
Wrapper for nullable value types.
Definition: fcml_common.hpp:120
static const Register DR7()
Factory method for a register.
Definition: fcml_common.hpp:3770
bool operator==(const fcml_int32_t value) const
Checks if the integer is equal to the passed value.
Definition: fcml_common.hpp:882
static const Register XMM23()
Factory method for a register.
Definition: fcml_common.hpp:3240
Hints instruction to use FAR pointer to address the memory.
Definition: fcml_common.h:766
bool isPE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6885
Instruction pointer register.
Definition: fcml_common.h:442
bool isXRelease() const
Returns true if xrelease prefix is set.
Definition: fcml_common.hpp:7496
static const InstructionHint INDIRECT_PTR()
Creates a hint instance described by the name of the method.
Definition: fcml_common.hpp:7784
static Operand off(const Integer &offset, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which builds an address operand.
Definition: fcml_common.hpp:5886
static const Register ZMM29()
Factory method for a register.
Definition: fcml_common.hpp:3440
static const Register ST6()
Factory method for a register.
Definition: fcml_common.hpp:3630
IB & rep()
Sets a prefix described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7900
fcml_uint8_t reg
Register itself as a positive integer.
Definition: fcml_common.h:456
enum fcml_en_address_form fcml_en_effective_address_form
Memory addressing using ModR/M field.
void addr(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector, fcml_usize sizeOperator=FCML_DS_UNDEF)
Prepares address operator for given parameters.
Definition: fcml_common.hpp:5413
bool isNA() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6771
static const Register XMM31()
Factory method for a register.
Definition: fcml_common.hpp:3480
static Address effective(const EffectiveAddress &effectiveAddress, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factor method which creates an address instance with an effective address and optional size operator ...
Definition: fcml_common.hpp:4805
static const OperandHint OP_ABSOLUTE_ADDRESSING()
Gets absolute hint for the operand.
Definition: fcml_common.hpp:8051
fcml_st_integer displacement
Displacement value.
Definition: fcml_common.h:613
#define FCML_TEXT(x)
Used to code literal strings.
Definition: fcml_types.h:61
Decorators & setBcast(const Nullable< fcml_uint8_t > &bcast)
Sets a new AVX-512 {bcast} decorator.
Definition: fcml_common.hpp:5041
static const Register YMM29()
Factory method for a register.
Definition: fcml_common.hpp:3430
static const Register ZMM11()
Factory method for a register.
Definition: fcml_common.hpp:2740
bool operator!=(const EffectiveAddress &address) const
Checks whether two effective addresses are equal or not.
Definition: fcml_common.hpp:4387
static const Register R13D()
Factory method for a register.
Definition: fcml_common.hpp:2840
static const Register ZMM7()
Factory method for a register.
Definition: fcml_common.hpp:2460
0 Overflow
Definition: fcml_common.h:475
Address & setSizeOperator(fcml_usize sizeOperator)
Sets a new size operator for the address.
Definition: fcml_common.hpp:4978
static const Condition NGE()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6970
EffectiveAddress(const Register &base)
Creates an effective address instance with the base register only.
Definition: fcml_common.hpp:4287
static const Register IP()
Factory method for a register.
Definition: fcml_common.hpp:3780
static const Register YMM9()
Factory method for a register.
Definition: fcml_common.hpp:2590
IB & offb(const Integer &offset)
Adds an offset based address operand with byte size operator.
Definition: fcml_common.hpp:8181
Definitions of common structures used by FCML components.
static const Register DR3()
Factory method for a register.
Definition: fcml_common.hpp:3730
fcml_int32_t getInt32() const
Definition: fcml_common.hpp:766
bool operator==(const Integer &value) const
Checks if the integer is equal to the passed value.
Definition: fcml_common.hpp:915
static const Register DI()
Factory method for a register.
Definition: fcml_common.hpp:2400
static Operand effw(const Register &base, const Register &index)
Factory method which creates an effective address based operator for a base register, index register and word size operator.
Definition: fcml_common.hpp:6309
Encode ModR/M with optional SIB byte if possible.
Definition: fcml_common.h:729
bool operator!=(const Register &reg) const
Compares registers.
Definition: fcml_common.hpp:1767
static const Condition NZ()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6742
IB & effb(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Adds an an effective address based operator for a base register, index register, scale factor and byt...
Definition: fcml_common.hpp:8767
bool isNL() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6980
static const Register EDI()
Factory method for a register.
Definition: fcml_common.hpp:2410
static const Condition NP()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6913
static const InstructionPrefix XRELEASE()
Creates a prefix instance described by the name of the method.
Definition: fcml_common.hpp:7975
static const Register XMM9()
Factory method for a register.
Definition: fcml_common.hpp:2580
EntryPoint(OperatingMode opMode, fcml_ip ip=0, fcml_usize addressSizeAttribute=FCML_DS_UNDEF, fcml_usize operandSizeAttribute=FCML_DS_UNDEF)
Creates an entry point instance for given processor operating mode, instruction pointer and optionall...
Definition: fcml_common.hpp:556
IB & effq(const Integer &displacement)
Adds an an effective address based operator for a displacement and quadro byte size operator...
Definition: fcml_common.hpp:8428
static SegmentSelector seg(const Register &segmentSelector, bool isDefaultReg)
Creates segment selector for the given register.
Definition: fcml_common.hpp:4191
static const Register R12()
Factory method for a register.
Definition: fcml_common.hpp:2780
FarPointer(fcml_uint16_t segment, fcml_int32_t offset32)
Creates an far pointer instance.
Definition: fcml_common.hpp:3935
Holds instruction pointer, processor operating mode and memory segment flags.
Definition: fcml_common.hpp:524
void setSegment(fcml_uint16_t segment)
Sets segment selector.
Definition: fcml_common.hpp:4088
static const InstructionPrefix REPZ()
Creates instruction prefix: REPZ.
Definition: fcml_common.hpp:364
static const OperandHint OP_MULTIMEDIA_HINT()
Gets multimedia hint for the operand.
Definition: fcml_common.hpp:8035
static const Register GS()
Factory method for a register.
Definition: fcml_common.hpp:3560
static Operand effq(const Register &base, const Integer &displacement)
Factory method which creates an effective address based operator for a base register, displacement and quadro word size operator.
Definition: fcml_common.hpp:6214
fcml_int16_t getOffset16() const
Gets the 16-bit offset.
Definition: fcml_common.hpp:4038
IB & effw(const Integer &displacement)
Adds an an effective address based operator for a displacement and word size operator.
Definition: fcml_common.hpp:8406
static Operand addr(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates address type operand for given segment selector, effective address and o...
Definition: fcml_common.hpp:5989
static Operand effd(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Factory method which creates an effective address based operator for a base register, index register, scale factor and double word size operator.
Definition: fcml_common.hpp:6445
static const Condition NBE()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6799
static Address effective(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address instance with the index register, scale factor and displacement.
Definition: fcml_common.hpp:4712
static const Register DR1()
Factory method for a register.
Definition: fcml_common.hpp:3710
const Address & getAddress() const
Gets reference to the constant address associated with the operand.
Definition: fcml_common.hpp:5491
static const Register ST0()
Factory method for a register.
Definition: fcml_common.hpp:3570
void addr(const EffectiveAddress &effectiveAddress, fcml_usize sizeOperator=FCML_DS_UNDEF)
Prepares an address operand for given effective address and optional size operator.
Definition: fcml_common.hpp:5400
IB & off(const Integer &offset, fcml_usize sizeOperator=FCML_DS_UNDEF)
Adds an offset operand.
Definition: fcml_common.hpp:8169
void setAddressSizeAttribute(fcml_usize addressSizeAttribute)
Sets a new address size attribute for the entry point.
Definition: fcml_common.hpp:611
Generic instruction model.
Definition: fcml_common.h:783
static const Register YMM4()
Factory method for a register.
Definition: fcml_common.hpp:2178
fcml_int32_t offset32
32-bit offset.
Definition: fcml_common.h:564
bool operator==(const fcml_uint8_t value) const
Checks if the integer is equal to the passed value.
Definition: fcml_common.hpp:827
static Operand eff(const Register &base, const Register &index, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address based operator for a base register, index register and optional size operator.
Definition: fcml_common.hpp:6287
Instruction()
Creates an empty instruction.
Definition: fcml_common.hpp:7192
Register & getBase()
Gets the base register associated with the effective address.
Definition: fcml_common.hpp:4483
IB & repnz()
Sets a prefix described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7879
IB & effd(const Integer &displacement)
Adds an an effective address based operator for a displacement and double word size operator...
Definition: fcml_common.hpp:8417
void setType(RegisterType type)
Sets the register type.
Definition: fcml_common.hpp:1727
static const Condition Z()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6704
Integer & setSize(fcml_usize size)
Definition: fcml_common.hpp:815
static Operand offd(const Integer &offset)
Factory method which builds an offset based address operand with double word size operator...
Definition: fcml_common.hpp:5916
IB & operandSIBEncodingHint()
Sets preferred encoding to SIB for the lastly added ModR/M operand.
Definition: fcml_common.hpp:8094
Operand builder.
Definition: fcml_common.hpp:5816
void add(const Operand &operand)
Adds a new operand to the instruction.
Definition: fcml_common.hpp:7222
bool isPseudoOpcode() const
Returns true if it&#39;s pseudo opcode operand.
Definition: fcml_common.hpp:5719
IB & effd(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Adds an an effective address based operator for a base register, index register, scale factor and dou...
Definition: fcml_common.hpp:8795
Address & getAddress()
Gets reference to the address associated with the operand.
Definition: fcml_common.hpp:5501
void addr(const Address &address)
Prepares address operand for given address.
Definition: fcml_common.hpp:5376
IB & effq(const Register &base)
Adds an an effective address based operator for a base register and quadro word size operator...
Definition: fcml_common.hpp:8484
IB & effw(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Adds an an effective address based operator for an index register, scaleFactor, displacement and word...
Definition: fcml_common.hpp:8585
bool isConditional() const
Gets true if it&#39;s a conditional instruction.
Definition: fcml_common.hpp:7342
Describes far pointer.
Definition: fcml_common.hpp:3902
bool isNegation() const
Returns true if condition is negated.
Definition: fcml_common.hpp:7142
static Operand effq(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Factory method which creates an effective address based operator for an index register, scaleFactor, displacement and quadro word size operator.
Definition: fcml_common.hpp:6275
static Operand far_ptr(fcml_uint16_t seg, fcml_int16_t addr)
Factory method which builds a far pointer operand.
Definition: fcml_common.hpp:5844
#define FCML_PREFIX_XACQUIRE
XACQUIRE prefix (0xF2)
Definition: fcml_common.h:60
static const Register YMM20()
Factory method for a register.
Definition: fcml_common.hpp:3160
static const Register ECX()
Factory method for a register.
Definition: fcml_common.hpp:1888
Integer & setInt8(fcml_int8_t int8)
Definition: fcml_common.hpp:793
fcml_int64_t getInt64() const
Definition: fcml_common.hpp:777
static const Register R11L()
Factory method for a register.
Definition: fcml_common.hpp:2680
static const Register ZMM28()
Factory method for a register.
Definition: fcml_common.hpp:3410
Integer & setInt32(fcml_int32_t int32)
Definition: fcml_common.hpp:771
static const Register K2()
Factory method for a register.
Definition: fcml_common.hpp:3830
Definition: fcml_assembler.hpp:39
Operand & operator[](fcml_int index)
Gets reference to the operand at given index.
Definition: fcml_common.hpp:7263
fcml_bool is_default_reg
Set to true if given segment register is a default one in given context.
Definition: fcml_common.h:625
const Register & getOpmaskReg() const
Gets constant AVX-512 opmask register for {k} decorator.
Definition: fcml_common.hpp:5105
Integer operator+(const Integer &src) const
Addition operator.
Definition: fcml_common.hpp:1265
static Operand offw(const Integer &offset)
Factory method which builds an offset based address operand with word size operator.
Definition: fcml_common.hpp:5906
static const Register XMM1()
Factory method for a register.
Definition: fcml_common.hpp:1918
IB & eff(const Register &base, const Register &index, fcml_uint8_t scaleFactor, fcml_usize sizeOperator=FCML_DS_UNDEF)
Adds an an effective address based operator for a base register, index register, scale factor and opt...
Definition: fcml_common.hpp:8686
Offset should be encoded as relative address.
Definition: fcml_common.h:725
static const InstructionPrefix NOBRANCH_HINT()
Creates instruction prefix: NOBRANCH_HINT.
Definition: fcml_common.hpp:392
Decorators & setOpmaskReg(const Register &opmaskReg)
Sets AVX-512 opmask register for {k} decorator.
Definition: fcml_common.hpp:5052
static Operand eff(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address based operator for a base register, index register, scale factor and optional size operator.
Definition: fcml_common.hpp:6406
#define FCML_PREFIX_REPNZ
REPNZ prefix (0xF2)
Definition: fcml_common.h:52
IB & effd(const Register &base, const Register &index, fcml_uint8_t scaleFactor)
Adds an an effective address based operator for a base register, index register, scale factor and dou...
Definition: fcml_common.hpp:8725
static const Register YMM21()
Factory method for a register.
Definition: fcml_common.hpp:3190
static const Register DS()
Factory method for a register.
Definition: fcml_common.hpp:3540
static Operand imm(const Integer &imm)
Factory method which builds an immediate operand.
Definition: fcml_common.hpp:5833
IB & directPtr()
Sets a hint described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7814
#define FCML_OPERANDS_COUNT
Maximal number of the instruction operands.
Definition: fcml_common.h:35
Integer & getOffset()
Gets the offset associated with the address.
Definition: fcml_common.hpp:4914
Wraps instruction hint and exposes factory methods for instruction hints.
Definition: fcml_common.hpp:402
static Operand effd(const Register &base, const Register &index)
Factory method which creates an effective address based operator for a base register, index register and double word size operator.
Definition: fcml_common.hpp:6320
bool getX64Exp() const
Gets true if it&#39;s a 8-bit general purpose register for REX aware instruction.
Definition: fcml_common.hpp:1736
IB & addr(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector, fcml_usize sizeOperator=FCML_DS_UNDEF)
Adds an address type operand for given segment selector, effective address and optional size operator...
Definition: fcml_common.hpp:8292
This hint is used only by assembler in order to force it to generate three byte VEX/XOP prefix even i...
Definition: fcml_common.h:771
void clean()
Cleans the instruction by removing all operands from it.
Definition: fcml_common.hpp:7272
bool isBE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6752
const Integer & getOffset() const
Gets the constant offset associated with the address.
Definition: fcml_common.hpp:4904
OperandType getOperandType() const
Gets operand type.
Definition: fcml_common.hpp:5587
static Operand effb(const Register &base, const Register &index)
Factory method which creates an effective address based operator for a base register, index register and byte size operator.
Definition: fcml_common.hpp:6298
EffectiveAddress & setDisplacement(const Integer &displacement)
Sets a new displacement value for the effective address.
Definition: fcml_common.hpp:4526
static const Register XMM3()
Factory method for a register.
Definition: fcml_common.hpp:2078
FarPointer & getFarPointer()
Gets a reference to the far pointer instance associated with the address.
Definition: fcml_common.hpp:5533
IB & indirectPtr()
Sets a hint described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7793
bool operator==(const FarPointer &fp) const
Compares two far pointers.
Definition: fcml_common.hpp:3953
fcml_uint16_t getSegment() const
Gets segment selector.
Definition: fcml_common.hpp:4078
Offset should be encoded as absolute address.
Definition: fcml_common.h:721
static const Register XMM10()
Factory method for a register.
Definition: fcml_common.hpp:2650
static const Register BP()
Factory method for a register.
Definition: fcml_common.hpp:2219
static const Register AX()
Factory method for a register.
Definition: fcml_common.hpp:1798
bool isNZ() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6733
static const Register R14W()
Factory method for a register.
Definition: fcml_common.hpp:2900
static const InstructionPrefix BRANCH_HINT()
Creates instruction prefix: BRANCH_HINT.
Definition: fcml_common.hpp:385
static Integer int32(fcml_int32_t value)
Factory method which creates an insatnce fo the Integer for given parameter.
Definition: fcml_common.hpp:1353
static const Register XMM27()
Factory method for a register.
Definition: fcml_common.hpp:3360
static Operand reg(fcml_uint8_t reg, fcml_usize size, Register::RegisterType type=Register::REG_GPR, fcml_bool x64_exp=FCML_FALSE)
Factory method which creates an register based operator for given parameters.
Definition: fcml_common.hpp:6056
static const Register YMM0()
Factory method for a register.
Definition: fcml_common.hpp:1848
Integer operator-(const Integer &src) const
Subtraction operator.
Definition: fcml_common.hpp:1276
IB & repe()
Sets a prefix described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7921
Structure describes x86_64 register.
Definition: fcml_common.h:450
Base exception for all exceptions exposed by FCML library.
Definition: fcml_common.hpp:187
static const InstructionPrefix REPNZ()
Creates instruction prefix: REPNZ.
Definition: fcml_common.hpp:343
Instruction operand.
Definition: fcml_common.hpp:5184
static Operand effw(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Factory method which creates an effective address based operator for a base register, index register, scale factor and word size operator.
Definition: fcml_common.hpp:6432
Hints instruction to use DIRECT memory addressing.
Definition: fcml_common.h:775
static FarPointer off16(fcml_uint16_t segment, fcml_int16_t offset)
Creates FarPointer instance for 16 bit segment and 16-bit offset.
Definition: fcml_common.hpp:3995
static const Register MM2()
Factory method for a register.
Definition: fcml_common.hpp:1988
void setOffset16(fcml_int16_t offset16)
Sets 16-bit offset.
Definition: fcml_common.hpp:4048
static const Register R14D()
Factory method for a register.
Definition: fcml_common.hpp:2910
static const Register MM4()
Factory method for a register.
Definition: fcml_common.hpp:2158
fcml_bool sae
Indicates support for SAE (Suppress All Exceptions).
Definition: fcml_common.h:667
static const Register RBX()
Factory method for a register.
Definition: fcml_common.hpp:2058
static Operand effb(const Register &base, const Integer &displacement)
Factory method which creates an effective address based operator for a base register, displacement and byte size operator.
Definition: fcml_common.hpp:6181
static EffectiveAddress addr(const Register &base, const Integer &displacement)
Factory method which creates an effective address instance with the base register and displacement...
Definition: fcml_common.hpp:4417
static const Register ST3()
Factory method for a register.
Definition: fcml_common.hpp:3600
bool operator!=(const Address &address) const
Checks if two addresses are equal or not.
Definition: fcml_common.hpp:4778
fcml_usize getAddressSizeAttribute() const
Gets address size attribute held by the entry point.
Definition: fcml_common.hpp:601
bool isNE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6714
static Integer uint32(fcml_uint32_t value)
Factory method which creates an insatnce fo the Integer for given parameter.
Definition: fcml_common.hpp:1363
IB & operandRelativeHint()
Marks the lastly added address operand as a relative one.
Definition: fcml_common.hpp:8076
bool operator==(const Operand &op) const
Checks if two operands are equal or not.
Definition: fcml_common.hpp:5275
static const Condition L()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6951
3 Below or equal
Definition: fcml_common.h:481
IB & addrb(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector)
Adds an address type operand for given effective address and byte size operator.
Definition: fcml_common.hpp:8305
fcml_en_condition_type
Condition type.
Definition: fcml_common.h:473
IB & repz()
Sets a prefix described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7942
Represents integer value.
Definition: fcml_common.hpp:700
static const Register K1()
Factory method for a register.
Definition: fcml_common.hpp:3820
static const Register DR5()
Factory method for a register.
Definition: fcml_common.hpp:3750
static Operand effd(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Factory method which creates an effective address based operator for an index register, scaleFactor, displacement and double word size operator.
Definition: fcml_common.hpp:6263
static const OperandHint ABSOLUTE_ADDRESSING()
Creates operand level hint: ABSOLUTE_ADDRESSING.
Definition: fcml_common.hpp:499
bool isRepne() const
Returns true if repne prefix is set.
Definition: fcml_common.hpp:7442
static Operand effq(const Register &base, const Register &index, fcml_uint8_t scaleFactor)
Factory method which creates an effective address based operator for a base register, index register, scale factor and quadro word size operator.
Definition: fcml_common.hpp:6392
bool operator==(const fcml_int16_t value) const
Checks if the integer is equal to the passed value.
Definition: fcml_common.hpp:860
bool operator!=(const FarPointer &fp) const
Compares two far pointers.
Definition: fcml_common.hpp:3981
static Operand effb(const Register &base)
Factory method which creates an effective address based operator for a base register and byte size op...
Definition: fcml_common.hpp:6128
Decorators & getDecorators()
Gets decorators associated with the operand.
Definition: fcml_common.hpp:5673
static const Register YMM10()
Factory method for a register.
Definition: fcml_common.hpp:2660
static const InstructionHint DIRECT_PTR()
Creates a hint instance described by the name of the method.
Definition: fcml_common.hpp:7805
fcml_st_register reg
Register operand.
Definition: fcml_common.h:747
static const Register XMM24()
Factory method for a register.
Definition: fcml_common.hpp:3270
fcml_en_operating_mode op_mode
Processor operating mode 16/32/64-bit.
Definition: fcml_common.h:826
IB & longFormPtr()
Sets a hint described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7772
fcml_usize getSize() const
Gets the register size.
Definition: fcml_common.hpp:1700
static EffectiveAddress addr(const Integer &displacement)
Factory method which creates an effective address instance with the displacement only.
Definition: fcml_common.hpp:4398
static const Register ZMM14()
Factory method for a register.
Definition: fcml_common.hpp:2950
static const Register XMM15()
Factory method for a register.
Definition: fcml_common.hpp:3000
Operand not used.
Definition: fcml_common.h:675
static fcml_string strDup(const fcml_string str)
Definition: fcml_common.hpp:74
static const Condition NAE()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6609
static const InstructionHint INDIRECT_POINTER()
Creates instruction hint: INDIRECT_POINTER.
Definition: fcml_common.hpp:444
FPU register.
Definition: fcml_common.h:434
static const Register EIP()
Factory method for a register.
Definition: fcml_common.hpp:3790
bool operator==(const Decorators &decorators) const
Checks if two decorators containers are equal or not.
Definition: fcml_common.hpp:5147
static const OperandHint UNDEFIEND()
Creates operand level hint: UNDEFIEND.
Definition: fcml_common.hpp:471
static const Register R15()
Factory method for a register.
Definition: fcml_common.hpp:2990
fcml_int8_t getInt8() const
Definition: fcml_common.hpp:788
Processor register.
Definition: fcml_common.h:683
fcml_prefixes prefixes
Describes explicit instruction prefixes.
Definition: fcml_common.h:786
Integer(fcml_uint16_t value)
Definition: fcml_common.hpp:734
static const OperandHint RELATIVE_ADDRESSING()
Creates operand level hint: RELATIVE_ADDRESSING.
Definition: fcml_common.hpp:506
fcml_st_register base
GPR base register.
Definition: fcml_common.h:607
EffectiveAddress(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Creates an effective address instance with the base register, index register, scale factor and displa...
Definition: fcml_common.hpp:4350
static const Condition C()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6647
static const Register XMM6()
Factory method for a register.
Definition: fcml_common.hpp:2349
fcml_prefixes getPrefixes() const
Gets prefixes associated with the instruction.
Definition: fcml_common.hpp:7408
static const Register CR4()
Factory method for a register.
Definition: fcml_common.hpp:3680
static Operand eff(const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address based operator for a displacement and optional size...
Definition: fcml_common.hpp:6067
IB & far_ptr(const FarPointer &pointer)
Adds a far pointer operand.
Definition: fcml_common.hpp:8144
static Integer int64(fcml_int64_t value)
Factory method which creates an insatnce fo the Integer for given parameter.
Definition: fcml_common.hpp:1373
void imm(const Integer &imm)
Sets given immediate value for the operand and makes it to be an immediate operand.
Definition: fcml_common.hpp:5330
FarPointer()
Creates an far pointer instance.
Definition: fcml_common.hpp:3910
IB & effq(const Register &base, const Integer &displacement)
Adds an an effective address based operator for a base register, displacement and quadro word size op...
Definition: fcml_common.hpp:8545
void op(const Operand &operand)
Sets a next operand for the instruction.
Definition: fcml_common.hpp:7694
bool operator==(const fcml_uint32_t value) const
Checks if the integer is equal to the passed value.
Definition: fcml_common.hpp:871
FarPointer(fcml_uint16_t segment, fcml_int16_t offset16)
Creates an far pointer instance.
Definition: fcml_common.hpp:3923
const Integer & getDisplacement() const
Gets the constant displacement associated with the effective address.
Definition: fcml_common.hpp:4505
static const Condition NL()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6989
fcml_usize address_size_attribute
Default address size attribute (See &#39;D&#39; flag of segment descriptor.)
Definition: fcml_common.h:828
static const Register R9D()
Factory method for a register.
Definition: fcml_common.hpp:2560
Operand & setHints(fcml_hints hints)
Sets new operand level hits for the operand.
Definition: fcml_common.hpp:5652
IB & effb(const Register &base, const Register &index, fcml_uint8_t scaleFactor)
Adds an an effective address based operator for a base register, index register, scale factor and byt...
Definition: fcml_common.hpp:8699
IB & addr(const EffectiveAddress &effectiveAddress, fcml_usize sizeOperator=FCML_DS_UNDEF)
Adds an address type operand for given effective address and optional size operator.
Definition: fcml_common.hpp:8230
fcml_bool isSae() const
Gets AVX-512 {sae} decorator.
Definition: fcml_common.hpp:5135
EffectiveAddress(const Register &base, const Register &index)
Creates an effective address instance with the base register and index register.
Definition: fcml_common.hpp:4323
bool isDirectPointer() const
Returns true if direct pointer hint is set.
Definition: fcml_common.hpp:7559
Exposes API responsible for environment specific operations, even if standard CPP library is used to ...
Definition: fcml_common.hpp:68
static Operand offq(const Integer &offset)
Factory method which builds an offset based address operand with quadro word size operator...
Definition: fcml_common.hpp:5926
Operand & setFarPointer(const FarPointer &farPointer)
Sets a new far pointer for the operand.
Definition: fcml_common.hpp:5544
static const Register XMM16()
Factory method for a register.
Definition: fcml_common.hpp:3030
static const InstructionPrefix BRANCH()
Creates a prefix instance described by the name of the method.
Definition: fcml_common.hpp:7996
static Operand far_ptr(fcml_uint16_t seg, fcml_int32_t addr)
Factory method which builds a far pointer operand.
Definition: fcml_common.hpp:5855
static const Register YMM2()
Factory method for a register.
Definition: fcml_common.hpp:2008
Integer(fcml_uint32_t value)
Definition: fcml_common.hpp:739
bool isS() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6828
static Operand addrb(const EffectiveAddress &effectiveAddress)
Factory method which creates address type operand for given effective address and byte size operator...
Definition: fcml_common.hpp:5947
fcml_int64_t fcml_ip
General instruction pointer holder.
Definition: fcml_common.h:96
bool operator==(const fcml_uint16_t value) const
Checks if the integer is equal to the passed value.
Definition: fcml_common.hpp:849
static const Register CR0()
Factory method for a register.
Definition: fcml_common.hpp:3650
Debug register.
Definition: fcml_common.h:440
AddressForm
Addressing type, see fcml_en_address_form enumerator.
Definition: fcml_common.hpp:4608
IB & effb(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Adds an an effective address based operator for an index register, scaleFactor, displacement and byte...
Definition: fcml_common.hpp:8572
static const Register DR6()
Factory method for a register.
Definition: fcml_common.hpp:3760
Protected/Compatibility mode when &#39;D&#39; segment descriptor flag is set to 1.
Definition: fcml_common.h:78
Condition()
Creates an empty condition.
Definition: fcml_common.hpp:6500
static const Register MM7()
Factory method for a register.
Definition: fcml_common.hpp:2430
bool operator!=(const fcml_uint16_t value) const
Checks if the integer is not equal to the passed value.
Definition: fcml_common.hpp:948
Immediate integer value.
Definition: fcml_common.h:677
bool isZ() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6695
EffectiveAddress(const Register &base, const Integer &displacement)
Creates an effective address instance with the base register and displacement only.
Definition: fcml_common.hpp:4298
virtual ~Integer()
Definition: fcml_common.hpp:749
fcml_hints hints
Holds instruction level hints.
Definition: fcml_common.h:788
static const Condition NC()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6666
Absolute offset (address).
Definition: fcml_common.h:580
fcml_ip getIP() const
Gets instruction pointer held by the entry point.
Definition: fcml_common.hpp:641
static const Register SIL()
Factory method for a register.
Definition: fcml_common.hpp:2299
static Operand addrw(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector)
Factory method which creates address type operand for given effective address and word size operator...
Definition: fcml_common.hpp:6011
static const Register RDI()
Factory method for a register.
Definition: fcml_common.hpp:2420
const Operand & operator[](fcml_int index) const
Gets reference to the constant operand at given index.
Definition: fcml_common.hpp:7251
static const Register MM0()
Factory method for a register.
Definition: fcml_common.hpp:1828
fcml_hints hints
Optional operand level hints.
Definition: fcml_common.h:739
void setDefaultReg(bool isDefaultReg)
Sets "default" flag for the segment selector.
Definition: fcml_common.hpp:4214
Integer & getDisplacement()
Gets the displacement associated with the effective address.
Definition: fcml_common.hpp:4515
bool operator!=(const Nullable &nullable) const
Checks if two nullable values are not equal.
Definition: fcml_common.hpp:172
static const Register ST5()
Factory method for a register.
Definition: fcml_common.hpp:3620
bool isB() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6562
bool isEffectiveAddress() const
Returns true if address holds effective address.
Definition: fcml_common.hpp:4829
bool operator!=(const EntryPoint &ep) const
Checks if two entry points are not equal.
Definition: fcml_common.hpp:589
Integer(fcml_int64_t value)
Definition: fcml_common.hpp:724
SIMD operand.
Definition: fcml_common.h:705
static const Register YMM16()
Factory method for a register.
Definition: fcml_common.hpp:3040
fcml_int operands_count
Number of operands defined for instruction.
Definition: fcml_common.h:800
Integer()
Definition: fcml_common.hpp:704
#define FCML_PREFIX_XRELEASE
XRELEASE prefix (0xF3)
Definition: fcml_common.h:62
fcml_st_address address
Effective address or absolute offset.
Definition: fcml_common.h:745
static Operand effb(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Factory method which creates an effective address based operator for a base register, index register, scale factor and byte size operator.
Definition: fcml_common.hpp:6419
SegmentSelector()
Creates an empty segment selector instance.
Definition: fcml_common.hpp:4116
static const Condition LE()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:7027
static const Register BX()
Factory method for a register.
Definition: fcml_common.hpp:2038
static const Register ZMM26()
Factory method for a register.
Definition: fcml_common.hpp:3350
fcml_int32_t getOffset32() const
Gets 32-bit offset.
Definition: fcml_common.hpp:4058
static Address effective(const Register &base, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address instance with the base register only...
Definition: fcml_common.hpp:4689
const FarPointer & getFarPointer() const
Gets a reference to the constant far pointer instance associated with the address.
Definition: fcml_common.hpp:5523
OperatingMode getOpMode() const
Gets processor operating mode.
Definition: fcml_common.hpp:661
static const InstructionHint NEAR_POINTER()
Creates instruction hint: NEAR_POINTER.
Definition: fcml_common.hpp:423
IB & imm(const Integer &imm)
Adds an immediate operand.
Definition: fcml_common.hpp:8106
bool isL() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6942
static const InstructionPrefix XRELEASE()
Creates instruction prefix: XRELEASE.
Definition: fcml_common.hpp:378
bool isFarPointer() const
Returns true if far pointer hint is set.
Definition: fcml_common.hpp:7523
static const OperandHint PSEUDO_OPCODE()
Creates operand level hint: PSEUDO_OPCODE.
Definition: fcml_common.hpp:492
static const Condition G()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:7084
Condition & setNegation(bool isNegation)
Sets negation flag for the condition.
Definition: fcml_common.hpp:7152
fcml_bool z
Zeroing masking.
Definition: fcml_common.h:661
static const Register R13L()
Factory method for a register.
Definition: fcml_common.hpp:2820
Undefined.
Definition: fcml_common.h:699
bool operator!=(const Decorators &decorators) const
Checks if two decorators are equal or not.
Definition: fcml_common.hpp:5164
Undefined register type.
Definition: fcml_common.h:428
bool operator==(const Nullable &nullable) const
Checks if two nullable values are equal.
Definition: fcml_common.hpp:160
bool isNAE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6600
static const InstructionHint FAR_PTR()
Creates a hint instance described by the name of the method.
Definition: fcml_common.hpp:7721
Operand(const Integer &imm, fcml_hints hints=FCML_OP_HINT_UNDEFIEND)
Creates an immediate value operand for given integer.
Definition: fcml_common.hpp:5221
static const Condition NG()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:7046
fcml_st_effective_address effective_address
Memory address for FCML_AF_COMBINED form.
Definition: fcml_common.h:641
Operand(const FarPointer &pointer, fcml_hints hints=FCML_OP_HINT_UNDEFIEND)
Creates a far pointer operand for given far pointer.
Definition: fcml_common.hpp:5234
static const Register XMM22()
Factory method for a register.
Definition: fcml_common.hpp:3210
Integer(fcml_uint64_t value)
Definition: fcml_common.hpp:744
OperatingMode
Supported operating modes.
Definition: fcml_common.hpp:531
SegmentSelector(const Register &segmentSelector, bool isDefaultReg=FCML_TRUE)
Creates a segment selector instance for given parameters.
Definition: fcml_common.hpp:4127
bool operator==(const fcml_int8_t value) const
Checks if the integer is equal to the passed value.
Definition: fcml_common.hpp:838
static const Register YMM15()
Factory method for a register.
Definition: fcml_common.hpp:3010
static const Register ZMM6()
Factory method for a register.
Definition: fcml_common.hpp:2369
General purpose register.
Definition: fcml_common.hpp:1612
static EffectiveAddress addr(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Factory method which creates an effective address instance with the index register, scale factor and displacement.
Definition: fcml_common.hpp:4428
static const OperandHint SIB_ENCODING()
Creates operand level hint: SIB_ENCODING.
Definition: fcml_common.hpp:513
static Operand effw(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Factory method which creates an effective address based operator for an index register, scaleFactor, displacement and word size operator.
Definition: fcml_common.hpp:6251
static const InstructionHint FAR_POINTER()
Creates instruction hint: FAR_POINTER.
Definition: fcml_common.hpp:430
IB(fcml_prefixes prefixes, const fcml_cstring &mnemonic, fcml_hints hints)
Creates an instruction builder for given prefixes, mnemonic and hints.
Definition: fcml_common.hpp:7654
static const Register XMM7()
Factory method for a register.
Definition: fcml_common.hpp:2440
static const Register K3()
Factory method for a register.
Definition: fcml_common.hpp:3840
static const Register BL()
Factory method for a register.
Definition: fcml_common.hpp:2028
fcml_uint8_t scale_factor
Scale factor 1,2,4 or 8.
Definition: fcml_common.h:611
IB & effw(const Register &base, const Register &index)
Adds an an effective address based operator for a base register, index register and word size operato...
Definition: fcml_common.hpp:8648
Holds operand decorators.
Definition: fcml_common.hpp:5001
bool isLongFormPointer() const
Returns true if long form pointer hint is set.
Definition: fcml_common.hpp:7541
static const Register XMM5()
Factory method for a register.
Definition: fcml_common.hpp:2259
static const Register CS()
Factory method for a register.
Definition: fcml_common.hpp:3520
void setReg(fcml_uint8_t reg)
Sets the register number.
Definition: fcml_common.hpp:1691
Address()
Creates an empty address.
Definition: fcml_common.hpp:4621
Integer & setInt16(fcml_int16_t int16)
Definition: fcml_common.hpp:760
Operand(const Register &reg, fcml_hints hints=FCML_OP_HINT_UNDEFIEND)
Creates a new register operand for given register.
Definition: fcml_common.hpp:5260
fcml_st_far_pointer far_pointer
Far pointer operand.
Definition: fcml_common.h:743
A base iterator interface.
Definition: fcml_common.hpp:98
Operand(const Address &address, fcml_hints hints=FCML_OP_HINT_UNDEFIEND)
Creates an address operand for given address.
Definition: fcml_common.hpp:5247
static const Register AL()
Factory method for a register.
Definition: fcml_common.hpp:1788
IB & offd(const Integer &offset)
Adds an offset based address operand with double word size operator.
Definition: fcml_common.hpp:8205
static const Register SP()
Factory method for a register.
Definition: fcml_common.hpp:2128
static const Register ZMM18()
Factory method for a register.
Definition: fcml_common.hpp:3110
IB & effw(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Adds an an effective address based operator for a base register, index register, scale factor and wor...
Definition: fcml_common.hpp:8781
static const Register YMM24()
Factory method for a register.
Definition: fcml_common.hpp:3280
static const Register R15D()
Factory method for a register.
Definition: fcml_common.hpp:2980
bool isNearPointer() const
Returns true if near pointer hint is set.
Definition: fcml_common.hpp:7532
Condition & setConditionType(ConditionType conditionType)
Sets condition type.
Definition: fcml_common.hpp:7131
static const Register YMM25()
Factory method for a register.
Definition: fcml_common.hpp:3310
Default value set if memory addressing hasn&#39;t been configured.
Definition: fcml_common.h:578
Decorators & setEr(const Nullable< EmbeededRoundingControl > &er)
Sets AVX-512 {er} decorator.
Definition: fcml_common.hpp:5063
EmbeededRoundingControl
Rounding mode.
Definition: fcml_common.hpp:5007
static Operand effd(const Register &base, const Integer &displacement)
Factory method which creates an effective address based operator for a base register, displacement and double word size operator.
Definition: fcml_common.hpp:6203
bool isG() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:7075
Register(const fcml_st_register &reg)
Creates a register instance for given register structure.
Definition: fcml_common.hpp:1647
Address(const EffectiveAddress &effectiveAddress, fcml_usize sizeOperator=FCML_DS_UNDEF)
Creates an address instance with an effective address and optional size operator set.
Definition: fcml_common.hpp:4646
static const Register ZMM4()
Factory method for a register.
Definition: fcml_common.hpp:2188
static const Register XMM25()
Factory method for a register.
Definition: fcml_common.hpp:3300
#define FCML_PREFIX_NOBRANCH_HINT
nobranch hint (0x3E) (SSE2 extension)
Definition: fcml_common.h:66
static const Register XMM4()
Factory method for a register.
Definition: fcml_common.hpp:2168
void far_ptr(const FarPointer &pointer)
Prepares far pointer operand for given far pointer.
Definition: fcml_common.hpp:5365
bool operator!=(const fcml_uint8_t value) const
Checks if the integer is not equal to the passed value.
Definition: fcml_common.hpp:926
fcml_int16_t off16
Place for 16-bit absolute offset.
Definition: fcml_common.h:595
static const Register YMM28()
Factory method for a register.
Definition: fcml_common.hpp:3400
Instruction condition.
Definition: fcml_common.hpp:6470
static const Condition AE()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6628
EffectiveAddress & setBase(const Register &base)
Sets a new base register for the effective address.
Definition: fcml_common.hpp:4494
static const Register ST7()
Factory method for a register.
Definition: fcml_common.hpp:3640
IB(const fcml_cstring &mnemonic, fcml_hints hints)
Creates an instruction builder for given mnemonic and hints.
Definition: fcml_common.hpp:7639
virtual ~EffectiveAddress()
Definition: fcml_common.hpp:4360
Register & getOpmaskReg()
Gets AVX-512 opmask register for {k} decorator.
Definition: fcml_common.hpp:5115
Operand & setOperandType(OperandType operandType)
Sets a new operand type.
Definition: fcml_common.hpp:5598
Decorators()
Creates an empty operand decorators container.
Definition: fcml_common.hpp:5018
AddressForm getAddressForm() const
Gets an address form.
Definition: fcml_common.hpp:4849
bool operator!=(const fcml_int64_t value) const
Checks if the integer is not equal to the passed value.
Definition: fcml_common.hpp:1003
ConditionType getConditionType() const
Gets a type of the condition.
Definition: fcml_common.hpp:7121
EffectiveAddress & setIndex(const Register &index)
Sets a new index register for the effective address.
Definition: fcml_common.hpp:4558
bool operator!=(const fcml_uint64_t value) const
Checks if the integer is not equal to the passed value.
Definition: fcml_common.hpp:992
Integer(fcml_int16_t value)
Definition: fcml_common.hpp:714
static const Register RCX()
Factory method for a register.
Definition: fcml_common.hpp:1898
static Operand effb(const Integer &displacement)
Factory method which creates an effective address based operator for a displacement and byte size ope...
Definition: fcml_common.hpp:6077
static const Register RSP()
Factory method for a register.
Definition: fcml_common.hpp:2148
bool isLE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:7018
static const Register ST4()
Factory method for a register.
Definition: fcml_common.hpp:3610
static const Register SPL()
Factory method for a register.
Definition: fcml_common.hpp:2118
IB & far_ptr(fcml_uint16_t seg, fcml_int16_t addr)
Adds a far pointer operand.
Definition: fcml_common.hpp:8119
EffectiveAddress(const Integer &displacement)
Creates an effective address instance with the displacement only.
Definition: fcml_common.hpp:4277
static EffectiveAddress addr(const Register &base, const Register &index, fcml_uint8_t scaleFactor)
Factory method which creates an effective address instance with the base register, index register and scale factor.
Definition: fcml_common.hpp:4449
Hints instruction to use INDIRECT pointer to address the memory.
Definition: fcml_common.h:773
bool isNLE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:7056
7 Less than or equal to
Definition: fcml_common.h:489
Operand & setAddress(const Address &address)
Sets a new address for the operand.
Definition: fcml_common.hpp:5512
Address(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector, fcml_usize sizeOperator=FCML_DS_UNDEF)
Creates an address instance with an effective address, segment selector and optional size operator se...
Definition: fcml_common.hpp:4660
static const Register R10L()
Factory method for a register.
Definition: fcml_common.hpp:2610
static const Register ZMM5()
Factory method for a register.
Definition: fcml_common.hpp:2279
static const Register XMM11()
Factory method for a register.
Definition: fcml_common.hpp:2720
static Operand eff(const Register &base, const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address based operator for a base register, displacement and optional size operator.
Definition: fcml_common.hpp:6170
static const Condition NS()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6856
static const Register R8()
Factory method for a register.
Definition: fcml_common.hpp:2500
SIMD (SSE, MMX) register.
Definition: fcml_common.h:432
bool isNGE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6961
bool operator!=(const fcml_uint32_t value) const
Checks if the integer is not equal to the passed value.
Definition: fcml_common.hpp:970
fcml_en_instruction_hints
Instruction level hints.
Definition: fcml_common.h:762
Definition: fcml_types.h:257
static const Register K5()
Factory method for a register.
Definition: fcml_common.hpp:3860
static const Register YMM23()
Factory method for a register.
Definition: fcml_common.hpp:3250
IB & effb(const Register &base, const Integer &displacement)
Adds an an effective address based operator for a base register, displacement and byte size operator...
Definition: fcml_common.hpp:8509
bool isPO() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6923
static const Register ZMM31()
Factory method for a register.
Definition: fcml_common.hpp:3500
static const Register R13W()
Factory method for a register.
Definition: fcml_common.hpp:2830
Operand()
Creates an undefined operand.
Definition: fcml_common.hpp:5209
static const Register EAX()
Factory method for a register.
Definition: fcml_common.hpp:1808
static const Register K6()
Factory method for a register.
Definition: fcml_common.hpp:3870
static const Register K0()
Factory method for a register.
Definition: fcml_common.hpp:3810
Integer(fcml_int32_t value)
Definition: fcml_common.hpp:719
static const Condition NA()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6780
Instruction build() const
Builds an instruction instance for the current state of the builder.
Definition: fcml_common.hpp:7676
IB & addrw(const EffectiveAddress &effectiveAddress)
Adds an address type operand for given effective address and word size operator.
Definition: fcml_common.hpp:8254
Direct far pointer.
Definition: fcml_common.h:679
const Register & getIndex() const
Gets the constant index register associated with the effective address.
Definition: fcml_common.hpp:4537
static Operand addr(const EffectiveAddress &effectiveAddress, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates address type operand for given effective address and optional size opera...
Definition: fcml_common.hpp:5937
static const Register R11D()
Factory method for a register.
Definition: fcml_common.hpp:2700
void setSize(fcml_usize size)
Sets the register size.
Definition: fcml_common.hpp:1709
static const Register FS()
Factory method for a register.
Definition: fcml_common.hpp:3550
Condition & getCondition()
Gets a pointer to the condition associated with the instruction.
Definition: fcml_common.hpp:7298
Real-addressing mode, virtual 8086 mode.
Definition: fcml_common.h:75
IB & addr(const Address &address)
Adds an address operand.
Definition: fcml_common.hpp:8156
bool isNC() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6657
static const Register CR2()
Factory method for a register.
Definition: fcml_common.hpp:3660
IB & reg(const Register &reg)
Adds an an register based operator for given register.
Definition: fcml_common.hpp:8356
static const Register YMM22()
Factory method for a register.
Definition: fcml_common.hpp:3220
bool operator==(const fcml_int64_t value) const
Checks if the integer is equal to the passed value.
Definition: fcml_common.hpp:904
IB & effb(const Integer &displacement)
Adds an an effective address based operator for a displacement and byte size operator.
Definition: fcml_common.hpp:8395
EffectiveAddress(const Register &base, const Register &index, fcml_uint8_t scaleFactor)
Creates an effective address instance with the base register, index register and scale factor set...
Definition: fcml_common.hpp:4336
Hints instruction to use NEAR pointer to address the memory.
Definition: fcml_common.h:768
SegmentSelector & operator=(const SegmentSelector &reg)
Copies one segment selector to another.
Definition: fcml_common.hpp:4173
static Operand eff(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address based operator for an index register, scaleFactor, displacement and optional size operator.
Definition: fcml_common.hpp:6227
Not an operand in a strict sense, only a container for attributes.
Definition: fcml_common.h:688
fcml_int getOperandsCount() const
Gets number of operands associated with the instruction.
Definition: fcml_common.hpp:7386
fcml_st_operand operands[FCML_OPERANDS_COUNT]
Fixed size array of instruction operands.
Definition: fcml_common.h:798
IB & offw(const Integer &offset)
Adds an offset based address operand with word size operator.
Definition: fcml_common.hpp:8193
bool isLock() const
Returns true if lock prefix is set.
Definition: fcml_common.hpp:7433
bool isIndirectPointer() const
Returns true if indirect pointer hint is set.
Definition: fcml_common.hpp:7550
fcml_int16_t getInt16() const
Definition: fcml_common.hpp:755
static const InstructionPrefix REP()
Creates a prefix instance described by the name of the method.
Definition: fcml_common.hpp:7891
void setOpMode(OperatingMode opMode)
Sets a new processor operating mode for the entry point.
Definition: fcml_common.hpp:671
bool isReg() const
Returns true if operand is a register operand.
Definition: fcml_common.hpp:5461
Describes an instruction.
Definition: fcml_common.hpp:7185
bool operator!=(const Integer &value) const
Checks if the integer is not equal to the passed value.
Definition: fcml_common.hpp:1014
Instruction operand.
Definition: fcml_common.h:735
static const InstructionHint DIRECT_POINTER()
Creates instruction hint: DIRECT_POINTER.
Definition: fcml_common.hpp:451
fcml_usize offset_size
Size of the offset.
Definition: fcml_common.h:560
Wraps instruction prefix and prepares factory methods for the hints.
Definition: fcml_common.hpp:312
static const Register XMM21()
Factory method for a register.
Definition: fcml_common.hpp:3180
static const Register ZMM27()
Factory method for a register.
Definition: fcml_common.hpp:3380
IB & addrd(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector)
Adds an address type operand for given effective address and double word size operator.
Definition: fcml_common.hpp:8331
bool isRepe() const
Returns true if repe prefix is set.
Definition: fcml_common.hpp:7469
Instruction & setPrefixes(fcml_prefixes prefixes)
Sets a new set of prefixes for the instruction.
Definition: fcml_common.hpp:7419
static const Register R13()
Factory method for a register.
Definition: fcml_common.hpp:2850
static const Register R10W()
Factory method for a register.
Definition: fcml_common.hpp:2620
bool isImm() const
Returns true if operand is an immediate value operand.
Definition: fcml_common.hpp:5451
bool isE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6676
static const Register CL()
Factory method for a register.
Definition: fcml_common.hpp:1868
static Operand effq(const Register &base, const Register &index)
Factory method which creates an effective address based operator for a base register, index register and quadro word size operator.
Definition: fcml_common.hpp:6331
static const Register R8W()
Factory method for a register.
Definition: fcml_common.hpp:2480
Register & getSegmentSelector()
Gets segment register associated with the selector.
Definition: fcml_common.hpp:4234
static const Register BPL()
Factory method for a register.
Definition: fcml_common.hpp:2209
static const Condition NE()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6723
static const OperandHint DISPLACEMENT_RELATIVE_ADDRESS()
Creates operand level hint: DISPLACEMENT_RELATIVE_ADDRESS.
Definition: fcml_common.hpp:485
#define FCML_PREFIX_BRANCH_HINT
branch hint (0x2E) (SSE2 extension)
Definition: fcml_common.h:64
static EffectiveAddress addr(const Register &base)
Factory method which creates an effective address instance with the base register only...
Definition: fcml_common.hpp:4407
static const Register BH()
Factory method for a register.
Definition: fcml_common.hpp:2380
Instruction & setMnemonic(const fcml_cstring &mnemonic)
Sets a new mnemonic for the instruction.
Definition: fcml_common.hpp:7375
bool isDisRelativeAddress() const
Returns true if it&#39;s an displacement relative address.
Definition: fcml_common.hpp:5708
Operation succeed.
Definition: fcml_errors.h:42
static const Register R8D()
Factory method for a register.
Definition: fcml_common.hpp:2490
fcml_st_register segment_selector
Used segment register.
Definition: fcml_common.h:621
static const Register R8L()
Factory method for a register.
Definition: fcml_common.hpp:2470
std::basic_ostringstream< fcml_char > fcml_costream
String output stream.
Definition: fcml_common.hpp:59
fcml_bool is_signed
True if offset should be treated as signed value.
Definition: fcml_common.h:593
Address & setAddressForm(AddressForm addressForm)
Sets a new address form for the effective address.
Definition: fcml_common.hpp:4861
fcml_usize size
Register size in bits.
Definition: fcml_common.h:454
static Address effective(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factor method which creates an instance of the address for an effective address, segment selector and...
Definition: fcml_common.hpp:4793
void setOffset32(fcml_int32_t offset32)
Sets 32-bit offset.
Definition: fcml_common.hpp:4068
static const Register YMM26()
Factory method for a register.
Definition: fcml_common.hpp:3340
fcml_uint8_t getScaleFactor() const
Gets a scale factor value associated with the effective address.
Definition: fcml_common.hpp:4569
static const Register ZMM3()
Factory method for a register.
Definition: fcml_common.hpp:2098
Instruction & setHints(fcml_hints hints)
Sets new instruction hints.
Definition: fcml_common.hpp:7331
fcml_bool is_conditional
True for conditional instructions.
Definition: fcml_common.h:793
No hints defined.
Definition: fcml_common.h:764
Bad arguments.
Definition: fcml_common.hpp:242
static Operand effq(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Factory method which creates an effective address based operator for a base register, index register, scale factor and quardo word size operator.
Definition: fcml_common.hpp:6458
bool operator==(const Register &reg) const
Compares registers.
Definition: fcml_common.hpp:1757
static const Register ZMM20()
Factory method for a register.
Definition: fcml_common.hpp:3170
IB & effw(const Register &base, const Integer &displacement)
Adds an an effective address based operator for a base register, displacement and word size operator...
Definition: fcml_common.hpp:8521
const Register & getBase() const
Gets the constant base register associated with the effective address.
Definition: fcml_common.hpp:4473
static const InstructionPrefix REPE()
Creates instruction prefix: REPE.
Definition: fcml_common.hpp:357
static Operand effq(const Integer &displacement)
Factory method which creates an effective address based operator for a displacement and quadro byte s...
Definition: fcml_common.hpp:6107
static const Register EBX()
Factory method for a register.
Definition: fcml_common.hpp:2048
bool operator!=(const SegmentSelector &segmentSelector) const
Checks if two segment selector are not equal.
Definition: fcml_common.hpp:4154
const SegmentSelector & getSegmentSelector() const
Gets the constant segment selector associated with the address.
Definition: fcml_common.hpp:4936
Decorators & setSae(const fcml_bool sae)
Sets AVX-512 {sae} decorator.
Definition: fcml_common.hpp:5074
Representation of far pointer operand.
Definition: fcml_common.h:556
OperandType
See fcml_en_operand_type structure for more details.
Definition: fcml_common.hpp:5190
void reg(fcml_uint8_t reg, fcml_usize size, Register::RegisterType type=Register::REG_GPR, fcml_bool x64_exp=FCML_FALSE)
Prepares an register operator for given register compounds.
Definition: fcml_common.hpp:5438
static const Register XMM19()
Factory method for a register.
Definition: fcml_common.hpp:3120
IB & xrelease()
Sets a prefix described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7984
IB & addrd(const EffectiveAddress &effectiveAddress)
Adds an address type operand for given effective address and double word size operator.
Definition: fcml_common.hpp:8266
Effective address.
Definition: fcml_common.h:605
fcml_st_register index
GPR index register.
Definition: fcml_common.h:609
static const Register XMM8()
Factory method for a register.
Definition: fcml_common.hpp:2510
static const Condition E()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6685
static const Register ZMM30()
Factory method for a register.
Definition: fcml_common.hpp:3470
static const Register R11()
Factory method for a register.
Definition: fcml_common.hpp:2710
static Operand effd(const Register &base)
Factory method which creates an effective address based operator for a base register and double word ...
Definition: fcml_common.hpp:6148
bool isA() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6809
fcml_usize getOperandSizeAttribute() const
Gets operand size attribute held by the entry point.
Definition: fcml_common.hpp:621
static Operand effw(const Integer &displacement)
Factory method which creates an effective address based operator for a displacement and word size ope...
Definition: fcml_common.hpp:6087
static const Register YMM17()
Factory method for a register.
Definition: fcml_common.hpp:3070
Describes address of an instruction code.
Definition: fcml_common.h:824
4 Sign
Definition: fcml_common.h:483
const Register & getSegmentSelector() const
Gets constant segment register associated with the selector.
Definition: fcml_common.hpp:4224
IB & effd(const Register &base, const Integer &displacement)
Adds an an effective address based operator for a base register, displacement and double word size op...
Definition: fcml_common.hpp:8533
static Operand effb(const Register &base, const Register &index, fcml_uint8_t scaleFactor)
Factory method which creates an effective address based operator for a base register, index register, scale factor and byte size operator.
Definition: fcml_common.hpp:6356
bool isNO() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6543
static Address effective(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address instance with the base register, index register, scale factor and displacement.
Definition: fcml_common.hpp:4748
Operand & setDecorators(const Decorators &decorators)
Sets new operand decorators for the operand.
Definition: fcml_common.hpp:5684
Address & setEffectiveAddress(const EffectiveAddress &effectiveAddress)
Sets a new effective address for the address.
Definition: fcml_common.hpp:4893
void far_ptr(fcml_uint16_t seg, fcml_int32_t addr)
Prepares far pointer operand for given components.
Definition: fcml_common.hpp:5354
static const InstructionPrefix REPE()
Creates a prefix instance described by the name of the method.
Definition: fcml_common.hpp:7912
static const Register YMM1()
Factory method for a register.
Definition: fcml_common.hpp:1928
static const InstructionPrefix REP()
Creates instruction prefix: REP.
Definition: fcml_common.hpp:350
IB & effd(const Register &base)
Adds an an effective address based operator for a base register and double word size operator...
Definition: fcml_common.hpp:8473
static const Register MM5()
Factory method for a register.
Definition: fcml_common.hpp:2249
static const Register XMM14()
Factory method for a register.
Definition: fcml_common.hpp:2930
static const Register R15W()
Factory method for a register.
Definition: fcml_common.hpp:2970
fcml_uint16_t fcml_prefixes
Type for explicit instruction prefixes bit mask.
Definition: fcml_common.h:91
EffectiveAddress & getEffectiveAddress()
Gets reference to the effective address associated with the address.
Definition: fcml_common.hpp:4882
fcml_usize getOffsetSize() const
Gets offset size.
Definition: fcml_common.hpp:4018
Operation is not supported.
Definition: fcml_common.hpp:275
Memory address.
Definition: fcml_common.h:681
Generic memory addressing operator.
Definition: fcml_common.h:631
IB & reg(fcml_uint8_t reg, fcml_usize size, Register::RegisterType type=Register::REG_GPR, fcml_bool x64_exp=FCML_FALSE)
Adds an an register based operator for given parameters.
Definition: fcml_common.hpp:8371
static const Register ZMM23()
Factory method for a register.
Definition: fcml_common.hpp:3260
static const Register ZMM1()
Factory method for a register.
Definition: fcml_common.hpp:1938
static const Register MM3()
Factory method for a register.
Definition: fcml_common.hpp:2068
static const Register ZMM0()
Factory method for a register.
Definition: fcml_common.hpp:1858
bool isAbsoluteAddressing() const
Returns true if it&#39;s an absolute offset being set in the operand.
Definition: fcml_common.hpp:5729
static const Register ZMM10()
Factory method for a register.
Definition: fcml_common.hpp:2670
static const Register XMM13()
Factory method for a register.
Definition: fcml_common.hpp:2860
static const Condition NB()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6590
void setOffsetSize(fcml_usize offsetSize)
Sets offset size.
Definition: fcml_common.hpp:4028
void far_ptr(fcml_uint16_t seg, fcml_int16_t addr)
Converts operand to the far pointer and sets the segment selector and offset for it.
Definition: fcml_common.hpp:5342
Global error handling related declarations.
static const Register XMM12()
Factory method for a register.
Definition: fcml_common.hpp:2790
static const Register ZMM8()
Factory method for a register.
Definition: fcml_common.hpp:2530
static const Register ST2()
Factory method for a register.
Definition: fcml_common.hpp:3590
static const Register YMM14()
Factory method for a register.
Definition: fcml_common.hpp:2940
static const Register ZMM24()
Factory method for a register.
Definition: fcml_common.hpp:3290
bool operator!=(const fcml_int32_t value) const
Checks if the integer is not equal to the passed value.
Definition: fcml_common.hpp:981
static const Register CR8()
Factory method for a register.
Definition: fcml_common.hpp:3690
Register & getRegister()
Returns a reference to the register associated with the operand.
Definition: fcml_common.hpp:5619
IB & repne()
Sets a prefix described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7858
#define FCML_PREFIX_REP
REP prefix (0xF3)
Definition: fcml_common.h:54
static const Register R15L()
Factory method for a register.
Definition: fcml_common.hpp:2960
void off(const Integer &offset, fcml_usize sizeOperator=FCML_DS_UNDEF)
Prepares address operand for given offset.
Definition: fcml_common.hpp:5388
static Operand effw(const Register &base, const Integer &displacement)
Factory method which creates an effective address based operator for a base register, displacement and word size operator.
Definition: fcml_common.hpp:6192
static const Register K7()
Factory method for a register.
Definition: fcml_common.hpp:3880
static const Register R12D()
Factory method for a register.
Definition: fcml_common.hpp:2770
static Operand addrw(const EffectiveAddress &effectiveAddress)
Factory method which creates address type operand for given effective address and word size operator...
Definition: fcml_common.hpp:5957
IB & addrq(const EffectiveAddress &effectiveAddress)
Adds an address type operand for given effective address and quadro word size operator.
Definition: fcml_common.hpp:8278
RegisterType
Register types.
Definition: fcml_common.hpp:1608
Integer(fcml_uint8_t value)
Definition: fcml_common.hpp:729
static const InstructionHint NEAR_PTR()
Creates a hint instance described by the name of the method.
Definition: fcml_common.hpp:7742
fcml_usize size_operator
Size of data accessed in memory.
Definition: fcml_common.h:633
Register(fcml_uint8_t reg, fcml_usize size, RegisterType type=REG_GPR, fcml_bool x64_exp=FCML_FALSE)
Creates a register instance for given parameters.
Definition: fcml_common.hpp:1662
fcml_nuint8_t bcast
Broadcasting: 2, 4, 8, 16, 32, 64.
Definition: fcml_common.h:659
Absolute offset.
Definition: fcml_common.h:589
IB & farPtr()
Sets a hint described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7730
static Operand addrq(const EffectiveAddress &effectiveAddress)
Factory method which creates address type operand for given effective address and quadro word size op...
Definition: fcml_common.hpp:5977
static const Register YMM11()
Factory method for a register.
Definition: fcml_common.hpp:2730
static Integer int16(fcml_int16_t value)
Factory method which creates an instance fo the Integer for given parameter.
Definition: fcml_common.hpp:1333
fcml_nuint8_t er
Embedded rounding control.
Definition: fcml_common.h:665
bool isGE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6999
Integer operator*(const Integer &src) const
Multiplication operator.
Definition: fcml_common.hpp:1287
static Operand effb(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Factory method which creates an effective address based operator for an index register, scaleFactor, displacement and byte size operator.
Definition: fcml_common.hpp:6239
bool operator!=(const Operand &op) const
Checks if two operands are equal or not.
Definition: fcml_common.hpp:5310
static const Register RAX()
Factory method for a register.
Definition: fcml_common.hpp:1818
fcml_en_register type
Register type.
Definition: fcml_common.h:452
static const Register DR4()
Factory method for a register.
Definition: fcml_common.hpp:3740
static const Register ZMM16()
Factory method for a register.
Definition: fcml_common.hpp:3050
static const Register R14L()
Factory method for a register.
Definition: fcml_common.hpp:2890
fcml_st_condition condition
Describes condition used by assembled/disassembled conditional instruction.
Definition: fcml_common.h:796
static const InstructionPrefix XACQUIRE()
Creates instruction prefix: XACQUIRE.
Definition: fcml_common.hpp:371
static const Register DX()
Factory method for a register.
Definition: fcml_common.hpp:1958
Component can not be initialized correctly.
Definition: fcml_common.hpp:231
static const InstructionHint NO_HINTS()
Creates instruction hint: NO_HINTS.
Definition: fcml_common.hpp:416
IB & effq(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Adds an an effective address based operator for a base register, index register, scale factor and qua...
Definition: fcml_common.hpp:8809
static const Register UNDEF()
Factory method for an undefined register.
Definition: fcml_common.hpp:1778
bool operator!=(const fcml_int8_t value) const
Checks if the integer is not equal to the passed value.
Definition: fcml_common.hpp:937
static const Register ZMM21()
Factory method for a register.
Definition: fcml_common.hpp:3200
Integer & getImmediate()
Gets a reference to the immediate value associated with the operand.
Definition: fcml_common.hpp:5565
static const Register R10()
Factory method for a register.
Definition: fcml_common.hpp:2640
static const InstructionPrefix LOCK()
Creates instruction prefix: LOCK.
Definition: fcml_common.hpp:329
static const Register ZMM13()
Factory method for a register.
Definition: fcml_common.hpp:2880
static Operand effd(const Register &base, const Register &index, fcml_uint8_t scaleFactor)
Factory method which creates an effective address based operator for a base register, index register, scale factor and double word size operator.
Definition: fcml_common.hpp:6380
static const Register EBP()
Factory method for a register.
Definition: fcml_common.hpp:2229
IB & offq(const Integer &offset)
Adds an offset based address operand with quadro word size operator.
Definition: fcml_common.hpp:8217
IB(fcml_prefixes prefixes, const fcml_cstring &mnemonic)
Creates builder for the given mnemonic and prefixes.
Definition: fcml_common.hpp:7625
static const Register R12L()
Factory method for a register.
Definition: fcml_common.hpp:2750
IB & eff(const Register &base, const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Adds an an effective address based operator for a base register, displacement and optional size opera...
Definition: fcml_common.hpp:8497
const fcml_cstring & getMnemonic() const
Gets the mnemonic associated with the instruction.
Definition: fcml_common.hpp:7364
static const Register XMM0()
Factory method for a register.
Definition: fcml_common.hpp:1838
fcml_uint16_t fcml_ceh_error
All error codes should be held in variables of this type.
Definition: fcml_errors.h:156
static Operand addrd(const EffectiveAddress &effectiveAddress)
Factory method which creates address type operand for given effective address and double word size op...
Definition: fcml_common.hpp:5967
static const InstructionPrefix XACQUIRE()
Creates a prefix instance described by the name of the method.
Definition: fcml_common.hpp:7954
static const Register RSI()
Factory method for a register.
Definition: fcml_common.hpp:2329
static Operand far_ptr(const FarPointer &pointer)
Factory method which builds a far pointer operand.
Definition: fcml_common.hpp:5865
static const Register YMM3()
Factory method for a register.
Definition: fcml_common.hpp:2088
static const InstructionPrefix REPNZ()
Creates a prefix instance described by the name of the method.
Definition: fcml_common.hpp:7870
static const Register ST1()
Factory method for a register.
Definition: fcml_common.hpp:3580
static EffectiveAddress addr(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Factory method which creates an effective address instance with the base register, index register, scale factor and displacement.
Definition: fcml_common.hpp:4461
IB & effb(const Register &base)
Adds an an effective address based operator for a base register and byte size operator.
Definition: fcml_common.hpp:8451
static Operand addr(const Address &address)
Factory method which builds an address operand.
Definition: fcml_common.hpp:5875
static const Register CR3()
Factory method for a register.
Definition: fcml_common.hpp:3670
fcml_en_operand_type type
Operand type.
Definition: fcml_common.h:737
static const Register ZMM17()
Factory method for a register.
Definition: fcml_common.hpp:3080
static const Condition BE()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6761
static const Register R10D()
Factory method for a register.
Definition: fcml_common.hpp:2630
static const Register YMM5()
Factory method for a register.
Definition: fcml_common.hpp:2269
static const Condition NLE()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:7065
static const Register ZMM19()
Factory method for a register.
Definition: fcml_common.hpp:3140
Describes effective address.
Definition: fcml_common.hpp:4261
static Integer uint8(fcml_uint8_t value)
Factory method which creates an instance fo the Integer for given parameter.
Definition: fcml_common.hpp:1323
Instruction & setConditional(bool isConditional)
Sets conditional flag for the instruction.
Definition: fcml_common.hpp:7353
static const Register ESI()
Factory method for a register.
Definition: fcml_common.hpp:2319
fcml_int32_t off32
Place for 32-bit absolute offset.
Definition: fcml_common.h:597
IB & eff(const Register &base, const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Adds an an effective address based operator for a base register, index register, scale factor and opt...
Definition: fcml_common.hpp:8753
static Integer int8(fcml_int8_t value)
Factory method which creates an instance fo the Integer for given parameter.
Definition: fcml_common.hpp:1313
bool operator==(const Condition &cond) const
Checks if two condition are equal.
Definition: fcml_common.hpp:7098
static const Register R11W()
Factory method for a register.
Definition: fcml_common.hpp:2690
static Operand undef()
Factory method which builds an empty operand.
Definition: fcml_common.hpp:5824
static Address effective(const Register &base, const Register &index, fcml_uint8_t scaleFactor, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address instance with the base register, index register and scale factor.
Definition: fcml_common.hpp:4735
Types declarations.
bool isC() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6638
fcml_en_operand_hints
Operand hints.
Definition: fcml_common.h:695
IB & operandAbsoluteHint()
Marks the lastly added address operand as a absolute one.
Definition: fcml_common.hpp:8085
IB & addrb(const EffectiveAddress &effectiveAddress)
Adds an address type operand for given effective address and byte size operator.
Definition: fcml_common.hpp:8242
fcml_usize getSize() const
Definition: fcml_common.hpp:810
2 Equal
Definition: fcml_common.h:479
Object which shouldn&#39;t be copied can inherit from this class.
Definition: fcml_common.hpp:288
IB & nearPtr()
Sets a hint described by the name of the method for the instruction being built.
Definition: fcml_common.hpp:7751
bool isXAcquire() const
Returns true if xacquire prefix is set.
Definition: fcml_common.hpp:7487
static const Condition B()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6571
IB(const fcml_cstring &mnemonic)
Creates builder for the given mnemonic.
Definition: fcml_common.hpp:7611
static const Register SI()
Factory method for a register.
Definition: fcml_common.hpp:2309
static const OperandHint OP_RELATIVE_ADDRESSING()
Gets relative address hint for the operand.
Definition: fcml_common.hpp:8043
bool isP() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6866
IB & addrq(const EffectiveAddress &effectiveAddress, const SegmentSelector &segmentSelector)
Adds an address type operand for given effective address and quadro word size operator.
Definition: fcml_common.hpp:8344
fcml_en_effective_address_form address_form
Memory addressing format: absolute offset/effective address.
Definition: fcml_common.h:637
static const Register MM6()
Factory method for a register.
Definition: fcml_common.hpp:2339
Address & setOffset(const Integer &offset)
Sets a new offset for the address.
Definition: fcml_common.hpp:4925
static const Register ZMM2()
Factory method for a register.
Definition: fcml_common.hpp:2018
1 Below
Definition: fcml_common.h:477
Register & getIndex()
Gets the index register associated with the effective address.
Definition: fcml_common.hpp:4547
bool isAE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6619
static const InstructionPrefix REPNE()
Creates instruction prefix: REPNE.
Definition: fcml_common.hpp:336
static Address effective(const Register &base, const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Factory method which creates an effective address instance with the base register and displacement...
Definition: fcml_common.hpp:4700
fcml_st_offset offset
Memory address for FCML_AF_OFFSET form.
Definition: fcml_common.h:643
static const Register XMM29()
Factory method for a register.
Definition: fcml_common.hpp:3420
static const InstructionHint LONG_FORM_PTR()
Creates a hint instance described by the name of the method.
Definition: fcml_common.hpp:7763
void setOperand(const Operand &operand, fcml_int index)
Sets a new oeprand for the instruction at given index.
Definition: fcml_common.hpp:7237
bool isAddr() const
Returns true if operand is an address operand.
Definition: fcml_common.hpp:5471
Illegal argument exception.
Definition: fcml_common.hpp:264
static const Register YMM12()
Factory method for a register.
Definition: fcml_common.hpp:2800
static const Condition PE()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6894
static const Condition O()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6533
Pseudo opcode.
Definition: fcml_common.h:717
64-bit mode.
Definition: fcml_common.h:80
static const Condition NO()
Factory method which creates a condition of a given type.
Definition: fcml_common.hpp:6552
static const Register K4()
Factory method for a register.
Definition: fcml_common.hpp:3850
Undefined register type.
Definition: fcml_common.hpp:1610
bool operator==(const fcml_uint64_t value) const
Checks if the integer is equal to the passed value.
Definition: fcml_common.hpp:893
IB & effq(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement)
Adds an an effective address based operator for an index register, scaleFactor, displacement and quad...
Definition: fcml_common.hpp:8611
static Operand effw(const Register &base)
Factory method which creates an effective address based operator for a base register and word size op...
Definition: fcml_common.hpp:6138
IB & operandMultimediaHint()
Marks the lastly added operand as a multimedia one.
Definition: fcml_common.hpp:8067
bool isNBE() const
Gets true the condition is of a given type.
Definition: fcml_common.hpp:6790
fcml_int64_t off64
Place for 64-bit absolute offset.
Definition: fcml_common.h:599
static const InstructionHint LONG_FORM_POINTER()
Creates instruction hint: LONG_FORM_POINTER.
Definition: fcml_common.hpp:437
Decorators & setZ(fcml_bool z)
Sets a new AVX-512 {z} decorator.
Definition: fcml_common.hpp:5029
Address & setSegmentSelector(const SegmentSelector &segmentSelector)
Sets a new segment selector for the address.
Definition: fcml_common.hpp:4957
static const Register DR2()
Factory method for a register.
Definition: fcml_common.hpp:3720
static const Register R9()
Factory method for a register.
Definition: fcml_common.hpp:2570
IB & eff(const Register &index, fcml_uint8_t scaleFactor, const Integer &displacement, fcml_usize sizeOperator=FCML_DS_UNDEF)
Adds an an effective address based operator for an index register, scaleFactor, displacement and opti...
Definition: fcml_common.hpp:8559
fcml_hints getHints() const
Gets hits associated with the operand.
Definition: fcml_common.hpp:5641
Instruction(const fcml_cstring &mnemonic)
Creates an empty instruction for given mnemonic.
Definition: fcml_common.hpp:7205
static const Register XMM20()
Factory method for a register.
Definition: fcml_common.hpp:3150
bool isFar() const
Returns true if operand is a far pointer operand.
Definition: fcml_common.hpp:5481
static const Register XMM18()
Factory method for a register.
Definition: fcml_common.hpp:3090