Merge branch 'master' of github.com:GaloisInc/macaw-semmc

This commit is contained in:
Kevin Quick 2019-02-08 14:37:54 -08:00
commit 9f46c9e60b
3 changed files with 13 additions and 8 deletions

View File

@ -74,6 +74,7 @@ ppc64MacawSymbolicFns =
{ MSB.crucGenArchConstraints = \x -> x { MSB.crucGenArchConstraints = \x -> x
, MSB.crucGenArchRegName = ppcRegName , MSB.crucGenArchRegName = ppcRegName
, MSB.crucGenRegAssignment = ppcRegAssignment , MSB.crucGenRegAssignment = ppcRegAssignment
, MSB.crucGenRegStructType = ppcRegStructType
, MSB.crucGenArchFn = ppcGenFn , MSB.crucGenArchFn = ppcGenFn
, MSB.crucGenArchStmt = ppcGenStmt , MSB.crucGenArchStmt = ppcGenStmt
, MSB.crucGenArchTermStmt = ppcGenTermStmt , MSB.crucGenArchTermStmt = ppcGenTermStmt
@ -85,6 +86,7 @@ ppc32MacawSymbolicFns =
{ MSB.crucGenArchConstraints = \x -> x { MSB.crucGenArchConstraints = \x -> x
, MSB.crucGenArchRegName = ppcRegName , MSB.crucGenArchRegName = ppcRegName
, MSB.crucGenRegAssignment = ppcRegAssignment , MSB.crucGenRegAssignment = ppcRegAssignment
, MSB.crucGenRegStructType = ppcRegStructType
, MSB.crucGenArchFn = ppcGenFn , MSB.crucGenArchFn = ppcGenFn
, MSB.crucGenArchStmt = ppcGenStmt , MSB.crucGenArchStmt = ppcGenStmt
, MSB.crucGenArchTermStmt = ppcGenTermStmt , MSB.crucGenArchTermStmt = ppcGenTermStmt
@ -170,6 +172,12 @@ ppcRegAssignment =
Ctx.<++> (R.repeatAssign (MP.PPC_GP . D.GPR . fromIntegral) :: Ctx.Assignment (MP.PPCReg (MP.AnyPPC v)) (R.CtxRepeat 32 (MT.BVType (RegSize v)))) Ctx.<++> (R.repeatAssign (MP.PPC_GP . D.GPR . fromIntegral) :: Ctx.Assignment (MP.PPCReg (MP.AnyPPC v)) (R.CtxRepeat 32 (MT.BVType (RegSize v))))
Ctx.<++> (R.repeatAssign (MP.PPC_FR . D.VSReg . fromIntegral) :: Ctx.Assignment (MP.PPCReg (MP.AnyPPC v)) (R.CtxRepeat 64 (MT.BVType 128))) Ctx.<++> (R.repeatAssign (MP.PPC_FR . D.VSReg . fromIntegral) :: Ctx.Assignment (MP.PPCReg (MP.AnyPPC v)) (R.CtxRepeat 64 (MT.BVType 128)))
ppcRegStructType :: forall v
. ( MP.KnownVariant v )
=> C.TypeRepr (MS.ArchRegStruct (MP.AnyPPC v))
ppcRegStructType =
C.StructRepr (MS.typeCtxToCrucible $ FC.fmapFC MT.typeRepr ppcRegAssignment)
data PPCSymbolicException v = MissingRegisterInState (Some (MP.PPCReg (MP.AnyPPC v))) data PPCSymbolicException v = MissingRegisterInState (Some (MP.PPCReg (MP.AnyPPC v)))
deriving instance Show (PPCSymbolicException v) deriving instance Show (PPCSymbolicException v)

View File

@ -29,6 +29,7 @@ import GHC.TypeLits
import Control.Lens ( (^.) ) import Control.Lens ( (^.) )
import Data.Bits import Data.Bits
import Data.Coerce ( coerce )
import qualified Text.PrettyPrint.ANSI.Leijen as PP import qualified Text.PrettyPrint.ANSI.Leijen as PP
import Data.Parameterized.Classes ( OrdF, knownRepr ) import Data.Parameterized.Classes ( OrdF, knownRepr )
import qualified Data.Parameterized.NatRepr as NR import qualified Data.Parameterized.NatRepr as NR
@ -72,10 +73,7 @@ instance MC.PrettyF PPCTermStmt where
PPCTrap -> PP.text "ppc_trap" PPCTrap -> PP.text "ppc_trap"
rewriteTermStmt :: PPCTermStmt src -> Rewriter ppc s src tgt (PPCTermStmt tgt) rewriteTermStmt :: PPCTermStmt src -> Rewriter ppc s src tgt (PPCTermStmt tgt)
rewriteTermStmt s = rewriteTermStmt s = pure (coerce s)
case s of
PPCSyscall -> pure PPCSyscall
PPCTrap -> pure PPCTrap
data PPCStmt ppc (v :: MT.Type -> *) where data PPCStmt ppc (v :: MT.Type -> *) where
Attn :: PPCStmt ppc v Attn :: PPCStmt ppc v

View File

@ -135,14 +135,13 @@ instructionMatcher ltr ena ae lib archSpecificMatcher formulas operandResultType
] ]
return (lam, fullDefs) return (lam, fullDefs)
-- | Unimplemented instructions return Nothing here, which will be translated
-- into a TranslationError inside the generator.
unimplementedInstruction :: Q (Name, Dec) unimplementedInstruction :: Q (Name, Dec)
unimplementedInstruction = do unimplementedInstruction = do
fname <- newName "noMatch" fname <- newName "noMatch"
arg1Nm <- newName "unknownOpcode" arg1Nm <- newName "unknownOpcode"
fdecl <- funD fname fdecl <- funD fname [clause [varP arg1Nm] (normalB [| Nothing |]) []]
[clause [varP arg1Nm]
(normalB [| error ("Unimplemented instruction: " ++ show $(varE arg1Nm)) |])
[]]
return (fname, fdecl) return (fname, fdecl)