├── .clang-format ├── .gitignore ├── .gitlab-ci.yml ├── CMakeLists.txt ├── LICENSE ├── MLton-LICENSE ├── Makefile.am ├── Makefile_arm7 ├── Makefile_avr ├── Makefile_manual ├── Makefile_mips ├── Makefile_x86 ├── NJ-LICENSE ├── README ├── Readme.md ├── arm.mk ├── avr.mk ├── bugs.udcli ├── build.bat ├── config.h ├── config.mk ├── configure.ac ├── detail ├── closure │ ├── closure-control.sml │ ├── closure-passes.sml │ ├── closure.sml │ └── from-cps.sml ├── codegen │ ├── c0 │ │ ├── c0.sml │ │ ├── runtime.c │ │ └── runtime.h │ ├── c1 │ │ ├── c1.sml │ │ ├── runtime.c │ │ └── runtime.h │ ├── codegen-control.sml │ ├── codegen-mangle.sml │ ├── codegen-passes.sml │ └── js0 │ │ ├── javascript-sig.sml │ │ ├── javascript.sml │ │ ├── js0.sml │ │ └── runtime.js ├── common │ ├── basic-control.sml │ ├── basis.sml │ ├── compilation-monad.sml │ ├── error.sml │ ├── expand-file.sml │ ├── float-lit.sml │ ├── integer-lit.sml │ ├── layout-sig.sml │ ├── layout.sml │ ├── literal.sml │ ├── pp.sml │ ├── stamp.sml │ ├── stats.sml │ ├── sum-sig.sml │ └── sum.sml ├── cps │ ├── cps-control.sml │ ├── cps-opt.sml │ ├── cps-passes.sml │ ├── cps.sml │ ├── from-core.sml │ └── mk-cps-pass.sml ├── desugar │ ├── desugar-control.sml │ ├── desugar-decode-syntax.sml │ ├── desugar-guards.sml │ ├── desugar-monadic-sequences.sml │ ├── desugar.sml │ ├── desugared-tree.sml │ ├── detokenize.sml │ ├── inline-decode-patterns.sml │ ├── retokenize.sml │ └── split-declarations.sml ├── driver │ └── main.sml ├── export.sml ├── external │ └── mllpt-lib │ │ ├── MLton-LICENSE │ │ ├── NJ-LICENSE │ │ ├── antlr-lexer-sig.sml │ │ ├── antlr-tokens-sig.sml │ │ ├── ebnf.sml │ │ ├── err-handler.sml │ │ ├── ml-lpt-lib.cm │ │ ├── ml-lpt-lib.mlb │ │ ├── mllpt-lib.mlb │ │ ├── repair.sml │ │ ├── stream-pos.sml │ │ ├── ulex-buffer.sml │ │ └── wrapped-strm.sml ├── imp │ ├── imp-control.sml │ ├── imp-from-core.sml │ ├── imp-opt.sml │ ├── imp-passes.sml │ ├── imp.sml │ └── mk-imp-pass.sml ├── ml │ ├── mlton │ │ └── main.sml │ └── smlnj │ │ └── unsealed.cm ├── parser │ ├── mk-ast.sml │ ├── parser.sml │ ├── spec-parse-tree.sml │ ├── spec.g │ ├── spec.g.sml │ ├── spec.l │ └── spec.l.sml ├── semantic │ ├── inference.sml │ ├── primitives.sml │ ├── resolve-symbols.sml │ ├── resolve-type-info.sml │ ├── spec-abstract-tree.sml │ ├── symbol-table-type.sml │ └── typing │ │ ├── boolean-domain.sml │ │ ├── environment-profiling.sml │ │ ├── environment.sml │ │ ├── lang-types.sml │ │ ├── size-constraint.sml │ │ ├── substitutions.sml │ │ ├── tvar.sml │ │ └── type-table.sml └── spec │ ├── core.sml │ └── spec.sml ├── eclipse-plugin ├── gdsl.plugin.sdk │ ├── .project │ ├── build.properties │ ├── category.xml │ └── feature.xml ├── gdsl.plugin.tests │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ └── org.eclipse.core.resources.prefs │ ├── META-INF │ │ └── MANIFEST.MF │ ├── build.properties │ ├── gdsl.plugin.tests.launch │ └── src-gen │ │ └── gdsl │ │ └── plugin │ │ ├── GDSLInjectorProvider.java │ │ └── GDSLUiInjectorProvider.java ├── gdsl.plugin.ui │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ └── org.eclipse.core.resources.prefs │ ├── META-INF │ │ └── MANIFEST.MF │ ├── build.properties │ ├── plugin.xml │ ├── plugin.xml_gen │ ├── src-gen │ │ └── gdsl │ │ │ └── plugin │ │ │ └── ui │ │ │ ├── AbstractGDSLUiModule.java │ │ │ ├── GDSLExecutableExtensionFactory.java │ │ │ ├── contentassist │ │ │ ├── AbstractGDSLProposalProvider.java │ │ │ └── antlr │ │ │ │ ├── GDSLParser.java │ │ │ │ ├── PartialGDSLContentAssistParser.java │ │ │ │ └── internal │ │ │ │ ├── InternalGDSL.g │ │ │ │ ├── InternalGDSL.tokens │ │ │ │ ├── InternalGDSLLexer.java │ │ │ │ └── InternalGDSLParser.java │ │ │ └── internal │ │ │ └── GDSLActivator.java │ ├── src │ │ └── gdsl │ │ │ └── plugin │ │ │ └── ui │ │ │ ├── GDSLUiModule.java │ │ │ ├── contentassist │ │ │ └── GDSLProposalProvider.xtend │ │ │ ├── labeling │ │ │ ├── GDSLDescriptionLabelProvider.xtend │ │ │ └── GDSLLabelProvider.xtend │ │ │ ├── outline │ │ │ └── GDSLOutlineTreeProvider.xtend │ │ │ └── quickfix │ │ │ └── GDSLQuickfixProvider.xtend │ └── xtend-gen │ │ └── gdsl │ │ └── plugin │ │ └── ui │ │ ├── contentassist │ │ ├── .gitignore │ │ └── GDSLProposalProvider.java │ │ ├── labeling │ │ ├── .gitignore │ │ ├── GDSLDescriptionLabelProvider.java │ │ └── GDSLLabelProvider.java │ │ ├── outline │ │ ├── .gitignore │ │ └── GDSLOutlineTreeProvider.java │ │ └── quickfix │ │ ├── .gitignore │ │ └── GDSLQuickfixProvider.java ├── gdsl.plugin │ ├── .antlr-generator-3.2.0.jar │ ├── .classpath │ ├── .gitignore │ ├── .launch │ │ ├── Generate Language Infrastructure (gdsl.plugin).launch │ │ └── Launch Runtime Eclipse.launch │ ├── .project │ ├── .settings │ │ └── org.eclipse.core.resources.prefs │ ├── META-INF │ │ └── MANIFEST.MF │ ├── build.properties │ ├── model │ │ └── generated │ │ │ ├── GDSL.ecore │ │ │ └── GDSL.genmodel │ ├── plugin.xml │ ├── plugin.xml_gen │ ├── src-gen │ │ └── gdsl │ │ │ └── plugin │ │ │ ├── AbstractGDSLRuntimeModule.java │ │ │ ├── GDSL.xtextbin │ │ │ ├── GDSLStandaloneSetupGenerated.java │ │ │ ├── gDSL │ │ │ ├── AExp.java │ │ │ ├── AndAlsoExp.java │ │ │ ├── ApplyExp.java │ │ │ ├── Args.java │ │ │ ├── AtomicExp.java │ │ │ ├── CONS.java │ │ │ ├── CaseExp.java │ │ │ ├── ClosedExp.java │ │ │ ├── ConDecl.java │ │ │ ├── Decl.java │ │ │ ├── DeclExport.java │ │ │ ├── Exp.java │ │ │ ├── Field.java │ │ │ ├── GDSLFactory.java │ │ │ ├── GDSLPackage.java │ │ │ ├── MExp.java │ │ │ ├── Model.java │ │ │ ├── MonadicExp.java │ │ │ ├── OrElseExp.java │ │ │ ├── PAT.java │ │ │ ├── RExp.java │ │ │ ├── SelectExp.java │ │ │ ├── Ty.java │ │ │ ├── TyBind.java │ │ │ ├── TyElement.java │ │ │ ├── TyVars.java │ │ │ ├── Type.java │ │ │ ├── Val.java │ │ │ ├── ValueDecl.java │ │ │ ├── impl │ │ │ │ ├── AExpImpl.java │ │ │ │ ├── AndAlsoExpImpl.java │ │ │ │ ├── ApplyExpImpl.java │ │ │ │ ├── ArgsImpl.java │ │ │ │ ├── AtomicExpImpl.java │ │ │ │ ├── CONSImpl.java │ │ │ │ ├── CaseExpImpl.java │ │ │ │ ├── ClosedExpImpl.java │ │ │ │ ├── ConDeclImpl.java │ │ │ │ ├── DeclExportImpl.java │ │ │ │ ├── DeclImpl.java │ │ │ │ ├── ExpImpl.java │ │ │ │ ├── FieldImpl.java │ │ │ │ ├── GDSLFactoryImpl.java │ │ │ │ ├── GDSLPackageImpl.java │ │ │ │ ├── MExpImpl.java │ │ │ │ ├── ModelImpl.java │ │ │ │ ├── MonadicExpImpl.java │ │ │ │ ├── OrElseExpImpl.java │ │ │ │ ├── PATImpl.java │ │ │ │ ├── RExpImpl.java │ │ │ │ ├── SelectExpImpl.java │ │ │ │ ├── TyBindImpl.java │ │ │ │ ├── TyElementImpl.java │ │ │ │ ├── TyImpl.java │ │ │ │ ├── TyVarsImpl.java │ │ │ │ ├── TypeImpl.java │ │ │ │ ├── ValImpl.java │ │ │ │ └── ValueDeclImpl.java │ │ │ └── util │ │ │ │ ├── GDSLAdapterFactory.java │ │ │ │ └── GDSLSwitch.java │ │ │ ├── parser │ │ │ └── antlr │ │ │ │ ├── GDSLAntlrTokenFileProvider.java │ │ │ │ ├── GDSLParser.java │ │ │ │ └── internal │ │ │ │ ├── InternalGDSL.g │ │ │ │ ├── InternalGDSL.tokens │ │ │ │ ├── InternalGDSLLexer.java │ │ │ │ └── InternalGDSLParser.java │ │ │ ├── serializer │ │ │ ├── GDSLSemanticSequencer.java │ │ │ └── GDSLSyntacticSequencer.java │ │ │ ├── services │ │ │ └── GDSLGrammarAccess.java │ │ │ └── validation │ │ │ └── AbstractGDSLValidator.java │ ├── src │ │ └── gdsl │ │ │ └── plugin │ │ │ ├── GDSL.xtext │ │ │ ├── GDSLRuntimeModule.java │ │ │ ├── GDSLStandaloneSetup.java │ │ │ ├── GenerateGDSL.mwe2 │ │ │ ├── formatting │ │ │ └── GDSLFormatter.xtend │ │ │ ├── generator │ │ │ └── GDSLGenerator.xtend │ │ │ ├── preferences │ │ │ ├── GDSLPluginPreferences.java │ │ │ └── GdslCompilerPreferencePage.java │ │ │ ├── properties │ │ │ ├── GDSLProjectProperties.java │ │ │ └── GdslCompilerPropertyPage.java │ │ │ ├── scoping │ │ │ └── GDSLScopeProvider.xtend │ │ │ └── validation │ │ │ ├── GDSLCompilerTools.java │ │ │ └── GDSLValidator.xtend │ └── xtend-gen │ │ └── gdsl │ │ └── plugin │ │ ├── formatting │ │ ├── .gitignore │ │ └── GDSLFormatter.java │ │ ├── generator │ │ ├── .gitignore │ │ └── GDSLGenerator.java │ │ ├── scoping │ │ ├── .gitignore │ │ └── GDSLScopeProvider.java │ │ └── validation │ │ ├── .gitignore │ │ └── GDSLValidator.java └── gdslUpdateSite │ ├── artifacts.jar │ ├── content.jar │ ├── features │ ├── gdsl.plugin.sdk_1.0.0.201408270200.jar │ ├── gdsl.plugin.sdk_1.0.0.201408271510.jar │ ├── gdsl.plugin.sdk_1.0.0.201408271741.jar │ ├── gdsl.plugin.sdk_1.0.0.201408291346.jar │ ├── gdsl.plugin.sdk_1.0.0.201409021957.jar │ └── gdsl.plugin.sdk_1.0.0.201409111251.jar │ └── plugins │ ├── gdsl.plugin.ui_1.0.0.201408270200.jar │ ├── gdsl.plugin.ui_1.0.0.201408271510.jar │ ├── gdsl.plugin.ui_1.0.0.201408271741.jar │ ├── gdsl.plugin.ui_1.0.0.201408291346.jar │ ├── gdsl.plugin.ui_1.0.0.201409021957.jar │ ├── gdsl.plugin.ui_1.0.0.201409111251.jar │ ├── gdsl.plugin_1.0.0.201408270200.jar │ ├── gdsl.plugin_1.0.0.201408271510.jar │ ├── gdsl.plugin_1.0.0.201408271741.jar │ ├── gdsl.plugin_1.0.0.201408291346.jar │ ├── gdsl.plugin_1.0.0.201409021957.jar │ └── gdsl.plugin_1.0.0.201409111251.jar ├── gdsl.cm ├── gdsl.h ├── gdslConfig.cmake.in ├── gdslConfigVersion.cmake.in ├── gdslc.mlb ├── include ├── context.h ├── cppgdsl ├── decoder_config.h ├── executor.h ├── gdsl.h ├── gdsl_elf.h ├── gdsl_generic.h ├── gdsl_multiplex.h ├── gdwrap.h ├── generator.h ├── generator_tree.h ├── memory.h ├── readhex.h ├── rreil ├── simulator ├── stack.h ├── tbgen.h ├── tbgen_alloc.h ├── tester.h ├── util.h ├── x86.h ├── x86_features.h └── x86_opcodes.h ├── java_eclipse_formatting.xml ├── lib ├── libcgdsl.a ├── libcppgdsl.a ├── libgdsl-current.so ├── libgdsl-current.so.0 ├── libgdsl-multiplex-windows.a ├── libgdsl-multiplex.a ├── libgdsl-x86-rreil.so ├── libgdsl.so ├── libgdsl.so.0 ├── libgdutil.a ├── libgdwrap.a ├── libjgdsl.so ├── libreadhex.a ├── librreil-sim.a ├── libx86-generator.a ├── libx86-tester.a └── libx86.a ├── libs ├── CMakeLists.txt ├── Makefile ├── cgdsl │ ├── .gitignore │ ├── Makefile │ ├── include │ │ └── rreil │ │ │ ├── gdrr_builder.h │ │ │ ├── rreil.h │ │ │ ├── rreil_address.h │ │ │ ├── rreil_arity.h │ │ │ ├── rreil_branch_hint.h │ │ │ ├── rreil_comparator.h │ │ │ ├── rreil_copy.h │ │ │ ├── rreil_exception.h │ │ │ ├── rreil_expr.h │ │ │ ├── rreil_flop.h │ │ │ ├── rreil_free.h │ │ │ ├── rreil_id.h │ │ │ ├── rreil_linear.h │ │ │ ├── rreil_print.h │ │ │ ├── rreil_sexpr.h │ │ │ ├── rreil_statement.h │ │ │ ├── rreil_variable.h │ │ │ └── rreil_variable_limited.h │ └── src │ │ └── rreil │ │ ├── alloc.c │ │ ├── copy.c │ │ ├── free.c │ │ ├── gdrr_builder.c │ │ ├── print.c │ │ └── rreil_id.c ├── cppgdsl │ ├── CMakeLists.txt │ ├── Makefile │ ├── include │ │ └── cppgdsl │ │ │ ├── arch │ │ │ └── x86.h │ │ │ ├── asm_builder.h │ │ │ ├── assembly │ │ │ ├── annotation │ │ │ │ ├── annotation.h │ │ │ │ ├── annotation_visitor.h │ │ │ │ ├── function_annotation.h │ │ │ │ ├── operand_annotation.h │ │ │ │ └── string_annotation.h │ │ │ ├── arch │ │ │ │ └── x86 │ │ │ │ │ └── factory.h │ │ │ ├── assembly.h │ │ │ ├── boundary │ │ │ │ ├── boundary.h │ │ │ │ ├── boundary_visitor.h │ │ │ │ └── offset_boundary.h │ │ │ ├── instruction.h │ │ │ ├── operand │ │ │ │ ├── annotated.h │ │ │ │ ├── bounded.h │ │ │ │ ├── composite.h │ │ │ │ ├── immediate.h │ │ │ │ ├── memory.h │ │ │ │ ├── operand.h │ │ │ │ ├── operand_visitor.h │ │ │ │ ├── post_op.h │ │ │ │ ├── pre_op.h │ │ │ │ ├── register.h │ │ │ │ ├── rel.h │ │ │ │ ├── scale.h │ │ │ │ ├── signed.h │ │ │ │ └── sum.h │ │ │ └── signedness.h │ │ │ ├── block.h │ │ │ ├── compare.h │ │ │ ├── frontend │ │ │ ├── bare_frontend.h │ │ │ └── frontend.h │ │ │ ├── gdsl.h │ │ │ ├── gdsl_exception.h │ │ │ ├── instruction.h │ │ │ ├── iterator.h │ │ │ ├── optimization.h │ │ │ ├── rreil │ │ │ ├── address.h │ │ │ ├── arch │ │ │ │ └── x86 │ │ │ │ │ └── factory.h │ │ │ ├── branch_hint.h │ │ │ ├── copy_visitor.h │ │ │ ├── exception │ │ │ │ ├── arch_exception.h │ │ │ │ ├── exception.h │ │ │ │ ├── exception_visitor.h │ │ │ │ └── shared_exception.h │ │ │ ├── expr │ │ │ │ ├── binop_op.h │ │ │ │ ├── expr.h │ │ │ │ ├── expr_binop.h │ │ │ │ ├── expr_ext.h │ │ │ │ ├── expr_sexpr.h │ │ │ │ └── expr_visitor.h │ │ │ ├── expr_cmp │ │ │ │ ├── cmp_op.h │ │ │ │ └── expr_cmp.h │ │ │ ├── flop.h │ │ │ ├── id │ │ │ │ ├── arch_id.h │ │ │ │ ├── id.h │ │ │ │ ├── id_visitor.h │ │ │ │ ├── shared_id.h │ │ │ │ └── virtual.h │ │ │ ├── linear │ │ │ │ ├── binop_lin_op.h │ │ │ │ ├── lin_binop.h │ │ │ │ ├── lin_imm.h │ │ │ │ ├── lin_scale.h │ │ │ │ ├── lin_var.h │ │ │ │ ├── linear.h │ │ │ │ └── linear_visitor.h │ │ │ ├── rreil.h │ │ │ ├── sexpr │ │ │ │ ├── arbitrary.h │ │ │ │ ├── sexpr.h │ │ │ │ ├── sexpr_cmp.h │ │ │ │ ├── sexpr_lin.h │ │ │ │ └── sexpr_visitor.h │ │ │ ├── statement │ │ │ │ ├── assign.h │ │ │ │ ├── branch.h │ │ │ │ ├── cbranch.h │ │ │ │ ├── floating.h │ │ │ │ ├── ite.h │ │ │ │ ├── load.h │ │ │ │ ├── prim.h │ │ │ │ ├── statement.h │ │ │ │ ├── statement_visitor.h │ │ │ │ ├── store.h │ │ │ │ ├── throw.h │ │ │ │ └── while.h │ │ │ ├── variable.h │ │ │ ├── variable_limited.h │ │ │ └── visitor.h │ │ │ └── rreil_builder.h │ └── src │ │ ├── arch │ │ └── x86.cpp │ │ ├── asm_builder.cpp │ │ ├── assembly │ │ ├── annotation │ │ │ ├── annotation.cpp │ │ │ ├── function_annotation.cpp │ │ │ ├── operand_annotation.cpp │ │ │ └── string_annotation.cpp │ │ ├── boundary │ │ │ ├── boundary.cpp │ │ │ └── offset_boundary.cpp │ │ ├── instruction.cpp │ │ └── operand │ │ │ ├── annotated.cpp │ │ │ ├── bounded.cpp │ │ │ ├── composite.cpp │ │ │ ├── immediate.cpp │ │ │ ├── memory.cpp │ │ │ ├── operand.cpp │ │ │ ├── post_op.cpp │ │ │ ├── pre_op.cpp │ │ │ ├── register.cpp │ │ │ ├── rel.cpp │ │ │ ├── scale.cpp │ │ │ ├── signed.cpp │ │ │ └── sum.cpp │ │ ├── block.cpp │ │ ├── frontend │ │ ├── bare_frontend.cpp │ │ └── frontend.cpp │ │ ├── gdsl.cpp │ │ ├── gdsl_exception.cpp │ │ ├── instruction.cpp │ │ ├── rreil │ │ ├── address.cpp │ │ ├── branch_hint.cpp │ │ ├── copy_visitor.cpp │ │ ├── exception │ │ │ ├── arch_exception.cpp │ │ │ ├── exception.cpp │ │ │ └── shared_exception.cpp │ │ ├── expr │ │ │ ├── binop_op.cpp │ │ │ ├── expr.cpp │ │ │ ├── expr_binop.cpp │ │ │ ├── expr_ext.cpp │ │ │ ├── expr_sexpr.cpp │ │ │ └── expr_visitor.cpp │ │ ├── expr_cmp │ │ │ ├── cmp_op.cpp │ │ │ └── expr_cmp.cpp │ │ ├── flop.cpp │ │ ├── id │ │ │ ├── arch_id.cpp │ │ │ ├── id.cpp │ │ │ ├── id_visitor.cpp │ │ │ ├── shared_id.cpp │ │ │ └── virtual.cpp │ │ ├── linear │ │ │ ├── binop_lin_op.cpp │ │ │ ├── lin_binop.cpp │ │ │ ├── lin_imm.cpp │ │ │ ├── lin_scale.cpp │ │ │ ├── lin_var.cpp │ │ │ └── linear.cpp │ │ ├── sexpr │ │ │ ├── arbitrary.cpp │ │ │ ├── sexpr.cpp │ │ │ ├── sexpr_cmp.cpp │ │ │ ├── sexpr_lin.cpp │ │ │ └── sexpr_visitor.cpp │ │ ├── statement │ │ │ ├── assign.cpp │ │ │ ├── branch.cpp │ │ │ ├── cbranch.cpp │ │ │ ├── floating.cpp │ │ │ ├── ite.cpp │ │ │ ├── load.cpp │ │ │ ├── prim.cpp │ │ │ ├── statement.cpp │ │ │ ├── statement_visitor.cpp │ │ │ ├── store.cpp │ │ │ ├── throw.cpp │ │ │ └── while.cpp │ │ ├── variable.cpp │ │ ├── variable_limited.cpp │ │ └── visitor.cpp │ │ └── rreil_builder.cpp ├── cppgdsl_legacy │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Makefile │ ├── include │ │ └── cppgdsl │ │ │ ├── block.h │ │ │ ├── frontend │ │ │ ├── bare_frontend.h │ │ │ └── frontend.h │ │ │ ├── gdsl.h │ │ │ ├── gdsl_exception.h │ │ │ ├── instruction.h │ │ │ ├── optimization.h │ │ │ ├── rreil │ │ │ ├── address.h │ │ │ ├── branch_hint.h │ │ │ ├── copy_visitor.h │ │ │ ├── exception │ │ │ │ ├── arch_exception.h │ │ │ │ ├── exception.h │ │ │ │ ├── exception_visitor.h │ │ │ │ └── shared_exception.h │ │ │ ├── expr │ │ │ │ ├── binop_op.h │ │ │ │ ├── expr.h │ │ │ │ ├── expr_binop.h │ │ │ │ ├── expr_ext.h │ │ │ │ ├── expr_sexpr.h │ │ │ │ └── expr_visitor.h │ │ │ ├── expr_cmp │ │ │ │ ├── cmp_op.h │ │ │ │ └── expr_cmp.h │ │ │ ├── flop.h │ │ │ ├── id │ │ │ │ ├── arch_id.h │ │ │ │ ├── id.h │ │ │ │ ├── id_visitor.h │ │ │ │ ├── shared_id.h │ │ │ │ └── virtual.h │ │ │ ├── linear │ │ │ │ ├── binop_lin_op.h │ │ │ │ ├── lin_binop.h │ │ │ │ ├── lin_imm.h │ │ │ │ ├── lin_scale.h │ │ │ │ ├── lin_var.h │ │ │ │ ├── linear.h │ │ │ │ └── linear_visitor.h │ │ │ ├── rreil.h │ │ │ ├── sexpr │ │ │ │ ├── arbitrary.h │ │ │ │ ├── sexpr.h │ │ │ │ ├── sexpr_cmp.h │ │ │ │ ├── sexpr_lin.h │ │ │ │ └── sexpr_visitor.h │ │ │ ├── statement │ │ │ │ ├── assign.h │ │ │ │ ├── branch.h │ │ │ │ ├── cbranch.h │ │ │ │ ├── floating.h │ │ │ │ ├── ite.h │ │ │ │ ├── load.h │ │ │ │ ├── prim.h │ │ │ │ ├── statement.h │ │ │ │ ├── statement_visitor.h │ │ │ │ ├── store.h │ │ │ │ ├── throw.h │ │ │ │ └── while.h │ │ │ ├── variable.h │ │ │ ├── variable_limited.h │ │ │ └── visitor.h │ │ │ └── rreil_builder.h │ └── src │ │ ├── block.cpp │ │ ├── frontend │ │ ├── bare_frontend.cpp │ │ └── frontend.cpp │ │ ├── gdsl.cpp │ │ ├── gdsl_exception.cpp │ │ ├── rreil │ │ ├── address.cpp │ │ ├── branch_hint.cpp │ │ ├── copy_visitor.cpp │ │ ├── exception │ │ │ ├── arch_exception.cpp │ │ │ ├── exception.cpp │ │ │ └── shared_exception.cpp │ │ ├── expr │ │ │ ├── binop_op.cpp │ │ │ ├── expr.cpp │ │ │ ├── expr_binop.cpp │ │ │ ├── expr_ext.cpp │ │ │ ├── expr_sexpr.cpp │ │ │ └── expr_visitor.cpp │ │ ├── expr_cmp │ │ │ ├── cmp_op.cpp │ │ │ └── expr_cmp.cpp │ │ ├── flop.cpp │ │ ├── id │ │ │ ├── arch_id.cpp │ │ │ ├── id.cpp │ │ │ ├── id_visitor.cpp │ │ │ ├── shared_id.cpp │ │ │ └── virtual.cpp │ │ ├── instruction.cpp │ │ ├── linear │ │ │ ├── binop_lin_op.cpp │ │ │ ├── lin_binop.cpp │ │ │ ├── lin_imm.cpp │ │ │ ├── lin_scale.cpp │ │ │ ├── lin_var.cpp │ │ │ └── linear.cpp │ │ ├── sexpr │ │ │ ├── arbitrary.cpp │ │ │ ├── sexpr.cpp │ │ │ ├── sexpr_cmp.cpp │ │ │ ├── sexpr_lin.cpp │ │ │ └── sexpr_visitor.cpp │ │ ├── statement │ │ │ ├── assign.cpp │ │ │ ├── branch.cpp │ │ │ ├── cbranch.cpp │ │ │ ├── floating.cpp │ │ │ ├── ite.cpp │ │ │ ├── load.cpp │ │ │ ├── prim.cpp │ │ │ ├── statement.cpp │ │ │ ├── statement_visitor.cpp │ │ │ ├── store.cpp │ │ │ ├── throw.cpp │ │ │ └── while.cpp │ │ ├── variable.cpp │ │ ├── variable_limited.cpp │ │ └── visitor.cpp │ │ └── rreil_builder.cpp ├── dgdsl │ ├── .gitignore │ ├── Makefile │ ├── dub.json │ ├── dub.selections.json │ └── source │ │ └── gdsl │ │ ├── frontend.d │ │ ├── gdsl.d │ │ ├── ireferable.d │ │ ├── multiplex │ │ ├── gdsl_generic.d │ │ └── multiplex.d │ │ ├── reference_manager.d │ │ └── rreil │ │ ├── builder_backend.d │ │ ├── exception │ │ ├── arch_exception.d │ │ ├── exception.d │ │ └── shared_exception.d │ │ ├── expr │ │ ├── binop.d │ │ ├── expr.d │ │ ├── extension.d │ │ └── sexpr.d │ │ ├── expr_cmp │ │ └── expr_cmp.d │ │ ├── id │ │ ├── arch_id.d │ │ ├── id.d │ │ ├── shared_id.d │ │ └── virt_id.d │ │ ├── linear │ │ ├── binop.d │ │ ├── immediate.d │ │ ├── linear.d │ │ └── scale.d │ │ ├── sexpr │ │ ├── arbitrary.d │ │ ├── expr_cmp.d │ │ ├── linear.d │ │ └── sexpr.d │ │ └── statement │ │ ├── assign.d │ │ └── statement.d ├── gdsl-multiplex-windows │ ├── .gitignore │ ├── Makefile │ └── src │ │ └── gdsl_multiplex.c ├── gdsl-multiplex │ ├── CMakeLists.txt │ ├── Makefile │ ├── include │ │ ├── gdsl_generic.h │ │ └── gdsl_multiplex.h │ └── src │ │ └── gdsl_multiplex.c ├── gdutil │ ├── CMakeLists.txt │ ├── Makefile │ ├── include │ │ ├── decoder_config.h │ │ ├── gdsl_elf.h │ │ ├── stack.h │ │ └── util.h │ └── src │ │ ├── decoder_config.c │ │ ├── gdsl_elf.c │ │ ├── stack.c │ │ └── util.c ├── gdwrap │ ├── Makefile │ ├── include │ │ └── gdwrap.h │ └── src │ │ └── gdwrap.c ├── jgdsl │ ├── .gitignore │ ├── CMakeLists.txt │ ├── Makefile │ ├── run.sh │ └── src │ │ ├── GdslTest.java │ │ ├── Program.java │ │ ├── gdsl │ │ ├── BareFrontend.java │ │ ├── Frontend.java │ │ ├── Gdsl.java │ │ ├── GdslException.java │ │ ├── HeapExpiredException.java │ │ ├── HeapUseIndicator.java │ │ ├── IFrontendConfig.java │ │ ├── IReferable.java │ │ ├── ListFrontend.java │ │ ├── ReferenceManager.java │ │ ├── ResourceUnavailableException.java │ │ ├── arch │ │ │ ├── AVRBinder.java │ │ │ ├── ArchBinder.java │ │ │ ├── ArchId.java │ │ │ ├── IConfigFlag.java │ │ │ ├── MIPSBinder.java │ │ │ ├── X86Binder.java │ │ │ └── X86ConfigFlag.java │ │ ├── asm │ │ │ ├── GeneralizerBackend.java │ │ │ ├── Instruction.java │ │ │ ├── Signedness.java │ │ │ ├── Visitor.java │ │ │ ├── annotation │ │ │ │ ├── Annotation.java │ │ │ │ ├── FunctionAnnotation.java │ │ │ │ ├── OperandAnnotation.java │ │ │ │ └── StringAnnotation.java │ │ │ ├── boundary │ │ │ │ ├── Boundary.java │ │ │ │ ├── SizeBoundary.java │ │ │ │ └── SizeOffsetBoundary.java │ │ │ └── operand │ │ │ │ ├── Annotated.java │ │ │ │ ├── Bounded.java │ │ │ │ ├── Composite.java │ │ │ │ ├── Immediate.java │ │ │ │ ├── Memory.java │ │ │ │ ├── Operand.java │ │ │ │ ├── PostOperation.java │ │ │ │ ├── PreOperation.java │ │ │ │ ├── Register.java │ │ │ │ ├── Relative.java │ │ │ │ ├── Scale.java │ │ │ │ ├── Sign.java │ │ │ │ └── Sum.java │ │ ├── decoder │ │ │ ├── Decoder.java │ │ │ ├── GdslDecodeException.java │ │ │ ├── NativeInstruction.java │ │ │ ├── OperandType.java │ │ │ └── OperandTypeVisitor.java │ │ ├── rreil │ │ │ ├── Address.java │ │ │ ├── BranchHint.java │ │ │ ├── BuilderBackend.java │ │ │ ├── DefaultLimitedVariableCollection.java │ │ │ ├── DefaultRReilBuilder.java │ │ │ ├── DefaultStatementCollection.java │ │ │ ├── Flop.java │ │ │ ├── IAddress.java │ │ │ ├── IBranchHint.java │ │ │ ├── IFlop.java │ │ │ ├── ILimitedVariable.java │ │ │ ├── IRReilBuilder.java │ │ │ ├── IRReilCollection.java │ │ │ ├── IVariable.java │ │ │ ├── LimitedVariable.java │ │ │ ├── Variable.java │ │ │ ├── exception │ │ │ │ ├── Exception.java │ │ │ │ ├── GenericArchException.java │ │ │ │ ├── IException.java │ │ │ │ └── x86 │ │ │ │ │ └── X86Exception.java │ │ │ ├── expression │ │ │ │ ├── And.java │ │ │ │ ├── Binary.java │ │ │ │ ├── Compare.java │ │ │ │ ├── CompareEqual.java │ │ │ │ ├── CompareLessOrEqualSigned.java │ │ │ │ ├── CompareLessOrEqualUnsigned.java │ │ │ │ ├── CompareLessSigned.java │ │ │ │ ├── CompareLessUnsigned.java │ │ │ │ ├── CompareNotEqual.java │ │ │ │ ├── Division.java │ │ │ │ ├── Expression.java │ │ │ │ ├── Extend.java │ │ │ │ ├── ICompare.java │ │ │ │ ├── IExpression.java │ │ │ │ ├── Modulo.java │ │ │ │ ├── Multiplication.java │ │ │ │ ├── Or.java │ │ │ │ ├── ShiftLeft.java │ │ │ │ ├── ShiftRight.java │ │ │ │ ├── ShiftRightSigned.java │ │ │ │ ├── SignExtend.java │ │ │ │ ├── SignedDivision.java │ │ │ │ ├── SignedModulo.java │ │ │ │ ├── Simple.java │ │ │ │ ├── Unary.java │ │ │ │ ├── Xor.java │ │ │ │ └── ZeroExtend.java │ │ │ ├── id │ │ │ │ ├── ArchRegister.java │ │ │ │ ├── FloatingFlags.java │ │ │ │ ├── IId.java │ │ │ │ ├── Id.java │ │ │ │ ├── VirtualEqualsId.java │ │ │ │ ├── VirtualEqualsNotId.java │ │ │ │ ├── VirtualLessOrEqualSignedId.java │ │ │ │ ├── VirtualLessOrEqualUnsignedId.java │ │ │ │ ├── VirtualLessSignedId.java │ │ │ │ ├── VirtualLessUnsignedId.java │ │ │ │ ├── VirtualTemporaryId.java │ │ │ │ └── x86 │ │ │ │ │ ├── X86Register.java │ │ │ │ │ └── X86RegisterId.java │ │ │ ├── linear │ │ │ │ ├── ILinearExpression.java │ │ │ │ ├── LinearAdditionExpression.java │ │ │ │ ├── LinearBinaryExpression.java │ │ │ │ ├── LinearExpression.java │ │ │ │ ├── LinearImmediateExpression.java │ │ │ │ ├── LinearScaleExpression.java │ │ │ │ ├── LinearSubtractionExpression.java │ │ │ │ └── LinearVariableExpression.java │ │ │ ├── sexpression │ │ │ │ ├── Arbitrary.java │ │ │ │ ├── ISimpleExpression.java │ │ │ │ ├── SimpleCompareExpression.java │ │ │ │ ├── SimpleExpression.java │ │ │ │ └── SimpleLinearExpression.java │ │ │ └── statement │ │ │ │ ├── AssignStatement.java │ │ │ │ ├── BranchStatement.java │ │ │ │ ├── ConditionalBranchStatement.java │ │ │ │ ├── FlopStatement.java │ │ │ │ ├── IStatement.java │ │ │ │ ├── IfThenElseStatement.java │ │ │ │ ├── LoadStatement.java │ │ │ │ ├── PrimitiveStatement.java │ │ │ │ ├── Statement.java │ │ │ │ ├── StoreStatement.java │ │ │ │ ├── ThrowStatement.java │ │ │ │ └── WhileStatement.java │ │ └── translator │ │ │ ├── OptimizationConfig.java │ │ │ ├── OptimizationOptions.java │ │ │ ├── RReilTranslateException.java │ │ │ ├── TranslatedBlock.java │ │ │ ├── TranslatedBlockRaw.java │ │ │ └── Translator.java │ │ ├── gdsl_BareFrontend.c │ │ ├── gdsl_BareFrontend.h │ │ ├── gdsl_Frontend.c │ │ ├── gdsl_Frontend.h │ │ ├── gdsl_Gdsl.c │ │ ├── gdsl_Gdsl.h │ │ ├── gdsl_ListFrontend.c │ │ ├── gdsl_ListFrontend.h │ │ ├── gdsl_asm_GeneralizerBackend.c │ │ ├── gdsl_asm_GeneralizerBackend.h │ │ ├── gdsl_decoder_NativeInstruction.c │ │ ├── gdsl_decoder_NativeInstruction.h │ │ ├── gdsl_rreil_BuilderBackend.c │ │ ├── gdsl_rreil_BuilderBackend.h │ │ ├── util.c │ │ └── util.h ├── memstream │ ├── CMakeLists.txt │ ├── include │ │ └── memstream.h │ └── src │ │ └── memstream.c ├── readhex │ ├── CMakeLists.txt │ ├── Makefile │ ├── include │ │ └── readhex.h │ └── src │ │ └── readhex.c ├── rreil-sim │ ├── Makefile │ ├── include │ │ ├── context.h │ │ ├── memory.h │ │ └── simulator │ │ │ ├── ops.h │ │ │ ├── regacc.h │ │ │ ├── register.h │ │ │ ├── simulator.h │ │ │ └── tracking.h │ └── src │ │ ├── context.c │ │ ├── memory.c │ │ └── simulator │ │ ├── ops.c │ │ ├── regacc.c │ │ ├── simulator.c │ │ └── tracking.c ├── rustgdsl │ ├── rreil │ │ ├── id │ │ │ ├── arch.rs │ │ │ ├── mod.rs │ │ │ ├── shared.rs │ │ │ └── virtual_.rs │ │ ├── linear │ │ │ ├── binary.rs │ │ │ └── mod.rs │ │ └── mod.rs │ └── test.rs ├── x86-generator │ ├── Makefile │ ├── include │ │ ├── generator.h │ │ ├── generator_tree.h │ │ └── x86_opcodes.h │ └── src │ │ ├── generator.c │ │ ├── generator_tree.c │ │ └── x86_opcodes.c ├── x86-tester │ ├── Makefile │ ├── include │ │ ├── executor.h │ │ ├── tbgen.h │ │ ├── tbgen_alloc.h │ │ └── tester.h │ └── src │ │ ├── executor.c │ │ ├── tbgen.c │ │ ├── tbgen_alloc.c │ │ └── tester.c └── x86 │ ├── Makefile │ ├── include │ ├── x86.h │ └── x86_features.h │ └── src │ ├── x86.c │ └── x86_features.c ├── mips.mk ├── pygdsl ├── Makefile ├── README.md ├── env ├── ida │ ├── IDAPythonExample.py │ └── spidautils.py ├── pygdsl.i ├── pygdsl_error.h ├── pygdsl_funcs.h ├── pygdsl_impl.c ├── setup.py └── tests │ ├── a.bin │ ├── multiple_instrs-expected.txt │ ├── multiple_instrs.py │ ├── single_instrs-expected.txt │ └── single_instrs.py ├── scoping.patch ├── specifications ├── arm7 │ ├── arm7-asm.ml │ ├── arm7-liveness.ml │ ├── arm7-pretty.ml │ ├── arm7-rreil-pretty.ml │ ├── arm7-rreil-registermapping.ml │ ├── arm7-rreil-translator.ml │ ├── arm7.ml │ └── instructions.txt ├── asm │ ├── asm-cif.ml │ ├── asm-pretty.ml │ └── asm.ml ├── avr │ ├── avr-asm.ml │ ├── avr-liveness.ml │ ├── avr-pretty.ml │ ├── avr-rreil-pretty.ml │ ├── avr-rreil-registermapping.ml │ ├── avr-rreil-translator.ml │ ├── avr-traverse.ml │ └── avr.ml ├── basis │ ├── bbtree.ml │ ├── prelude.ml │ └── tree-set.ml ├── mips │ ├── mips-asm.ml │ ├── mips-asm_r5.ml │ ├── mips-asm_r6.ml │ ├── mips-liveness.ml │ ├── mips-pretty.ml │ ├── mips-pretty_r5.ml │ ├── mips-pretty_r6.ml │ ├── mips-rreil-pretty.ml │ ├── mips-rreil-registermapping.ml │ ├── mips-rreil-translator.ml │ ├── mips-rreil-translator_r5.ml │ ├── mips-rreil-translator_r6.ml │ ├── mips-traverse.ml │ ├── mips-traverse_r5.ml │ ├── mips-traverse_r6.ml │ ├── mips.ml │ ├── mips_r5.ml │ └── mips_r6.ml ├── msp430 │ └── msp430.ml ├── rreil │ ├── fmap.ml │ ├── forward-subst │ │ ├── delayed-forward-subst │ │ │ ├── inline.ml │ │ │ ├── substitute.ml │ │ │ └── substmap.ml │ │ └── forward-subst │ │ │ ├── inline.ml │ │ │ ├── simplify-expressions.ml │ │ │ ├── substitute.ml │ │ │ └── substmap.ml │ ├── fusion │ │ └── fusion.ml │ ├── rreil-cif.ml │ ├── rreil-cleanup.ml │ ├── rreil-examples.ml │ ├── rreil-forward-subst.ml │ ├── rreil-liveness.ml │ ├── rreil-opt.ml │ ├── rreil-pretty.ml │ ├── rreil-translator.ml │ └── rreil.ml ├── x86-tester │ └── x86-pretty-simple.ml └── x86 │ ├── x86-asm.ml │ ├── x86-equals.ml │ ├── x86-liveness.ml │ ├── x86-pretty.ml │ ├── x86-rreil-translator-a-l.ml │ ├── x86-rreil-translator-m-z.ml │ ├── x86-rreil-translator.ml │ ├── x86-semantics-mapping-pretty.ml │ ├── x86-semantics-mapping.ml │ ├── x86-traverse.ml │ └── x86.ml ├── stale ├── Makefile-old ├── Makefile_sml ├── asm-test.s ├── dis-tool-test │ ├── binary │ │ ├── 1 │ │ ├── 2 │ │ ├── 3 │ │ ├── 4 │ │ ├── 5 │ │ ├── 6 │ │ ├── 7 │ │ ├── 8 │ │ ├── 9 │ │ ├── 10 │ │ ├── 11 │ │ ├── 12 │ │ ├── 13 │ │ ├── 14 │ │ ├── 15 │ │ └── bea │ │ │ ├── 1 │ │ │ ├── 2 │ │ │ ├── 3 │ │ │ ├── 4 │ │ │ ├── 5 │ │ │ ├── 6 │ │ │ ├── 7 │ │ │ ├── 8 │ │ │ ├── 9 │ │ │ ├── 10 │ │ │ ├── 11 │ │ │ ├── 12 │ │ │ ├── 13 │ │ │ ├── 14 │ │ │ ├── 15 │ │ │ └── template.exe │ ├── clis │ │ ├── bea │ │ │ ├── Makefile │ │ │ └── bea-cli.c │ │ ├── distorm │ │ │ ├── Makefile │ │ │ └── distorm-cli.c │ │ ├── opdis │ │ │ ├── Makefile │ │ │ └── opdis-cli.c │ │ ├── readhex │ │ │ ├── Makefile │ │ │ ├── include │ │ │ │ └── readhex.h │ │ │ └── readhex.c │ │ └── xed │ │ │ ├── Makefile │ │ │ ├── xed-cli.cpp │ │ │ └── xed-examples-ostreams.H │ ├── pex.desc │ ├── tools │ └── tools.table ├── examples │ ├── js │ │ └── pretty.js │ └── x86 │ │ ├── Makefile │ │ ├── cmp.c │ │ ├── pretty.c │ │ ├── pretty.h │ │ └── xed-cmp.c ├── gdrr │ ├── Makefile │ ├── include │ │ ├── gdrr.h │ │ ├── gdrr_arch.h │ │ ├── gdrr_arch_callbacks.h │ │ ├── gdrr_callbacks.h │ │ ├── gdrr_config.h │ │ └── gdrr_types.h │ └── src │ │ └── gdrr.c ├── liveness-example-bins │ ├── Xorg │ ├── bash │ ├── cat │ ├── echo │ ├── less │ ├── ls │ ├── mkdir │ ├── netstat │ ├── ps │ ├── pwd │ ├── rm │ ├── sed │ ├── tar │ ├── touch │ └── uname ├── liveness-example.c ├── liveness-sweep-simple.c ├── liveness-table.sh ├── liveness-test.c ├── liveness.c ├── liveness │ └── example_a.c ├── opcode-sequence-01.txt ├── opcode-sequence-02.txt ├── resweep.sh ├── sweep │ ├── Makefile │ ├── sweep-beaengine.c │ ├── sweep-dcc.c │ ├── sweep-distorm.c │ ├── sweep-libopcode.c │ ├── sweep-udis86.c │ ├── sweep-xed.c │ └── test-binary ├── tester.c └── x86-tester │ ├── opcode-extrator.c │ └── opcodes ├── stats-102013 ├── todo ├── tools ├── CMakeLists.txt ├── Makefile ├── cgdsl-demo.c ├── cppgdsl-demo.cpp ├── decoder-cli.c ├── mipseval │ ├── Makefile │ └── mipseval-cli.c ├── optimization-sweep.c ├── semantics-cif-cli.c ├── semantics-cli-dynamic.c ├── semantics-cli.c ├── semantics-opt.c ├── sweep.c ├── x86-test-runner │ ├── Makefile │ ├── src │ │ └── main.c │ └── test_cases │ │ └── delayed_fsubst_test_cases ├── x86-test-stats-runner │ ├── Makefile │ └── src │ │ ├── hash_array.c │ │ ├── hash_array.h │ │ └── main.c └── xed-cmp │ ├── Makefile │ ├── run.sh │ └── src │ └── xed-cmp.c └── x86.mk /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: Google 3 | --- 4 | Language: Cpp 5 | # Force pointers to the type for C++. 6 | # DerivePointerAlignment: false 7 | # PointerAlignment: Left 8 | --- 9 | 10 | -------------------------------------------------------------------------------- /Makefile_manual: -------------------------------------------------------------------------------- 1 | include config.mk 2 | 3 | archs:=x86 avr mips arm7 4 | 5 | $(archs): 6 | $(MAKE) -f Makefile_$@ 7 | 8 | $(archs:=-libs): 9 | $(MAKE) -f Makefile_$(@:%-libs=%) libs 10 | 11 | $(archs:=-tools): 12 | $(MAKE) -f Makefile_$(@:%-tools=%) tools 13 | 14 | $(archs:=-clean): 15 | $(MAKE) -f Makefile_$(@:%-clean=%) clean 16 | 17 | clean: $(archs:=-clean) 18 | -------------------------------------------------------------------------------- /arm.mk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/arm.mk -------------------------------------------------------------------------------- /avr.mk: -------------------------------------------------------------------------------- 1 | export GDSL_ARCH=avr 2 | -------------------------------------------------------------------------------- /bugs.udcli: -------------------------------------------------------------------------------- 1 | 64bit: 2 | 3 | 0f8700000000 ja ... 4 | 660f870000 ja ... <= should be unsupported 5 | xed2: both are the same 6 | seems that jumps are note decoded correlty in 64bit mode 7 | -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/config.h -------------------------------------------------------------------------------- /config.mk: -------------------------------------------------------------------------------- 1 | export GDSL=gdsl 2 | -------------------------------------------------------------------------------- /detail/closure/closure-control.sml: -------------------------------------------------------------------------------- 1 | 2 | structure ClosureControl = struct 3 | val (registry, debug) = 4 | BasicControl.newRegistryWithDebug 5 | {name="closure", 6 | pri=9, 7 | help="controls for the closure conversion phases"} 8 | end 9 | -------------------------------------------------------------------------------- /detail/codegen/codegen-control.sml: -------------------------------------------------------------------------------- 1 | 2 | structure CodegenControl = struct 3 | val (registry, debug) = 4 | BasicControl.newRegistryWithDebug 5 | {name="codegen", 6 | pri=9, 7 | help="controls for the code generation phase"} 8 | end 9 | -------------------------------------------------------------------------------- /detail/common/basis.sml: -------------------------------------------------------------------------------- 1 | 2 | structure StringMap = struct 3 | structure Key = struct 4 | open String 5 | type ord_key = string 6 | end 7 | structure Map = RedBlackMapFn(Key) 8 | open Map 9 | end 10 | 11 | structure Op = struct 12 | nonfix div mod 13 | val times = Atom.atom "*" 14 | val mod = Atom.atom "%" 15 | val plus = Atom.atom "+" 16 | val minus = Atom.atom "-" 17 | val concat = Atom.atom "^" 18 | val select = Atom.atom "." 19 | val andAlso = Atom.atom "and" 20 | val orElse = Atom.atom "or" 21 | end 22 | -------------------------------------------------------------------------------- /detail/common/sum-sig.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2006-2007 SSH Communications Security, Helsinki, Finland 2 | * 3 | * This code is released under the MLton license, a BSD-style license. 4 | * See the LICENSE file or http://mlton.org/License for details. 5 | *) 6 | 7 | (** A general purpose sum type. *) 8 | signature SUM = sig 9 | datatype ('a, 'b) sum = INL of 'a | INR of 'b 10 | type ('a, 'b) t = ('a, 'b) sum 11 | exception Sum 12 | val swap : ('a, 'b) t -> ('b, 'a) t 13 | end 14 | -------------------------------------------------------------------------------- /detail/common/sum.sml: -------------------------------------------------------------------------------- 1 | (* Copyright (C) 2006-2007 SSH Communications Security, Helsinki, Finland 2 | * 3 | * This code is released under the MLton license, a BSD-style license. 4 | * See the LICENSE file or http://mlton.org/License for details. 5 | *) 6 | 7 | structure Sum : SUM = struct 8 | datatype ('a, 'b) sum = INL of 'a | INR of 'b 9 | type ('a, 'b) t = ('a, 'b) sum 10 | exception Sum 11 | val swap = fn INL x => INR x | INR x => INL x 12 | end 13 | -------------------------------------------------------------------------------- /detail/cps/cps-control.sml: -------------------------------------------------------------------------------- 1 | 2 | structure CPSControl = struct 3 | val (registry, debug) = 4 | BasicControl.newRegistryWithDebug 5 | {name="cps", 6 | pri=9, 7 | help="controls for the cps phases"} 8 | end 9 | -------------------------------------------------------------------------------- /detail/desugar/desugar-control.sml: -------------------------------------------------------------------------------- 1 | 2 | structure DesugarControl = struct 3 | val (registry, debug) = 4 | BasicControl.newRegistryWithDebug 5 | {name="desugar", 6 | pri=9, 7 | help="controls for the desugaring passes"} 8 | end 9 | -------------------------------------------------------------------------------- /detail/external/mllpt-lib/antlr-lexer-sig.sml: -------------------------------------------------------------------------------- 1 | (* antlr-lexer-sig.sml 2 | * 3 | * COPYRIGHT (c) 2006 4 | * John Reppy (http://www.cs.uchicago.edu/~jhr) 5 | * Aaron Turon (http://www.cs.uchicago.edu/~adrassi) 6 | * All rights reserved. 7 | * 8 | * Signature for the lexer argument to parser functors generated 9 | * by ml-antlr. 10 | *) 11 | 12 | signature ANTLR_LEXER = sig 13 | 14 | type strm 15 | type pos = AntlrStreamPos.pos 16 | 17 | val getPos : strm -> pos 18 | 19 | end -------------------------------------------------------------------------------- /detail/external/mllpt-lib/antlr-tokens-sig.sml: -------------------------------------------------------------------------------- 1 | (* antlr-tokens-sig.sml 2 | * 3 | * COPYRIGHT (c) 2006 4 | * John Reppy (http://www.cs.uchicago.edu/~jhr) 5 | * Aaron Turon (http://www.cs.uchicago.edu/~adrassi) 6 | * All rights reserved. 7 | * 8 | * Signature for generated tokens module, for ml-antlr 9 | *) 10 | 11 | signature ANTLR_TOKENS = sig 12 | 13 | type token 14 | 15 | val allToks : token list 16 | val isKW : token -> bool 17 | val isEOF : token -> bool 18 | val toString : token -> string 19 | 20 | end -------------------------------------------------------------------------------- /detail/external/mllpt-lib/mllpt-lib.mlb: -------------------------------------------------------------------------------- 1 | ml-lpt-lib.mlb 2 | -------------------------------------------------------------------------------- /detail/imp/imp-control.sml: -------------------------------------------------------------------------------- 1 | 2 | structure ImpControl = struct 3 | val (registry, debug) = 4 | BasicControl.newRegistryWithDebug 5 | {name="imp", 6 | pri=9, 7 | help="controls for the imp phases"} 8 | end 9 | -------------------------------------------------------------------------------- /detail/ml/mlton/main.sml: -------------------------------------------------------------------------------- 1 | 2 | val () = Main.main() 3 | (* val () = Main.Passes.runTc "examples/x86.d" *) 4 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.sdk/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | gdsl.plugin.sdk 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.FeatureBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.pde.FeatureNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.sdk/build.properties: -------------------------------------------------------------------------------- 1 | bin.includes =feature.xml 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.sdk/category.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.sdk/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.tests/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.tests/.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.tests/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.tests/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = META-INF/,\ 5 | . 6 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.tests/src-gen/gdsl/plugin/GDSLUiInjectorProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin; 5 | 6 | import org.eclipse.xtext.junit4.IInjectorProvider; 7 | 8 | import com.google.inject.Injector; 9 | 10 | public class GDSLUiInjectorProvider implements IInjectorProvider { 11 | 12 | public Injector getInjector() { 13 | return gdsl.plugin.ui.internal.GDSLActivator.getInstance().getInjector("gdsl.plugin.GDSL"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = META-INF/,\ 5 | .,\ 6 | plugin.xml -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/src/gdsl/plugin/ui/GDSLUiModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.ui; 5 | 6 | import org.eclipse.ui.plugin.AbstractUIPlugin; 7 | 8 | /** 9 | * Use this class to register components to be used within the IDE. 10 | */ 11 | public class GDSLUiModule extends gdsl.plugin.ui.AbstractGDSLUiModule { 12 | public GDSLUiModule(AbstractUIPlugin plugin) { 13 | super(plugin); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/src/gdsl/plugin/ui/contentassist/GDSLProposalProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.ui.contentassist 5 | 6 | import gdsl.plugin.ui.contentassist.AbstractGDSLProposalProvider 7 | 8 | /** 9 | * see http://www.eclipse.org/Xtext/documentation.html#contentAssist on how to customize content assistant 10 | */ 11 | class GDSLProposalProvider extends AbstractGDSLProposalProvider { 12 | } 13 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/src/gdsl/plugin/ui/labeling/GDSLDescriptionLabelProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.ui.labeling 5 | 6 | //import org.eclipse.xtext.resource.IEObjectDescription 7 | 8 | /** 9 | * Provides labels for a IEObjectDescriptions and IResourceDescriptions. 10 | * 11 | * see http://www.eclipse.org/Xtext/documentation.html#labelProvider 12 | */ 13 | class GDSLDescriptionLabelProvider extends org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider { 14 | 15 | // Labels and icons can be computed like this: 16 | 17 | // override text(IEObjectDescription ele) { 18 | // ele.name.toString 19 | // } 20 | // 21 | // override image(IEObjectDescription ele) { 22 | // ele.EClass.name + '.gif' 23 | // } 24 | } 25 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/xtend-gen/gdsl/plugin/ui/contentassist/.gitignore: -------------------------------------------------------------------------------- 1 | /.GDSLProposalProvider.java._trace 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/xtend-gen/gdsl/plugin/ui/contentassist/GDSLProposalProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.ui.contentassist; 5 | 6 | import gdsl.plugin.ui.contentassist.AbstractGDSLProposalProvider; 7 | 8 | /** 9 | * see http://www.eclipse.org/Xtext/documentation.html#contentAssist on how to customize content assistant 10 | */ 11 | @SuppressWarnings("all") 12 | public class GDSLProposalProvider extends AbstractGDSLProposalProvider { 13 | } 14 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/xtend-gen/gdsl/plugin/ui/labeling/.gitignore: -------------------------------------------------------------------------------- 1 | /.GDSLDescriptionLabelProvider.java._trace 2 | /.GDSLLabelProvider.java._trace 3 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/xtend-gen/gdsl/plugin/ui/labeling/GDSLDescriptionLabelProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.ui.labeling; 5 | 6 | import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider; 7 | 8 | /** 9 | * Provides labels for a IEObjectDescriptions and IResourceDescriptions. 10 | * 11 | * see http://www.eclipse.org/Xtext/documentation.html#labelProvider 12 | */ 13 | @SuppressWarnings("all") 14 | public class GDSLDescriptionLabelProvider extends DefaultDescriptionLabelProvider { 15 | } 16 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/xtend-gen/gdsl/plugin/ui/outline/.gitignore: -------------------------------------------------------------------------------- 1 | /.GDSLOutlineTreeProvider.java._trace 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin.ui/xtend-gen/gdsl/plugin/ui/quickfix/.gitignore: -------------------------------------------------------------------------------- 1 | /.GDSLQuickfixProvider.java._trace 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/.antlr-generator-3.2.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdsl.plugin/.antlr-generator-3.2.0.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = model/,\ 5 | META-INF/,\ 6 | .,\ 7 | plugin.xml -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/plugin.xml_gen: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/src-gen/gdsl/plugin/GDSL.xtextbin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdsl.plugin/src-gen/gdsl/plugin/GDSL.xtextbin -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/src-gen/gdsl/plugin/gDSL/AndAlsoExp.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package gdsl.plugin.gDSL; 4 | 5 | 6 | /** 7 | * 8 | * A representation of the model object 'And Also Exp'. 9 | * 10 | * 11 | * 12 | * @see gdsl.plugin.gDSL.GDSLPackage#getAndAlsoExp() 13 | * @model 14 | * @generated 15 | */ 16 | public interface AndAlsoExp extends OrElseExp 17 | { 18 | } // AndAlsoExp 19 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/src-gen/gdsl/plugin/gDSL/Decl.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package gdsl.plugin.gDSL; 4 | 5 | import org.eclipse.emf.ecore.EObject; 6 | 7 | /** 8 | * 9 | * A representation of the model object 'Decl'. 10 | * 11 | * 12 | * 13 | * @see gdsl.plugin.gDSL.GDSLPackage#getDecl() 14 | * @model 15 | * @generated 16 | */ 17 | public interface Decl extends EObject 18 | { 19 | } // Decl 20 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/src-gen/gdsl/plugin/gDSL/RExp.java: -------------------------------------------------------------------------------- 1 | /** 2 | */ 3 | package gdsl.plugin.gDSL; 4 | 5 | 6 | /** 7 | * 8 | * A representation of the model object 'RExp'. 9 | * 10 | * 11 | * 12 | * @see gdsl.plugin.gDSL.GDSLPackage#getRExp() 13 | * @model 14 | * @generated 15 | */ 16 | public interface RExp extends AndAlsoExp 17 | { 18 | } // RExp 19 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/src-gen/gdsl/plugin/parser/antlr/GDSLAntlrTokenFileProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.parser.antlr; 5 | 6 | import java.io.InputStream; 7 | import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider; 8 | 9 | public class GDSLAntlrTokenFileProvider implements IAntlrTokenFileProvider { 10 | 11 | public InputStream getAntlrTokenFile() { 12 | ClassLoader classLoader = getClass().getClassLoader(); 13 | return classLoader.getResourceAsStream("gdsl/plugin/parser/antlr/internal/InternalGDSL.tokens"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/src-gen/gdsl/plugin/validation/AbstractGDSLValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.validation; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import org.eclipse.emf.ecore.EPackage; 9 | 10 | public class AbstractGDSLValidator extends org.eclipse.xtext.validation.AbstractDeclarativeValidator { 11 | 12 | @Override 13 | protected List getEPackages() { 14 | List result = new ArrayList(); 15 | result.add(gdsl.plugin.gDSL.GDSLPackage.eINSTANCE); 16 | return result; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/src/gdsl/plugin/GDSLRuntimeModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin; 5 | 6 | /** 7 | * Use this class to register components to be used at runtime / without the Equinox extension registry. 8 | */ 9 | public class GDSLRuntimeModule extends gdsl.plugin.AbstractGDSLRuntimeModule { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/src/gdsl/plugin/GDSLStandaloneSetup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin; 5 | 6 | /** 7 | * Initialization support for running Xtext languages 8 | * without equinox extension registry 9 | */ 10 | public class GDSLStandaloneSetup extends GDSLStandaloneSetupGenerated{ 11 | 12 | public static void doSetup() { 13 | new GDSLStandaloneSetup().createInjectorAndDoEMFRegistration(); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/src/gdsl/plugin/scoping/GDSLScopeProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.scoping 5 | 6 | /** 7 | * This class contains custom scoping description. 8 | * 9 | * see : http://www.eclipse.org/Xtext/documentation.html#scoping 10 | * on how and when to use it 11 | * 12 | */ 13 | class GDSLScopeProvider extends org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/xtend-gen/gdsl/plugin/formatting/.gitignore: -------------------------------------------------------------------------------- 1 | /.GDSLFormatter.java._trace 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/xtend-gen/gdsl/plugin/formatting/GDSLFormatter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.formatting; 5 | 6 | import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter; 7 | import org.eclipse.xtext.formatting.impl.FormattingConfig; 8 | 9 | /** 10 | * This class contains custom formatting description. 11 | * 12 | * see : http://www.eclipse.org/Xtext/documentation.html#formatting 13 | * on how and when to use it 14 | * 15 | * Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example 16 | */ 17 | @SuppressWarnings("all") 18 | public class GDSLFormatter extends AbstractDeclarativeFormatter { 19 | protected void configureFormatting(final FormattingConfig c) { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/xtend-gen/gdsl/plugin/generator/.gitignore: -------------------------------------------------------------------------------- 1 | /.GDSLGenerator.java._trace 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/xtend-gen/gdsl/plugin/generator/GDSLGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.generator; 5 | 6 | import org.eclipse.emf.ecore.resource.Resource; 7 | import org.eclipse.xtext.generator.IFileSystemAccess; 8 | import org.eclipse.xtext.generator.IGenerator; 9 | 10 | /** 11 | * Generates code from your model files on save. 12 | * 13 | * see http://www.eclipse.org/Xtext/documentation.html#TutorialCodeGeneration 14 | */ 15 | @SuppressWarnings("all") 16 | public class GDSLGenerator implements IGenerator { 17 | public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/xtend-gen/gdsl/plugin/scoping/.gitignore: -------------------------------------------------------------------------------- 1 | /.GDSLScopeProvider.java._trace 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/xtend-gen/gdsl/plugin/scoping/GDSLScopeProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 3 | */ 4 | package gdsl.plugin.scoping; 5 | 6 | import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; 7 | 8 | /** 9 | * This class contains custom scoping description. 10 | * 11 | * see : http://www.eclipse.org/Xtext/documentation.html#scoping 12 | * on how and when to use it 13 | */ 14 | @SuppressWarnings("all") 15 | public class GDSLScopeProvider extends AbstractDeclarativeScopeProvider { 16 | } 17 | -------------------------------------------------------------------------------- /eclipse-plugin/gdsl.plugin/xtend-gen/gdsl/plugin/validation/.gitignore: -------------------------------------------------------------------------------- 1 | /.GDSLValidator.java._trace 2 | -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/artifacts.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/artifacts.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/content.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/content.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201408270200.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201408270200.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201408271510.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201408271510.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201408271741.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201408271741.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201408291346.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201408291346.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201409021957.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201409021957.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201409111251.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/features/gdsl.plugin.sdk_1.0.0.201409111251.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201408270200.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201408270200.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201408271510.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201408271510.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201408271741.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201408271741.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201408291346.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201408291346.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201409021957.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201409021957.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201409111251.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin.ui_1.0.0.201409111251.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201408270200.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201408270200.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201408271510.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201408271510.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201408271741.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201408271741.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201408291346.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201408291346.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201409021957.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201409021957.jar -------------------------------------------------------------------------------- /eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201409111251.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/eclipse-plugin/gdslUpdateSite/plugins/gdsl.plugin_1.0.0.201409111251.jar -------------------------------------------------------------------------------- /gdsl.cm: -------------------------------------------------------------------------------- 1 | 2 | library 3 | source(detail/export.sml) 4 | is 5 | detail/export.sml 6 | detail/ml/smlnj/unsealed.cm -------------------------------------------------------------------------------- /gdsl.h: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #define GDSL_NO_PREFIX 3 | 4 | #ifdef USE_X86 5 | #include "gdsl-x86.h" 6 | #elif USE_X86_RREIL 7 | #include "gdsl-x86-rreil.h" 8 | #elif USE_AVR 9 | #include "gdsl-avr.h" 10 | #elif USE_AVR_RREIL 11 | #include "gdsl-avr-rreil.h" 12 | #elif USE_MIPS 13 | #include "gdsl-mips.h" 14 | #elif USE_MIPS_RREIL 15 | #include "gdsl-mips-rreil.h" 16 | #elif USE_ARM7_RREIL 17 | #include "gdsl-arm7-rreil.h" 18 | #endif 19 | 20 | 21 | -------------------------------------------------------------------------------- /gdslConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # - Config file for the gdsl package 2 | # It defines the following variables 3 | # GDSL_INCLUDE_DIRS - include directories for gdsl 4 | # GDSL_LIBRARIES - libraries to link against 5 | 6 | # Compute paths 7 | get_filename_component(GDSL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 8 | set(GDSL_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@") 9 | 10 | #TODO(kranzj): Check if the commented code is required! 11 | ## Our library dependencies (contains definitions for IMPORTED targets) 12 | #if(NOT TARGET readhex AND NOT gdsl_BINARY_DIR) 13 | include("${GDSL_CMAKE_DIR}/gdslTargets.cmake") 14 | #endif() 15 | 16 | # These are IMPORTED targets created by gdslTargets.cmake 17 | set(GDSL_LIBRARIES ${EXPORT_LIBRARIES}) 18 | #set(GDSL_EXECUTABLE bar) 19 | 20 | -------------------------------------------------------------------------------- /gdslConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "@GDSL_VERSION@") 2 | 3 | # Check whether the requested PACKAGE_FIND_VERSION is compatible 4 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") 5 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 6 | else() 7 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 8 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 9 | set(PACKAGE_VERSION_EXACT TRUE) 10 | endif() 11 | endif() 12 | 13 | -------------------------------------------------------------------------------- /include/context.h: -------------------------------------------------------------------------------- 1 | ../libs/rreil-sim/include/context.h -------------------------------------------------------------------------------- /include/cppgdsl: -------------------------------------------------------------------------------- 1 | ../libs/cppgdsl/include/cppgdsl -------------------------------------------------------------------------------- /include/decoder_config.h: -------------------------------------------------------------------------------- 1 | ../libs/gdutil/include/decoder_config.h -------------------------------------------------------------------------------- /include/executor.h: -------------------------------------------------------------------------------- 1 | ../libs/x86-tester/include/executor.h -------------------------------------------------------------------------------- /include/gdsl.h: -------------------------------------------------------------------------------- 1 | ../gdsl_manual.h -------------------------------------------------------------------------------- /include/gdsl_elf.h: -------------------------------------------------------------------------------- 1 | ../libs/gdutil/include/gdsl_elf.h -------------------------------------------------------------------------------- /include/gdsl_generic.h: -------------------------------------------------------------------------------- 1 | ../libs/gdsl-multiplex/include/gdsl_generic.h -------------------------------------------------------------------------------- /include/gdsl_multiplex.h: -------------------------------------------------------------------------------- 1 | ../libs/gdsl-multiplex/include/gdsl_multiplex.h -------------------------------------------------------------------------------- /include/gdwrap.h: -------------------------------------------------------------------------------- 1 | ../libs/gdwrap/include/gdwrap.h -------------------------------------------------------------------------------- /include/generator.h: -------------------------------------------------------------------------------- 1 | ../libs/x86-generator/include/generator.h -------------------------------------------------------------------------------- /include/generator_tree.h: -------------------------------------------------------------------------------- 1 | ../libs/x86-generator/include/generator_tree.h -------------------------------------------------------------------------------- /include/memory.h: -------------------------------------------------------------------------------- 1 | ../libs/rreil-sim/include/memory.h -------------------------------------------------------------------------------- /include/readhex.h: -------------------------------------------------------------------------------- 1 | ../libs/readhex/include/readhex.h -------------------------------------------------------------------------------- /include/rreil: -------------------------------------------------------------------------------- 1 | ../libs/cgdsl/include/rreil -------------------------------------------------------------------------------- /include/simulator: -------------------------------------------------------------------------------- 1 | ../libs/rreil-sim/include/simulator/ -------------------------------------------------------------------------------- /include/stack.h: -------------------------------------------------------------------------------- 1 | ../libs/gdutil/include/stack.h -------------------------------------------------------------------------------- /include/tbgen.h: -------------------------------------------------------------------------------- 1 | ../libs/x86-tester/include/tbgen.h -------------------------------------------------------------------------------- /include/tbgen_alloc.h: -------------------------------------------------------------------------------- 1 | ../libs/x86-tester/include/tbgen_alloc.h -------------------------------------------------------------------------------- /include/tester.h: -------------------------------------------------------------------------------- 1 | ../libs/x86-tester/include/tester.h -------------------------------------------------------------------------------- /include/util.h: -------------------------------------------------------------------------------- 1 | ../libs/gdutil/include/util.h -------------------------------------------------------------------------------- /include/x86.h: -------------------------------------------------------------------------------- 1 | ../libs/x86/include/x86.h -------------------------------------------------------------------------------- /include/x86_features.h: -------------------------------------------------------------------------------- 1 | ../libs/x86/include/x86_features.h -------------------------------------------------------------------------------- /include/x86_opcodes.h: -------------------------------------------------------------------------------- 1 | ../libs/x86-generator/include/x86_opcodes.h -------------------------------------------------------------------------------- /lib/libcgdsl.a: -------------------------------------------------------------------------------- 1 | ../libs/cgdsl/libcgdsl.a -------------------------------------------------------------------------------- /lib/libcppgdsl.a: -------------------------------------------------------------------------------- 1 | ../libs/cppgdsl/libcppgdsl.a -------------------------------------------------------------------------------- /lib/libgdsl-current.so: -------------------------------------------------------------------------------- 1 | ../libgdsl.so -------------------------------------------------------------------------------- /lib/libgdsl-current.so.0: -------------------------------------------------------------------------------- 1 | ../libgdsl.so -------------------------------------------------------------------------------- /lib/libgdsl-multiplex-windows.a: -------------------------------------------------------------------------------- 1 | ../libs/gdsl-multiplex-windows/libgdsl-multiplex.a -------------------------------------------------------------------------------- /lib/libgdsl-multiplex.a: -------------------------------------------------------------------------------- 1 | ../libs/gdsl-multiplex/libgdsl-multiplex.a -------------------------------------------------------------------------------- /lib/libgdsl-x86-rreil.so: -------------------------------------------------------------------------------- 1 | libgdsl-current.so -------------------------------------------------------------------------------- /lib/libgdsl.so: -------------------------------------------------------------------------------- 1 | ../libgdsl.so -------------------------------------------------------------------------------- /lib/libgdsl.so.0: -------------------------------------------------------------------------------- 1 | ../libgdsl.so -------------------------------------------------------------------------------- /lib/libgdutil.a: -------------------------------------------------------------------------------- 1 | ../libs/gdutil/libgdutil.a -------------------------------------------------------------------------------- /lib/libgdwrap.a: -------------------------------------------------------------------------------- 1 | ../libs/gdwrap/libgdwrap.a -------------------------------------------------------------------------------- /lib/libjgdsl.so: -------------------------------------------------------------------------------- 1 | ../libs/jgdsl/libjgdsl.so -------------------------------------------------------------------------------- /lib/libreadhex.a: -------------------------------------------------------------------------------- 1 | ../libs/readhex/libreadhex.a -------------------------------------------------------------------------------- /lib/librreil-sim.a: -------------------------------------------------------------------------------- 1 | ../libs/rreil-sim/librreil-sim.a -------------------------------------------------------------------------------- /lib/libx86-generator.a: -------------------------------------------------------------------------------- 1 | ../libs/x86-generator/libx86-generator.a -------------------------------------------------------------------------------- /lib/libx86-tester.a: -------------------------------------------------------------------------------- 1 | ../libs/x86-tester/libx86-tester.a -------------------------------------------------------------------------------- /lib/libx86.a: -------------------------------------------------------------------------------- 1 | ../libs/x86/libx86.a -------------------------------------------------------------------------------- /libs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.8) 2 | project (gdsl-libs) 3 | include (CheckFunctionExists) 4 | check_function_exists (open_memstream HAVE_MEMSTREAM) 5 | if (NOT HAVE_MEMSTREAM) 6 | add_subdirectory(memstream) 7 | endif (NOT HAVE_MEMSTREAM) 8 | 9 | add_subdirectory(gdsl-multiplex) 10 | add_subdirectory(cppgdsl) 11 | add_subdirectory(readhex) 12 | add_subdirectory(gdutil) 13 | add_subdirectory(jgdsl) 14 | 15 | set (EXPORT_LIBRARIES ${EXPORT_LIBRARIES} PARENT_SCOPE) 16 | -------------------------------------------------------------------------------- /libs/Makefile: -------------------------------------------------------------------------------- 1 | LIBS=gdutil gdsl-multiplex gdwrap readhex cgdsl cppgdsl 2 | 3 | #eq = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1))) 4 | #$(if $(call eq,$GDSL_ARCH,x86), \ 5 | #LIBS+=x86 x86-tester x86-generator \ 6 | #) 7 | 8 | ifeq ($(GDSL_ARCH),x86) 9 | LIBS+=x86 x86-tester x86-generator 10 | endif 11 | 12 | .PHONY all: $(LIBS) 13 | 14 | $(LIBS): 15 | $(MAKE) -C $@ 16 | 17 | .PHONY clean: $(LIBS:=-clean) 18 | 19 | $(LIBS:=-clean): 20 | $(MAKE) -C $(@:-clean=) clean 21 | -------------------------------------------------------------------------------- /libs/cgdsl/.gitignore: -------------------------------------------------------------------------------- 1 | /src/**/*.lo 2 | /src/**/*.o 3 | build/ 4 | libcgdsl.a 5 | -------------------------------------------------------------------------------- /libs/cgdsl/include/rreil/gdrr_builder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rreil_gdrr_builder.h 3 | * 4 | * Created on: 03.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef RREIL_GDRR_BUILDER_H_ 9 | #define RREIL_GDRR_BUILDER_H_ 10 | 11 | #include 12 | 13 | callbacks_t rreil_gdrr_builder_callbacks_get(state_t state); 14 | 15 | #endif /* RREIL_GDRR_BUILDER_H_ */ 16 | -------------------------------------------------------------------------------- /libs/cgdsl/include/rreil/rreil_address.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rreil_address.h 3 | * 4 | * Created on: 03.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef RREIL_ADDRESS_H_ 9 | #define RREIL_ADDRESS_H_ 10 | 11 | #include 12 | #include 13 | 14 | struct rreil_address { 15 | long long unsigned int size; 16 | struct rreil_linear *address; 17 | }; 18 | 19 | extern struct rreil_address *rreil_address_alloc(long long unsigned int size, struct rreil_linear *addr_lin); 20 | 21 | #endif /* RREIL_ADDRESS_H_ */ 22 | -------------------------------------------------------------------------------- /libs/cgdsl/include/rreil/rreil_arity.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rreil_arity.h 3 | * 4 | * Created on: 03.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef RREIL_ARITY_H_ 9 | #define RREIL_ARITY_H_ 10 | 11 | #include 12 | 13 | struct rreil_sexpr; 14 | struct rreil_linear; 15 | 16 | struct rreil_arity1 { 17 | struct rreil_linear *opnd1; 18 | }; 19 | 20 | struct rreil_arity2 { 21 | struct rreil_linear *opnd1; 22 | struct rreil_linear *opnd2; 23 | }; 24 | 25 | 26 | #endif /* RREIL_ARITY_H_ */ 27 | -------------------------------------------------------------------------------- /libs/cgdsl/include/rreil/rreil_branch_hint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rreil_branch_hint.h 3 | * 4 | * Created on: 03.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef RREIL_BRANCH_HINT_H_ 9 | #define RREIL_BRANCH_HINT_H_ 10 | 11 | enum rreil_branch_hint { 12 | RREIL_BRANCH_HINT_JUMP, 13 | RREIL_BRANCH_HINT_CALL, 14 | RREIL_BRANCH_HINT_RET 15 | }; 16 | 17 | #endif /* RREIL_BRANCH_HINT_H_ */ 18 | -------------------------------------------------------------------------------- /libs/cgdsl/include/rreil/rreil_comparator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rreil_comperator.h 3 | * 4 | * Created on: 02.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef RREIL_COMPARATOR_H_ 9 | #define RREIL_COMPARATOR_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | enum rreil_comparator_type { 16 | RREIL_COMPARATOR_TYPE_EQ, 17 | RREIL_COMPARATOR_TYPE_NEQ, 18 | RREIL_COMPARATOR_TYPE_LES, 19 | RREIL_COMPARATOR_TYPE_LEU, 20 | RREIL_COMPARATOR_TYPE_LTS, 21 | RREIL_COMPARATOR_TYPE_LTU 22 | }; 23 | 24 | struct rreil_comparator { 25 | enum rreil_comparator_type type; 26 | struct rreil_arity2 arity2; 27 | }; 28 | 29 | #endif /* RREIL_COMPARATOR_H_ */ 30 | -------------------------------------------------------------------------------- /libs/cgdsl/include/rreil/rreil_flop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rreil_flop.h 3 | * 4 | * Created on: Sep 13, 2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef RREIL_FLOP_H_ 9 | #define RREIL_FLOP_H_ 10 | 11 | enum rreil_flop { 12 | RREIL_FLOP_SEM_FADD, 13 | RREIL_FLOP_SEM_FSUB, 14 | RREIL_FLOP_SEM_FMUL 15 | }; 16 | 17 | #endif /* RREIL_FLOP_H_ */ 18 | -------------------------------------------------------------------------------- /libs/cgdsl/include/rreil/rreil_sexpr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rreil_sexpr.h 3 | * 4 | * Created on: 03.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef RREIL_SEXPR_H_ 9 | #define RREIL_SEXPR_H_ 10 | 11 | #include 12 | #include 13 | 14 | enum rreil_sexpr_type { 15 | RREIL_SEXPR_TYPE_LIN, RREIL_SEXPR_TYPE_CMP, RREIL_SEXPR_TYPE_ARB 16 | }; 17 | 18 | struct rreil_sexpr { 19 | enum rreil_sexpr_type type; 20 | union { 21 | struct rreil_linear *lin; 22 | struct { 23 | long long unsigned int size; 24 | struct rreil_comparator *comp; 25 | } cmp; 26 | }; 27 | }; 28 | 29 | extern struct rreil_sexpr *rreil_sexpr_linear_alloc(struct rreil_linear *linear); 30 | 31 | #endif /* RREIL_SEXPR_H_ */ 32 | -------------------------------------------------------------------------------- /libs/cgdsl/include/rreil/rreil_variable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rreil_variable.h 3 | * 4 | * Created on: 02.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef RREIL_VARIABLE_H_ 9 | #define RREIL_VARIABLE_H_ 10 | 11 | #include 12 | #include 13 | 14 | struct rreil_variable { 15 | struct rreil_id *id; 16 | long long unsigned offset; 17 | }; 18 | 19 | extern struct rreil_variable *rreil_variable_alloc(struct rreil_id *id, long long unsigned offset); 20 | 21 | #endif /* RREIL_VARIABLE_H_ */ 22 | -------------------------------------------------------------------------------- /libs/cgdsl/include/rreil/rreil_variable_limited.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rreil_variable_limited.h 3 | * 4 | * Created on: Sep 13, 2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef RREIL_VARIABLE_LIMITED_H_ 9 | #define RREIL_VARIABLE_LIMITED_H_ 10 | 11 | #include 12 | #include 13 | 14 | struct rreil_variable_limited { 15 | struct rreil_id *id; 16 | long long unsigned offset; 17 | long long unsigned size; 18 | }; 19 | 20 | struct rreil_variable_limited_tuple { 21 | struct rreil_variable_limited **variables; 22 | size_t variables_length; 23 | size_t variables_size; 24 | }; 25 | 26 | #endif /* RREIL_VARIABLE_LIMITED_H_ */ 27 | -------------------------------------------------------------------------------- /libs/cppgdsl/include/cppgdsl/asm_builder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The file contains all definitions for the generic assembly builder. It 3 | * can be used to convert the internal GDSL format of a generic assembly 4 | * instruction into its C++ representation. 5 | */ 6 | 7 | #pragma once 8 | #include 9 | 10 | #include "cppgdsl/assembly/instruction.h" 11 | #include "cppgdsl/gdsl.h" 12 | 13 | namespace gdsl { 14 | 15 | class asm_builder { 16 | private: 17 | gdsl* g; 18 | 19 | public: 20 | asm_builder(gdsl* g) : g(g) {} 21 | 22 | assembly::instruction convert(asm_insn_t ginsn); 23 | }; 24 | 25 | } // namespace gdsl 26 | -------------------------------------------------------------------------------- /libs/cppgdsl/include/cppgdsl/assembly/arch/x86/factory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file defines factory functions for x86 specific assembly 3 | * registers. 4 | */ 5 | 6 | #pragma once 7 | #include 8 | 9 | #include "cppgdsl/arch/x86.h" 10 | #include "cppgdsl/assembly/operand/register.h" 11 | 12 | namespace gdsl { 13 | namespace assembly { 14 | 15 | std::unique_ptr make_register(x86_rreil_register r) { 16 | return std::unique_ptr(new register_(to_string(r))); 17 | } 18 | 19 | } // namespace assembly 20 | } // namespace gdsl 21 | -------------------------------------------------------------------------------- /libs/cppgdsl/include/cppgdsl/assembly/signedness.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This files defines an enumeration to represent the signedness of 3 | * an operand, i.e. whether it is signed or unsigned. 4 | */ 5 | 6 | #pragma once 7 | 8 | namespace gdsl { 9 | namespace assembly { 10 | 11 | enum class signedness { SIGNED, UNSIGNED }; 12 | 13 | } // namespace assembly 14 | } // namespace gdsl 15 | -------------------------------------------------------------------------------- /libs/cppgdsl/include/cppgdsl/frontend/bare_frontend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The file contains a class to represent a bare front-end. A bare 3 | * front-end is defined by the name of the corresponding shared object 4 | * library. 5 | */ 6 | 7 | #pragma once 8 | #include 9 | 10 | #include "cppgdsl/frontend/frontend.h" 11 | 12 | namespace gdsl { 13 | 14 | class bare_frontend : public _frontend { 15 | public: 16 | bare_frontend(std::string const& name); 17 | }; 18 | 19 | } // namespace gdsl 20 | -------------------------------------------------------------------------------- /libs/cppgdsl/include/cppgdsl/rreil/branch_hint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The file contains all definitions for a branch hint used 3 | * in RReil branch statements. 4 | */ 5 | 6 | #pragma once 7 | #include 8 | 9 | namespace gdsl { 10 | namespace rreil { 11 | 12 | enum branch_hint { BRANCH_HINT_JUMP, BRANCH_HINT_CALL, BRANCH_HINT_RET }; 13 | 14 | std::string branch_hint_to_string(branch_hint hint); 15 | 16 | } // namespace rreil 17 | } // namespace gdsl 18 | -------------------------------------------------------------------------------- /libs/cppgdsl/include/cppgdsl/rreil/expr/binop_op.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains an enumeration of all binary 3 | * operations supported by RReil. 4 | */ 5 | 6 | #pragma once 7 | #include 8 | 9 | namespace gdsl { 10 | namespace rreil { 11 | 12 | enum binop_op { 13 | BIN_MUL, 14 | BIN_DIV, 15 | BIN_DIVS, 16 | BIN_MOD, 17 | BIN_MODS, 18 | BIN_SHL, 19 | BIN_SHR, 20 | BIN_SHRS, 21 | BIN_AND, 22 | BIN_OR, 23 | BIN_XOR 24 | }; 25 | 26 | std::string binop_op_to_string(binop_op op); 27 | 28 | } // namespace rreil 29 | } // namespace gdsl 30 | -------------------------------------------------------------------------------- /libs/cppgdsl/include/cppgdsl/rreil/expr_cmp/cmp_op.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cmp_op.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | 11 | namespace gdsl { 12 | namespace rreil { 13 | 14 | enum cmp_op { CMP_EQ, CMP_NEQ, CMP_LES, CMP_LEU, CMP_LTS, CMP_LTU }; 15 | 16 | std::string cmp_op_to_string(cmp_op op); 17 | 18 | } // namespace rreil 19 | } // namespace gdsl 20 | -------------------------------------------------------------------------------- /libs/cppgdsl/include/cppgdsl/rreil/flop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains all definitions for a floating point operator used 3 | * in RReil floating point statements. 4 | */ 5 | 6 | #pragma once 7 | #include 8 | 9 | namespace gdsl { 10 | namespace rreil { 11 | 12 | enum flop { FLOP_FADD, FLOP_FSUB, FLOP_FMUL }; 13 | 14 | std::string flop_to_string(flop f); 15 | 16 | } // namespace rreil 17 | } // namespace gdsl 18 | -------------------------------------------------------------------------------- /libs/cppgdsl/include/cppgdsl/rreil/linear/binop_lin_op.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file contains all definitions for a binary operator used 3 | * in linear RReil expressions. 4 | */ 5 | 6 | #pragma once 7 | #include 8 | 9 | namespace gdsl { 10 | namespace rreil { 11 | 12 | enum binop_lin_op { BIN_LIN_ADD, BIN_LIN_SUB }; 13 | 14 | std::string bin_lin_op_to_string(binop_lin_op op); 15 | 16 | } // namespace rreil 17 | } // namespace gdsl 18 | -------------------------------------------------------------------------------- /libs/cppgdsl/include/cppgdsl/rreil_builder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The file contains all definitions for the RReil builder. It 3 | * can be used to convert the internal format stored on the GDSL heap 4 | * consisting of a list of RReil statements into its C++ representation. 5 | */ 6 | 7 | #pragma once 8 | #include 9 | #include 10 | 11 | #include "cppgdsl/frontend/frontend.h" 12 | #include "cppgdsl/gdsl.h" 13 | #include "cppgdsl/rreil/statement/statement.h" 14 | 15 | namespace gdsl { 16 | 17 | class rreil_builder { 18 | private: 19 | gdsl* g; 20 | 21 | public: 22 | rreil_builder(gdsl* g); 23 | 24 | rreil::statements_t convert(obj_t rreil); 25 | }; 26 | 27 | } // namespace gdsl 28 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/annotation/annotation.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/annotation/annotation.h" 2 | 3 | namespace gdsl { 4 | namespace assembly { 5 | 6 | std::ostream& operator<<(std::ostream& out, const annotation& _this) { 7 | _this.put(out); 8 | return out; 9 | } 10 | 11 | } // namespace assembly 12 | } // namespace gdsl 13 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/annotation/string_annotation.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/annotation/string_annotation.h" 2 | 3 | namespace gdsl { 4 | namespace assembly { 5 | 6 | void gdsl::assembly::string_annotation::put(std::ostream& out) const { 7 | out << "(ann:" << annotation_ << ")"; 8 | } 9 | 10 | bool gdsl::assembly::string_annotation::operator==(const annotation& o) const { 11 | bool equals = false; 12 | annotation_visitor av(true); 13 | av._([&](string_annotation const* a) { 14 | equals = this->annotation_ == a->annotation_; 15 | }); 16 | o.accept(av); 17 | return equals; 18 | } 19 | 20 | } // namespace assembly 21 | } // namespace gdsl 22 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/boundary/boundary.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/boundary/boundary.h" 2 | 3 | namespace gdsl { 4 | namespace assembly { 5 | 6 | void boundary::put(std::ostream& out) const { out << get_size(); } 7 | 8 | bool boundary::operator==(boundary const& o) const { 9 | boundary_visitor bv; 10 | bool is_boundary = false; 11 | bv._((std::function) ([&](boundary const* b) { 12 | is_boundary = true;})); 13 | o.accept(bv); 14 | return is_boundary ? size == o.size : o == *this; 15 | } 16 | 17 | std::ostream& operator<<(std::ostream& out, const boundary& _this) { 18 | _this.put(out); 19 | return out; 20 | } 21 | 22 | } // namespace assembly 23 | } // namespace gdsl 24 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/operand/immediate.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/operand/immediate.h" 2 | #include "cppgdsl/assembly/operand/operand_visitor.h" 3 | 4 | namespace gdsl { 5 | namespace assembly { 6 | 7 | void immediate::put(std::ostream& out) const { out << imm; } 8 | 9 | void immediate::accept(operand_visitor& ov) const { ov.visit(this); } 10 | 11 | bool immediate::operator==(operand const& o) const { 12 | bool equals = false; 13 | operand_visitor v(true); 14 | v._([&](immediate const* o) { equals = this->imm == o->imm; }); 15 | o.accept(v); 16 | return equals; 17 | } 18 | 19 | } // namespace assembly 20 | } // namespace gdsl 21 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/operand/memory.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/operand/memory.h" 2 | #include "cppgdsl/assembly/operand/operand_visitor.h" 3 | 4 | namespace gdsl { 5 | namespace assembly { 6 | 7 | void memory::put(std::ostream& out) const { out << "*{" << *operand_ << "}"; } 8 | 9 | void memory::accept(operand_visitor& ov) const { ov.visit(this); } 10 | 11 | bool memory::operator==(operand const& o) const { 12 | bool equals = false; 13 | operand_visitor v(true); 14 | v._([&](memory const* o) { equals = *this->operand_ == *o->operand_; }); 15 | o.accept(v); 16 | return equals; 17 | } 18 | 19 | } // namespace assembly 20 | } // namespace gdsl 21 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/operand/operand.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/operand/operand.h" 2 | 3 | namespace gdsl { 4 | namespace assembly { 5 | 6 | std::ostream& operator<<(std::ostream& out, const operand& _this) { 7 | _this.put(out); 8 | return out; 9 | } 10 | 11 | } // namespace assembly 12 | } // namespace gdsl 13 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/operand/post_op.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/operand/post_op.h" 2 | #include "cppgdsl/assembly/operand/operand_visitor.h" 3 | 4 | namespace gdsl { 5 | namespace assembly { 6 | 7 | void post_op::put(std::ostream& out) const { 8 | out << "(" << *operand_ << "; " << *expr << ")"; 9 | } 10 | 11 | void post_op::accept(operand_visitor& ov) const { ov.visit(this); } 12 | 13 | bool post_op::operator==(operand const& o) const { 14 | bool equals = false; 15 | operand_visitor v(true); 16 | v._([&](post_op const* o) { 17 | equals = *this->expr == *o->expr && *this->operand_ == *o->operand_; 18 | }); 19 | o.accept(v); 20 | return equals; 21 | } 22 | 23 | } // namespace assembly 24 | } // namespace gdsl 25 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/operand/pre_op.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/operand/pre_op.h" 2 | #include "cppgdsl/assembly/operand/operand_visitor.h" 3 | 4 | namespace gdsl { 5 | namespace assembly { 6 | 7 | void pre_op::put(std::ostream& out) const { 8 | out << "(" << *expr << "; " << *operand_ << ")"; 9 | } 10 | 11 | void pre_op::accept(operand_visitor& ov) const { ov.visit(this); } 12 | 13 | bool pre_op::operator==(operand const& o) const { 14 | bool equals = false; 15 | operand_visitor v(true); 16 | v._([&](pre_op const* o) { 17 | equals = *this->expr == *o->expr && *this->operand_ == *o->operand_; 18 | }); 19 | o.accept(v); 20 | return equals; 21 | } 22 | 23 | } // namespace assembly 24 | } // namespace gdsl 25 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/operand/register.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/operand/register.h" 2 | #include "cppgdsl/assembly/operand/operand_visitor.h" 3 | 4 | namespace gdsl { 5 | namespace assembly { 6 | 7 | void register_::put(std::ostream& out) const { out << name; } 8 | 9 | void register_::accept(operand_visitor& ov) const { ov.visit(this); } 10 | 11 | bool register_::operator==(operand const& o) const { 12 | bool equals = false; 13 | operand_visitor v(true); 14 | v._([&](register_ const* o) { equals = this->name == o->name; }); 15 | o.accept(v); 16 | return equals; 17 | } 18 | 19 | } // namespace assembly 20 | } // namespace gdsl 21 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/operand/rel.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/operand/rel.h" 2 | #include "cppgdsl/assembly/operand/operand_visitor.h" 3 | 4 | namespace gdsl { 5 | namespace assembly { 6 | 7 | void rel::put(std::ostream& out) const { out << "(IP + " << *operand_ << ")"; } 8 | 9 | void rel::accept(operand_visitor& ov) const { ov.visit(this); } 10 | 11 | bool rel::operator==(operand const& o) const { 12 | bool equals = false; 13 | operand_visitor v(true); 14 | v._([&](rel const* o) { equals = *this->operand_ == *o->operand_; }); 15 | o.accept(v); 16 | return equals; 17 | } 18 | 19 | } // namespace assembly 20 | } // namespace gdsl 21 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/operand/scale.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/operand/scale.h" 2 | #include "cppgdsl/assembly/operand/operand_visitor.h" 3 | 4 | namespace gdsl { 5 | namespace assembly { 6 | 7 | void scale::put(std::ostream& out) const { out << factor << *operand_; } 8 | 9 | void scale::accept(operand_visitor& ov) const { ov.visit(this); } 10 | 11 | bool scale::operator==(operand const& o) const { 12 | bool equals = false; 13 | operand_visitor v(true); 14 | v._([&](scale const* o) { 15 | equals = this->factor == o->factor && *this->operand_ == *o->operand_; 16 | }); 17 | o.accept(v); 18 | return equals; 19 | } 20 | 21 | } // namespace assembly 22 | } // namespace gdsl 23 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/assembly/operand/sum.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/assembly/operand/sum.h" 2 | #include "cppgdsl/assembly/operand/operand_visitor.h" 3 | 4 | namespace gdsl { 5 | namespace assembly { 6 | 7 | void sum::put(std::ostream& out) const { 8 | out << "(" << *lhs << " + " << *rhs << ")"; 9 | } 10 | 11 | void sum::accept(operand_visitor& ov) const { ov.visit(this); } 12 | 13 | bool sum::operator==(operand const& o) const { 14 | bool equals = false; 15 | operand_visitor v(true); 16 | v._([&](sum const* o) { 17 | equals = *this->lhs == *o->lhs && *this->rhs == *o->rhs; 18 | }); 19 | o.accept(v); 20 | return equals; 21 | } 22 | 23 | } // namespace assembly 24 | } // namespace gdsl 25 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/block.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/block.h" 2 | 3 | namespace gdsl { 4 | 5 | block::block(std::vector instructions, 6 | rreil::statements_t statements) 7 | : instructions(move(instructions)), statements(move(statements)) {} 8 | 9 | } // namespace gdsl 10 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/frontend/bare_frontend.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/frontend/bare_frontend.h" 2 | 3 | #include 4 | 5 | namespace gdsl { 6 | 7 | bare_frontend::bare_frontend(std::string const& name) { 8 | char err = gdsl_multiplex_frontend_get_by_lib_name(&frontend, name.c_str()); 9 | if (err != GDSL_MULTIPLEX_ERROR_NONE) 10 | err = gdsl_multiplex_frontend_get_by_path_name_with_base(&frontend, ".", 11 | name.c_str()); 12 | if (err != GDSL_MULTIPLEX_ERROR_NONE) 13 | throw std::runtime_error("Unable to open frontend"); 14 | initialized = true; 15 | } 16 | 17 | } // namespace gdsl 18 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/frontend/frontend.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/frontend/frontend.h" 2 | #include 3 | 4 | namespace gdsl { 5 | 6 | _frontend::~_frontend() { 7 | if (initialized) gdsl_multiplex_frontend_close(&frontend); 8 | } 9 | 10 | } // namespace gdsl 11 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/gdsl_exception.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/gdsl_exception.h" 2 | 3 | #include 4 | 5 | namespace gdsl { 6 | 7 | gdsl_exception::gdsl_exception(std::string cppgdsl_message, 8 | std::string gdsl_message) 9 | : cppgdsl_message(std::move(cppgdsl_message)), 10 | gdsl_message(std::move(gdsl_message)) {} 11 | 12 | std::ostream& operator<<(std::ostream& out, gdsl_exception& _this) { 13 | out << "gdsl exception, original gdsl message: " << _this.gdsl_message 14 | << ", cppgdsl message: " << _this.cppgdsl_message; 15 | return out; 16 | } 17 | 18 | } // namespace gdsl 19 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/rreil/branch_hint.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/rreil/branch_hint.h" 2 | 3 | namespace gdsl { 4 | namespace rreil { 5 | 6 | std::string branch_hint_to_string(branch_hint hint) { 7 | switch (hint) { 8 | case BRANCH_HINT_JUMP: { 9 | return "JUMP"; 10 | } 11 | case BRANCH_HINT_CALL: { 12 | return "CALL"; 13 | } 14 | case BRANCH_HINT_RET: { 15 | return "RET"; 16 | } 17 | } 18 | } 19 | 20 | } // namespace rreil 21 | } // namespace gdsl 22 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/rreil/exception/exception.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/rreil/exception/exception.h" 2 | 3 | #include 4 | 5 | std::string gdsl::rreil::exception::to_string() const { 6 | std::stringstream o; 7 | o << *this; 8 | return o.str(); 9 | } 10 | 11 | std::ostream& gdsl::rreil::operator<<(std::ostream& out, 12 | exception const& _this) { 13 | _this.put(out); 14 | return out; 15 | } 16 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/rreil/expr/expr.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/rreil/expr/expr.h" 2 | 3 | #include 4 | 5 | namespace gdsl { 6 | namespace rreil { 7 | 8 | std::ostream& operator<<(std::ostream& out, expr& _this) { 9 | _this.put(out); 10 | return out; 11 | } 12 | 13 | std::string expr::to_string() { 14 | std::stringstream o; 15 | o << *this; 16 | return o.str(); 17 | } 18 | 19 | } // namespace rreil 20 | } // namespace gdsl 21 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/rreil/expr_cmp/cmp_op.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/rreil/expr_cmp/cmp_op.h" 2 | 3 | namespace gdsl { 4 | namespace rreil { 5 | 6 | std::string cmp_op_to_string(cmp_op op) { 7 | switch (op) { 8 | case CMP_EQ: { 9 | return "=="; 10 | } 11 | case CMP_NEQ: { 12 | return "!="; 13 | } 14 | case CMP_LES: { 15 | return "<=s"; 16 | } 17 | case CMP_LEU: { 18 | return "<=u"; 19 | } 20 | case CMP_LTS: { 21 | return " 4 | 5 | namespace gdsl { 6 | namespace rreil { 7 | 8 | size_t id::subclass_counter = 0; 9 | 10 | std::ostream& operator<<(std::ostream& out, id const& _this) { 11 | _this.put(out); 12 | return out; 13 | } 14 | 15 | std::string id::to_string() const { 16 | std::stringstream o; 17 | o << *this; 18 | return o.str(); 19 | } 20 | 21 | } // namespace rreil 22 | } // namespace gdsl 23 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/rreil/linear/binop_lin_op.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/rreil/linear/binop_lin_op.h" 2 | 3 | namespace gdsl { 4 | namespace rreil { 5 | 6 | std::string bin_lin_op_to_string(binop_lin_op op) { 7 | switch (op) { 8 | case BIN_LIN_ADD: { 9 | return "+"; 10 | } 11 | case BIN_LIN_SUB: { 12 | return "-"; 13 | } 14 | } 15 | } 16 | 17 | } // namespace rreil 18 | } // namespace gdsl 19 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/rreil/linear/lin_var.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/rreil/linear/lin_var.h" 2 | 3 | namespace gdsl { 4 | namespace rreil { 5 | 6 | void lin_var::put(std::ostream& out) const { out << *var; } 7 | 8 | lin_var::lin_var(std::unique_ptr var) : var(move(var)) {} 9 | 10 | std::unique_ptr lin_var::copy() const { 11 | return std::unique_ptr(new lin_var(*this)); 12 | } 13 | 14 | void lin_var::accept(linear_visitor& v) const { v.visit(this); } 15 | 16 | bool gdsl::rreil::lin_var::operator==(linear const& o) const { 17 | bool is_equal = false; 18 | linear_visitor v; 19 | v._([&](lin_var const* o) { is_equal = *this->var == *o->var; }); 20 | o.accept(v); 21 | return is_equal; 22 | } 23 | 24 | } // namespace rreil 25 | } // namespace gdsl 26 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/rreil/linear/linear.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/rreil/linear/linear.h" 2 | 3 | #include 4 | 5 | namespace gdsl { 6 | namespace rreil { 7 | 8 | std::string linear::to_string() const { 9 | std::stringstream o; 10 | o << *this; 11 | return o.str(); 12 | } 13 | 14 | std::ostream& operator<<(std::ostream& out, linear const& _this) { 15 | _this.put(out); 16 | return out; 17 | } 18 | 19 | } // namespace rreil 20 | } // namespace gdsl 21 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/rreil/sexpr/arbitrary.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/rreil/sexpr/arbitrary.h" 2 | 3 | #include 4 | 5 | namespace gdsl { 6 | namespace rreil { 7 | 8 | void arbitrary::put(std::ostream& out) const { out << "arbitrary"; } 9 | 10 | std::unique_ptr arbitrary::copy() const { 11 | return std::unique_ptr(new arbitrary(*this)); 12 | } 13 | 14 | void arbitrary::accept(sexpr_visitor& v) const { v.visit(this); } 15 | 16 | bool arbitrary::operator==(sexpr const& o) const { 17 | bool is_equal = false; 18 | sexpr_visitor v; 19 | v._([&](arbitrary const* o) { is_equal = true; }); 20 | o.accept(v); 21 | return is_equal; 22 | } 23 | 24 | } // namespace rreil 25 | } // namespace gdsl 26 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/rreil/sexpr/sexpr.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/rreil/sexpr/sexpr.h" 2 | 3 | #include 4 | 5 | namespace gdsl { 6 | namespace rreil { 7 | 8 | std::string sexpr::to_string() const { 9 | std::stringstream o; 10 | o << *this; 11 | return o.str(); 12 | } 13 | 14 | std::ostream& operator<<(std::ostream& out, sexpr const& _this) { 15 | _this.put(out); 16 | return out; 17 | } 18 | 19 | } // namespace rreil 20 | } // namespace gdsl 21 | -------------------------------------------------------------------------------- /libs/cppgdsl/src/rreil/statement/statement.cpp: -------------------------------------------------------------------------------- 1 | #include "cppgdsl/rreil/statement/statement.h" 2 | 3 | #include 4 | 5 | namespace gdsl { 6 | namespace rreil { 7 | 8 | std::ostream& operator<<(std::ostream& out, const statement& statement) { 9 | statement.put(out); 10 | return out; 11 | } 12 | 13 | std::string statement::to_string() const { 14 | std::stringstream o; 15 | o << *this; 16 | return o.str(); 17 | } 18 | 19 | statements_t copy(const statements_t& stmts) { 20 | statements_t copied; 21 | copied.reserve(stmts.size()); 22 | for (auto const& stmt : stmts) copied.emplace_back(stmt->copy()); 23 | return copied; 24 | } 25 | 26 | } // namespace rreil 27 | } // namespace gdsl 28 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/.gitignore: -------------------------------------------------------------------------------- 1 | /libcppgdsl.a 2 | /build/* 3 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.8) 2 | project (cppgdsl) 3 | 4 | file(GLOB_RECURSE SOURCES 5 | "src/**.cpp" 6 | ) 7 | 8 | include_directories("include/") 9 | 10 | add_library(cppgdsl ${SOURCES}) 11 | set_property(TARGET cppgdsl PROPERTY CXX_STANDARD 11) 12 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/frontend/bare_frontend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bare_frontend.h 3 | * 4 | * Created on: May 22, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | #include 11 | 12 | namespace gdsl { 13 | 14 | class bare_frontend : public _frontend { 15 | public: 16 | bare_frontend(std::string name); 17 | }; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/frontend/frontend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * frontend.h 3 | * 4 | * Created on: May 22, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | extern "C" { 10 | #include 11 | } 12 | 13 | namespace gdsl { 14 | 15 | class _frontend { 16 | protected: 17 | struct frontend frontend; 18 | bool initialized = false; 19 | protected: 20 | virtual ~_frontend(); 21 | 22 | public: 23 | const struct frontend &native() const { 24 | return frontend; 25 | } 26 | }; 27 | 28 | } // namespace gdsl 29 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/optimization.h: -------------------------------------------------------------------------------- 1 | /* 2 | * optimization.h 3 | * 4 | * Created on: May 23, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | 11 | namespace gdsl { 12 | 13 | enum optimization_configuration { 14 | EVERYWHERE = PRESERVATION_EVERYWHERE, 15 | BLOCK = PRESERVATION_BLOCK, 16 | CONTEXT = PRESERVATION_CONTEXT, 17 | LIVENESS = OC_LIVENESS, 18 | FSUBST = OC_FSUBST, 19 | DELAYEDFSUBST = OC_DELAYED_FSUBST 20 | }; 21 | 22 | inline optimization_configuration operator|(optimization_configuration a, optimization_configuration b) { 23 | return static_cast(static_cast(a) | static_cast(b)); 24 | } 25 | 26 | } // namespace gdsl 27 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/branch_hint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * branch_hint.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | 11 | namespace gdsl { 12 | namespace rreil { 13 | 14 | enum branch_hint { 15 | BRANCH_HINT_JUMP, BRANCH_HINT_CALL, BRANCH_HINT_RET 16 | }; 17 | 18 | std::string branch_hint_to_string(branch_hint hint); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/exception/arch_exception.h: -------------------------------------------------------------------------------- 1 | /* 2 | * arch_exception.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | #include 11 | 12 | namespace gdsl { 13 | namespace rreil { 14 | 15 | class arch_exception : public exception { 16 | private: 17 | std::string name; 18 | 19 | void put(std::ostream &out); 20 | public: 21 | arch_exception(std::string name); 22 | 23 | const std::string &get_name() { 24 | return name; 25 | } 26 | 27 | void accept(exception_visitor &v); 28 | }; 29 | 30 | } // namespace rreil 31 | } // namespace gdsl 32 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/exception/exception.h: -------------------------------------------------------------------------------- 1 | /* 2 | * exception.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include "exception_visitor.h" 10 | #include 11 | #include 12 | 13 | namespace gdsl { 14 | namespace rreil { 15 | 16 | class exception { 17 | private: 18 | virtual void put(std::ostream &out) = 0; 19 | public: 20 | virtual ~exception() { 21 | } 22 | 23 | std::string to_string(); 24 | friend std::ostream &operator<< (std::ostream &out, exception &_this); 25 | 26 | virtual void accept(exception_visitor &v) = 0; 27 | }; 28 | 29 | std::ostream &operator<<(std::ostream &out, exception &_this); 30 | 31 | } // namespace rreil 32 | } // namespace gdsl 33 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/expr/binop_op.h: -------------------------------------------------------------------------------- 1 | /* 2 | * binop_op.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | 11 | namespace gdsl { 12 | namespace rreil { 13 | 14 | enum binop_op { 15 | BIN_MUL, BIN_DIV, BIN_DIVS, BIN_MOD, BIN_MODS, BIN_SHL, BIN_SHR, BIN_SHRS, BIN_AND, BIN_OR, BIN_XOR 16 | }; 17 | 18 | std::string binop_op_to_string(binop_op op); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/expr/expr_sexpr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * expr_sexpr.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | #include 11 | 12 | namespace gdsl { 13 | namespace rreil { 14 | 15 | class expr_sexpr : public expr { 16 | private: 17 | sexpr *inner; 18 | 19 | void put(std::ostream &out); 20 | public: 21 | expr_sexpr(sexpr *inner); 22 | ~expr_sexpr(); 23 | 24 | sexpr *get_inner() { 25 | return inner; 26 | } 27 | 28 | void accept(expr_visitor &v); 29 | }; 30 | 31 | } // namespace rreil 32 | } // namespace gdsl 33 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/expr_cmp/cmp_op.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cmp_op.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | 11 | namespace gdsl { 12 | namespace rreil { 13 | 14 | enum cmp_op { 15 | CMP_EQ, CMP_NEQ, CMP_LES, CMP_LEU, CMP_LTS, CMP_LTU 16 | }; 17 | 18 | std::string cmp_op_to_string(cmp_op op); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/flop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * flop.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | 11 | namespace gdsl { 12 | namespace rreil { 13 | 14 | enum flop { 15 | FLOP_FADD, FLOP_FSUB, FLOP_FMUL 16 | }; 17 | 18 | std::string flop_to_string(flop f); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/id/virtual.h: -------------------------------------------------------------------------------- 1 | /* 2 | * virtual.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include "id.h" 10 | #include 11 | 12 | namespace gdsl { 13 | namespace rreil { 14 | 15 | class _virtual : public id { 16 | private: 17 | int_t t; 18 | bool opt; 19 | 20 | void put(std::ostream &out); 21 | 22 | static size_t subclass_counter; 23 | public: 24 | _virtual(int_t t, bool opt); 25 | 26 | size_t get_subclass_counter() const; 27 | int_t get_t(); 28 | bool get_opt(); 29 | 30 | bool operator== (id &other) const; 31 | bool operator<(id const& other) const; 32 | void accept(id_visitor &v); 33 | }; 34 | 35 | } // namespace rreil 36 | } // namespace gdsl 37 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/linear/binop_lin_op.h: -------------------------------------------------------------------------------- 1 | /* 2 | * binop_lin_op.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | 11 | namespace gdsl { 12 | namespace rreil { 13 | 14 | enum binop_lin_op { 15 | BIN_LIN_ADD, BIN_LIN_SUB 16 | }; 17 | 18 | std::string bin_lin_op_to_string(binop_lin_op op); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/linear/lin_imm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lin_imm.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "linear.h" 11 | #include 12 | 13 | extern "C" { 14 | #include 15 | } 16 | 17 | namespace gdsl { 18 | namespace rreil { 19 | 20 | class lin_imm : public linear { 21 | private: 22 | int_t _const; 23 | 24 | void put(std::ostream &out); 25 | public: 26 | lin_imm(int_t _const); 27 | 28 | int_t get_imm() { 29 | return _const; 30 | } 31 | 32 | void accept(linear_visitor &v); 33 | }; 34 | 35 | }} 36 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/linear/lin_scale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lin_scale.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "linear.h" 11 | extern "C" { 12 | #include 13 | } 14 | 15 | namespace gdsl { 16 | namespace rreil { 17 | 18 | class lin_scale : public linear { 19 | private: 20 | int_t _const; 21 | linear *opnd; 22 | 23 | void put(std::ostream &out); 24 | public: 25 | lin_scale(int_t _const, linear *opnd); 26 | ~lin_scale(); 27 | 28 | int_t get_const() { 29 | return _const; 30 | } 31 | 32 | linear *get_opnd() { 33 | return opnd; 34 | } 35 | 36 | void accept(linear_visitor &v); 37 | }; 38 | 39 | }} 40 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/linear/lin_var.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lin_var.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | #include "linear.h" 11 | #include 12 | 13 | namespace gdsl { 14 | namespace rreil { 15 | 16 | class lin_var : public linear { 17 | private: 18 | variable *var; 19 | 20 | void put(std::ostream &out); 21 | public: 22 | lin_var(variable *var); 23 | ~lin_var(); 24 | 25 | variable *get_var() { 26 | return var; 27 | } 28 | 29 | void accept(linear_visitor &v); 30 | }; 31 | 32 | } // namespace rreil 33 | } // namespace gdsl 34 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/sexpr/arbitrary.h: -------------------------------------------------------------------------------- 1 | /* 2 | * arbitrary.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | 10 | #include "sexpr.h" 11 | 12 | namespace gdsl { 13 | namespace rreil { 14 | 15 | class arbitrary : public sexpr { 16 | private: 17 | void put(std::ostream &out); 18 | public: 19 | void accept(sexpr_visitor &v); 20 | }; 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/sexpr/sexpr_lin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sexpr_lin.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | #include "sexpr.h" 12 | 13 | namespace gdsl { 14 | namespace rreil { 15 | 16 | class sexpr_lin : public sexpr { 17 | private: 18 | linear *inner; 19 | 20 | void put(std::ostream &out); 21 | public: 22 | sexpr_lin(linear *inner); 23 | ~sexpr_lin(); 24 | 25 | linear *get_lin() { 26 | return inner; 27 | } 28 | 29 | void accept(sexpr_visitor &v); 30 | }; 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil/variable_limited.h: -------------------------------------------------------------------------------- 1 | /* 2 | * variable_limited.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | #include 11 | extern "C" { 12 | #include 13 | } 14 | 15 | namespace gdsl { 16 | namespace rreil { 17 | 18 | class variable_limited : public variable { 19 | private: 20 | int_t size; 21 | protected: 22 | void put(std::ostream &out); 23 | public: 24 | variable_limited(id *_id, int_t offset, int_t size); 25 | 26 | int_t get_size() { 27 | return size; 28 | } 29 | 30 | void accept(visitor &v); 31 | }; 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/include/cppgdsl/rreil_builder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rreil_builder.h 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace gdsl { 15 | 16 | class rreil_builder { 17 | private: 18 | gdsl *g; 19 | public: 20 | rreil_builder(gdsl *g); 21 | 22 | std::vector *convert(obj_t rreil); 23 | }; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/block.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * block.cpp 3 | * 4 | * Created on: May 23, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | 10 | gdsl::block::block(std::vector *instructions, std::vector *statements) { 11 | this->instructions = instructions; 12 | this->statements = statements; 13 | } 14 | 15 | gdsl::block::block(block &&o) : instructions(o.instructions), statements(o.statements) { 16 | o.instructions = NULL; 17 | } 18 | 19 | gdsl::block::~block() { 20 | delete instructions; 21 | } 22 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/frontend/bare_frontend.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * bare_frontend.cpp 3 | * 4 | * Created on: May 22, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | 10 | using namespace std; 11 | 12 | gdsl::bare_frontend::bare_frontend(string name) { 13 | char err = gdsl_multiplex_frontend_get_by_lib_name(&frontend, name.c_str()); 14 | if(err != GDSL_MULTIPLEX_ERROR_NONE) 15 | throw string("Unable to open frontend"); 16 | initialized = true; 17 | } 18 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/frontend/frontend.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * frontend.cpp 3 | * 4 | * Created on: May 22, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | gdsl::_frontend::~_frontend() { 12 | if(initialized) gdsl_multiplex_frontend_close(&frontend); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/gdsl_exception.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * gdsl_exception.cpp 3 | * 4 | * Created on: May 27, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | gdsl::gdsl_exception::gdsl_exception(std::string cppgdsl_message, std::string gdsl_message) { 12 | this->cppgdsl_message = cppgdsl_message; 13 | this->gdsl_message = gdsl_message; 14 | } 15 | 16 | std::ostream &gdsl::operator <<(std::ostream &out, gdsl_exception &_this) { 17 | out << "gdsl exception, original gdsl message: " << _this.gdsl_message << ", cppgdsl message: " 18 | << _this.cppgdsl_message; 19 | return out; 20 | } 21 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/branch_hint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * branch_hint.cpp 3 | * 4 | * Created on: May 22, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | 10 | std::string gdsl::rreil::branch_hint_to_string(branch_hint hint) { 11 | switch(hint) { 12 | case BRANCH_HINT_JUMP: { 13 | return "JUMP"; 14 | } 15 | case BRANCH_HINT_CALL: { 16 | return "CALL"; 17 | } 18 | case BRANCH_HINT_RET: { 19 | return "RET"; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/exception/arch_exception.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * arch_exception.cpp 3 | * 4 | * Created on: May 22, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | gdsl::rreil::arch_exception::arch_exception(std::string name) { 12 | this->name = name; 13 | } 14 | 15 | void gdsl::rreil::arch_exception::accept(exception_visitor &v) { 16 | return v.visit(this); 17 | } 18 | 19 | void gdsl::rreil::arch_exception::put(std::ostream &out) { 20 | out << "[architecture specific exception:"; 21 | out << name; 22 | out << "]"; 23 | } 24 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/exception/exception.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * exception.cpp 3 | * 4 | * Created on: May 23, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | std::string gdsl::rreil::exception::to_string() { 12 | std::stringstream o; 13 | o << *this; 14 | return o.str(); 15 | } 16 | 17 | std::ostream &gdsl::rreil::operator <<(std::ostream &out, exception &_this) { 18 | _this.put(out); 19 | return out; 20 | } 21 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/expr/expr.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * expr.cpp 3 | * 4 | * Created on: May 23, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | std::ostream &gdsl::rreil::operator <<(std::ostream &out, expr &_this) { 12 | _this.put(out); 13 | return out; 14 | } 15 | 16 | std::string gdsl::rreil::expr::to_string() { 17 | std::stringstream o; 18 | o << *this; 19 | return o.str(); 20 | } 21 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/expr/expr_binop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * expr_binop.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | void gdsl::rreil::expr_binop::put(std::ostream &out) { 12 | out << *opnd1 << " " << binop_op_to_string(op) << " " << *opnd2; 13 | } 14 | 15 | gdsl::rreil::expr_binop::expr_binop(binop_op op, linear *opnd1, linear *opnd2) { 16 | this->op = op; 17 | this->opnd1 = opnd1; 18 | this->opnd2 = opnd2; 19 | } 20 | 21 | gdsl::rreil::expr_binop::~expr_binop() { 22 | delete this->opnd1; 23 | delete this->opnd2; 24 | } 25 | 26 | void gdsl::rreil::expr_binop::accept(expr_visitor &v) { 27 | v.visit(this); 28 | } 29 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/expr/expr_sexpr.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * expr_sexpr.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | void gdsl::rreil::expr_sexpr::put(std::ostream &out) { 12 | out << *inner; 13 | } 14 | 15 | gdsl::rreil::expr_sexpr::expr_sexpr(sexpr *inner) { 16 | this->inner = inner; 17 | } 18 | 19 | gdsl::rreil::expr_sexpr::~expr_sexpr() { 20 | delete this->inner; 21 | } 22 | 23 | void gdsl::rreil::expr_sexpr::accept(expr_visitor &v) { 24 | v.visit(this); 25 | } 26 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/expr_cmp/cmp_op.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * cmp_op.cpp 3 | * 4 | * Created on: May 22, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | 10 | std::string gdsl::rreil::cmp_op_to_string(cmp_op op) { 11 | switch(op) { 12 | case CMP_EQ: { 13 | return "=="; 14 | } 15 | case CMP_NEQ: { 16 | return "!="; 17 | } 18 | case CMP_LES: { 19 | return "<=s"; 20 | } 21 | case CMP_LEU: { 22 | return "<=u"; 23 | } 24 | case CMP_LTS: { 25 | return " 9 | 10 | std::string gdsl::rreil::flop_to_string(flop f) { 11 | switch(f) { 12 | case FLOP_FADD: { 13 | return ".+"; 14 | } 15 | case FLOP_FSUB: { 16 | return ".-"; 17 | } 18 | case FLOP_FMUL: { 19 | return ".*"; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/id/id.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * id.cpp 3 | * 4 | * Created on: May 23, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | size_t gdsl::rreil::id::subclass_counter = 0; 12 | 13 | std::ostream &gdsl::rreil::operator <<(std::ostream &out, id &_this) { 14 | _this.put(out); 15 | return out; 16 | } 17 | 18 | std::string gdsl::rreil::id::to_string() { 19 | std::stringstream o; 20 | o << *this; 21 | return o.str(); 22 | } 23 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/linear/binop_lin_op.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * binop_lin_op.cpp 3 | * 4 | * Created on: May 22, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | 10 | std::string gdsl::rreil::bin_lin_op_to_string(binop_lin_op op) { 11 | switch(op) { 12 | case BIN_LIN_ADD: { 13 | return "+"; 14 | } 15 | case BIN_LIN_SUB: { 16 | return "-"; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/linear/lin_binop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * lin_add.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | void gdsl::rreil::lin_binop::put(std::ostream &out) { 12 | out << "(" << *opnd1 << " " << bin_lin_op_to_string(op) << " " << *opnd2 << ")"; 13 | } 14 | 15 | gdsl::rreil::lin_binop::lin_binop(binop_lin_op op, linear *opnd1, linear *opnd2) { 16 | this->op = op; 17 | this->opnd1 = opnd1; 18 | this->opnd2 = opnd2; 19 | } 20 | 21 | gdsl::rreil::lin_binop::~lin_binop() { 22 | delete this->opnd1; 23 | delete this->opnd2; 24 | } 25 | 26 | void gdsl::rreil::lin_binop::accept(linear_visitor& v) { 27 | v.visit(this); 28 | } 29 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/linear/lin_imm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * lin_imm.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | void gdsl::rreil::lin_imm::put(std::ostream &out) { 12 | out << _const; 13 | } 14 | 15 | gdsl::rreil::lin_imm::lin_imm(int_t _const) { 16 | this->_const = _const; 17 | } 18 | 19 | void gdsl::rreil::lin_imm::accept(linear_visitor &v) { 20 | v.visit(this); 21 | } 22 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/linear/lin_scale.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * lin_scale.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | void gdsl::rreil::lin_scale::put(std::ostream &out) { 12 | out << _const << "*" << *opnd; 13 | } 14 | 15 | gdsl::rreil::lin_scale::lin_scale(int_t _const, linear *opnd) { 16 | this->_const = _const; 17 | this->opnd = opnd; 18 | } 19 | 20 | gdsl::rreil::lin_scale::~lin_scale() { 21 | delete this->opnd; 22 | } 23 | 24 | void gdsl::rreil::lin_scale::accept(linear_visitor &v) { 25 | v.visit(this); 26 | } 27 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/linear/lin_var.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * lin_var.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | 10 | void gdsl::rreil::lin_var::put(std::ostream &out) { 11 | out << *var; 12 | } 13 | 14 | gdsl::rreil::lin_var::lin_var(variable *var) { 15 | this->var = var; 16 | } 17 | 18 | gdsl::rreil::lin_var::~lin_var() { 19 | delete this->var; 20 | } 21 | 22 | void gdsl::rreil::lin_var::accept(linear_visitor &v) { 23 | v.visit(this); 24 | } 25 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/linear/linear.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * linear.cpp 3 | * 4 | * Created on: May 26, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | std::string gdsl::rreil::linear::to_string() { 12 | std::stringstream o; 13 | o << *this; 14 | return o.str(); 15 | } 16 | 17 | std::ostream &gdsl::rreil::operator <<(std::ostream &out, linear &_this) { 18 | _this.put(out); 19 | return out; 20 | } 21 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/sexpr/arbitrary.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * arbitrary.cpp 3 | * 4 | * Created on: May 22, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | void gdsl::rreil::arbitrary::put(std::ostream &out) { 12 | out << "arbitrary"; 13 | } 14 | 15 | void gdsl::rreil::arbitrary::accept(sexpr_visitor &v) { 16 | v.visit(this); 17 | } 18 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/sexpr/sexpr.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * sexpr.cpp 3 | * 4 | * Created on: May 26, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | std::string gdsl::rreil::sexpr::to_string() { 12 | std::stringstream o; 13 | o << *this; 14 | return o.str(); 15 | } 16 | 17 | std::ostream& gdsl::rreil::operator <<(std::ostream &out, sexpr &_this) { 18 | _this.put(out); 19 | return out; 20 | } 21 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/sexpr/sexpr_cmp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * sexpr_cmp.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | void gdsl::rreil::sexpr_cmp::put(std::ostream &out) { 12 | out << "[" << *inner << "]:" << size; 13 | } 14 | 15 | gdsl::rreil::sexpr_cmp::sexpr_cmp(int_t size, expr_cmp *inner) { 16 | this->size = size; 17 | this->inner = inner; 18 | } 19 | 20 | gdsl::rreil::sexpr_cmp::~sexpr_cmp() { 21 | delete this->inner; 22 | } 23 | 24 | void gdsl::rreil::sexpr_cmp::accept(sexpr_visitor &v) { 25 | v.visit(this); 26 | } 27 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/sexpr/sexpr_lin.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * sexpr_lin.cpp 4 | * 5 | * Created on: May 21, 2014 6 | * Author: Julian Kranz 7 | */ 8 | 9 | #include 10 | 11 | using namespace gdsl::rreil; 12 | 13 | void gdsl::rreil::sexpr_lin::put(std::ostream &out) { 14 | out << *inner; 15 | } 16 | 17 | gdsl::rreil::sexpr_lin::sexpr_lin(linear *inner) { 18 | this->inner = inner; 19 | } 20 | 21 | gdsl::rreil::sexpr_lin::~sexpr_lin() { 22 | delete this->inner; 23 | } 24 | 25 | void gdsl::rreil::sexpr_lin::accept(sexpr_visitor &v) { 26 | v.visit(this); 27 | } 28 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/statement/assign.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * assign.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | gdsl::rreil::assign::assign(int_t size, variable *lhs, expr *rhs) { 12 | this->size = size; 13 | this->lhs = lhs; 14 | this->rhs = rhs; 15 | } 16 | 17 | gdsl::rreil::assign::~assign() { 18 | delete this->lhs; 19 | delete this->rhs; 20 | } 21 | 22 | void gdsl::rreil::assign::accept(statement_visitor &v) { 23 | v.visit(this); 24 | } 25 | 26 | void gdsl::rreil::assign::put(std::ostream &out) const { 27 | out << *lhs << " =:" << size << " " << *rhs; 28 | } 29 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/statement/branch.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * branch.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | gdsl::rreil::branch::branch(address *target, branch_hint hint) { 12 | this->target = target; 13 | this->hint = hint; 14 | } 15 | 16 | gdsl::rreil::branch::~branch() { 17 | delete target; 18 | } 19 | 20 | void gdsl::rreil::branch::accept(statement_visitor &v) { 21 | v.visit(this); 22 | } 23 | 24 | void gdsl::rreil::branch::put(std::ostream &out) const { 25 | out << branch_hint_to_string(hint) << " => " << *target; 26 | } 27 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/statement/load.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * load.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | gdsl::rreil::load::load(int_t size, variable *lhs, address *_address) { 12 | this->size = size; 13 | this->lhs = lhs; 14 | this->_address = _address; 15 | } 16 | 17 | gdsl::rreil::load::~load() { 18 | delete this->lhs; 19 | delete this->_address; 20 | } 21 | 22 | void gdsl::rreil::load::accept(statement_visitor &v) { 23 | v.visit(this); 24 | } 25 | 26 | void gdsl::rreil::load::put(std::ostream &out) const { 27 | out << *lhs << " =:" << size << " *" << *_address; 28 | } 29 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/statement/statement.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * statement.cpp 3 | * 4 | * Created on: May 23, 2014 5 | * Author: Julian Kranz 6 | */ 7 | #include 8 | #include 9 | 10 | std::ostream &gdsl::rreil::operator<<(std::ostream &out, 11 | const statement &statement) { 12 | statement.put(out); 13 | return out; 14 | } 15 | 16 | std::string gdsl::rreil::statement::to_string() const { 17 | std::stringstream o; 18 | o << *this; 19 | return o.str(); 20 | } 21 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/statement/store.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * store.cpp 4 | * 5 | * Created on: May 21, 2014 6 | * Author: Julian Kranz 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | gdsl::rreil::store::store(int_t size, address *_address, linear *rhs) { 13 | this->size = size; 14 | this->_address = _address; 15 | this->rhs = rhs; 16 | } 17 | 18 | gdsl::rreil::store::~store() { 19 | delete this->_address; 20 | delete this->rhs; 21 | } 22 | 23 | void gdsl::rreil::store::accept(statement_visitor &v) { 24 | v.visit(this); 25 | } 26 | 27 | void gdsl::rreil::store::put(std::ostream &out) const { 28 | out << "*" << *_address << " =:" << size << " " << *rhs; 29 | } 30 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/statement/throw.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * throw.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | gdsl::rreil::_throw::_throw(exception *inner) { 12 | this->inner = inner; 13 | } 14 | 15 | gdsl::rreil::_throw::~_throw() { 16 | delete this->inner; 17 | } 18 | 19 | void gdsl::rreil::_throw::accept(statement_visitor& v) { 20 | v.visit(this); 21 | } 22 | 23 | void gdsl::rreil::_throw::put(std::ostream &out) const { 24 | out << "throw " << *inner; 25 | } 26 | -------------------------------------------------------------------------------- /libs/cppgdsl_legacy/src/rreil/variable_limited.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * variable_limited.cpp 3 | * 4 | * Created on: May 21, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | void gdsl::rreil::variable_limited::put(std::ostream &out) { 13 | variable::put(out); 14 | out << "/" << size; 15 | } 16 | 17 | gdsl::rreil::variable_limited::variable_limited(id *_id, int_t offset, int_t size) : 18 | variable(_id, offset) { 19 | this->size = size; 20 | } 21 | 22 | void gdsl::rreil::variable_limited::accept(visitor &v) { 23 | v.visit(this); 24 | } 25 | -------------------------------------------------------------------------------- /libs/dgdsl/.gitignore: -------------------------------------------------------------------------------- 1 | /.buildpath 2 | /.project 3 | /.settings/ 4 | /__test__library__ 5 | /libdgdsl.a 6 | /.dub 7 | -------------------------------------------------------------------------------- /libs/dgdsl/Makefile: -------------------------------------------------------------------------------- 1 | # vim: noexpandtab 2 | 3 | all: 4 | dub --compiler gdc 5 | 6 | clean: 7 | dub clean 8 | -------------------------------------------------------------------------------- /libs/dgdsl/dub.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "dgdsl", 3 | "description" : "A minimal D bundle.", 4 | "dependencies" : { 5 | }, 6 | "lflags-linux" : [ "-lgdsl-multiplex", "-lgdsl", "-ldl" ] 7 | 8 | } 9 | -------------------------------------------------------------------------------- /libs/dgdsl/dub.selections.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileVersion": 1, 3 | "versions": {} 4 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/ireferable.d: -------------------------------------------------------------------------------- 1 | module gdsl.ireferable; 2 | 3 | interface IReferable { 4 | public void free(); 5 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/exception/arch_exception.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.exception.arch_exception; 2 | 3 | import gdsl.rreil.exception.exception; 4 | 5 | class ArchException : Exception_ { 6 | private string _name; 7 | 8 | @property public string name() { 9 | return _name; 10 | } 11 | 12 | public this(string name) { 13 | this._name = name; 14 | } 15 | 16 | public override string toString() { 17 | return "Exception: " ~ name; 18 | } 19 | } 20 | 21 | unittest { 22 | ArchException ae = new ArchException("SomeVeryBadThingHappened"); 23 | assert(ae.toString == "Exception: SomeVeryBadThingHappened"); 24 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/exception/exception.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.exception.exception; 2 | 3 | abstract class Exception_ { 4 | public abstract override string toString(); 5 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/expr/expr.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.expr.expr; 2 | 3 | abstract class Expression { 4 | public abstract override string toString(); 5 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/expr/sexpr.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.expr.sexpr; 2 | 3 | import gdsl.rreil.expr.expr; 4 | import sexpr = gdsl.rreil.sexpr.sexpr; 5 | 6 | class Sexpr : Expression { 7 | private sexpr.Sexpr _inner; 8 | 9 | @property public sexpr.Sexpr inner() { 10 | return _inner; 11 | } 12 | 13 | public this(sexpr.Sexpr inner) { 14 | _inner = inner; 15 | } 16 | 17 | public override string toString() { 18 | return _inner.toString(); 19 | } 20 | } 21 | 22 | unittest { 23 | import gdsl.rreil.sexpr.arbitrary; 24 | Sexpr s = new Sexpr(new Arbitrary()); 25 | assert(s.toString == "arbitrary"); 26 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/id/arch_id.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.id.arch_id; 2 | 3 | import gdsl.rreil.id.id; 4 | 5 | class ArchId : Id { 6 | private string _id; 7 | 8 | @property public string id() { 9 | return _id; 10 | } 11 | 12 | public this(string _id) { 13 | this._id = _id; 14 | } 15 | 16 | public override string toString() const { 17 | return _id; 18 | } 19 | } 20 | 21 | unittest { 22 | ArchId aid = new ArchId("A"); 23 | assert(aid.toString == "A"); 24 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/id/id.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.id.id; 2 | 3 | abstract class Id { 4 | public abstract override string toString() const; 5 | } 6 | 7 | unittest { 8 | import gdsl.rreil.id.virt_id; 9 | 10 | Id id = new VirtId(42); 11 | assert(id.toString == "t42"); 12 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/id/shared_id.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.id.shared_id; 2 | 3 | import gdsl.rreil.id.id; 4 | 5 | enum SharedIdType : string { 6 | FloatingFlags = "FloatingFlags" 7 | } 8 | 9 | class SharedId : Id { 10 | private SharedIdType _inner; 11 | 12 | @property public SharedIdType inner() { 13 | return _inner; 14 | } 15 | 16 | public this(SharedIdType _inner) { 17 | this._inner = _inner; 18 | } 19 | 20 | public override string toString() const { 21 | return cast(string)_inner; 22 | } 23 | } 24 | 25 | unittest { 26 | SharedId sid = new SharedId(SharedIdType.FloatingFlags); 27 | assert(sid.toString == "FloatingFlags"); 28 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/id/virt_id.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.id.virt_id; 2 | 3 | import gdsl.multiplex.gdsl_generic; 4 | import gdsl.rreil.id.id; 5 | import std.conv; 6 | 7 | class VirtId : Id { 8 | private int_t _t; 9 | 10 | @property public int_t t() { 11 | return _t; 12 | } 13 | 14 | public this(int_t _t) { 15 | this._t = _t; 16 | } 17 | 18 | public override string toString() const { 19 | return "t" ~ to!(string)(_t); 20 | } 21 | } 22 | 23 | unittest { 24 | VirtId vid = new VirtId(99); 25 | assert(vid.toString == "t99"); 26 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/linear/immediate.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.linear.immediate; 2 | 3 | import gdsl.rreil.linear.linear; 4 | import gdsl.multiplex.gdsl_generic; 5 | import std.conv; 6 | 7 | class Immediate : Linear { 8 | private int_t _inner; 9 | 10 | @property public int_t inner() { 11 | return _inner; 12 | } 13 | 14 | public this(int_t _inner) { 15 | this._inner = _inner; 16 | } 17 | 18 | public override string toString() { 19 | return to!string(_inner); 20 | } 21 | } 22 | 23 | unittest { 24 | Immediate li = new Immediate(88); 25 | assert(li.toString == "88"); 26 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/linear/linear.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.linear.linear; 2 | 3 | abstract class Linear { 4 | public abstract override string toString(); 5 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/sexpr/arbitrary.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.sexpr.arbitrary; 2 | 3 | import gdsl.rreil.sexpr.sexpr; 4 | 5 | class Arbitrary : Sexpr { 6 | public override string toString() { 7 | return "arbitrary"; 8 | } 9 | } 10 | 11 | unittest { 12 | Arbitrary a = new Arbitrary(); 13 | assert(a.toString == "arbitrary"); 14 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/sexpr/expr_cmp.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.sexpr.expr_cmp; 2 | 3 | import gdsl.rreil.sexpr.sexpr; 4 | import expr_cmp = gdsl.rreil.expr_cmp.expr_cmp; 5 | 6 | class CompareExpression : Sexpr { 7 | private expr_cmp.CompareExpression _inner; 8 | 9 | @property public expr_cmp.CompareExpression inner() { 10 | return _inner; 11 | } 12 | 13 | public this(expr_cmp.CompareExpression inner) { 14 | this._inner = inner; 15 | } 16 | 17 | public override string toString() { 18 | return _inner.toString(); 19 | } 20 | } 21 | 22 | unittest { 23 | // CompareExpression ce = new CompareExpression(new expr_cmp.CompareExpression( 24 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/sexpr/linear.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.sexpr.linear; 2 | 3 | import gdsl.rreil.sexpr.sexpr; 4 | import linear = gdsl.rreil.linear.linear; 5 | 6 | class Linear : Sexpr { 7 | private linear.Linear _inner; 8 | 9 | @property public linear.Linear inner() { 10 | return _inner; 11 | } 12 | 13 | public this(linear.Linear inner) { 14 | this._inner = inner; 15 | } 16 | 17 | public override string toString() { 18 | return _inner.toString(); 19 | } 20 | } 21 | 22 | unittest { 23 | import gdsl.rreil.linear.immediate; 24 | Linear l = new Linear(new Immediate(99)); 25 | assert(l.toString() == "99"); 26 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/sexpr/sexpr.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.sexpr.sexpr; 2 | 3 | class Sexpr { 4 | public abstract override string toString(); 5 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/statement/assign.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.statement.assign; 2 | 3 | import gdsl.rreil.statement.statement; 4 | 5 | class Assign : Statement { 6 | 7 | } -------------------------------------------------------------------------------- /libs/dgdsl/source/gdsl/rreil/statement/statement.d: -------------------------------------------------------------------------------- 1 | module gdsl.rreil.statement.statement; 2 | 3 | class Statement { 4 | 5 | } -------------------------------------------------------------------------------- /libs/gdsl-multiplex-windows/.gitignore: -------------------------------------------------------------------------------- 1 | /libgdsl-multiplex.a 2 | -------------------------------------------------------------------------------- /libs/gdsl-multiplex-windows/Makefile: -------------------------------------------------------------------------------- 1 | MLTK=../.. 2 | CC=gcc 3 | #CC=clang 4 | INCDS=-Iinclude -I$(MLTK)/include 5 | CFLAGS=-c -fPIC -g3 -std=gnu99 -Wall -Wfatal-errors -DRELAXEDFATAL $(INCDS) 6 | 7 | LIBRARY=libgdsl-multiplex.a 8 | SOURCES=gdsl_multiplex.c 9 | 10 | all: pre-build $(LIBRARY) 11 | 12 | SPRE=src 13 | BPRE=build 14 | 15 | BDIRS=$(BPRE) 16 | pre-build: 17 | mkdir -p $(BDIRS) 18 | 19 | OBJECTS=$(addprefix $(BPRE)/, $(SOURCES:.c=.o)) 20 | 21 | $(LIBRARY): $(OBJECTS) 22 | ar -r $@ $(OBJECTS) 23 | 24 | $(OBJECTS): $(BPRE)/%.o : $(SPRE)/%.c 25 | $(CC) $(CFLAGS) $< -o $@ 26 | 27 | clean: 28 | rm -rf $(BDIRS) $(LIBRARY) 29 | -------------------------------------------------------------------------------- /libs/gdsl-multiplex/Makefile: -------------------------------------------------------------------------------- 1 | MLTK=../.. 2 | CC=gcc 3 | #CC=clang 4 | INCDS=-Iinclude -I$(MLTK)/include 5 | CFLAGS=-c -fPIC -g3 -std=gnu99 -Wall -Wfatal-errors -DRELAXEDFATAL $(INCDS) 6 | 7 | LIBRARY=libgdsl-multiplex.a 8 | SOURCES=gdsl_multiplex.c 9 | 10 | all: pre-build $(LIBRARY) 11 | 12 | SPRE=src 13 | BPRE=build 14 | 15 | BDIRS=$(BPRE) 16 | pre-build: 17 | mkdir -p $(BDIRS) 18 | 19 | OBJECTS=$(addprefix $(BPRE)/, $(SOURCES:.c=.o)) 20 | 21 | $(LIBRARY): $(OBJECTS) 22 | ar -r $@ $(OBJECTS) 23 | 24 | $(OBJECTS): $(BPRE)/%.o : $(SPRE)/%.c 25 | $(CC) $(CFLAGS) $< -o $@ 26 | 27 | clean: 28 | rm -rf $(BDIRS) $(LIBRARY) 29 | -------------------------------------------------------------------------------- /libs/gdutil/Makefile: -------------------------------------------------------------------------------- 1 | MLTK=../.. 2 | CC=gcc 3 | #CC=clang 4 | INCDS=-Iinclude -I$(MLTK)/include 5 | CFLAGS=-c -g3 -std=c11 -Wall -Wfatal-errors -DRELAXEDFATAL $(INCDS) 6 | 7 | LIBRARY=libgdutil.a 8 | SOURCES=stack.c util.c gdsl_elf.c decoder_config.c 9 | 10 | all: pre-build $(LIBRARY) 11 | 12 | SPRE=src 13 | BPRE=build 14 | 15 | BDIRS=$(BPRE) 16 | pre-build: 17 | mkdir -p $(BDIRS) 18 | 19 | OBJECTS=$(addprefix $(BPRE)/, $(SOURCES:.c=.o)) 20 | 21 | $(LIBRARY): $(OBJECTS) 22 | ar -r $@ $(OBJECTS) 23 | 24 | $(OBJECTS): $(BPRE)/%.o : $(SPRE)/%.c 25 | $(CC) $(CFLAGS) $< -o $@ 26 | 27 | clean: 28 | rm -rf $(BDIRS) $(LIBRARY) 29 | -------------------------------------------------------------------------------- /libs/gdutil/include/gdsl_elf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gdsl_elf.h 3 | * 4 | * Created on: Jul 10, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | extern char elf_section_boundary_get(char* path, size_t* offset, size_t* size); 13 | -------------------------------------------------------------------------------- /libs/gdutil/include/stack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * stack.h 3 | * 4 | * Created on: 25.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef STACK_H_ 9 | #define STACK_H_ 10 | 11 | #include 12 | 13 | struct stack { 14 | void** data; 15 | size_t data_length; 16 | size_t data_size; 17 | }; 18 | 19 | extern struct stack* stack_init(); 20 | extern void stack_free(struct stack* stack); 21 | extern void stack_push(struct stack* stack, void* data); 22 | extern void* stack_pop(struct stack* stack); 23 | extern void* stack_peek(struct stack* stack); 24 | extern char stack_empty(struct stack* stack); 25 | extern size_t stack_data_get(void*** loops, struct stack* stack); 26 | 27 | #endif /* STACK_H_ */ 28 | -------------------------------------------------------------------------------- /libs/gdwrap/Makefile: -------------------------------------------------------------------------------- 1 | MLTK=../.. 2 | CC=gcc 3 | #CC=clang 4 | INCDS=-Iinclude -I$(MLTK)/include 5 | 6 | 7 | DEFINES=-DRELAXEDFATAL 8 | ifdef GDSL_ARCH 9 | UPPER_ARCH = $(shell echo $(GDSL_ARCH) | tr a-z A-Z) 10 | DEFINES+=-DGDSL_$(UPPER_ARCH) 11 | endif 12 | CFLAGS=-c -g3 -std=c11 -pedantic -Wall -Wfatal-errors $(DEFINES) $(INCDS) 13 | 14 | LIBRARY=libgdwrap.a 15 | SOURCES=gdwrap.c 16 | 17 | all: pre-build $(LIBRARY) 18 | 19 | SPRE=src 20 | BPRE=build 21 | 22 | BDIRS=$(BPRE) 23 | pre-build: 24 | mkdir -p $(BDIRS) 25 | 26 | OBJECTS=$(addprefix $(BPRE)/, $(SOURCES:.c=.o)) 27 | 28 | $(LIBRARY): $(OBJECTS) 29 | ar -r $@ $(OBJECTS) 30 | 31 | $(OBJECTS): $(BPRE)/%.o : $(SPRE)/%.c 32 | $(CC) $(CFLAGS) $< -o $@ 33 | 34 | clean: 35 | rm -rf $(BDIRS) $(LIBRARY) 36 | -------------------------------------------------------------------------------- /libs/gdwrap/include/gdwrap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gdsl.h 3 | * 4 | * Created on: 21.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef GDSL_H_ 9 | #define GDSL_H_ 10 | 11 | #include 12 | 13 | enum gdwrap_x86_print_mode { 14 | GDSL_X86_PRINT_MODE_FULL, GDSL_X86_PRINT_MODE_SIMPLE 15 | }; 16 | 17 | extern char gdwrap_decode(state_t state, obj_t *insn); 18 | extern char *gdwrap_x86_pretty(state_t state, obj_t insn, 19 | enum gdwrap_x86_print_mode mode); 20 | extern char gdwrap_translate(obj_t state, obj_t *rreil, obj_t insn); 21 | extern char gdwrap_translate_block(obj_t state, obj_t *rreil); 22 | 23 | #endif /* GDSL_H_ */ 24 | -------------------------------------------------------------------------------- /libs/jgdsl/.gitignore: -------------------------------------------------------------------------------- 1 | /.classpath 2 | /.externalToolBuilders/* 3 | /.settings/* 4 | /build/* 5 | /.project 6 | /libjgdsl.so 7 | /jgdsl.jar 8 | /jgdsl-src.jar 9 | /hs_err_* 10 | 11 | /src/.libs/* 12 | /src/*.o 13 | /src/*.lo 14 | /src/.dirstamp 15 | /build 16 | -------------------------------------------------------------------------------- /libs/jgdsl/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | java -ss134217728 -cp jgdsl.jar -Djava.library.path=. Program 4 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/GdslException.java: -------------------------------------------------------------------------------- 1 | package gdsl; 2 | 3 | /** 4 | * The GdslException class is the base class for all Gdsl specific 5 | * exceptions. 6 | * 7 | * @author Julian Kranz 8 | * 9 | */ 10 | public class GdslException extends RuntimeException { 11 | private static final long serialVersionUID = 1L; 12 | 13 | public GdslException () { 14 | } 15 | 16 | public GdslException (String message) { 17 | super(message); 18 | } 19 | 20 | public GdslException (Throwable cause) { 21 | super(cause); 22 | } 23 | 24 | public GdslException (String message, Throwable cause) { 25 | super(message, cause); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/HeapExpiredException.java: -------------------------------------------------------------------------------- 1 | package gdsl; 2 | 3 | public class HeapExpiredException extends RuntimeException { 4 | /** 5 | * 6 | */ 7 | private static final long serialVersionUID = 1L; 8 | 9 | public HeapExpiredException () { 10 | super("Heap Expired"); 11 | } 12 | 13 | public HeapExpiredException (String message) { 14 | super(message); 15 | } 16 | 17 | public HeapExpiredException (Throwable cause) { 18 | super(cause); 19 | } 20 | 21 | public HeapExpiredException (String message, Throwable cause) { 22 | super(message, cause); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/IFrontendConfig.java: -------------------------------------------------------------------------------- 1 | package gdsl; 2 | 3 | /** 4 | * The IFrontendConfig is implemented by all configurators 5 | * for Gdsl frontends. A configurator configures a 6 | * Gdsl frontend of some specific architecture. 7 | * 8 | * @author Julian Kranz 9 | */ 10 | public interface IFrontendConfig { 11 | public long vector(); 12 | } 13 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/IReferable.java: -------------------------------------------------------------------------------- 1 | package gdsl; 2 | 3 | /** 4 | * This interface specifies the methods required by object 5 | * to managed by a {@link ReferenceManager}. 6 | * 7 | * @author Julian Kranz 8 | */ 9 | public interface IReferable { 10 | /** 11 | * Acknowledge a reference count of zero 12 | */ 13 | public void free(); 14 | } 15 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/arch/IConfigFlag.java: -------------------------------------------------------------------------------- 1 | package gdsl.arch; 2 | 3 | /** 4 | * This interfaces defines the interface for configuration 5 | * flags. 6 | * 7 | * @author Julian Kranz 8 | * 9 | */ 10 | public interface IConfigFlag { 11 | /** 12 | * The configuration of an architecture is represented by 13 | * an integer consisting of flags. This method returns an 14 | * integer with only the bit set that represents this 15 | * specific configuration flag. 16 | * 17 | * @return the discussed integer 18 | */ 19 | public long getFlag (); 20 | } 21 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/arch/MIPSBinder.java: -------------------------------------------------------------------------------- 1 | package gdsl.arch; 2 | 3 | import gdsl.Frontend; 4 | 5 | /** 6 | * The MIPSBinder class is the binder used 7 | * for the MIPS architecture. 8 | * 9 | * @author Julian Kranz 10 | */ 11 | public class MIPSBinder extends ArchBinder { 12 | /** 13 | * This constructor of the MIPSBinder class automatically 14 | * searches the correct frontend from the list of 15 | * available frontends and initializes the binder. It also 16 | * sets a default configuration. 17 | * 18 | * @param frontends the list of available frontends 19 | */ 20 | public MIPSBinder (Frontend[] frontends) { 21 | super(specific(frontends, ArchId.MIPS)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/arch/X86ConfigFlag.java: -------------------------------------------------------------------------------- 1 | package gdsl.arch; 2 | 3 | /** 4 | * This class implements the IConfigFlag interface for 5 | * the X86 architecture. 6 | * 7 | * @author Julian Kranz 8 | */ 9 | public enum X86ConfigFlag implements IConfigFlag { 10 | MODE32(1), 11 | DefaultOpndSz16(2); 12 | 13 | private long flag; 14 | 15 | @Override public long getFlag () { 16 | return flag; 17 | } 18 | 19 | private X86ConfigFlag (long flag) { 20 | this.flag = flag; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/Signedness.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm; 2 | 3 | public enum Signedness { 4 | Signed, Unsigned 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/annotation/Annotation.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.annotation; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public abstract class Annotation { 6 | @Override public abstract String toString (); 7 | public abstract void accept(Visitor v); 8 | } 9 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/annotation/StringAnnotation.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.annotation; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public class StringAnnotation extends Annotation { 6 | private String annotation; 7 | 8 | public String getAnnotation() { 9 | return annotation; 10 | } 11 | 12 | public StringAnnotation(String annotation) { 13 | this.annotation = annotation; 14 | } 15 | 16 | @Override public String toString () { 17 | return "{Annotation: " + annotation + "}"; 18 | } 19 | 20 | @Override public void accept (Visitor v) { 21 | v.visit(this); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/boundary/Boundary.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.boundary; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public abstract class Boundary { 6 | @Override public abstract String toString (); 7 | public abstract void accept(Visitor v); 8 | } 9 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/boundary/SizeBoundary.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.boundary; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public class SizeBoundary extends Boundary { 6 | private long size; 7 | 8 | public long getSize() { 9 | return size; 10 | } 11 | 12 | /** 13 | * @param size 14 | */ 15 | public SizeBoundary (long size) { 16 | super(); 17 | this.size = size; 18 | } 19 | 20 | @Override public String toString () { 21 | return "/" + size; 22 | } 23 | 24 | @Override public void accept (Visitor v) { 25 | v.visit(this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/operand/Composite.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.operand; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public class Composite extends Operand { 6 | private Operand[] operands; 7 | 8 | public Operand[] getOperands() { 9 | return operands; 10 | } 11 | 12 | public Composite (Operand[] operands) { 13 | this.operands = operands; 14 | } 15 | 16 | @Override public String toString () { 17 | StringBuilder sB = new StringBuilder(); 18 | for (int i = 0; i < operands.length; i++) { 19 | if(i > 0) 20 | sB.append(":"); 21 | sB.append(operands[i]); 22 | } 23 | return sB.toString(); 24 | } 25 | 26 | @Override public void accept (Visitor v) { 27 | v.visit(this); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/operand/Immediate.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.operand; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public class Immediate extends Operand { 6 | private long value; 7 | 8 | public long getValue() { 9 | return value; 10 | } 11 | 12 | /** 13 | * @param value 14 | */ 15 | public Immediate (long value) { 16 | super(); 17 | this.value = value; 18 | } 19 | 20 | @Override public String toString () { 21 | return Long.toString(value); 22 | } 23 | 24 | @Override public void accept (Visitor v) { 25 | v.visit(this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/operand/Memory.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.operand; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public class Memory extends Operand { 6 | private Operand pointer; 7 | 8 | public Operand getPointer() { 9 | return pointer; 10 | } 11 | 12 | /** 13 | * @param pointer 14 | */ 15 | public Memory (Operand pointer) { 16 | super(); 17 | this.pointer = pointer; 18 | } 19 | 20 | @Override public String toString () { 21 | return "*(" + pointer + ")"; 22 | } 23 | 24 | @Override public void accept (Visitor v) { 25 | v.visit(this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/operand/Operand.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.operand; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public abstract class Operand { 6 | @Override public abstract String toString (); 7 | public abstract void accept(Visitor v); 8 | } 9 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/operand/Register.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.operand; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public class Register extends Operand { 6 | private String register; 7 | 8 | public String getRegister() { 9 | return register; 10 | } 11 | 12 | /** 13 | * @param register 14 | */ 15 | public Register (String register) { 16 | super(); 17 | this.register = register; 18 | } 19 | 20 | @Override public String toString () { 21 | return register; 22 | } 23 | 24 | @Override public void accept (Visitor v) { 25 | v.visit(this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/operand/Relative.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.operand; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public class Relative extends Operand { 6 | private Operand operand; 7 | 8 | public Operand getOperand() { 9 | return operand; 10 | } 11 | 12 | /** 13 | * @param operand 14 | */ 15 | public Relative (Operand operand) { 16 | super(); 17 | this.operand = operand; 18 | } 19 | 20 | @Override public String toString () { 21 | return "(? + " + operand + ")"; 22 | } 23 | 24 | @Override public void accept (Visitor v) { 25 | v.visit(this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/operand/Scale.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.operand; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public class Scale extends Operand { 6 | private long factor; 7 | 8 | public long getFactor() { 9 | return factor; 10 | } 11 | 12 | private Operand rhs; 13 | 14 | public Operand getRhs() { 15 | return rhs; 16 | } 17 | 18 | /** 19 | * @param lhs 20 | * @param rhs 21 | */ 22 | public Scale (long factor, Operand rhs) { 23 | super(); 24 | this.factor = factor; 25 | this.rhs = rhs; 26 | } 27 | 28 | @Override public String toString () { 29 | return factor + "*(" + rhs + ")"; 30 | } 31 | 32 | @Override public void accept (Visitor v) { 33 | v.visit(this); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/asm/operand/Sum.java: -------------------------------------------------------------------------------- 1 | package gdsl.asm.operand; 2 | 3 | import gdsl.asm.Visitor; 4 | 5 | public class Sum extends Operand { 6 | private Operand lhs; 7 | 8 | public Operand getLhs() { 9 | return lhs; 10 | } 11 | 12 | private Operand rhs; 13 | 14 | public Operand getRhs() { 15 | return rhs; 16 | } 17 | 18 | /** 19 | * @param lhs 20 | * @param rhs 21 | */ 22 | public Sum (Operand lhs, Operand rhs) { 23 | super(); 24 | this.lhs = lhs; 25 | this.rhs = rhs; 26 | } 27 | 28 | @Override public String toString () { 29 | return "(" + lhs + " + " + rhs + ")"; 30 | } 31 | 32 | @Override public void accept (Visitor v) { 33 | v.visit(this); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/decoder/Decoder.java: -------------------------------------------------------------------------------- 1 | package gdsl.decoder; 2 | 3 | import gdsl.Gdsl; 4 | 5 | /** 6 | * This class represents the decoder interface of Gdsl. 7 | * 8 | * @author Julian Kranz 9 | */ 10 | public class Decoder { 11 | private Gdsl gdsl; 12 | 13 | public Decoder (Gdsl gdsl) { 14 | this.gdsl = gdsl; 15 | } 16 | 17 | /** 18 | * Decode one instruction 19 | * 20 | * @return the decoded instruction 21 | */ 22 | public NativeInstruction decodeOne () { 23 | long insnPtr = gdsl.decodeOne(); 24 | 25 | return new NativeInstruction(gdsl, insnPtr); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/decoder/GdslDecodeException.java: -------------------------------------------------------------------------------- 1 | package gdsl.decoder; 2 | 3 | import gdsl.GdslException; 4 | 5 | /** 6 | * This exception class is used for Gdsl errors during the decoding 7 | * of instructions. 8 | * 9 | * @author Julian Kranz 10 | */ 11 | public class GdslDecodeException extends GdslException { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | public GdslDecodeException () { 16 | } 17 | 18 | public GdslDecodeException (String message) { 19 | super(message); 20 | } 21 | 22 | public GdslDecodeException (Throwable cause) { 23 | super(cause); 24 | } 25 | 26 | public GdslDecodeException (String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/Address.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil; 2 | 3 | import gdsl.rreil.IAddress; 4 | import gdsl.rreil.linear.LinearExpression; 5 | 6 | public class Address implements IAddress { 7 | protected long size; 8 | 9 | public long getSize() { 10 | return size; 11 | } 12 | 13 | protected LinearExpression address; 14 | 15 | public LinearExpression getAddress() { 16 | return address; 17 | } 18 | 19 | public Address(long size, LinearExpression address) { 20 | this.size = size; 21 | this.address = address; 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return address + ":" + size; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/BranchHint.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil; 2 | 3 | import gdsl.rreil.IBranchHint; 4 | 5 | public enum BranchHint implements IBranchHint { 6 | JUMP, CALL, RET 7 | } 8 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/Flop.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil; 2 | 3 | import gdsl.rreil.IFlop; 4 | 5 | public enum Flop implements IFlop { 6 | FADD, FSUB, FMUL 7 | } 8 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/IAddress.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil; 2 | 3 | public interface IAddress { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/IBranchHint.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil; 2 | 3 | public interface IBranchHint { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/IFlop.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil; 2 | 3 | public interface IFlop { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/ILimitedVariable.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil; 2 | 3 | public interface ILimitedVariable { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/IRReilCollection.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil; 2 | 3 | public interface IRReilCollection { 4 | void add(T s); 5 | 6 | T get(int i); 7 | 8 | int size(); 9 | } 10 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/IVariable.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil; 2 | 3 | public interface IVariable { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/Variable.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil; 2 | 3 | import gdsl.rreil.IVariable; 4 | import gdsl.rreil.id.Id; 5 | 6 | public class Variable implements IVariable { 7 | protected Id id; 8 | 9 | public Id getId() { 10 | return id; 11 | } 12 | 13 | protected long offset; 14 | 15 | public long getOffset() { 16 | return offset; 17 | } 18 | 19 | public Variable(Id id, long offset) { 20 | this.id = id; 21 | this.offset = offset; 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | if(offset > 0) 27 | return id + "@" + offset; 28 | else 29 | return id.toString(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/exception/Exception.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.exception; 2 | 3 | import gdsl.rreil.exception.IException; 4 | 5 | public enum Exception implements IException { 6 | DIVISION_BY_ZERO 7 | } 8 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/exception/GenericArchException.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.exception; 2 | 3 | import gdsl.rreil.exception.IException; 4 | 5 | public class GenericArchException implements IException { 6 | private String ex; 7 | 8 | public GenericArchException (String ex) { 9 | this.ex = ex; 10 | } 11 | 12 | @Override public String toString () { 13 | return "[Arch Exception " + ex + "]"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/exception/IException.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.exception; 2 | 3 | public interface IException { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/exception/x86/X86Exception.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.exception.x86; 2 | 3 | import gdsl.rreil.exception.IException; 4 | 5 | public enum X86Exception implements IException { 6 | DIVISION_OVERFLOW 7 | } 8 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/And.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Binary; 5 | 6 | public class And extends Binary { 7 | 8 | public And(LinearExpression operand1, 9 | LinearExpression operand2) { 10 | super(operand1, operand2); 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return operand1 + " & " + operand2; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/Binary.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Expression; 5 | 6 | public abstract class Binary extends Expression { 7 | protected LinearExpression operand1; 8 | 9 | public LinearExpression getOperand1 () { 10 | return operand1; 11 | } 12 | 13 | protected LinearExpression operand2; 14 | 15 | public LinearExpression getOperand2 () { 16 | return operand2; 17 | } 18 | 19 | public Binary (LinearExpression operand1, 20 | LinearExpression operand2) { 21 | this.operand1 = operand1; 22 | this.operand2 = operand2; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/Compare.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Binary; 5 | import gdsl.rreil.expression.ICompare; 6 | 7 | public abstract class Compare extends Binary implements ICompare { 8 | 9 | public Compare (LinearExpression operand1, 10 | LinearExpression operand2) { 11 | super(operand1, operand2); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/CompareEqual.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Compare; 5 | 6 | public class CompareEqual extends Compare { 7 | 8 | public CompareEqual(LinearExpression operand1, 9 | LinearExpression operand2) { 10 | super(operand1, operand2); 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return operand1 + " == " + operand2; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/CompareLessOrEqualSigned.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Compare; 5 | 6 | public class CompareLessOrEqualSigned extends Compare { 7 | 8 | public CompareLessOrEqualSigned(LinearExpression operand1, 9 | LinearExpression operand2) { 10 | super(operand1, operand2); 11 | } 12 | 13 | public String toString() { 14 | return operand1 + " <=s " + operand2; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/CompareLessOrEqualUnsigned.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Compare; 5 | 6 | public class CompareLessOrEqualUnsigned extends Compare { 7 | 8 | public CompareLessOrEqualUnsigned(LinearExpression operand1, LinearExpression operand2) { 9 | super(operand1, operand2); 10 | } 11 | 12 | public String toString() { 13 | return operand1 + " <=u " + operand2; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/CompareLessSigned.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Compare; 5 | 6 | public class CompareLessSigned extends Compare { 7 | 8 | public CompareLessSigned(LinearExpression operand1, 9 | LinearExpression operand2) { 10 | super(operand1, operand2); 11 | } 12 | 13 | public String toString() { 14 | return operand1 + " >u " + operand2; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/ShiftRightSigned.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Binary; 5 | 6 | public class ShiftRightSigned extends Binary { 7 | 8 | public ShiftRightSigned(LinearExpression operand1, 9 | LinearExpression operand2) { 10 | super(operand1, operand2); 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return operand1 + " >>s " + operand2; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/SignExtend.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Extend; 5 | 6 | public class SignExtend extends Extend { 7 | 8 | public SignExtend(long fromsize, 9 | LinearExpression operand1) { 10 | super(fromsize, operand1); 11 | } 12 | 13 | @Override 14 | public String getSignedUnsignedString() { 15 | return "s"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/SignedDivision.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Binary; 5 | 6 | public class SignedDivision extends Binary { 7 | 8 | public SignedDivision(LinearExpression operand1, 9 | LinearExpression operand2) { 10 | super(operand1, operand2); 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return operand1 + " /s " + operand2; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/SignedModulo.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Binary; 5 | 6 | public class SignedModulo extends Binary { 7 | 8 | public SignedModulo(LinearExpression operand1, LinearExpression operand2) { 9 | super(operand1, operand2); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return operand1 + " %s " + operand2; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/Simple.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.sexpression.SimpleExpression; 4 | import gdsl.rreil.expression.Expression; 5 | 6 | public class Simple extends Expression { 7 | SimpleExpression operand1; 8 | 9 | public SimpleExpression getSexpr() { 10 | return operand1; 11 | } 12 | 13 | public Simple(SimpleExpression operand1) { 14 | this.operand1 = operand1; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return operand1.toString(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/Unary.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Expression; 5 | 6 | public abstract class Unary extends Expression { 7 | protected LinearExpression operand1; 8 | 9 | public LinearExpression getOperand1() { 10 | return operand1; 11 | } 12 | 13 | public Unary(LinearExpression operand1) { 14 | this.operand1 = operand1; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/Xor.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Binary; 5 | 6 | public class Xor extends Binary { 7 | 8 | public Xor(LinearExpression operand1, 9 | LinearExpression operand2) { 10 | super(operand1, operand2); 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return operand1 + " ^ " + operand2; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/expression/ZeroExtend.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.expression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.expression.Extend; 5 | 6 | public class ZeroExtend extends Extend { 7 | 8 | public ZeroExtend(long fromsize, 9 | LinearExpression operand1) { 10 | super(fromsize, operand1); 11 | } 12 | 13 | @Override 14 | public String getSignedUnsignedString() { 15 | return "z"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/ArchRegister.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | public class ArchRegister extends Id { 4 | private String name; 5 | 6 | public String getName () { 7 | return name; 8 | } 9 | 10 | public ArchRegister (String name) { 11 | this.name = name; 12 | } 13 | 14 | @Override public String toString () { 15 | return name; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/FloatingFlags.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | import gdsl.rreil.id.Id; 4 | 5 | public class FloatingFlags extends Id { 6 | @Override 7 | public String toString() { 8 | return "[Floating Flags]"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/IId.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | public interface IId { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/Id.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | import gdsl.rreil.id.IId; 4 | 5 | public abstract class Id implements IId { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/VirtualEqualsId.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | import gdsl.rreil.id.Id; 4 | 5 | public class VirtualEqualsId extends Id { 6 | @Override 7 | public String toString() { 8 | return "[Virtual Equals]"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/VirtualEqualsNotId.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | import gdsl.rreil.id.Id; 4 | 5 | public class VirtualEqualsNotId extends Id { 6 | @Override 7 | public String toString() { 8 | return "[Virtual Equals Not]"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/VirtualLessOrEqualSignedId.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | import gdsl.rreil.id.Id; 4 | 5 | public class VirtualLessOrEqualSignedId extends Id { 6 | @Override 7 | public String toString() { 8 | return "[Virtual Less Or Equal Signed]"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/VirtualLessOrEqualUnsignedId.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | import gdsl.rreil.id.Id; 4 | 5 | public class VirtualLessOrEqualUnsignedId extends Id { 6 | @Override 7 | public String toString() { 8 | return "[Virtual Less Or Equal Unsigned]"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/VirtualLessSignedId.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | import gdsl.rreil.id.Id; 4 | 5 | public class VirtualLessSignedId extends Id { 6 | @Override 7 | public String toString() { 8 | return "[Virtual Less Signed]"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/VirtualLessUnsignedId.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | import gdsl.rreil.id.Id; 4 | 5 | public class VirtualLessUnsignedId extends Id { 6 | @Override 7 | public String toString() { 8 | return "[Virtual Less Unsigned]"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/VirtualTemporaryId.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id; 2 | 3 | import gdsl.rreil.id.Id; 4 | 5 | public class VirtualTemporaryId extends Id { 6 | protected long id; 7 | 8 | protected boolean opt; 9 | 10 | public long getId () { 11 | return id; 12 | } 13 | 14 | public boolean getOpt () { 15 | return opt; 16 | } 17 | 18 | public VirtualTemporaryId (long id, boolean opt) { 19 | this.id = id; 20 | this.opt = opt; 21 | } 22 | 23 | @Override public String toString () { 24 | return (opt ? "o" : "t") + id; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/x86/X86Register.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id.x86; 2 | 3 | public enum X86Register { 4 | IP, FLAGS, MXCSR, A, B, C, D, SI, DI, SP, BP, R8, R9, R10, R11, R12, R13, R14, R15, CS_Base, DS_Base, SS_Base, ES_Base, FS_Base, GS_Base, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/id/x86/X86RegisterId.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.id.x86; 2 | 3 | import gdsl.rreil.id.Id; 4 | import gdsl.rreil.id.x86.X86Register; 5 | 6 | public class X86RegisterId extends Id { 7 | private X86Register register; 8 | 9 | public X86Register getRegister () { 10 | return register; 11 | } 12 | 13 | public X86RegisterId (X86Register register) { 14 | this.register = register; 15 | } 16 | 17 | @Override public String toString () { 18 | return register.toString(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/linear/ILinearExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.linear; 2 | 3 | public interface ILinearExpression { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/linear/LinearAdditionExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.linear; 2 | 3 | import gdsl.rreil.linear.LinearBinaryExpression; 4 | import gdsl.rreil.linear.LinearExpression; 5 | 6 | public class LinearAdditionExpression extends LinearBinaryExpression { 7 | 8 | public LinearAdditionExpression(LinearExpression operand1, 9 | LinearExpression operand2) { 10 | super(operand1, operand2); 11 | } 12 | 13 | @Override 14 | protected String getOperatorString() { 15 | return "+"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/linear/LinearExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.linear; 2 | 3 | import gdsl.rreil.linear.ILinearExpression; 4 | 5 | public abstract class LinearExpression implements ILinearExpression { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/linear/LinearImmediateExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.linear; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | 5 | public class LinearImmediateExpression extends LinearExpression { 6 | protected long immediate; 7 | 8 | public long getImmediate() { 9 | return immediate; 10 | } 11 | 12 | public LinearImmediateExpression(long immediate) { 13 | this.immediate = immediate; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return Long.toString(immediate); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/linear/LinearScaleExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.linear; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | 5 | public class LinearScaleExpression extends LinearExpression { 6 | protected long immediate; 7 | 8 | public long getImmediate() { 9 | return immediate; 10 | } 11 | 12 | protected LinearExpression operand; 13 | 14 | public LinearExpression getOperand1() { 15 | return operand; 16 | } 17 | 18 | public LinearScaleExpression(long immediate, LinearExpression operand) { 19 | this.immediate = immediate; 20 | this.operand = operand; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return immediate + "*" + operand; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/linear/LinearSubtractionExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.linear; 2 | 3 | import gdsl.rreil.linear.LinearBinaryExpression; 4 | import gdsl.rreil.linear.LinearExpression; 5 | 6 | public class LinearSubtractionExpression extends LinearBinaryExpression { 7 | 8 | public LinearSubtractionExpression(LinearExpression operand1, 9 | LinearExpression operand2) { 10 | super(operand1, operand2); 11 | } 12 | 13 | @Override 14 | protected String getOperatorString() { 15 | return "-"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/linear/LinearVariableExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.linear; 2 | 3 | import gdsl.rreil.Variable; 4 | import gdsl.rreil.linear.LinearExpression; 5 | 6 | public class LinearVariableExpression extends LinearExpression { 7 | protected Variable variable; 8 | 9 | public Variable getVariable() { 10 | return variable; 11 | } 12 | 13 | public LinearVariableExpression(Variable variable) { 14 | this.variable = variable; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return variable.toString(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/sexpression/Arbitrary.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.sexpression; 2 | 3 | import gdsl.rreil.sexpression.SimpleExpression; 4 | 5 | public class Arbitrary extends SimpleExpression { 6 | @Override 7 | public String toString() { 8 | return "arbitrary"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/sexpression/ISimpleExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.sexpression; 2 | 3 | public interface ISimpleExpression { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/sexpression/SimpleCompareExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.sexpression; 2 | 3 | import gdsl.rreil.expression.Compare; 4 | import gdsl.rreil.sexpression.SimpleExpression; 5 | 6 | public class SimpleCompareExpression extends SimpleExpression { 7 | 8 | protected long size; 9 | 10 | public long getSize() { 11 | return size; 12 | } 13 | 14 | protected Compare _this; 15 | 16 | public Compare getThis () { 17 | return _this; 18 | } 19 | 20 | public SimpleCompareExpression (long size, Compare _this) { 21 | this.size = size; 22 | this._this = _this; 23 | } 24 | 25 | @Override public String toString () { 26 | return "[" + _this.toString() + "]:" + size; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/sexpression/SimpleExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.sexpression; 2 | 3 | import gdsl.rreil.sexpression.ISimpleExpression; 4 | 5 | public abstract class SimpleExpression implements ISimpleExpression { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/sexpression/SimpleLinearExpression.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.sexpression; 2 | 3 | import gdsl.rreil.linear.LinearExpression; 4 | import gdsl.rreil.sexpression.SimpleExpression; 5 | 6 | public class SimpleLinearExpression extends SimpleExpression { 7 | protected LinearExpression _this; 8 | 9 | public LinearExpression getThis() { 10 | return _this; 11 | } 12 | 13 | public SimpleLinearExpression(LinearExpression _this) { 14 | this._this = _this; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return _this.toString(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/statement/BranchStatement.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.statement; 2 | 3 | import gdsl.rreil.Address; 4 | import gdsl.rreil.BranchHint; 5 | import gdsl.rreil.statement.Statement; 6 | 7 | public class BranchStatement extends Statement { 8 | protected BranchHint hint; 9 | 10 | public BranchHint getHint() { 11 | return hint; 12 | } 13 | 14 | protected Address target; 15 | 16 | public Address getTarget() { 17 | return target; 18 | } 19 | 20 | public BranchStatement(BranchHint hint, Address target) { 21 | this.hint = hint; 22 | this.target = target; 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return "goto[" + hint + "] " + target; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/statement/IStatement.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.statement; 2 | 3 | public interface IStatement { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/statement/Statement.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.statement; 2 | 3 | import gdsl.rreil.statement.IStatement; 4 | 5 | public abstract class Statement implements IStatement { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl/rreil/statement/ThrowStatement.java: -------------------------------------------------------------------------------- 1 | package gdsl.rreil.statement; 2 | 3 | import gdsl.rreil.exception.IException; 4 | import gdsl.rreil.statement.Statement; 5 | 6 | public class ThrowStatement extends Statement { 7 | private gdsl.rreil.exception.IException exception; 8 | 9 | public gdsl.rreil.exception.IException getException() { 10 | return exception; 11 | } 12 | 13 | public ThrowStatement(IException exception) { 14 | this.exception = exception; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "throw " + exception; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl_BareFrontend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gdsl_BareFrontend.h 3 | * 4 | * Created on: Mar 26, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | 10 | /* 11 | * Class: gdsl_BareFrontend 12 | * Method: getFrontendPtrByLibName 13 | * Signature: (Lgdsl/Frontend;)J 14 | */ 15 | JNIEXPORT jlong JNICALL Java_gdsl_BareFrontend_getFrontendPtrByLibName 16 | (JNIEnv *, jobject, jstring); 17 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl_Frontend.c: -------------------------------------------------------------------------------- 1 | /* 2 | * gdsl_Frontend.c 3 | * 4 | * Created on: 13.04.2014 5 | * Author: jucs 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "gdsl_Frontend.h" 15 | #include "util.h" 16 | 17 | JNIEXPORT void JNICALL Java_gdsl_Frontend_destroy 18 | (JNIEnv *env, jobject this, jlong frontendPtr) { 19 | struct frontend *frontend = (struct frontend*)frontendPtr; 20 | 21 | // printf("Destroying frontend...\n"); 22 | // fflush(stdout); 23 | 24 | gdsl_multiplex_frontend_close(frontend); 25 | free(frontend); 26 | } 27 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl_Frontend.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gdsl_Frontend */ 4 | 5 | #ifndef _Included_gdsl_Frontend 6 | #define _Included_gdsl_Frontend 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: gdsl_Frontend 12 | * Method: destroy 13 | * Signature: (J)V 14 | */ 15 | JNIEXPORT void JNICALL Java_gdsl_Frontend_destroy 16 | (JNIEnv *, jobject, jlong); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl_ListFrontend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gdsl_ListFrontend.h 3 | * 4 | * Created on: Mar 26, 2014 5 | * Author: Julian Kranz 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | /* 13 | * Class: gdsl_ListFrontend 14 | * Method: getFrontendPtrByDesc 15 | * Signature: (Lgdsl/Frontend;)J 16 | */ 17 | JNIEXPORT jlong JNICALL Java_gdsl_ListFrontend_getFrontendPtrByDesc 18 | (JNIEnv *, jobject); 19 | -------------------------------------------------------------------------------- /libs/jgdsl/src/gdsl_asm_GeneralizerBackend.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class gdsl_asm_GeneralizerBackend */ 4 | 5 | #ifndef _Included_gdsl_asm_GeneralizerBackend 6 | #define _Included_gdsl_asm_GeneralizerBackend 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: gdsl_asm_GeneralizerBackend 12 | * Method: generalize 13 | * Signature: (JJJ)Lgdsl/asm/Instruction; 14 | */ 15 | JNIEXPORT jobject JNICALL Java_gdsl_asm_GeneralizerBackend_generalize 16 | (JNIEnv *, jobject, jlong, jlong, jlong); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /libs/memstream/include/memstream.h: -------------------------------------------------------------------------------- 1 | #ifndef MEMSTREAM_H_ 2 | #define MEMSTREAM_H_ 3 | 4 | #include 5 | 6 | extern FILE *open_memstream(char **cp, size_t *lenp); 7 | 8 | #endif /* MEMSTREAM_H_ */ 9 | -------------------------------------------------------------------------------- /libs/readhex/Makefile: -------------------------------------------------------------------------------- 1 | MLTK=../.. 2 | CC=gcc 3 | #CC=clang 4 | INCDS=-Iinclude -I$(MLTK)/include 5 | CFLAGS=-c -g3 -std=c11 -pedantic -Wall -Wfatal-errors -DRELAXEDFATAL $(INCDS) 6 | 7 | LIBRARY=libreadhex.a 8 | SOURCES=readhex.c 9 | 10 | all: pre-build $(LIBRARY) 11 | 12 | SPRE=src/ 13 | BPRE=build/ 14 | 15 | BDIRS=$(BPRE) 16 | pre-build: 17 | mkdir -p $(BDIRS) 18 | 19 | OBJECTS=$(addprefix $(BPRE), $(SOURCES:.c=.o)) 20 | 21 | $(LIBRARY): $(OBJECTS) 22 | ar -r $@ $(OBJECTS) 23 | 24 | $(OBJECTS): $(BPRE)%.o : $(SPRE)%.c 25 | $(CC) $(CFLAGS) $< -o $@ 26 | 27 | clean: 28 | rm -rf $(BDIRS) $(LIBRARY) 29 | -------------------------------------------------------------------------------- /libs/readhex/include/readhex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * readhex.h 3 | * 4 | * Created on: May 28, 2012 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef READHEX_H_ 9 | #define READHEX_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | size_t readhex_hex_read(FILE* f, uint8_t** buffer); 16 | 17 | #endif /* READHEX_H_ */ 18 | -------------------------------------------------------------------------------- /libs/rreil-sim/Makefile: -------------------------------------------------------------------------------- 1 | MLTK=../.. 2 | CC=gcc 3 | #CC=clang 4 | INCDS=-Iinclude -I$(MLTK)/include 5 | 6 | DEFINES=-DGDSL_X86 7 | 8 | CFLAGS=-c -g3 -std=c11 -pedantic -Wall -Wfatal-errors $(DEFINES) $(INCDS) 9 | 10 | LIBRARY=librreil-sim.a 11 | SOURCES=memory.c context.c simulator/ops.c simulator/regacc.c simulator/simulator.c simulator/tracking.c 12 | 13 | all: pre-build $(LIBRARY) 14 | 15 | SPRE=src 16 | BPRE=build 17 | 18 | BDIRS=$(BPRE) $(BPRE)/simulator 19 | pre-build: 20 | mkdir -p $(BDIRS) 21 | 22 | OBJECTS=$(addprefix $(BPRE)/, $(SOURCES:.c=.o)) 23 | 24 | $(LIBRARY): $(OBJECTS) 25 | ar -r $@ $(OBJECTS) 26 | 27 | $(OBJECTS): $(BPRE)/%.o : $(SPRE)/%.c 28 | $(CC) $(CFLAGS) $< -o $@ 29 | 30 | clean: 31 | rm -rf $(BDIRS) $(LIBRARY) 32 | -------------------------------------------------------------------------------- /libs/rreil-sim/include/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * memory.h 3 | * 4 | * Created on: 18.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef MEMORY_H_ 9 | #define MEMORY_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | extern void *memory_ptr_get(uint8_t *address, uint64_t address_size); 16 | extern void memory_load(struct context *context, uint8_t **buffer, 17 | uint8_t *address, uint64_t address_size, uint64_t access_size, 18 | uint8_t *source); 19 | extern void memory_store(struct context *context, uint8_t *buffer, 20 | uint8_t *address, uint64_t address_size, uint64_t access_size); 21 | extern void memory_jump(struct context *context, uint8_t *address, 22 | uint64_t address_size); 23 | 24 | #endif /* MEMORY_H_ */ 25 | -------------------------------------------------------------------------------- /libs/rreil-sim/include/simulator/register.h: -------------------------------------------------------------------------------- 1 | /* 2 | * register.h 3 | * 4 | * Created on: 27.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef REGISTER_H_ 9 | #define REGISTER_H_ 10 | 11 | #include 12 | #include 13 | 14 | struct register_ { 15 | uint8_t *data; 16 | uint8_t *defined; 17 | size_t bit_length; 18 | }; 19 | 20 | #endif /* REGISTER_H_ */ 21 | -------------------------------------------------------------------------------- /libs/rustgdsl/rreil/id/arch.rs: -------------------------------------------------------------------------------- 1 | use std::fmt; 2 | use rreil::id::SuperId; 3 | 4 | pub struct ArchId { 5 | name: String 6 | } 7 | 8 | impl ArchId { 9 | pub fn new(name: String) -> ArchId { 10 | ArchId {name:name} 11 | } 12 | } 13 | 14 | impl fmt::Show for ArchId { 15 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 16 | write!(f, "{}", self.name) 17 | } 18 | } 19 | 20 | impl SuperId for ArchId { 21 | } 22 | -------------------------------------------------------------------------------- /libs/rustgdsl/rreil/id/shared.rs: -------------------------------------------------------------------------------- 1 | use std::fmt; 2 | use rreil::id::SuperId; 3 | 4 | pub enum SharedId { 5 | FloatingFlags 6 | } 7 | 8 | impl fmt::Show for SharedId { 9 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 10 | let self_str = match *self { 11 | FloatingFlags => "FloatingFlags" 12 | }; 13 | write!(f, "{}", self_str) 14 | } 15 | } 16 | 17 | impl SuperId for SharedId { 18 | } 19 | -------------------------------------------------------------------------------- /libs/rustgdsl/rreil/id/virtual_.rs: -------------------------------------------------------------------------------- 1 | use std::fmt; 2 | use rreil::id::SuperId; 3 | 4 | pub struct VirtualId { 5 | t: i64 6 | } 7 | 8 | impl VirtualId { 9 | pub fn new(t: i64) -> VirtualId { 10 | VirtualId {t:t} 11 | } 12 | } 13 | 14 | impl fmt::Show for VirtualId { 15 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 16 | write!(f, "t{}", self.t) 17 | } 18 | } 19 | 20 | impl SuperId for VirtualId { 21 | } 22 | -------------------------------------------------------------------------------- /libs/rustgdsl/rreil/linear/binary.rs: -------------------------------------------------------------------------------- 1 | use std::fmt; 2 | use rreil::linear::Linear; 3 | use rreil::linear::SuperLinear; 4 | 5 | pub enum Binop { 6 | Add, Sub 7 | } 8 | 9 | pub struct BinaryLinear { 10 | op: Binop, 11 | opnd1: Box, 12 | opnd2: Box 13 | } 14 | 15 | impl BinaryLinear { 16 | pub fn new(op: Binop, opnd1: Box, opnd2: Box) -> BinaryLinear { 17 | BinaryLinear {op:op, opnd1:opnd1, opnd2:opnd2} 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /libs/rustgdsl/rreil/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod id; 2 | pub mod linear; 3 | 4 | fn cc<'a, T>(x: &'a T) -> &'a T { x } 5 | -------------------------------------------------------------------------------- /libs/x86-generator/Makefile: -------------------------------------------------------------------------------- 1 | MLTK=../.. 2 | CC=gcc 3 | #CC=clang 4 | INCDS=-Iinclude -I$(MLTK)/include 5 | CFLAGS=-c -std=c11 -Wall -Wfatal-errors -DRELAXEDFATAL $(INCDS) 6 | 7 | LIBRARY=libx86-generator.a 8 | SOURCES=generator_tree.c x86_opcodes.c generator.c 9 | 10 | all: pre-build $(LIBRARY) 11 | 12 | SPRE=src 13 | BPRE=build 14 | 15 | BDIRS=$(BPRE) 16 | pre-build: 17 | mkdir -p $(BDIRS) 18 | 19 | OBJECTS=$(addprefix $(BPRE)/, $(SOURCES:.c=.o)) 20 | 21 | $(LIBRARY): $(OBJECTS) 22 | ar -r $@ $(OBJECTS) 23 | 24 | $(OBJECTS): $(BPRE)/%.o : $(SPRE)/%.c 25 | $(CC) $(CFLAGS) $< -o $@ 26 | 27 | clean: 28 | rm -rf $(BDIRS) $(LIBRARY) 29 | -------------------------------------------------------------------------------- /libs/x86-generator/include/x86_opcodes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * opcodes.h 3 | * 4 | * Created on: Apr 29, 2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef X86_OPCODES_H_ 9 | #define X86_OPCODES_H_ 10 | 11 | #include 12 | 13 | struct opcode_table { 14 | size_t *offsets; 15 | size_t offsets_length; 16 | 17 | uint8_t *opcodes; 18 | }; 19 | 20 | extern struct opcode_table *x86_opcodes_opcode_table_build(); 21 | extern void x86_opcodes_opcode_table_free(struct opcode_table *table); 22 | 23 | #endif /* X86_OPCODES_H_ */ 24 | -------------------------------------------------------------------------------- /libs/x86-tester/Makefile: -------------------------------------------------------------------------------- 1 | MLTK=../.. 2 | CC=gcc 3 | #CC=clang 4 | INCDS=-Iinclude -I$(MLTK)/include 5 | CFLAGS=-c -g3 -std=gnu11 -Wall -Wfatal-errors -DRELAXEDFATAL $(INCDS) 6 | 7 | LIBRARY=libx86-tester.a 8 | SOURCES=tbgen.c tbgen_alloc.c executor.c tester.c 9 | 10 | all: pre-build $(LIBRARY) 11 | 12 | SPRE=src/ 13 | BPRE=build/ 14 | 15 | BDIRS=$(BPRE) 16 | pre-build: 17 | mkdir -p $(BDIRS) 18 | 19 | OBJECTS=$(addprefix $(BPRE), $(SOURCES:.c=.o)) 20 | 21 | $(LIBRARY): $(OBJECTS) 22 | ar -r $@ $(OBJECTS) 23 | 24 | $(OBJECTS): $(BPRE)%.o : $(SPRE)%.c 25 | $(CC) $(CFLAGS) $< -o $@ 26 | 27 | clean: 28 | rm -rf $(BDIRS) $(LIBRARY) 29 | -------------------------------------------------------------------------------- /libs/x86/Makefile: -------------------------------------------------------------------------------- 1 | MLTK=../.. 2 | CC=gcc 3 | #CC=clang 4 | INCDS=-Iinclude -I$(MLTK)/include 5 | CFLAGS=-c -g3 -std=c11 -pedantic -Wall -Wfatal-errors -DRELAXEDFATAL $(INCDS) 6 | 7 | LIBRARIES=libx86.a 8 | 9 | all: $(LIBRARIES) 10 | 11 | OBJECTS=x86.o x86_features.o 12 | 13 | libx86.a: $(OBJECTS) 14 | ar -r $@ $(OBJECTS) 15 | 16 | $(OBJECTS): %.o : src/%.c 17 | $(CC) $(CFLAGS) src/$(@:.o=.c) -o $@ 18 | 19 | clean: 20 | rm -f $(LIBRARIES) $(OBJECTS) 21 | -------------------------------------------------------------------------------- /mips.mk: -------------------------------------------------------------------------------- 1 | export GDSL_ARCH=mips 2 | -------------------------------------------------------------------------------- /pygdsl/Makefile: -------------------------------------------------------------------------------- 1 | # vim: noexpandtab 2 | 3 | all: _pygdsl.so 4 | 5 | prepare: 6 | ln -f -s ../build/gdsl-x86-rreil.h ../build/gdsl.h 7 | 8 | _pygdsl.so: pygdsl_impl.c pygdsl_error.h pygdsl_funcs.h pygdsl.i 9 | python setup.py build_ext --inplace 10 | test: _pygdsl.so 11 | export PYTHONPATH=. 12 | python tests/single_instrs.py 13 | python tests/multiple_instrs.py 14 | install: _pygdsl.so 15 | python setup.py install 16 | clean: 17 | rm -rf *.o *.pyc pygdsl.py _pygdsl.so pygdsl_wrap.c build 18 | -------------------------------------------------------------------------------- /pygdsl/env: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../build/.libs 2 | export LIBRARY_PATH=$LIBRARY_PATH:../build/.libs 3 | export C_INCLUDE_PATH=$C_INCLUDE_PATH:../build/ 4 | -------------------------------------------------------------------------------- /pygdsl/pygdsl_error.h: -------------------------------------------------------------------------------- 1 | #ifndef PYGDSL_ERROR_H 2 | #define PYGDSL_ERROR_H 3 | 4 | #define MAX_ERROR_LENGTH 1024 5 | 6 | 7 | void throw_exception(char* msg); 8 | void clear_exception(void); 9 | int check_exception(void); 10 | void copy_error(char* buffer, size_t buffer_size); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /pygdsl/pygdsl_funcs.h: -------------------------------------------------------------------------------- 1 | #ifndef PYGDSL_FUNCS_H 2 | #define PYGDSL_FUNCS_H 3 | 4 | void semantics_instr(char* input, unsigned int in_size, char** output, unsigned int* out_size); 5 | void semantics_multi_opt(char* input, unsigned int in_size, char** output, unsigned int* out_size, long preservation); 6 | void semantics_multi(char* input, unsigned int in_size, char** output, unsigned int* out_size); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /pygdsl/tests/a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/pygdsl/tests/a.bin -------------------------------------------------------------------------------- /pygdsl/tests/multiple_instrs.py: -------------------------------------------------------------------------------- 1 | import pygdsl 2 | 3 | with open('tests/a.bin','r') as testdump: 4 | instrs = testdump.read() 5 | 6 | print(pygdsl.semantics_multi(instrs)) 7 | 8 | print(pygdsl.semantics_multi_opt(instrs, pygdsl.GDSL_SEM_PRESERVATION_EVERYWHERE)) 9 | print(pygdsl.semantics_multi_opt(instrs, pygdsl.GDSL_SEM_PRESERVATION_CONTEXT)) 10 | print(pygdsl.semantics_multi_opt(instrs, pygdsl.GDSL_SEM_PRESERVATION_BLOCK)) 11 | -------------------------------------------------------------------------------- /pygdsl/tests/single_instrs.py: -------------------------------------------------------------------------------- 1 | import pygdsl 2 | 3 | print('; b8 05 00 00 00 mov eax, 0x5') 4 | print(pygdsl.semantics_instr('\xb8\x05\x00\x00\x00')) 5 | print('; 81 c3 04 00 00 00 add ebx, 0x4') 6 | print(pygdsl.semantics_instr('\x81\xc3\x04\x00\x00\x00')) 7 | print('; 0f af c3 imul eax, ebx') 8 | print(pygdsl.semantics_instr('\x0f\xaf\xc3')) 9 | try: 10 | print(pygdsl.semantics_instr('abcd')) 11 | except Exception as e: 12 | print("Successfully generated exception:") 13 | print("Exception message: {}".format(e)) 14 | 15 | -------------------------------------------------------------------------------- /specifications/arm7/arm7-asm.ml: -------------------------------------------------------------------------------- 1 | export generalize : (insndata) -> asm-insn 2 | 3 | val generalize insn = asm-insn 0 (string-from-rope "") asm-opnds-none 4 | -------------------------------------------------------------------------------- /specifications/arm7/arm7-liveness.ml: -------------------------------------------------------------------------------- 1 | val registers-live-map = let 2 | val ++- map reg-sem = 3 | fmap-add-range map reg-sem.id reg-sem.size reg-sem.offset 4 | val ++ map r = map ++- semantic-register-of r 5 | in 6 | fmap-empty 7 | ++ R0 8 | end 9 | -------------------------------------------------------------------------------- /specifications/arm7/arm7-rreil-pretty.ml: -------------------------------------------------------------------------------- 1 | export pretty-arch-id: (sem_id) -> rope 2 | export pretty-arch-exception: (sem_exception) -> rope 3 | 4 | val pretty-arch-id r = arch-show-id r 5 | 6 | val pretty-arch-exception exception = case 0 of 1: "" end 7 | 8 | val arch-show-id r = 9 | case r of 10 | Sem_R0: "R0" 11 | | Sem_R1: "R1" 12 | | Sem_R2: "R2" 13 | | Sem_R3: "R3" 14 | | Sem_R4: "R4" 15 | | Sem_R5: "R5" 16 | | Sem_R6: "R6" 17 | | Sem_R7: "R7" 18 | | Sem_R8: "R8" 19 | | Sem_R9: "R9" 20 | | Sem_R10: "R10" 21 | | Sem_R11: "R11" 22 | | Sem_R12: "R12" 23 | | Sem_SP: "SP" 24 | | Sem_LR: "LR" 25 | | Sem_PC: "PC" 26 | | Sem_APSR: "APSR" 27 | | Sem_ISETSTATE: "ISETSTATE" 28 | end 29 | -------------------------------------------------------------------------------- /specifications/avr/avr-rreil-pretty.ml: -------------------------------------------------------------------------------- 1 | export pretty-arch-id: (sem_id) -> rope 2 | export pretty-arch-exception: (sem_exception) -> rope 3 | 4 | val arch-show-id r = 5 | case r of 6 | Sem_ALL: "memory" 7 | | Sem_PC: "PC" 8 | | Sem_PM: "PM" 9 | end 10 | 11 | val pretty-arch-id r = arch-show-id r 12 | 13 | val pretty-arch-exception exception = case 0 of 1: "" end 14 | -------------------------------------------------------------------------------- /specifications/basis/tree-set.ml: -------------------------------------------------------------------------------- 1 | #type treeset [c, b] = Fop of {cmp: c, tree: bbtree} 2 | # 3 | #val sm a b = a < b 4 | # 5 | #val treeset-empty-int = Fop {cmp=sm} 6 | 7 | val foo x = 2 * x 8 | -------------------------------------------------------------------------------- /specifications/mips/mips-asm_r5.ml: -------------------------------------------------------------------------------- 1 | val revision/generalize-immediate i = 2 | case 0 of 3 | 1: asm-bounded (asm-boundary-sz 1) (asm-imm 1) 4 | end 5 | -------------------------------------------------------------------------------- /specifications/mips/mips-asm_r6.ml: -------------------------------------------------------------------------------- 1 | val revision/generalize-immediate i = let 2 | val inner i sz = asm-bounded (asm-boundary-sz sz) (asm-imm (zx i)) 3 | in case i of 4 | IMM21 i: inner i 21 5 | | IMM32 i: inner i 32 6 | | BP i: inner i 2 7 | | SA2 i: inner i 2 8 | | OFFSET11 i: inner i 11 9 | | OFFSET23 i: inner i 23 10 | | OFFSET28 i: inner i 28 11 | | C2CONDITION i: inner i 5 12 | | CODE16 i: inner i 16 13 | end end 14 | 15 | -------------------------------------------------------------------------------- /specifications/mips/mips-pretty_r5.ml: -------------------------------------------------------------------------------- 1 | val show/condop cond = 2 | case cond of 3 | C_F: "F" 4 | | C_UN: "UN" 5 | | C_EQ: "EQ" 6 | | C_UEQ: "UEQ" 7 | | C_OLT: "OLT" 8 | | C_ULT: "ULT" 9 | | C_OLE: "OLE" 10 | | C_ULE: "ULE" 11 | | C_SF: "SF" 12 | | C_NGLE: "NGLE" 13 | | C_SEQ: "SEQ" 14 | | C_NGL: "NGL" 15 | | C_LT: "LT" 16 | | C_NGE: "NGE" 17 | | C_LE: "LE" 18 | | C_NGT: "NGT" 19 | end 20 | 21 | val revision/show/immediate imm = 22 | case 0 of 23 | 1 : "ERROR" 24 | end 25 | 26 | val revision/show/format format = 27 | case format of 28 | PS : "PS" 29 | end 30 | -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/1 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/10 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/11: -------------------------------------------------------------------------------- 1 | � -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/12 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/13 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/14 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/15: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/15 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/2 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/3 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/4 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/5 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/6 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/7 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/8 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/9 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/1 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/10 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/11: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/11 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/12 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/13 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/14 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/15: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/15 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/2 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/3 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/4 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/5 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/6 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/7 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/8 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/9 -------------------------------------------------------------------------------- /stale/dis-tool-test/binary/bea/template.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/dis-tool-test/binary/bea/template.exe -------------------------------------------------------------------------------- /stale/dis-tool-test/clis/bea/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | CFLAGS = -I$(BEA_PATH)/include -I../readhex/include -g 3 | 4 | LDFLAGS = -L$(BEA_PATH)/lib/Linux.gnu.Debug -L../readhex 5 | LIBS = -lBeaEngine_s_d -lreadhex 6 | 7 | all: bea-cli 8 | 9 | bea-cli: bea-cli.o 10 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) 11 | 12 | bea-cli.o: bea-cli.c 13 | $(CC) $(CFLAGS) -c -o $@ $< 14 | 15 | clean: FRC 16 | rm -f bea-cli bea-cli.o 17 | 18 | # This pseudo target causes all targets that depend on FRC 19 | # to be remade even in case a file with the name of the target exists. 20 | # This works with any make implementation under the assumption that 21 | # there is no file FRC in the current directory. 22 | FRC: 23 | -------------------------------------------------------------------------------- /stale/dis-tool-test/clis/distorm/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | CFLAGS = -I$(DISTORM_PATH)/include -I../readhex/include -g 3 | 4 | LDFLAGS = -L$(DISTORM_PATH) -L../readhex 5 | LIBS = -ldistorm3 -lreadhex 6 | 7 | all: distorm-cli 8 | 9 | distorm-cli: distorm-cli.o 10 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) 11 | 12 | distorm-cli.o: distorm-cli.c 13 | $(CC) $(CFLAGS) -c -o $@ $< 14 | 15 | clean: FRC 16 | rm -f distorm-cli distorm-cli.o 17 | 18 | # This pseudo target causes all targets that depend on FRC 19 | # to be remade even in case a file with the name of the target exists. 20 | # This works with any make implementation under the assumption that 21 | # there is no file FRC in the current directory. 22 | FRC: 23 | -------------------------------------------------------------------------------- /stale/dis-tool-test/clis/opdis/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | CFLAGS = -I$(OPDIS_PATH) -I../readhex/include -g 3 | 4 | LDFLAGS = -L../readhex -L$(OPDIS_PATH)/dist/.libs 5 | LIBS = -lopcodes -lopdis -lreadhex 6 | 7 | all: opdis-cli 8 | 9 | opdis-cli: opdis-cli.o 10 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) 11 | 12 | opdis-cli.o: opdis-cli.c 13 | $(CC) $(CFLAGS) -c -o $@ $< 14 | 15 | clean: FRC 16 | rm -f opdis-cli opdis-cli.o 17 | 18 | # This pseudo target causes all targets that depend on FRC 19 | # to be remade even in case a file with the name of the target exists. 20 | # This works with any make implementation under the assumption that 21 | # there is no file FRC in the current directory. 22 | FRC: 23 | -------------------------------------------------------------------------------- /stale/dis-tool-test/clis/readhex/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | AR = ar 3 | CFLAGS = -I./include -g 4 | 5 | all: libreadhex.a 6 | 7 | libreadhex.a: readhex.o 8 | $(AR) -r $@ $^ 9 | 10 | readhex.o: readhex.c 11 | $(CC) $(CFLAGS) -c -o $@ $< 12 | 13 | clean: FRC 14 | rm -f libreadhex.a readhex.o 15 | 16 | # This pseudo target causes all targets that depend on FRC 17 | # to be remade even in case a file with the name of the target exists. 18 | # This works with any make implementation under the assumption that 19 | # there is no file FRC in the current directory. 20 | FRC: 21 | -------------------------------------------------------------------------------- /stale/dis-tool-test/clis/readhex/include/readhex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * readhex.h 3 | * 4 | * Created on: May 28, 2012 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef READHEX_H_ 9 | #define READHEX_H_ 10 | 11 | #include 12 | 13 | size_t readhex_hex_read(FILE *f, char **buffer); 14 | 15 | #endif /* READHEX_H_ */ 16 | -------------------------------------------------------------------------------- /stale/dis-tool-test/clis/xed/Makefile: -------------------------------------------------------------------------------- 1 | CC = g++ 2 | CFLAGS = -I$(XED_PATH)/include -I../readhex/include -g 3 | 4 | LDFLAGS = -L$(XED_PATH)/lib -L../readhex 5 | LIBS = -lxed -lreadhex 6 | 7 | all: xed-cli 8 | 9 | xed-cli: xed-cli.o 10 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) 11 | 12 | xed-cli.o: xed-cli.cpp 13 | $(CC) $(CFLAGS) -c -o $@ $< 14 | 15 | clean: FRC 16 | rm -f xed-cli xed-cli.o 17 | 18 | # This pseudo target causes all targets that depend on FRC 19 | # to be remade even in case a file with the name of the target exists. 20 | # This works with any make implementation under the assumption that 21 | # there is no file FRC in the current directory. 22 | FRC: 23 | -------------------------------------------------------------------------------- /stale/examples/x86/pretty.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __PRETTY_H 3 | #define __PRETTY_H 4 | 5 | #include 6 | 7 | char* pretty (__obj,char*,__word); 8 | char* prettyln (__obj,char*,__word); 9 | char* prettyOpnd(__obj,char*,__word); 10 | char* prettyMnemonic(__obj,char*,__word); 11 | 12 | #endif /* __PRETTY_H */ 13 | -------------------------------------------------------------------------------- /stale/gdrr/Makefile: -------------------------------------------------------------------------------- 1 | MLTK=../.. 2 | CC=gcc 3 | #CC=clang 4 | INCDS=-Iinclude -I$(MLTK)/include 5 | 6 | DEFINES=-DRELAXEDFATAL 7 | ifdef GDSL_X86 8 | DEFINES+=-DGDSL_X86 9 | endif 10 | 11 | CFLAGS=-c -g3 -fPIC -std=c11 -pedantic -Wall -Wfatal-errors $(DEFINES) $(INCDS) 12 | 13 | LIBRARIES=libgdrr.a 14 | 15 | all: $(LIBRARIES) 16 | 17 | OBJECTS=gdrr.o 18 | 19 | libgdrr.a: $(OBJECTS) 20 | ar -r $@ $(OBJECTS) 21 | 22 | gdrr.o: src/gdrr.c 23 | $(CC) $(CFLAGS) src/gdrr.c -o $@ 24 | 25 | clean: 26 | rm -f $(LIBRARIES) $(OBJECTS) 27 | -------------------------------------------------------------------------------- /stale/gdrr/include/gdrr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gdrr_types.h 3 | * 4 | * Created on: Mar 10, 2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef GDRR_H_ 9 | #define GDRR_H_ 10 | 11 | #include 12 | 13 | gdrr_sem_stmts_t *gdrr_convert(obj_t semantics, struct gdrr_config *config); 14 | 15 | #endif /* GDRR_H_ */ 16 | -------------------------------------------------------------------------------- /stale/gdrr/include/gdrr_arch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gdrr_arch.h 3 | * 4 | * Created on: Mar 10, 2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef GDRR_ARCH_H_ 9 | #define GDRR_ARCH_H_ 10 | 11 | #include "gdrr.h" 12 | 13 | gdrr_sem_id_t *gdrr_convert_sem_id_arch(obj_t sem_id_obj, 14 | struct gdrr_config *config); 15 | 16 | #endif /* GDRR_ARCH_H_ */ 17 | -------------------------------------------------------------------------------- /stale/gdrr/include/gdrr_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gdrr_types.h 3 | * 4 | * Created on: Mar 10, 2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef GDRR_TYPES_H_ 9 | #define GDRR_TYPES_H_ 10 | 11 | typedef void gdrr_sem_id_t; 12 | typedef void gdrr_sem_address_t; 13 | typedef void gdrr_sem_var_t; 14 | typedef void gdrr_sem_linear_t; 15 | typedef void gdrr_sem_sexpr_t; 16 | typedef void gdrr_sem_op_cmp_t; 17 | typedef void gdrr_sem_op_t; 18 | typedef void gdrr_branch_hint_t; 19 | typedef void gdrr_sem_stmt_t; 20 | typedef void gdrr_sem_stmts_t; 21 | 22 | #endif /* GDRR_TYPES_H_ */ 23 | -------------------------------------------------------------------------------- /stale/liveness-example-bins/Xorg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/Xorg -------------------------------------------------------------------------------- /stale/liveness-example-bins/bash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/bash -------------------------------------------------------------------------------- /stale/liveness-example-bins/cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/cat -------------------------------------------------------------------------------- /stale/liveness-example-bins/echo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/echo -------------------------------------------------------------------------------- /stale/liveness-example-bins/less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/less -------------------------------------------------------------------------------- /stale/liveness-example-bins/ls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/ls -------------------------------------------------------------------------------- /stale/liveness-example-bins/mkdir: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/mkdir -------------------------------------------------------------------------------- /stale/liveness-example-bins/netstat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/netstat -------------------------------------------------------------------------------- /stale/liveness-example-bins/ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/ps -------------------------------------------------------------------------------- /stale/liveness-example-bins/pwd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/pwd -------------------------------------------------------------------------------- /stale/liveness-example-bins/rm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/rm -------------------------------------------------------------------------------- /stale/liveness-example-bins/sed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/sed -------------------------------------------------------------------------------- /stale/liveness-example-bins/tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/tar -------------------------------------------------------------------------------- /stale/liveness-example-bins/touch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/touch -------------------------------------------------------------------------------- /stale/liveness-example-bins/uname: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/liveness-example-bins/uname -------------------------------------------------------------------------------- /stale/liveness-example.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) { 5 | int a; 6 | int b; 7 | int c; 8 | int d; 9 | 10 | start: 11 | a = 12; 12 | b = 55; 13 | c = 99; 14 | a = b*c + 66; 15 | b = a - c; 16 | c = (a + b)*(c - b); 17 | a = 3 + 77*c; 18 | d = 7*a + 2*(c - 3*b); 19 | c = b + 2*a - 3*d - 99*(a - 27*c); 20 | b = 66*(a + b + c + d); 21 | __asm__ ("jmp label\nlabel:\n"); 22 | end:; 23 | 24 | FILE *f = fopen("liveness-example.bin", "w"); 25 | if(!f) 26 | return 1; 27 | 28 | for(void *i = &&start; i < &&end; i++) 29 | fwrite(i, 1, 1, f); 30 | 31 | fclose(f); 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /stale/liveness-table.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./liveness-sweep --cleanup --elf --latex $(for file in examples/* ; do echo "--file $file"; done) 4 | -------------------------------------------------------------------------------- /stale/liveness/example_a.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void __exit() { 5 | exit(0); 6 | } 7 | 8 | int main(void) { 9 | FILE *f = fopen("example.bin", "w"); 10 | if(!f) 11 | return 1; 12 | 13 | for(void *i = &&start; i < &&end; i++) 14 | fwrite(i, 1, 1, f); 15 | 16 | fclose(f); 17 | 18 | __exit(); 19 | 20 | start: 21 | asm ( 22 | //"fadd %st(0), %st(1)\n" 23 | 24 | //"pclmulqdq $42, %xmm0, %xmm1\n" 25 | 26 | "nop\n" 27 | 28 | //"vaesdec %xmm14, %xmm15, %xmm2\n" 29 | //"vpextrw $0, %xmm2, %rax\n" 30 | //"vzeroall\n" 31 | ); 32 | end:; 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /stale/opcode-sequence-01.txt: -------------------------------------------------------------------------------- 1 | 4d 29 e7 4d 29 e7 74 0f 2 | -------------------------------------------------------------------------------- /stale/opcode-sequence-02.txt: -------------------------------------------------------------------------------- 1 | 8b 45 f8 48 98 48 c1 e0 02 48 03 45 e8 8b 00 01 45 fc 83 45 f8 01 8b 45 f8 48 98 48 3b 45 e0 72 df 2 | -------------------------------------------------------------------------------- /stale/resweep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm gcc-sweep; make gcc-sweep 4 | ./gcc-sweep a.out 1204 32 | less 5 | -------------------------------------------------------------------------------- /stale/sweep/test-binary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gdslang/gdsl-toolkit/50a958a621ceb7037a49fb29226f4ca66f554bf2/stale/sweep/test-binary -------------------------------------------------------------------------------- /stale/tester.c: -------------------------------------------------------------------------------- 1 | 2 | /* vim:cindent:ts=2:sw=2:expandtab */ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main (int argc, char** argv) { 9 | __eval(__test__, NULL, NULL); 10 | 11 | return 1; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /todo: -------------------------------------------------------------------------------- 1 | - Pattern matching auf Bitvektoren, z.B. 2 | 3 | val shift-left x = 4 | case x of 5 | 'xs x:1': '0' ^ xs 6 | end 7 | - 3 Modi für x86: 32 Bit, Compatibility, 64 Bit 8 | - Generisches ASM: Eine ASM-Sprache, die für alle Architekturen gleich ist => AST-Übersetzung nach z.B. Java wie bei RReil 9 | - semantic-register-of über multiplex exportieren => Stringvergleich? 10 | 11 | Weniger wichtig: 12 | 13 | - Für Register / Exceptions: IDs + Strings statt nur Strings? => Für librreil 14 | -------------------------------------------------------------------------------- /tools/x86-test-stats-runner/src/hash_array.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hash_array.h 3 | * 4 | * Created on: 26.05.2013 5 | * Author: jucs 6 | */ 7 | 8 | #ifndef HASH_ARRAY_H_ 9 | #define HASH_ARRAY_H_ 10 | 11 | #define _GNU_SOURCE 12 | #include 13 | 14 | struct hash_array { 15 | struct hsearch_data htab; 16 | 17 | ENTRY *entries; 18 | size_t entries_length; 19 | 20 | size_t nel; 21 | }; 22 | 23 | extern struct hash_array *hash_array_init(size_t nel); 24 | extern ENTRY *hash_array_search_insert(struct hash_array *ha, char *key); 25 | extern size_t hash_array_entries_get(struct hash_array *ha, ENTRY **entries); 26 | extern void hash_array_free(struct hash_array *ha); 27 | 28 | #endif /* HASH_ARRAY_H_ */ 29 | -------------------------------------------------------------------------------- /tools/xed-cmp/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$1" -eq 12 ]; then 4 | export XED=/home/jucs/Downloads/pin-2.12-58423-gcc.4.4.7-linux/extras/xed2-intel64 5 | fi 6 | 7 | if [ "$1" -eq 11 ]; then 8 | export XED=/home/jucs/Downloads/pin-2.11-49306-gcc.3.4.6-ia32_intel64-linux/extras/xed2-intel64 9 | fi 10 | 11 | make -B 12 | ./xed-cmp /usr/bin/clang >/dev/null 13 | ./xed-cmp /usr/bin/clang >/dev/null 14 | -------------------------------------------------------------------------------- /x86.mk: -------------------------------------------------------------------------------- 1 | export GDSL_ARCH=x86 2 | --------------------------------------------------------------------------------