mirror of
https://github.com/bitdefender/bddisasm.git
synced 2024-11-22 07:28:07 +00:00
Merge pull request #99 from akisari/master
Add support for builds without mnemonics.
This commit is contained in:
commit
4026e7610f
@ -5,6 +5,7 @@ option(BDD_INCLUDE_ISAGENERATOR_X86 "Include the x86 isagenerator target (if a p
|
||||
option(BDD_INCLUDE_FUZZERS "Include the bdshemu fuzzer" OFF)
|
||||
option(BDD_USE_EXTERNAL_VSNPRINTF "Expect nd_vsnprintf_s implementation from the integrator" OFF)
|
||||
option(BDD_USE_EXTERNAL_MEMSET "Expect nd_memset implementation from the integrator" OFF)
|
||||
option(BDD_NO_MNEMONIC "Exclude mnemonics - this option involves setting the BDDISASM_NO_FORMAT flag" OFF)
|
||||
option(BDD_ASAN "Build with ASAN" OFF)
|
||||
option(BDD_UBSAN "Build with UBSAN" OFF)
|
||||
|
||||
@ -143,6 +144,11 @@ if (NOT BDD_USE_EXTERNAL_MEMSET)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (BDD_NO_MNEMONIC)
|
||||
target_compile_definitions(bddisasm PUBLIC -DBDDISASM_NO_MNEMONIC)
|
||||
target_compile_definitions(bddisasm PUBLIC -DBDDISASM_NO_FORMAT)
|
||||
endif()
|
||||
|
||||
set_target_properties(
|
||||
bddisasm
|
||||
PROPERTIES POSITION_INDEPENDENT_CODE ON
|
||||
|
@ -4308,7 +4308,9 @@ NdCopyInstructionInfo(
|
||||
ND_IDBE *Idbe
|
||||
)
|
||||
{
|
||||
#ifndef BDDISASM_NO_MNEMONIC
|
||||
Instrux->Mnemonic = gMnemonics[Idbe->Mnemonic];
|
||||
#endif // !BDDISASM_NO_MNEMONIC
|
||||
Instrux->Attributes = Idbe->Attributes;
|
||||
Instrux->Instruction = (ND_INS_CLASS)Idbe->Instruction;
|
||||
Instrux->Category = (ND_INS_CATEGORY)Idbe->Category;
|
||||
|
@ -6,8 +6,7 @@
|
||||
#include "../inc/bddisasm.h"
|
||||
|
||||
|
||||
|
||||
#ifndef BDDISASM_NO_FORMAT
|
||||
#if !defined(BDDISASM_NO_MNEMONIC) && !defined(BDDISASM_NO_FORMAT)
|
||||
|
||||
static const char *const gReg8Bit[] =
|
||||
{
|
||||
@ -1033,4 +1032,4 @@ NdToText(
|
||||
|
||||
return ND_STATUS_SUCCESS;
|
||||
}
|
||||
#endif // !BDDISASM_NO_FORMAT
|
||||
#endif // !defined(BDDISASM_NO_MNEMONIC) && !defined(BDDISASM_NO_FORMAT)
|
||||
|
@ -10,6 +10,8 @@
|
||||
#ifndef BDX86_MNEMONICS_H
|
||||
#define BDX86_MNEMONICS_H
|
||||
|
||||
#ifndef BDDISASM_NO_MNEMONIC
|
||||
|
||||
const char *gMnemonics[1786] =
|
||||
{
|
||||
"AAA", "AAD", "AADD", "AAM", "AAND", "AAS", "ADC", "ADCX", "ADD",
|
||||
@ -320,6 +322,8 @@ const char *gMnemonics[1786] =
|
||||
"XSAVES", "XSAVES64", "XSETBV", "XSUSLDTRK", "XTEST",
|
||||
};
|
||||
|
||||
#endif // !BDDISASM_NO_MNEMONIC
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1439,7 +1439,9 @@ typedef struct _INSTRUX
|
||||
// Aliased over low 4 bits inside the main opcode.
|
||||
};
|
||||
|
||||
#ifndef BDDISASM_NO_MNEMONIC
|
||||
const char *Mnemonic; // Instruction mnemonic.
|
||||
#endif // !BDDISASM_NO_MNEMONIC
|
||||
ND_UINT8 InstructionBytes[16]; // The entire instruction.
|
||||
ND_UINT8 OpCodeBytes[3]; // Opcode bytes - escape codes and main opcode.
|
||||
|
||||
|
@ -801,6 +801,8 @@ def dump_mnemonics(mnemonics, prefixes, fname):
|
||||
f.write('#ifndef BDX86_MNEMONICS_H\n')
|
||||
f.write('#define BDX86_MNEMONICS_H\n')
|
||||
f.write('\n')
|
||||
f.write('#ifndef BDDISASM_NO_MNEMONIC\n')
|
||||
f.write('\n')
|
||||
f.write('const char *gMnemonics[%d] = \n' % len(mnemonics))
|
||||
f.write('{\n')
|
||||
f.write(' ')
|
||||
@ -815,7 +817,13 @@ def dump_mnemonics(mnemonics, prefixes, fname):
|
||||
ln = 0
|
||||
f.write('\n ')
|
||||
|
||||
f.write('\n};\n\n\n')
|
||||
|
||||
f.write('\n};\n')
|
||||
|
||||
f.write('\n')
|
||||
f.write('#endif // !BDDISASM_NO_MNEMONIC\n')
|
||||
|
||||
f.write('\n\n')
|
||||
|
||||
f.write('#endif\n\n')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user