Commit Graph

31 Commits

Author SHA1 Message Date
sschriner d5c74715b1 updates 2022-02-23 11:24:32 -05:00
Peter Goodman 28e48fec22 Removes some deprecated functions, and removes the basic block functi… (#569)
* Removes some deprecated functions, and removes the basic block function cloning apis, in favor of apis on Arch

* More tweaks for removing unnecessary APIs

* Goodbye dse

* Fix issue

* Tweaks

* Remove some annoying logs
2021-12-17 14:20:13 -05:00
Peter Goodman e24243c7e9 Add a type map into the code that moves constants and types. Also, add additional support for unary/binary operators. (#563) 2021-11-30 14:27:46 -05:00
XIN 905f75d6fb add some semantic function of instructions (#562)
* add some semantic function of instructions

* Modify

Co-authored-by: yangjiaxin <yangjiaxin8@huawei.com>
Co-authored-by: Peter Goodman <peter@trailofbits.com>
2021-11-24 10:14:58 -05:00
XIN bd75b4f286 add KMOW (#561)
* add KMOW

* add KMOVW

* bug fix

* bug fix

Co-authored-by: yangjiaxin <yangjiaxin8@huawei.com>
2021-11-24 09:36:00 -05:00
2over12 dd14a17cdc Ian/recover flags (#559)
* added cross compile semantics

* sorta fix for m1 macs, shouldnt hardcode macosx version

* added flag intrinsics

* changed ordering for easy compare

* made comparison hints easier to reference

* added neq and eq instrinsics

* added more intrinsics

* added intrinsics to tests
2021-11-19 17:26:26 -05:00
Peter Goodman 769c280720 Populate the register table even in the absence of semantics (#558)
* Populate the register table even in the absence of semantics

* Modify the test suite
2021-11-02 14:11:54 -04:00
Peter Goodman a144c1765d Missing arch fused x86 call ret (#552)
* Adds missing arch identification from triples. Adds sub-arch identifications. Adds x86 decoding logic for fusing calls that target the next instruction, and when the next instruction is a return

* Bug fix on call-ret fusing

* Bug fix on call-ret fusing

* Address PR feedback

* Address PR feedback

* Add 64-bit fusing support. Minor bug fix

* Add 64-bit fusing support. Minor bug fix
2021-10-10 15:06:56 -04:00
Peter Goodman a787375f9c Adds missing arch identification from triples. Adds sub-arch identifi… (#551)
* Adds missing arch identification from triples. Adds sub-arch identifications. Adds x86 decoding logic for fusing calls that target the next instruction, and when the next instruction is a return

* Bug fix on call-ret fusing

* Bug fix on call-ret fusing

* Address PR feedback

* Address PR feedback
2021-10-10 13:28:02 -04:00
Peter Goodman 7220001c12 Add some extra apis to remill arch for instruction minimum size and alignment (#549) 2021-10-09 20:12:25 -04:00
kumarak d8d3b6c7e0 fix remill intrinsics for float80 (#539)
* Fix remill fp intrinsics to handle fp80 types

* update f80 write intrinsic

* define read function
2021-09-13 13:36:19 -04:00
Artem Dinaburg d93575e0d4 Fix AArch64 test runner (#538)
* Fix AArch64 test runner
* Fix x86 test runner
2021-08-31 15:43:27 -04:00
kumarak 9006baf7db WIP: Fix FPU types (#536)
Update remill's FPU semantics to use 80-bit floats, at least on x86/amd64.

Co-authored-by: Artem Dinaburg <artem@trailofbits.com>
2021-08-25 12:26:21 -04:00
Sonya f9c9e515ed Update Instruction.cpp to account for ARMv7 shifting into carry out (#534)
* Update check in Instruction.cpp to account for ARMv7 shifting weirdness

* More correct solution

* Better solution
2021-08-06 10:23:21 -04:00
Peter Goodman 9d662396dc Clone metadata when moving stuff (#530) 2021-06-30 14:47:23 -04:00
Sonya c3d76def43 Added branch_taken_pc and branch_not_taken_pc to BX (#520)
* Added branch_taken_pc and branch_not_taken_pc

* Corrected comment

* Added t system reg flag. Still need to check inst.category

* Fixed inst.category in TryDecodeBX
2021-06-02 17:58:02 -04:00
lkorenc 7311c6a89f X86 segment reg override (#512)
* arch: Add segment_override attribute to Instruction.

* arch: Update x86 decoder wrt to default segment register.
2021-05-10 11:17:52 -04:00
kumarak d93823cd72 treat all pop to pc as function return (#502)
Update semantics to handle function returns and indirect jumps
2021-04-06 18:26:22 -04:00
kumarak 2b241b83c0 PC relative handling and instr category for AArch32 (#499)
* changes in AArch32 decoder to test using opt fuzz
2021-03-31 16:31:17 -04:00
Peter Goodman 021b799efc Exposes an internal function that can replace uses of a constant in a module (#497) 2021-03-17 12:03:54 -04:00
Eric Kilmer 3d7196082a Fixes for LLVM 11 compat CallSite.h (#495) 2021-03-02 15:52:03 -05:00
Sonya 6322f794d1 New arch support (#461)
* This branch contains support for new architectures.

* Initial start to support for AArch 32

* Progress

* Forgot the new files

* Added all data Integer processing instructions without S + ADDS and started ANDS

* Updated

* Finished Integer Data Processing with three registers, added integer data processing with 2 regs + immediate, started MUL instructions

* UMULL, UMULLS, UMLAL, UMLALS

* Corrected condition for addend or 0 immediate for UMULL/UMLAL + SMULL/SMLAL instructions

* Correct ops in Binary.cpp

* UMAAL

* SMULL, SMULLS, SMLAL, SMLALS + corrected acc was missing shift left in concatination

* Updated decoding instructions based on top level encodings

* Update returns around kDataProcessingRI and kDataProcessingI with comments to explain the correlation to the instruction rep

* Added appropriate inst.category flags to Multiply and accumulate

* Load/Store Word, Unsigned Byte (immediate, literal) && start of Logical Arithmetic (three register, immediate shift)

* Was missing UMAAL DEF_ISEL in Binary.cpp

* AddAddrRegOp

* Logical Arithmetic (three register, immediate shift) without accounting for the possible PC jump

* Made DecodeA32ExpandImm much much smaller

* Replaced some imm ops with AddImmOp calls

* Created AddShiftOp

* Added interpreter for evaluating new PC value at decoding time to handle direct jumps and conditional jumps

* Created EvalPCDest added PC evaluation to Logical Arithmetic Instructions

* AddShiftOp -> AddShiftOp, AddShiftThenExtractOp, AddExtractThenShiftOp

* Cleaned up some formatting, Renamed DecodeA32ExpandImm to ExpandTo32AddImmAddCarry and added a clarifying comment

* Added comment to EvalPCDest for clarity

* Cleaned up some things, updated the decoding semantics and semantics for the logical instructions

* Shortened kLogArithEvaluators and fixed a bug

* Updates from testing instructions

* Fixed DEF_ISEL for pre/post index instructions in MEM.cpp

* Integer Test and Compare (two register, immediate shift)

* Logical Arithmetic (two register and immediate)

* Integer Test and Compare (one register and immediate)

* Added to the top level encoding infrastructure to handle the Data-processing register (register shift) set of instructions and 3 corresponding subsets

* Add structs for the 3 subsets of Data-processing register (register shift)

* Code status before refactoring operand types

* This branch contains support for new architectures.

* Initial start to support for AArch 32

* Progress

* Forgot the new files

* Added all data Integer processing instructions without S + ADDS and started ANDS

* Updated

* Finished Integer Data Processing with three registers, added integer data processing with 2 regs + immediate, started MUL instructions

* UMULL, UMULLS, UMLAL, UMLALS

* Corrected condition for addend or 0 immediate for UMULL/UMLAL + SMULL/SMLAL instructions

* Correct ops in Binary.cpp

* UMAAL

* SMULL, SMULLS, SMLAL, SMLALS + corrected acc was missing shift left in concatination

* Updated decoding instructions based on top level encodings

* Update returns around kDataProcessingRI and kDataProcessingI with comments to explain the correlation to the instruction rep

* Added appropriate inst.category flags to Multiply and accumulate

* Load/Store Word, Unsigned Byte (immediate, literal) && start of Logical Arithmetic (three register, immediate shift)

* Was missing UMAAL DEF_ISEL in Binary.cpp

* AddAddrRegOp

* Logical Arithmetic (three register, immediate shift) without accounting for the possible PC jump

* Made DecodeA32ExpandImm much much smaller

* Replaced some imm ops with AddImmOp calls

* Created AddShiftOp

* Added interpreter for evaluating new PC value at decoding time to handle direct jumps and conditional jumps

* Created EvalPCDest added PC evaluation to Logical Arithmetic Instructions

* AddShiftOp -> AddShiftOp, AddShiftThenExtractOp, AddExtractThenShiftOp

* Cleaned up some formatting, Renamed DecodeA32ExpandImm to ExpandTo32AddImmAddCarry and added a clarifying comment

* Added comment to EvalPCDest for clarity

* Cleaned up some things, updated the decoding semantics and semantics for the logical instructions

* Shortened kLogArithEvaluators and fixed a bug

* Updates from testing instructions

* Fixed DEF_ISEL for pre/post index instructions in MEM.cpp

* Integer Test and Compare (two register, immediate shift)

* Logical Arithmetic (two register and immediate)

* Integer Test and Compare (one register and immediate)

* Added to the top level encoding infrastructure to handle the Data-processing register (register shift) set of instructions and 3 corresponding subsets

* Add structs for the 3 subsets of Data-processing register (register shift)

* Code status before refactoring operand types

* Finished updates off master

* Start of operand refactor

* Finished Expression Operand Support

* Fix the .gitignore to add AArch32 to lib/Arch && removed all extra rrx ops from semantics

* Updated .gitignore again, Added AddShiftRegRegOperand, Updated AddShiftRegImmOperand, Finished Register shift instructions for Integer Test and Compare, Logical Arithmetic, Integer Data Processing

* Updated ROR in AddShiftRegRegOperand

* Created ExtractAndZExtExpr

* Fixed comment formatting in if else statements

* Created RORExpr

* Small fixes

* Small fix in Logical Arithmetic (two register and immediate)

* Corrected AddShiftRegRegOperand and cleaned it up. Split the carry op into a separate function.

* conditional support + Start of Branch instructions

* Created AddExprOp, cleaned up some expressions in reg shifted reg, and updated some occurances of ShiftThenExtractOp with ExtractAndZExtExpr

* Updates from testing register shifted by register value inst

* Fix to ROR in AddShiftRegCarryOperand

* Corrected negation in DecodeCondition

* DecodeCondition edit

* DecodeCondition and AddShiftRegCarryOperand edits

* Updated arch_for_decode to arch

* Halfword Multiply and Accumulate

* Edits from testing Halfword Multiply and Accumulate

* Changed order of operands in Halfword Multiply and Accumulate to better reflect inst format + updated inst errors

* Branch (Imm) & BX/BXL

* Update aarch32 cmake

* cmake update

* CLZ

* Forgot BITBYTE.cpp

* MOVT

* Integer Saturating Arithmetic

* updated semantics in SMLAWh & SMLAh to use Select for setting PSTATE.Q

* Started Load/Store Word, Unsigned Byte (register) & fixed MOV halfword

* Load/Store Word, Unsigned Byte (register)

* Finished testing load/Store Word, Unsigned Byte (register)

* Load/Store Dual, Half, Signed Byte (register)

* Rest of Extra load store: Load/Store Dual, Half, Signed Byte (immediate, literal)

* Finished testing all the Load/store additions

* Signed multiply, Divide

* Cleaned up SExt some

* Saturate Insts and Start of Load Store Multiple - STMDB and LDM (aliases which support PUSH and POP of multiple regs)

* Condensed args in STMDB and LDM semantics

* Rest of Multiple Load/Store that do not execute in a different mode

* Bitfield Extract

* Extend and Add

* fix

* NOP

* Small fix

* Simplified the bit reps in TryMoveSpecialRegisterAndHintsI

* Moved Bitfield extract semantics out of BINARY and into BITBYTE

* Finished correcting S/ZExt and Trunc use

* Ran scripts/format-files to format

* Smoke Test

* Add false delay slot to kCategoryConditionalDirectFunctionCall

* CI: Use single packaging job, add changelog support (#491)

* CI: Add tag handler (#492)

* Delay slot fixes to TraceLifter

Co-authored-by: Peter Goodman <peter.goodman@gmail.com>
Co-authored-by: Alessandro Gario <5714290+alessandrogario@users.noreply.github.com>
2021-02-24 14:01:09 -05:00
Eric Kilmer c30cb5f4b5 Add more CallSite.h Cloning.h compatibility for LLVM 11 used in McSema (#482) 2021-02-12 15:34:24 -05:00
Aiethel f1514baedb Llvm 7 build (#469)
* bc: Use llvm::CallSite methods instead of raw llvm instructions.

* bc: Use llvm::CallSite in utils.

* bc: Add compatibility file for CallSite.

* bc: Reflect addition of compat for CallSite.
2021-01-13 21:53:11 -05:00
Aiethel 71371d8687 bc: Return enum instead of fail, when inst lifter cannot match args to isel. (#473) 2021-01-13 21:51:16 -05:00
Peter Goodman 26607a4a9c Wrap headers in some ugly pragmas for disabling error checks. Helps integration with downstream projects 2020-11-08 18:05:09 -05:00
Peter Goodman 6388788125 Rename arch_for_decode, remove lazy decode 2020-11-05 18:02:33 -05:00
Peter Goodman 90f9ccd2b5 New x86 instructions (#457)
* New x86 instructions

* Add some isels

* Fixes Issue #376

* Fixes Issue #433. Thanks @adahsuzixin for the semantics and tests

* Fixes Issue #374

* Minor fix to the semantics for VINSERTF128, it should only look at the low bit of imm8

* Minor fixes for sparc isel naming
2020-11-04 20:55:17 -05:00
Peter Goodman b4834f71b8 Additional APIs needed for clearing the internal instruction lifter cache 2020-11-03 18:41:02 -05:00
Artem Dinaburg 5903d273f1 Fixes for aarch64; some semantics tests do not yet pass (#455) 2020-10-29 11:00:41 -04:00
Peter Goodman 3808e9951d Refactor and add sparc (#454)
* Refactors the code to improve directory layout, use more std::string_view in place of std::string, deletes some deprecated functions, deprecates some other functions for eventual deletion, and includes semantics for sparcv8 (sparc32) and sparcv9 (sparc64)

* Update new dir layout with llvm 11 support

* Whoops missing files

* Drop llvm 800 from workflow

* Minor fix

* Move where the install directives are in CMake

* Minor fixes

* Rename tools/ to bin/.

* Minor tweaks

* Should fix issues
2020-10-28 15:11:42 -04:00