mirror of
https://github.com/lifting-bits/remill
synced 2026-06-21 13:56:07 +00:00
Minor cleanup before showing it off :-P
This commit is contained in:
@@ -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
@@ -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 ®_)
|
||||
: 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
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user