@@ -68,8 +68,10 @@ typedef uint32_t target_ulong;
6868typedef uint64_t target_ulong;
6969#endif
7070
71+ #if defined(TARGET_I386) || defined(TARGET_X86_64)
7172// XXX: hack
7273#define CC_OP_DYNAMIC 0
74+ #endif
7375
7476extern " C" {
7577// TODO: get rid of this global var
@@ -101,8 +103,9 @@ TCGLLVMTranslator::TCGLLVMTranslator(const std::string &bitcodeLibraryPath, std:
101103 m_cpuType = NULL ;
102104 m_cpuState = NULL ;
103105 m_eip = NULL ;
106+ #if defined(TARGET_I386) || defined(TARGET_X86_64)
104107 m_ccop = NULL ;
105-
108+ # endif
106109 initializeNativeCpuState ();
107110 initializeHelpers ();
108111}
@@ -188,8 +191,13 @@ uint64_t TCGLLVMTranslator::toInteger(llvm::Value *v) const {
188191#ifdef CONFIG_SYMBEX
189192
190193void TCGLLVMTranslator::initializeNativeCpuState () {
194+ #ifdef TARGET_ARM
195+ m_cpuType = m_module->getTypeByName (" struct.CPUARMState" );
196+ assert (m_cpuType && " Could not find CPUARMState in LLVM bitcode" );
197+ #else
191198 m_cpuType = m_module->getTypeByName (" struct.CPUX86State" );
192199 assert (m_cpuType && " Could not find CPUX86State in LLVM bitcode" );
200+ #endif
193201}
194202
195203void TCGLLVMTranslator::initializeHelpers () {
@@ -426,8 +434,9 @@ void TCGLLVMTranslator::loadNativeCpuState(Function *f) {
426434 m_noop = m_builder.Insert (add);
427435
428436 m_eip = generateCpuStatePtr (m_tcgContext->env_offset_eip , m_tcgContext->env_sizeof_eip );
437+ #if defined(TARGET_I386) || defined(TARGET_X86_64)
429438 m_ccop = generateCpuStatePtr (m_tcgContext->env_offset_ccop , m_tcgContext->env_sizeof_ccop );
430-
439+ # endif
431440 if (m_eip_last_gep_index == 0 ) {
432441 SmallVector<Value *, 3 > gepElements;
433442 bool ok = getCpuFieldGepIndexes (m_tcgContext->env_offset_eip , sizeof (target_ulong), gepElements);
@@ -1167,23 +1176,25 @@ Function *TCGLLVMTranslator::generateCode(TCGContext *s, TranslationBlock *tb) {
11671176 case INDEX_op_insn_start: {
11681177 assert (TARGET_INSN_START_WORDS == 2 );
11691178 uint64_t curpc = op->args [0 ] - tb->cs_base ;
1179+ #if defined(TARGET_I386) || defined(TARGET_X86_64)
11701180 uint64_t cc_op = op->args [1 ];
1171-
1181+ # endif
11721182 Value *valueToStore = handleSymbolicPcAssignment (ConstantInt::get (wordType (), curpc));
11731183
11741184 TCGArg args[3 ];
11751185 args[0 ] = 0 ; // Unused
11761186 args[1 ] = temp_arg (&m_tcgContext->temps [0 ]);
11771187 args[2 ] = m_tcgContext->env_offset_eip ;
11781188 generateQemuCpuStore (args, m_tcgContext->env_sizeof_eip * 8 , valueToStore);
1179-
1189+ # if defined(TARGET_I386) || defined(TARGET_X86_64)
11801190 if (cc_op != CC_OP_DYNAMIC) {
11811191 args[0 ] = 0 ; // Unused
11821192 args[1 ] = temp_arg (&m_tcgContext->temps [0 ]);
11831193 args[2 ] = m_tcgContext->env_offset_ccop ;
11841194 valueToStore = ConstantInt::get (wordType (m_tcgContext->env_sizeof_ccop * 8 ), cc_op);
11851195 generateQemuCpuStore (args, m_tcgContext->env_sizeof_ccop * 8 , valueToStore);
11861196 }
1197+ #endif
11871198 } break ;
11881199#endif
11891200
0 commit comments