Minor cleanup before showing it off :-P

This commit is contained in:
Peter Goodman
2015-10-22 11:24:58 -04:00
parent 94903d036e
commit 33084e1a34
3 changed files with 7 additions and 34 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ Arch::Arch(unsigned addressSize_)
Arch::~Arch(void) {}
Arch *CreateArch(std::string arch_name) {
Arch *Arch::Create(std::string arch_name) {
if (arch_name == "x86") {
VLOG(1) << "Using architecture: " << arch_name;
return new x86::Arch(32);
+5 -32
View File
@@ -19,40 +19,12 @@ namespace cfg {
class Instr;
} // namespace cfg
#if 0
// Generic register type. For example, a XED register for x86 falls into this
// type.
using ArchReg = unsigned;
// X86-specific McSema register type.
namespace x86 {
enum class Reg : unsigned;
} // namespace x86
// Cross-arch McSema register type.
//
// TODO(pag): Add more arch register types here (e.g. `arm::Reg`).
union McReg {
inline McReg(const McReg &reg_)
: flat(reg_.flat) {}
inline McReg(unsigned flat_)
: flat(flat_) {}
inline McReg(x86::Reg reg_)
: reg_x86(reg_) {}
const unsigned flat;
const x86::Reg reg_x86;
};
#endif
class Instr;
class Arch {
public:
Arch(unsigned address_size_);
static Arch *Create(std::string arch_name);
virtual ~Arch(void);
// Decode an instruction and invoke a visitor with the decoded instruction.
@@ -67,12 +39,13 @@ class Arch {
// Number of bits in an address.
const unsigned address_size;
protected:
Arch(unsigned address_size_);
private:
Arch(void) = delete;
};
Arch *CreateArch(std::string arch_name);
} // namespace mcsema
#endif // MC_SEMA_ARCH_ARCH_H_
+1 -1
View File
@@ -112,7 +112,7 @@ extern "C" int main(int argc, char *argv[]) {
CHECK(!FLAGS_bc_out.empty())
<< "Please specify an output bitcode file with --bc_out.";
auto arch = mcsema::CreateArch(FLAGS_arch);
auto arch = mcsema::Arch::Create(FLAGS_arch);
auto cfg = mcsema::ReadCFG(FLAGS_cfg);
auto module = mcsema::CreateOrLoadModule(arch, FLAGS_bc_in);