Fixed Issue #22

This commit is contained in:
kobalicekp
2014-04-22 21:57:17 +02:00
parent 190d1c1692
commit 7869d4e39f
3 changed files with 30 additions and 12 deletions

View File

@@ -6,7 +6,7 @@
// This file is used to test opcodes generated by AsmJit. Output can be
// disassembled in your IDE or by your favourite disassembler. Instructions
// are sorted alphabetically.
// are grouped by category and then sorted alphabetically.
// [Dependencies - AsmJit]
#include <asmjit/asmjit.h>

View File

@@ -3180,13 +3180,15 @@ _EmitX86M:
mIndex = rmMem->getIndex();
// Size override prefix.
if (Arch == kArchX86) {
if (rmMem->getMemType() != kMemTypeLabel && !rmMem->hasGpdBase())
EMIT_BYTE(0x67);
}
else {
if (rmMem->getMemType() != kMemTypeLabel && rmMem->hasGpdBase())
EMIT_BYTE(0x67);
if (rmMem->hasBaseOrIndex()) {
if (Arch == kArchX86) {
if (!rmMem->hasGpdBase())
EMIT_BYTE(0x67);
}
else {
if (rmMem->hasGpdBase())
EMIT_BYTE(0x67);
}
}
// Segment override prefix.

View File

@@ -2685,12 +2685,14 @@ struct Mem : public BaseMem {
// --------------------------------------------------------------------------
//! @brief Get whether the memory operand has base register.
ASMJIT_INLINE bool hasBase() const
{ return _vmem.base != kInvalidValue; }
ASMJIT_INLINE bool hasBase() const {
return _vmem.base != kInvalidValue;
}
//! @brief Get memory operand base register code, variable id, or @ref kInvalidValue.
ASMJIT_INLINE uint32_t getBase() const
{ return _vmem.base; }
ASMJIT_INLINE uint32_t getBase() const {
return _vmem.base;
}
//! @brief Set memory operand base register code, variable id, or @ref kInvalidValue.
ASMJIT_INLINE Mem& setBase(uint32_t base) {
@@ -2796,6 +2798,20 @@ struct Mem : public BaseMem {
return _setVSib(kMemVSibGpz);
}
// --------------------------------------------------------------------------
// [Misc]
// --------------------------------------------------------------------------
//! @brief Get whether the memory operand has base and index register.
ASMJIT_INLINE bool hasBaseOrIndex() const {
return _vmem.base != kInvalidValue || _vmem.index != kInvalidValue;
}
//! @brief Get whether the memory operand has base and index register.
ASMJIT_INLINE bool hasBaseAndIndex() const {
return _vmem.base != kInvalidValue && _vmem.index != kInvalidValue;
}
// --------------------------------------------------------------------------
// [Shift]
// --------------------------------------------------------------------------