00001 //===-- ExternalDispatcher.h ------------------------------------*- C++ -*-===// 00002 // 00003 // The KLEE Symbolic Virtual Machine 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef KLEE_EXTERNALDISPATCHER_H 00011 #define KLEE_EXTERNALDISPATCHER_H 00012 00013 #include <map> 00014 #include "llvm/System/DynamicLibrary.h" 00015 00016 namespace llvm { 00017 class ExecutionEngine; 00018 class Instruction; 00019 class Function; 00020 class FunctionType; 00021 class Module; 00022 } 00023 00024 namespace klee { 00025 class ExternalDispatcher { 00026 private: 00027 typedef std::map<const llvm::Instruction*,llvm::Function*> dispatchers_ty; 00028 dispatchers_ty dispatchers; 00029 llvm::Module *dispatchModule; 00030 llvm::ExecutionEngine *executionEngine; 00031 llvm::sys::DynamicLibrary dl_symbols; 00032 std::map<std::string, void*> preboundFunctions; 00033 00034 llvm::Function *createDispatcher(llvm::Function *f, llvm::Instruction *i); 00035 bool runProtectedCall(llvm::Function *f, uint64_t *args); 00036 00037 public: 00038 ExternalDispatcher(); 00039 ~ExternalDispatcher(); 00040 00041 /* Call the given function using the parameter passing convention of 00042 * ci with arguments in args[1], args[2], ... and writing the result 00043 * into args[0]. 00044 */ 00045 bool executeCall(llvm::Function *function, llvm::Instruction *i, uint64_t *args); 00046 void *resolveSymbol(const std::string &name); 00047 }; 00048 } 00049 00050 #endif
1.5.8