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

View File

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

View File

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