diff options
author | m417z <mmm.maltsev@gmail.com> | 2020-11-13 13:43:28 +0300 |
---|---|---|
committer | m417z <mmm.maltsev@gmail.com> | 2020-11-13 14:22:53 +0300 |
commit | 781916180b4ba69a08c57b7c6637cc26fedb815c (patch) | |
tree | 9a02d0f32b4ed95addc559dfd264bd38a9c915db | |
parent | 8fda4f5481fed5797dc2651cd91e238e9b3928c6 (diff) |
Small changes to hde
-rw-r--r-- | src/hde/hde32.c | 12 | ||||
-rw-r--r-- | src/hde/hde64.c | 8 |
2 files changed, 7 insertions, 13 deletions
diff --git a/src/hde/hde32.c b/src/hde/hde32.c index 08fa25b..eb6af9b 100644 --- a/src/hde/hde32.c +++ b/src/hde/hde32.c @@ -7,6 +7,7 @@ #if defined(_M_IX86) || defined(__i386__) +#include <string.h> #include "hde32.h" #include "table32.h" @@ -15,12 +16,7 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0; uint8_t *ht = hde32_table, m_mod, m_reg, m_rm, disp_size = 0; - // Avoid using memset to reduce the footprint. -#ifndef _MSC_VER - memset((LPBYTE)hs, 0, sizeof(hde32s)); -#else - __stosb((LPBYTE)hs, 0, sizeof(hde32s)); -#endif + memset(hs, 0, sizeof(hde32s)); for (x = 16; x; x--) switch (c = *p++) { @@ -183,7 +179,7 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) } for (; ht != table_end; ht += 2) if (*ht++ == opcode) { - if (*ht++ & pref && !((*ht << m_reg) & 0x80)) + if ((*ht++ & pref) && !((*ht << m_reg) & 0x80)) goto error_operand; else break; @@ -234,6 +230,7 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) disp_size = 2; if (!(pref & PRE_67)) disp_size <<= 1; + break; } if (m_mod != 3 && m_rm == 4 && !(pref & PRE_67)) { @@ -259,6 +256,7 @@ unsigned int hde32_disasm(const void *code, hde32s *hs) case 4: hs->flags |= F_DISP32; hs->disp.disp32 = *(uint32_t *)p; + break; } p += disp_size; } else if (pref & PRE_LOCK) diff --git a/src/hde/hde64.c b/src/hde/hde64.c index c23e2fc..55a702e 100644 --- a/src/hde/hde64.c +++ b/src/hde/hde64.c @@ -7,6 +7,7 @@ #if defined(_M_X64) || defined(__x86_64__) +#include <string.h> #include "hde64.h" #include "table64.h" @@ -16,12 +17,7 @@ unsigned int hde64_disasm(const void *code, hde64s *hs) uint8_t *ht = hde64_table, m_mod, m_reg, m_rm, disp_size = 0; uint8_t op64 = 0; - // Avoid using memset to reduce the footprint. -#ifndef _MSC_VER - memset((LPBYTE)hs, 0, sizeof(hde64s)); -#else - __stosb((LPBYTE)hs, 0, sizeof(hde64s)); -#endif + memset(hs, 0, sizeof(hde64s)); for (x = 16; x; x--) switch (c = *p++) { |